diff --git a/Makefile b/Makefile index 96619524..847849c0 100644 --- a/Makefile +++ b/Makefile @@ -4,14 +4,14 @@ dep: go mod tidy build: dep - go build -o build/klog ./cmd + go build -o build/cloudretro ./cmd run: build # Run coordinator first - ./build/klog -overlordhost overlord & + ./build/cloudretro -overlordhost overlord & # Wait till overlord finish initialized # Run a worker connecting to overload - ./build/klog -overlordhost ws://localhost:8000/wso + ./build/cloudretro -overlordhost ws://localhost:8000/wso run-docker: docker build . -t cloud-game-local @@ -19,3 +19,11 @@ run-docker: docker rm cloud-game-local # Overlord and worker should be run separately. Local is for demo purpose docker run --privileged -v $PWD/games:/cloud-game/games -d --name cloud-game-local -p 8000:8000 -p 9000:9000 cloud-game-local bash -c "cmd -overlordhost ws://localhost:8000/wso & cmd -overlordhost overlord" + +build-vendor: + go build -o build/cloudretro -mod=vendor ./cmd + +#run with vendor so it is faster +run-fast: build-vendor + ./build/cloudretro -overlordhost overlord & + ./build/cloudretro -overlordhost ws://localhost:8000/wso diff --git a/build/klog b/build/klog deleted file mode 100755 index 77305443..00000000 Binary files a/build/klog and /dev/null differ diff --git a/go.mod b/go.mod index 81b15a5f..4f800452 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.12 require ( cloud.google.com/go v0.43.0 github.com/gen2brain/x264-go v0.0.0-20180306035800-58f586137654 - github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 + github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 // indirect github.com/gofrs/uuid v3.2.0+incompatible github.com/gorilla/websocket v1.4.0 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect diff --git a/go.sum b/go.sum index 17e1c56a..e53d1ed0 100644 --- a/go.sum +++ b/go.sum @@ -11,10 +11,13 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gen2brain/x264-go v0.0.0-20180306035800-58f586137654 h1:RNpogAT5Qz69YLIu6+92q5sSw61PjjhDj4upH2el5pk= github.com/gen2brain/x264-go v0.0.0-20180306035800-58f586137654/go.mod h1:17kvfYQKi9/QHiKPeqmJW0YuDPZEgy72tSBVmweSyiE= @@ -27,9 +30,11 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -38,8 +43,10 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -51,6 +58,7 @@ github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoA github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -58,7 +66,9 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9 h1:tbuodUh2vuhOVZAdW3NEUvosFHUMJwUNl7jk/VSEiwc= github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9/go.mod h1:PpMmPfPKO9nKJ/psF49ESTAGQSdfXxlg1otPbEB2nOw= +github.com/marten-seemann/qtls v0.2.3 h1:0yWJ43C62LsZt08vuQJDK1uC1czUc3FJeCLPoNAI4vA= github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= @@ -68,7 +78,9 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pion/datachannel v1.4.5 h1:paz18kYAetpTdK8tlMAtDY+Ayxrv5fndZ5XPZwiZHrU= github.com/pion/datachannel v1.4.5/go.mod h1:SpMJbuu8v+qbA94m6lWQwSdCf8JKQvgmdSHDNtcbe+w= @@ -81,6 +93,7 @@ github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= github.com/pion/mdns v0.0.3 h1:DxdOYd0pgwLKiDlIIxfU0qdG5iWh1Xn6CsS9vc6cMAY= github.com/pion/mdns v0.0.3/go.mod h1:VrN3wefVgtfL8QgpEblPUC46ag1reLIfpqekCnKunLE= +github.com/pion/quic v0.1.1 h1:D951FV+TOqI9A0rTF7tHx0Loooqz+nyzjEyj8o3PuMA= github.com/pion/quic v0.1.1/go.mod h1:zEU51v7ru8Mp4AUBJvj6psrSth5eEFNnVQK5K48oV3k= github.com/pion/rtcp v1.2.1 h1:S3yG4KpYAiSmBVqKAfgRa5JdwBNj4zK3RLUa8JYdhak= github.com/pion/rtcp v1.2.1/go.mod h1:a5dj2d6BKIKHl43EnAOIrCczcjESrtPuMgfmL6/K6QM= @@ -106,6 +119,7 @@ github.com/pion/webrtc/v2 v2.1.2/go.mod h1:6+ovIHxDUZVgCVGP3JTEAyiy9Aa45q8u7/Feb github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= @@ -125,6 +139,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= @@ -207,6 +222,7 @@ google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -220,11 +236,15 @@ google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiq google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/hraban/opus.v2 v2.0.0-20180426093920-0f2e0b4fc6cd h1:oAcaGkUcXajq9yi+UKvzJMSKEb++XegVTSQjOlu3MVU= gopkg.in/hraban/opus.v2 v2.0.0-20180426093920-0f2e0b4fc6cd/go.mod h1:/L5E7a21VWl8DeuCPKxQBdVG5cy+L0MRZ08B1wnqt7g= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/libretro/nanoarch/nanoarch.go b/libretro/nanoarch/nanoarch.go index 50b58f66..95596e0b 100644 --- a/libretro/nanoarch/nanoarch.go +++ b/libretro/nanoarch/nanoarch.go @@ -15,7 +15,6 @@ import ( "unsafe" "github.com/giongto35/cloud-game/emulator" - "github.com/go-gl/gl/v2.1/gl" ) /* @@ -89,6 +88,15 @@ var bindRetroKeys = map[int]int{ 9: C.RETRO_DEVICE_ID_JOYPAD_RIGHT, } +const ( + // BIT_FORMAT_SHORT_5_5_5_1 has 5 bits R, 5 bits G, 5 bits B, 1 bit alpha + BIT_FORMAT_SHORT_5_5_5_1 = iota + // BIT_FORMAT_INT_8_8_8_8_REV has 8 bits R, 8 bits G, 8 bits B, 8 bit alpha + BIT_FORMAT_INT_8_8_8_8_REV + // BIT_FORMAT_SHORT_5_6_5 has 5 bits R, 6 bits G, 5 bits + BIT_FORMAT_SHORT_5_6_5 +) + type CloudEmulator interface { SetView(view *emulator.GameView) Start(path string) @@ -141,9 +149,9 @@ func toImageRGBA(data unsafe.Pointer, bytesPerRow int) *image.RGBA { sh.Len = bytesPerRow * eheight * 4 sh.Cap = bytesPerRow * eheight * 4 - if video.pixFmt == gl.UNSIGNED_SHORT_5_6_5 { + if video.pixFmt == BIT_FORMAT_SHORT_5_6_5 { return to565Image(data, bytes, bytesPerRow) - } else if video.pixFmt == gl.UNSIGNED_INT_8_8_8_8_REV { + } else if video.pixFmt == BIT_FORMAT_INT_8_8_8_8_REV { return to8888Image(data, bytes, bytesPerRow) } return nil @@ -485,18 +493,15 @@ func nanoarchRun() { func videoSetPixelFormat(format uint32) C.bool { switch format { case C.RETRO_PIXEL_FORMAT_0RGB1555: - video.pixFmt = gl.UNSIGNED_SHORT_5_5_5_1 - video.pixType = gl.BGRA + video.pixFmt = BIT_FORMAT_SHORT_5_5_5_1 video.bpp = 2 break case C.RETRO_PIXEL_FORMAT_XRGB8888: - video.pixFmt = gl.UNSIGNED_INT_8_8_8_8_REV - video.pixType = gl.BGRA + video.pixFmt = BIT_FORMAT_INT_8_8_8_8_REV video.bpp = 4 break case C.RETRO_PIXEL_FORMAT_RGB565: - video.pixFmt = gl.UNSIGNED_SHORT_5_6_5 - video.pixType = gl.RGB + video.pixFmt = BIT_FORMAT_SHORT_5_6_5 video.bpp = 2 break default: diff --git a/vendor/cloud.google.com/go/storage/README.md b/vendor/cloud.google.com/go/storage/README.md new file mode 100644 index 00000000..a2253c4b --- /dev/null +++ b/vendor/cloud.google.com/go/storage/README.md @@ -0,0 +1,32 @@ +## Cloud Storage [![GoDoc](https://godoc.org/cloud.google.com/go/storage?status.svg)](https://godoc.org/cloud.google.com/go/storage) + +- [About Cloud Storage](https://cloud.google.com/storage/) +- [API documentation](https://cloud.google.com/storage/docs) +- [Go client documentation](https://godoc.org/cloud.google.com/go/storage) +- [Complete sample programs](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/storage) + +### Example Usage + +First create a `storage.Client` to use throughout your application: + +[snip]:# (storage-1) +```go +client, err := storage.NewClient(ctx) +if err != nil { + log.Fatal(err) +} +``` + +[snip]:# (storage-2) +```go +// Read the object1 from bucket. +rc, err := client.Bucket("bucket").Object("object1").NewReader(ctx) +if err != nil { + log.Fatal(err) +} +defer rc.Close() +body, err := ioutil.ReadAll(rc) +if err != nil { + log.Fatal(err) +} +``` \ No newline at end of file diff --git a/vendor/cloud.google.com/go/storage/bucket.go b/vendor/cloud.google.com/go/storage/bucket.go index bbfc59b2..d585e3ef 100644 --- a/vendor/cloud.google.com/go/storage/bucket.go +++ b/vendor/cloud.google.com/go/storage/bucket.go @@ -317,6 +317,11 @@ type BucketAttrs struct { // Etag is the HTTP/1.1 Entity tag for the bucket. // This field is read-only. Etag string + + // LocationType describes how data is stored and replicated. + // Typical values are "multi-region", "region" and "dual-region". + // This field is read-only. + LocationType string } // BucketPolicyOnly configures access checks to use only bucket-level IAM @@ -506,6 +511,7 @@ func newBucket(b *raw.Bucket) (*BucketAttrs, error) { Website: toBucketWebsite(b.Website), BucketPolicyOnly: toBucketPolicyOnly(b.IamConfiguration), Etag: b.Etag, + LocationType: b.LocationType, }, nil } diff --git a/vendor/github.com/gen2brain/x264-go/.appveyor.yml b/vendor/github.com/gen2brain/x264-go/.appveyor.yml new file mode 100644 index 00000000..31e32f2b --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/.appveyor.yml @@ -0,0 +1,22 @@ +version: "{build}" + +clone_depth: 1 + +clone_folder: c:\gopath\src\github.com\gen2brain\x264-go + +environment: + GOPATH: c:\gopath + MSYS_PATH: c:\msys64 + CGO_ENABLED: 1 + GOARCH: 386 + CC: i686-w64-mingw32-gcc + +install: + - echo %GOPATH% + - echo %MSYS_PATH% + - set PATH=%GOPATH%\bin;c:\go\bin;%MSYS_PATH%\usr\bin;%MSYS_PATH%\mingw32\bin;%PATH% + - go version + - go env + +build_script: + - bash -lc "cd /c/gopath/src/github.com/gen2brain/x264-go && go build" diff --git a/vendor/github.com/gen2brain/x264-go/.travis.yml b/vendor/github.com/gen2brain/x264-go/.travis.yml new file mode 100644 index 00000000..5fa62f9a --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/.travis.yml @@ -0,0 +1,12 @@ +language: go + +go: + - 1.9.x + +gobuild_args: "-tags extlib" + +before_install: + - sudo apt-get install libx264-dev + +script: + - go test -tags extlib -v ./ diff --git a/vendor/github.com/gen2brain/x264-go/AUTHORS b/vendor/github.com/gen2brain/x264-go/AUTHORS new file mode 100644 index 00000000..28cd2c5b --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/AUTHORS @@ -0,0 +1 @@ +Milan Nikolic diff --git a/vendor/github.com/gen2brain/x264-go/COPYING b/vendor/github.com/gen2brain/x264-go/COPYING new file mode 100644 index 00000000..d60c31a9 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/vendor/github.com/gen2brain/x264-go/README.md b/vendor/github.com/gen2brain/x264-go/README.md new file mode 100644 index 00000000..3bbbbc84 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/README.md @@ -0,0 +1,77 @@ +## x264-go +[![TravisCI Build Status](https://travis-ci.org/gen2brain/x264-go.svg?branch=master)](https://travis-ci.org/gen2brain/x264-go) +[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/wfkqlac5ffwk5xgb?svg=true)](https://ci.appveyor.com/project/gen2brain/x264-go) +[![GoDoc](https://godoc.org/github.com/gen2brain/x264-go?status.svg)](https://godoc.org/github.com/gen2brain/x264-go) +[![Go Report Card](https://goreportcard.com/badge/github.com/gen2brain/x264-go?branch=master)](https://goreportcard.com/report/github.com/gen2brain/x264-go) + +`x264-go` provides H.264/MPEG-4 AVC codec encoder based on [x264](https://www.videolan.org/developers/x264.html) library. + +C source code is included in package. If you want to use external shared/static library (i.e. built with asm and/or OpenCL) use `-tags extlib`. + +### Installation + + go get -u github.com/gen2brain/x264-go + +### Examples + +See [screengrab](https://github.com/gen2brain/x264-go/blob/master/examples/screengrab/screengrab.go) example. + +### Usage + +```go +package main + +import ( + "bytes" + "image" + "image/color" + "image/draw" + + "github.com/gen2brain/x264-go" +) + +func main() { + buf := bytes.NewBuffer(make([]byte, 0)) + + opts := &x264.Options{ + Width: 640, + Height: 480, + FrameRate: 25, + Tune: "zerolatency", + Preset: "veryfast", + Profile: "baseline", + LogLevel: x264.LogDebug, + } + + enc, err := x264.NewEncoder(buf, opts) + if err != nil { + panic(err) + } + + img := x264.NewYCbCr(image.Rect(0, 0, opts.Width, opts.Height)) + draw.Draw(img, img.Bounds(), image.Black, image.ZP, draw.Src) + + for i := 0; i < opts.Width/2; i++ { + img.Set(i, opts.Height/2, color.RGBA{255, 0, 0, 255}) + + err = enc.Encode(img) + if err != nil { + panic(err) + } + } + + err = enc.Flush() + if err != nil { + panic(err) + } + + err = enc.Close() + if err != nil { + panic(err) + } +} +``` + +## More + +For AAC encoder see [aac-go](https://github.com/gen2brain/aac-go). diff --git a/vendor/github.com/gen2brain/x264-go/encode.go b/vendor/github.com/gen2brain/x264-go/encode.go new file mode 100644 index 00000000..26ad2bf6 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/encode.go @@ -0,0 +1,212 @@ +// Package x264 provides H.264/MPEG-4 AVC codec encoder based on [x264](https://www.videolan.org/developers/x264.html) library. +package x264 + +import "C" + +import ( + "fmt" + "image" + "io" + + "github.com/gen2brain/x264-go/x264c" +) + +// Logging constants. +const ( + LogNone int32 = iota - 1 + LogError + LogWarning + LogInfo + LogDebug +) + +// Options represent encoding options. +type Options struct { + // Frame width. + Width int + // Frame height. + Height int + // Frame rate. + FrameRate int + // Tunings: film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency. + Tune string + // Presets: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. + Preset string + // Profiles: baseline, main, high, high10, high422, high444. + Profile string + // Log level. + LogLevel int32 +} + +// Encoder type. +type Encoder struct { + e *x264c.T + w io.Writer + + img *YCbCr + opts *Options + + csp int32 + pts int64 + + nnals int32 + nals []*x264c.Nal +} + +// NewEncoder returns new x264 encoder. +func NewEncoder(w io.Writer, opts *Options) (e *Encoder, err error) { + e = &Encoder{} + + e.w = w + e.pts = 0 + e.opts = opts + + e.csp = x264c.CspI420 + + e.nals = make([]*x264c.Nal, 3) + e.img = NewYCbCr(image.Rect(0, 0, e.opts.Width, e.opts.Height)) + + param := x264c.Param{} + + if e.opts.Preset != "" && e.opts.Profile != "" { + ret := x264c.ParamDefaultPreset(¶m, e.opts.Preset, e.opts.Tune) + if ret < 0 { + err = fmt.Errorf("x264: invalid preset/tune name") + return + } + } else { + x264c.ParamDefault(¶m) + } + + param.IWidth = int32(e.opts.Width) + param.IHeight = int32(e.opts.Height) + + param.ICsp = e.csp + param.BVfrInput = 0 + param.BRepeatHeaders = 1 + param.BAnnexb = 1 + + param.ILogLevel = e.opts.LogLevel + + if e.opts.FrameRate > 0 { + param.IFpsNum = uint32(e.opts.FrameRate) + param.IFpsDen = 1 + + param.IKeyintMax = int32(e.opts.FrameRate) + param.BIntraRefresh = 1 + } + + if e.opts.Profile != "" { + ret := x264c.ParamApplyProfile(¶m, e.opts.Profile) + if ret < 0 { + err = fmt.Errorf("x264: invalid profile name") + return + } + } + + e.e = x264c.EncoderOpen(¶m) + if e.e == nil { + err = fmt.Errorf("x264: cannot open the encoder") + return + } + + ret := x264c.EncoderHeaders(e.e, e.nals, &e.nnals) + if ret < 0 { + err = fmt.Errorf("x264: cannot encode headers") + return + } + + if ret > 0 { + b := C.GoBytes(e.nals[0].PPayload, C.int(ret)) + n, er := e.w.Write(b) + if er != nil { + err = er + return + } + + if int(ret) != n { + err = fmt.Errorf("x264: error writing headers, size=%d, n=%d", ret, n) + } + } + + return +} + +// Encode encodes image. +func (e *Encoder) Encode(im image.Image) (err error) { + var picIn, picOut x264c.Picture + + e.img.ToYCbCr(im) + + ret := x264c.PictureAlloc(&picIn, e.csp, int32(e.opts.Width), int32(e.opts.Height)) + if ret < 0 { + err = fmt.Errorf("x264: cannot allocate picture") + return + } + + defer x264c.PictureClean(&picIn) + + picIn.Img.Plane[0] = C.CBytes(e.img.Y) + picIn.Img.Plane[1] = C.CBytes(e.img.Cb) + picIn.Img.Plane[2] = C.CBytes(e.img.Cr) + + picIn.IPts = e.pts + e.pts++ + + ret = x264c.EncoderEncode(e.e, e.nals, &e.nnals, &picIn, &picOut) + if ret < 0 { + err = fmt.Errorf("x264: cannot encode picture") + return + } + + if ret > 0 { + b := C.GoBytes(e.nals[0].PPayload, C.int(ret)) + + n, er := e.w.Write(b) + if er != nil { + err = er + return + } + + if int(ret) != n { + err = fmt.Errorf("x264: error writing payload, size=%d, n=%d", ret, n) + } + } + + return +} + +// Flush flushes encoder. +func (e *Encoder) Flush() (err error) { + var picOut x264c.Picture + + for x264c.EncoderDelayedFrames(e.e) > 0 { + ret := x264c.EncoderEncode(e.e, e.nals, &e.nnals, nil, &picOut) + if ret < 0 { + err = fmt.Errorf("x264: cannot encode picture") + return + } + + if ret > 0 { + b := C.GoBytes(e.nals[0].PPayload, C.int(ret)) + + n, er := e.w.Write(b) + if er != nil { + err = er + return + } + + if int(ret) != n { + err = fmt.Errorf("x264: error writing payload, size=%d, n=%d", ret, n) + } + } + } + + return +} + +// Close closes encoder. +func (e *Encoder) Close() error { + x264c.EncoderClose(e.e) + return nil +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.c new file mode 100644 index 00000000..c52db98a --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.c @@ -0,0 +1,42 @@ +/***************************************************************************** + * asm-offsets.c: check asm offsets for aarch64 + ***************************************************************************** + * Copyright (C) 2014-2017 x264 project + * + * Authors: Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "asm-offsets.h" + +#define X264_CHECK_OFFSET(s, m, o) struct check_##s##_##m \ +{ \ + int m_##m[2 * (offsetof(s, m) == o) - 1]; \ +} + +X264_CHECK_OFFSET(x264_cabac_t, i_low, CABAC_I_LOW); +X264_CHECK_OFFSET(x264_cabac_t, i_range, CABAC_I_RANGE); +X264_CHECK_OFFSET(x264_cabac_t, i_queue, CABAC_I_QUEUE); +X264_CHECK_OFFSET(x264_cabac_t, i_bytes_outstanding, CABAC_I_BYTES_OUTSTANDING); +X264_CHECK_OFFSET(x264_cabac_t, p_start, CABAC_P_START); +X264_CHECK_OFFSET(x264_cabac_t, p, CABAC_P); +X264_CHECK_OFFSET(x264_cabac_t, p_end, CABAC_P_END); +X264_CHECK_OFFSET(x264_cabac_t, f8_bits_encoded, CABAC_F8_BITS_ENCODED); +X264_CHECK_OFFSET(x264_cabac_t, state, CABAC_STATE); diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.h new file mode 100644 index 00000000..3b02f9ef --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/asm-offsets.h @@ -0,0 +1,39 @@ +/***************************************************************************** + * asm-offsets.h: asm offsets for aarch64 + ***************************************************************************** + * Copyright (C) 2014-2017 x264 project + * + * Authors: Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_AARCH64_ASM_OFFSETS_H +#define X264_AARCH64_ASM_OFFSETS_H + +#define CABAC_I_LOW 0x00 +#define CABAC_I_RANGE 0x04 +#define CABAC_I_QUEUE 0x08 +#define CABAC_I_BYTES_OUTSTANDING 0x0c +#define CABAC_P_START 0x10 +#define CABAC_P 0x18 +#define CABAC_P_END 0x20 +#define CABAC_F8_BITS_ENCODED 0x30 +#define CABAC_STATE 0x34 + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/dct.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/dct.h new file mode 100644 index 00000000..095f4ab5 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/dct.h @@ -0,0 +1,67 @@ +/***************************************************************************** + * dct.h: aarch64 transform and zigzag + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_AARCH64_DCT_H +#define X264_AARCH64_DCT_H + +void x264_dct4x4dc_neon( int16_t d[16] ); +void x264_idct4x4dc_neon( int16_t d[16] ); + +void x264_sub4x4_dct_neon( int16_t dct[16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_neon( int16_t dct[4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_neon( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); + +void x264_add4x4_idct_neon( uint8_t *p_dst, int16_t dct[16] ); +void x264_add8x8_idct_neon( uint8_t *p_dst, int16_t dct[4][16] ); +void x264_add16x16_idct_neon( uint8_t *p_dst, int16_t dct[16][16] ); + +void x264_add8x8_idct_dc_neon( uint8_t *p_dst, int16_t dct[4] ); +void x264_add16x16_idct_dc_neon( uint8_t *p_dst, int16_t dct[16] ); +void x264_sub8x8_dct_dc_neon( int16_t dct[4], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x16_dct_dc_neon( int16_t dct[8], uint8_t *pix1, uint8_t *pix2 ); + +void x264_sub8x8_dct8_neon( int16_t dct[64], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct8_neon( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 ); + +void x264_add8x8_idct8_neon( uint8_t *p_dst, int16_t dct[64] ); +void x264_add16x16_idct8_neon( uint8_t *p_dst, int16_t dct[4][64] ); + +void x264_zigzag_scan_4x4_frame_neon( int16_t level[16], int16_t dct[16] ); +void x264_zigzag_scan_4x4_field_neon( int16_t level[16], int16_t dct[16] ); +void x264_zigzag_scan_8x8_frame_neon( int16_t level[64], int16_t dct[64] ); +void x264_zigzag_scan_8x8_field_neon( int16_t level[64], int16_t dct[64] ); + +int x264_zigzag_sub_4x4_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst ); +int x264_zigzag_sub_4x4ac_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc ); +int x264_zigzag_sub_4x4_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst ); +int x264_zigzag_sub_4x4ac_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc ); + +int x264_zigzag_sub_8x8_field_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst ); +int x264_zigzag_sub_8x8_frame_neon( dctcoef level[16], const pixel *p_src, pixel *p_dst ); + +void x264_zigzag_interleave_8x8_cavlc_neon( dctcoef *dst, dctcoef *src, uint8_t *nnz ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc-c.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc-c.c new file mode 100644 index 00000000..f94aa5e5 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc-c.c @@ -0,0 +1,281 @@ +/***************************************************************************** + * mc-c.c: aarch64 motion compensation + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "mc.h" + +void x264_prefetch_ref_aarch64( uint8_t *, intptr_t, int ); +void x264_prefetch_fenc_420_aarch64( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_prefetch_fenc_422_aarch64( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +void *x264_memcpy_aligned_neon( void *dst, const void *src, size_t n ); +void x264_memzero_aligned_neon( void *dst, size_t n ); + +void x264_pixel_avg_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_16x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_8x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_8x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x2_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +void x264_pixel_avg2_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); +void x264_pixel_avg2_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); +void x264_pixel_avg2_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); +void x264_pixel_avg2_w20_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); + +void x264_plane_copy_core_neon( pixel *dst, intptr_t i_dst, + pixel *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_swap_core_neon( pixel *dst, intptr_t i_dst, + pixel *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_neon( pixel *dstu, intptr_t i_dstu, + pixel *dstv, intptr_t i_dstv, + pixel *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_rgb_neon( pixel *dsta, intptr_t i_dsta, + pixel *dstb, intptr_t i_dstb, + pixel *dstc, intptr_t i_dstc, + pixel *src, intptr_t i_src, int pw, int w, int h ); +void x264_plane_copy_interleave_core_neon( pixel *dst, intptr_t i_dst, + pixel *srcu, intptr_t i_srcu, + pixel *srcv, intptr_t i_srcv, int w, int h ); + +void x264_store_interleave_chroma_neon( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height ); +void x264_load_deinterleave_chroma_fdec_neon( pixel *dst, pixel *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fenc_neon( pixel *dst, pixel *src, intptr_t i_src, int height ); + +#define MC_WEIGHT(func)\ +void x264_mc_weight_w20##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +void x264_mc_weight_w16##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +void x264_mc_weight_w8##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +void x264_mc_weight_w4##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +\ +static void (* x264_mc##func##_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int ) =\ +{\ + x264_mc_weight_w4##func##_neon,\ + x264_mc_weight_w4##func##_neon,\ + x264_mc_weight_w8##func##_neon,\ + x264_mc_weight_w16##func##_neon,\ + x264_mc_weight_w16##func##_neon,\ + x264_mc_weight_w20##func##_neon,\ +}; + +MC_WEIGHT() +MC_WEIGHT(_nodenom) +MC_WEIGHT(_offsetadd) +MC_WEIGHT(_offsetsub) + +void x264_mc_copy_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_mc_copy_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_mc_copy_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +void x264_mc_chroma_neon( uint8_t *, uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, int, int ); +void x264_integral_init4h_neon( uint16_t *, uint8_t *, intptr_t ); +void x264_integral_init4v_neon( uint16_t *, uint16_t *, intptr_t ); +void x264_integral_init8h_neon( uint16_t *, uint8_t *, intptr_t ); +void x264_integral_init8v_neon( uint16_t *, intptr_t ); +void x264_frame_init_lowres_core_neon( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, intptr_t, int, int ); + +void x264_mbtree_propagate_cost_neon( int16_t *, uint16_t *, uint16_t *, uint16_t *, uint16_t *, float *, int ); + +void x264_mbtree_fix8_pack_neon( uint16_t *dst, float *src, int count ); +void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count ); + +#if !HIGH_BIT_DEPTH +static void x264_weight_cache_neon( x264_t *h, x264_weight_t *w ) +{ + if( w->i_scale == 1<i_denom ) + { + if( w->i_offset < 0 ) + { + w->weightfn = x264_mc_offsetsub_wtab_neon; + w->cachea[0] = -w->i_offset; + } + else + { + w->weightfn = x264_mc_offsetadd_wtab_neon; + w->cachea[0] = w->i_offset; + } + } + else if( !w->i_denom ) + w->weightfn = x264_mc_nodenom_wtab_neon; + else + w->weightfn = x264_mc_wtab_neon; +} + +static void (* const x264_pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) = +{ + NULL, + x264_pixel_avg2_w4_neon, + x264_pixel_avg2_w8_neon, + x264_pixel_avg2_w16_neon, // no slower than w12, so no point in a separate function + x264_pixel_avg2_w16_neon, + x264_pixel_avg2_w20_neon, +}; + +static void (* const x264_mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) = +{ + NULL, + x264_mc_copy_w4_neon, + x264_mc_copy_w8_neon, + NULL, + x264_mc_copy_w16_neon, +}; + +static void mc_luma_neon( uint8_t *dst, intptr_t i_dst_stride, + uint8_t *src[4], intptr_t i_src_stride, + int mvx, int mvy, + int i_width, int i_height, const x264_weight_t *weight ) +{ + int qpel_idx = ((mvy&3)<<2) + (mvx&3); + intptr_t offset = (mvy>>2)*i_src_stride + (mvx>>2); + uint8_t *src1 = src[x264_hpel_ref0[qpel_idx]] + offset; + if( (mvy&3) == 3 ) // explict if() to force conditional add + src1 += i_src_stride; + + if( qpel_idx & 5 ) /* qpel interpolation needed */ + { + uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3); + x264_pixel_avg_wtab_neon[i_width>>2]( + dst, i_dst_stride, src1, i_src_stride, + src2, i_height ); + if( weight->weightfn ) + weight->weightfn[i_width>>2]( dst, i_dst_stride, dst, i_dst_stride, weight, i_height ); + } + else if( weight->weightfn ) + weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height ); + else + x264_mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height ); +} + +static uint8_t *get_ref_neon( uint8_t *dst, intptr_t *i_dst_stride, + uint8_t *src[4], intptr_t i_src_stride, + int mvx, int mvy, + int i_width, int i_height, const x264_weight_t *weight ) +{ + int qpel_idx = ((mvy&3)<<2) + (mvx&3); + intptr_t offset = (mvy>>2)*i_src_stride + (mvx>>2); + uint8_t *src1 = src[x264_hpel_ref0[qpel_idx]] + offset; + if( (mvy&3) == 3 ) // explict if() to force conditional add + src1 += i_src_stride; + + if( qpel_idx & 5 ) /* qpel interpolation needed */ + { + uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3); + x264_pixel_avg_wtab_neon[i_width>>2]( + dst, *i_dst_stride, src1, i_src_stride, + src2, i_height ); + if( weight->weightfn ) + weight->weightfn[i_width>>2]( dst, *i_dst_stride, dst, *i_dst_stride, weight, i_height ); + return dst; + } + else if( weight->weightfn ) + { + weight->weightfn[i_width>>2]( dst, *i_dst_stride, src1, i_src_stride, weight, i_height ); + return dst; + } + else + { + *i_dst_stride = i_src_stride; + return src1; + } +} + +void x264_hpel_filter_neon( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, + uint8_t *src, intptr_t stride, int width, + int height, int16_t *buf ); + +PLANE_COPY(16, neon) +PLANE_COPY_SWAP(16, neon) +PLANE_INTERLEAVE(neon) +#endif // !HIGH_BIT_DEPTH + +PROPAGATE_LIST(neon) + +void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf ) +{ +#if !HIGH_BIT_DEPTH + if( cpu&X264_CPU_ARMV8 ) + { + pf->prefetch_fenc_420 = x264_prefetch_fenc_420_aarch64; + pf->prefetch_fenc_422 = x264_prefetch_fenc_422_aarch64; + pf->prefetch_ref = x264_prefetch_ref_aarch64; + } + + if( !(cpu&X264_CPU_NEON) ) + return; + + pf->copy_16x16_unaligned = x264_mc_copy_w16_neon; + pf->copy[PIXEL_16x16] = x264_mc_copy_w16_neon; + pf->copy[PIXEL_8x8] = x264_mc_copy_w8_neon; + pf->copy[PIXEL_4x4] = x264_mc_copy_w4_neon; + + pf->plane_copy = x264_plane_copy_neon; + pf->plane_copy_swap = x264_plane_copy_swap_neon; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_neon; + pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_neon; + pf->plane_copy_interleave = x264_plane_copy_interleave_neon; + + pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_neon; + pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_neon; + pf->store_interleave_chroma = x264_store_interleave_chroma_neon; + + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_neon; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_neon; + pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_neon; + pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_neon; + pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_neon; + pf->avg[PIXEL_4x16] = x264_pixel_avg_4x16_neon; + pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_neon; + pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_neon; + pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_neon; + + pf->weight = x264_mc_wtab_neon; + pf->offsetadd = x264_mc_offsetadd_wtab_neon; + pf->offsetsub = x264_mc_offsetsub_wtab_neon; + pf->weight_cache = x264_weight_cache_neon; + + pf->mc_chroma = x264_mc_chroma_neon; + pf->mc_luma = mc_luma_neon; + pf->get_ref = get_ref_neon; + pf->hpel_filter = x264_hpel_filter_neon; + pf->frame_init_lowres_core = x264_frame_init_lowres_core_neon; + + pf->integral_init4h = x264_integral_init4h_neon; + pf->integral_init8h = x264_integral_init8h_neon; + pf->integral_init4v = x264_integral_init4v_neon; + pf->integral_init8v = x264_integral_init8v_neon; + + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_neon; + pf->mbtree_propagate_list = x264_mbtree_propagate_list_neon; + pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_neon; + pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_neon; + + pf->memcpy_aligned = x264_memcpy_aligned_neon; + pf->memzero_aligned = x264_memzero_aligned_neon; +#endif // !HIGH_BIT_DEPTH +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc.h new file mode 100644 index 00000000..33c311e9 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/mc.h @@ -0,0 +1,31 @@ +/***************************************************************************** + * mc.h: aarch64 motion compensation + ***************************************************************************** + * Copyright (C) 2014-2017 x264 project + * + * Authors: Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_AARCH64_MC_H +#define X264_AARCH64_MC_H + +void x264_mc_init_aarch64( int cpu, x264_mc_functions_t *pf ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/pixel.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/pixel.h new file mode 100644 index 00000000..5206a0c7 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/pixel.h @@ -0,0 +1,79 @@ +/***************************************************************************** + * pixel.h: aarch64 pixel metrics + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_AARCH64_PIXEL_H +#define X264_AARCH64_PIXEL_H + +#define DECL_PIXELS( ret, name, suffix, args ) \ + ret x264_pixel_##name##_16x16_##suffix args;\ + ret x264_pixel_##name##_16x8_##suffix args;\ + ret x264_pixel_##name##_8x16_##suffix args;\ + ret x264_pixel_##name##_8x8_##suffix args;\ + ret x264_pixel_##name##_8x4_##suffix args;\ + ret x264_pixel_##name##_4x16_##suffix args;\ + ret x264_pixel_##name##_4x8_##suffix args;\ + ret x264_pixel_##name##_4x4_##suffix args;\ + +#define DECL_X1( name, suffix ) \ + DECL_PIXELS( int, name, suffix, ( uint8_t *, intptr_t, uint8_t *, intptr_t ) ) + +#define DECL_X4( name, suffix ) \ + DECL_PIXELS( void, name##_x3, suffix, ( uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, int * ) )\ + DECL_PIXELS( void, name##_x4, suffix, ( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, int * ) ) + +DECL_X1( sad, neon ) +DECL_X4( sad, neon ) +DECL_X1( satd, neon ) +DECL_X1( ssd, neon ) + + +void x264_pixel_ssd_nv12_core_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, uint64_t *, uint64_t * ); + +int x264_pixel_vsad_neon( uint8_t *, intptr_t, int ); + +int x264_pixel_sa8d_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t ); +int x264_pixel_sa8d_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t ); +uint64_t x264_pixel_sa8d_satd_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t ); + +uint64_t x264_pixel_var_8x8_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_var_8x16_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_var_16x16_neon( uint8_t *, intptr_t ); +int x264_pixel_var2_8x8_neon ( uint8_t *, uint8_t *, int * ); +int x264_pixel_var2_8x16_neon( uint8_t *, uint8_t *, int * ); + +uint64_t x264_pixel_hadamard_ac_8x8_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_hadamard_ac_8x16_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_hadamard_ac_16x8_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_hadamard_ac_16x16_neon( uint8_t *, intptr_t ); + +void x264_pixel_ssim_4x4x2_core_neon( const uint8_t *, intptr_t, + const uint8_t *, intptr_t, + int sums[2][4] ); +float x264_pixel_ssim_end4_neon( int sum0[5][4], int sum1[5][4], int width ); + +int x264_pixel_asd8_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict-c.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict-c.c new file mode 100644 index 00000000..34b81ebb --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict-c.c @@ -0,0 +1,139 @@ +/***************************************************************************** + * predict.c: aarch64 intra prediction + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "predict.h" +#include "pixel.h" + +void x264_predict_4x4_dc_top_neon( uint8_t *src ); +void x264_predict_4x4_ddr_neon( uint8_t *src ); +void x264_predict_4x4_ddl_neon( uint8_t *src ); + +void x264_predict_8x8c_dc_top_neon( uint8_t *src ); +void x264_predict_8x8c_dc_left_neon( uint8_t *src ); +void x264_predict_8x8c_p_neon( uint8_t *src ); + +void x264_predict_8x16c_dc_left_neon( uint8_t *src ); +void x264_predict_8x16c_dc_top_neon( uint8_t *src ); +void x264_predict_8x16c_p_neon( uint8_t *src ); + +void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] ); + +void x264_predict_16x16_dc_top_neon( uint8_t *src ); +void x264_predict_16x16_dc_left_neon( uint8_t *src ); +void x264_predict_16x16_p_neon( uint8_t *src ); + +void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] ) +{ +#if !HIGH_BIT_DEPTH + if( cpu&X264_CPU_ARMV8 ) + { + pf[I_PRED_4x4_H] = x264_predict_4x4_h_aarch64; + pf[I_PRED_4x4_V] = x264_predict_4x4_v_aarch64; + } + + if( cpu&X264_CPU_NEON ) + { + pf[I_PRED_4x4_DC] = x264_predict_4x4_dc_neon; + pf[I_PRED_4x4_DC_TOP] = x264_predict_4x4_dc_top_neon; + pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_neon; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_neon; + } +#endif // !HIGH_BIT_DEPTH +} + +void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] ) +{ +#if !HIGH_BIT_DEPTH + if( cpu&X264_CPU_ARMV8 ) + { + pf[I_PRED_CHROMA_V] = x264_predict_8x8c_v_aarch64; + } + + if( !(cpu&X264_CPU_NEON) ) + return; + + pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_neon; + pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_neon; + pf[I_PRED_CHROMA_DC_LEFT] = x264_predict_8x8c_dc_left_neon; + pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_neon; + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_neon; +#endif // !HIGH_BIT_DEPTH +} + + +void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + pf[I_PRED_CHROMA_V ] = x264_predict_8x16c_v_neon; + pf[I_PRED_CHROMA_H ] = x264_predict_8x16c_h_neon; + pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_neon; + pf[I_PRED_CHROMA_P ] = x264_predict_8x16c_p_neon; + pf[I_PRED_CHROMA_DC_LEFT]= x264_predict_8x16c_dc_left_neon; + pf[I_PRED_CHROMA_DC_TOP ]= x264_predict_8x16c_dc_top_neon; +#endif // !HIGH_BIT_DEPTH +} + +void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter ) +{ + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_neon; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_neon; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_neon; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_neon; + pf[I_PRED_8x8_DC] = x264_predict_8x8_dc_neon; + pf[I_PRED_8x8_H] = x264_predict_8x8_h_neon; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_neon; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_neon; + pf[I_PRED_8x8_V] = x264_predict_8x8_v_neon; +#endif // !HIGH_BIT_DEPTH +} + +void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + pf[I_PRED_16x16_DC ] = x264_predict_16x16_dc_neon; + pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_neon; + pf[I_PRED_16x16_DC_LEFT]= x264_predict_16x16_dc_left_neon; + pf[I_PRED_16x16_H ] = x264_predict_16x16_h_neon; + pf[I_PRED_16x16_V ] = x264_predict_16x16_v_neon; + pf[I_PRED_16x16_P ] = x264_predict_16x16_p_neon; +#endif // !HIGH_BIT_DEPTH +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict.h new file mode 100644 index 00000000..a8beada0 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/predict.h @@ -0,0 +1,58 @@ +/***************************************************************************** + * predict.h: aarch64 intra prediction + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_AARCH64_PREDICT_H +#define X264_AARCH64_PREDICT_H + +void x264_predict_4x4_h_aarch64( uint8_t *src ); +void x264_predict_4x4_v_aarch64( uint8_t *src ); +void x264_predict_8x8c_v_aarch64( uint8_t *src ); + +// for the merged 4x4 intra sad/satd which expects unified suffix +#define x264_predict_4x4_h_neon x264_predict_4x4_h_aarch64 +#define x264_predict_4x4_v_neon x264_predict_4x4_v_aarch64 +#define x264_predict_8x8c_v_neon x264_predict_8x8c_v_aarch64 + +void x264_predict_4x4_dc_neon( uint8_t *src ); +void x264_predict_8x8_v_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_h_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_dc_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8c_dc_neon( uint8_t *src ); +void x264_predict_8x8c_h_neon( uint8_t *src ); +void x264_predict_8x16c_v_neon( uint8_t *src ); +void x264_predict_8x16c_h_neon( uint8_t *src ); +void x264_predict_8x16c_dc_neon( uint8_t *src ); +void x264_predict_16x16_v_neon( uint8_t *src ); +void x264_predict_16x16_h_neon( uint8_t *src ); +void x264_predict_16x16_dc_neon( uint8_t *src ); + +void x264_predict_4x4_init_aarch64( int cpu, x264_predict_t pf[12] ); +void x264_predict_8x8_init_aarch64( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter ); +void x264_predict_8x8c_init_aarch64( int cpu, x264_predict_t pf[7] ); +void x264_predict_8x16c_init_aarch64( int cpu, x264_predict_t pf[7] ); +void x264_predict_16x16_init_aarch64( int cpu, x264_predict_t pf[7] ); + +#endif /* X264_AARCH64_PREDICT_H */ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/quant.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/quant.h new file mode 100644 index 00000000..e0133e75 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/aarch64/quant.h @@ -0,0 +1,59 @@ +/***************************************************************************** + * quant.h: arm quantization and level-run + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: David Conrad + * Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_AARCH64_QUANT_H +#define X264_AARCH64_QUANT_H + +int x264_quant_2x2_dc_aarch64( int16_t dct[4], int mf, int bias ); + +int x264_quant_2x2_dc_neon( int16_t dct[4], int mf, int bias ); +int x264_quant_4x4_dc_neon( int16_t dct[16], int mf, int bias ); +int x264_quant_4x4_neon( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] ); +int x264_quant_4x4x4_neon( int16_t dct[4][16], uint16_t mf[16], uint16_t bias[16] ); +int x264_quant_8x8_neon( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] ); + +void x264_dequant_4x4_dc_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_4x4_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_neon( int16_t dct[64], int dequant_mf[6][64], int i_qp ); + +int x264_decimate_score15_neon( int16_t * ); +int x264_decimate_score16_neon( int16_t * ); +int x264_decimate_score64_neon( int16_t * ); + +int x264_coeff_last4_aarch64( int16_t * ); +int x264_coeff_last8_aarch64( int16_t * ); +int x264_coeff_last15_neon( int16_t * ); +int x264_coeff_last16_neon( int16_t * ); +int x264_coeff_last64_neon( int16_t * ); + +int x264_coeff_level_run4_aarch64( int16_t *, x264_run_level_t * ); +int x264_coeff_level_run8_neon( int16_t *, x264_run_level_t * ); +int x264_coeff_level_run15_neon( int16_t *, x264_run_level_t * ); +int x264_coeff_level_run16_neon( int16_t *, x264_run_level_t * ); + +void x264_denoise_dct_neon( dctcoef *, uint32_t *, udctcoef *, int ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/dct.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/dct.h new file mode 100644 index 00000000..2b4210ab --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/dct.h @@ -0,0 +1,53 @@ +/***************************************************************************** + * dct.h: arm transform and zigzag + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ARM_DCT_H +#define X264_ARM_DCT_H + +void x264_dct4x4dc_neon( int16_t d[16] ); +void x264_idct4x4dc_neon( int16_t d[16] ); + +void x264_sub4x4_dct_neon( int16_t dct[16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_neon( int16_t dct[4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_neon( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); + +void x264_add4x4_idct_neon( uint8_t *p_dst, int16_t dct[16] ); +void x264_add8x8_idct_neon( uint8_t *p_dst, int16_t dct[4][16] ); +void x264_add16x16_idct_neon( uint8_t *p_dst, int16_t dct[16][16] ); + +void x264_add8x8_idct_dc_neon( uint8_t *p_dst, int16_t dct[4] ); +void x264_add16x16_idct_dc_neon( uint8_t *p_dst, int16_t dct[16] ); +void x264_sub8x8_dct_dc_neon( int16_t dct[4], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x16_dct_dc_neon( int16_t dct[8], uint8_t *pix1, uint8_t *pix2 ); + +void x264_sub8x8_dct8_neon( int16_t dct[64], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct8_neon( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 ); + +void x264_add8x8_idct8_neon( uint8_t *p_dst, int16_t dct[64] ); +void x264_add16x16_idct8_neon( uint8_t *p_dst, int16_t dct[4][64] ); + +void x264_zigzag_scan_4x4_frame_neon( int16_t level[16], int16_t dct[16] ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc-c.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc-c.c new file mode 100644 index 00000000..ab472291 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc-c.c @@ -0,0 +1,310 @@ +/***************************************************************************** + * mc-c.c: arm motion compensation + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * Janne Grunau + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "mc.h" + +void x264_prefetch_ref_arm( uint8_t *, intptr_t, int ); +void x264_prefetch_fenc_arm( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +void *x264_memcpy_aligned_neon( void *dst, const void *src, size_t n ); +void x264_memzero_aligned_neon( void *dst, size_t n ); + +void x264_pixel_avg_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_16x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_8x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_8x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x16_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_pixel_avg_4x2_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +void x264_pixel_avg2_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); +void x264_pixel_avg2_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); +void x264_pixel_avg2_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); +void x264_pixel_avg2_w20_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ); + +void x264_plane_copy_core_neon( pixel *dst, intptr_t i_dst, + pixel *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_neon( pixel *dstu, intptr_t i_dstu, + pixel *dstv, intptr_t i_dstv, + pixel *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_rgb_neon( pixel *dsta, intptr_t i_dsta, + pixel *dstb, intptr_t i_dstb, + pixel *dstc, intptr_t i_dstc, + pixel *src, intptr_t i_src, int pw, int w, int h ); +void x264_plane_copy_interleave_core_neon( pixel *dst, intptr_t i_dst, + pixel *srcu, intptr_t i_srcu, + pixel *srcv, intptr_t i_srcv, int w, int h ); +void x264_plane_copy_swap_core_neon( pixel *dst, intptr_t i_dst, + pixel *src, intptr_t i_src, int w, int h ); + +void x264_store_interleave_chroma_neon( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height ); +void x264_load_deinterleave_chroma_fdec_neon( pixel *dst, pixel *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fenc_neon( pixel *dst, pixel *src, intptr_t i_src, int height ); + +#if !HIGH_BIT_DEPTH +#define MC_WEIGHT(func)\ +void x264_mc_weight_w20##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +void x264_mc_weight_w16##func##_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +void x264_mc_weight_w8##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +void x264_mc_weight_w4##func##_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, const x264_weight_t *, int );\ +\ +static weight_fn_t x264_mc##func##_wtab_neon[6] =\ +{\ + x264_mc_weight_w4##func##_neon,\ + x264_mc_weight_w4##func##_neon,\ + x264_mc_weight_w8##func##_neon,\ + x264_mc_weight_w16##func##_neon,\ + x264_mc_weight_w16##func##_neon,\ + x264_mc_weight_w20##func##_neon,\ +}; + +MC_WEIGHT() +MC_WEIGHT(_nodenom) +MC_WEIGHT(_offsetadd) +MC_WEIGHT(_offsetsub) +#endif + +void x264_mc_copy_w4_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_mc_copy_w8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_mc_copy_w16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); +void x264_mc_copy_w16_aligned_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +void x264_mc_chroma_neon( uint8_t *, uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, int, int ); +void x264_frame_init_lowres_core_neon( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, intptr_t, int, int ); + +void x264_hpel_filter_v_neon( uint8_t *, uint8_t *, int16_t *, intptr_t, int ); +void x264_hpel_filter_c_neon( uint8_t *, int16_t *, int ); +void x264_hpel_filter_h_neon( uint8_t *, uint8_t *, int ); + +void x264_integral_init4h_neon( uint16_t *, uint8_t *, intptr_t ); +void x264_integral_init4v_neon( uint16_t *, uint16_t *, intptr_t ); +void x264_integral_init8h_neon( uint16_t *, uint8_t *, intptr_t ); +void x264_integral_init8v_neon( uint16_t *, intptr_t ); + +void x264_mbtree_propagate_cost_neon( int16_t *, uint16_t *, uint16_t *, uint16_t *, uint16_t *, float *, int ); + +void x264_mbtree_fix8_pack_neon( uint16_t *dst, float *src, int count ); +void x264_mbtree_fix8_unpack_neon( float *dst, uint16_t *src, int count ); + +#if !HIGH_BIT_DEPTH +static void x264_weight_cache_neon( x264_t *h, x264_weight_t *w ) +{ + if( w->i_scale == 1<i_denom ) + { + if( w->i_offset < 0 ) + { + w->weightfn = x264_mc_offsetsub_wtab_neon; + w->cachea[0] = -w->i_offset; + } + else + { + w->weightfn = x264_mc_offsetadd_wtab_neon; + w->cachea[0] = w->i_offset; + } + } + else if( !w->i_denom ) + w->weightfn = x264_mc_nodenom_wtab_neon; + else + w->weightfn = x264_mc_wtab_neon; +} + +static void (* const x264_pixel_avg_wtab_neon[6])( uint8_t *, intptr_t, uint8_t *, intptr_t, uint8_t *, int ) = +{ + NULL, + x264_pixel_avg2_w4_neon, + x264_pixel_avg2_w8_neon, + x264_pixel_avg2_w16_neon, // no slower than w12, so no point in a separate function + x264_pixel_avg2_w16_neon, + x264_pixel_avg2_w20_neon, +}; + +static void (* const x264_mc_copy_wtab_neon[5])( uint8_t *, intptr_t, uint8_t *, intptr_t, int ) = +{ + NULL, + x264_mc_copy_w4_neon, + x264_mc_copy_w8_neon, + NULL, + x264_mc_copy_w16_neon, +}; + +static void mc_luma_neon( uint8_t *dst, intptr_t i_dst_stride, + uint8_t *src[4], intptr_t i_src_stride, + int mvx, int mvy, + int i_width, int i_height, const x264_weight_t *weight ) +{ + int qpel_idx = ((mvy&3)<<2) + (mvx&3); + intptr_t offset = (mvy>>2)*i_src_stride + (mvx>>2); + uint8_t *src1 = src[x264_hpel_ref0[qpel_idx]] + offset; + if( (mvy&3) == 3 ) // explict if() to force conditional add + src1 += i_src_stride; + + if( qpel_idx & 5 ) /* qpel interpolation needed */ + { + uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3); + x264_pixel_avg_wtab_neon[i_width>>2]( + dst, i_dst_stride, src1, i_src_stride, + src2, i_height ); + if( weight->weightfn ) + weight->weightfn[i_width>>2]( dst, i_dst_stride, dst, i_dst_stride, weight, i_height ); + } + else if( weight->weightfn ) + weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height ); + else + x264_mc_copy_wtab_neon[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, i_height ); +} + +static uint8_t *get_ref_neon( uint8_t *dst, intptr_t *i_dst_stride, + uint8_t *src[4], intptr_t i_src_stride, + int mvx, int mvy, + int i_width, int i_height, const x264_weight_t *weight ) +{ + int qpel_idx = ((mvy&3)<<2) + (mvx&3); + intptr_t offset = (mvy>>2)*i_src_stride + (mvx>>2); + uint8_t *src1 = src[x264_hpel_ref0[qpel_idx]] + offset; + if( (mvy&3) == 3 ) // explict if() to force conditional add + src1 += i_src_stride; + + if( qpel_idx & 5 ) /* qpel interpolation needed */ + { + uint8_t *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3); + x264_pixel_avg_wtab_neon[i_width>>2]( + dst, *i_dst_stride, src1, i_src_stride, + src2, i_height ); + if( weight->weightfn ) + weight->weightfn[i_width>>2]( dst, *i_dst_stride, dst, *i_dst_stride, weight, i_height ); + return dst; + } + else if( weight->weightfn ) + { + weight->weightfn[i_width>>2]( dst, *i_dst_stride, src1, i_src_stride, weight, i_height ); + return dst; + } + else + { + *i_dst_stride = i_src_stride; + return src1; + } +} + +static void hpel_filter_neon( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src, + intptr_t stride, int width, int height, int16_t *buf ) +{ + intptr_t realign = (intptr_t)src & 15; + src -= realign; + dstv -= realign; + dstc -= realign; + dsth -= realign; + width += realign; + while( height-- ) + { + x264_hpel_filter_v_neon( dstv, src, buf+8, stride, width ); + x264_hpel_filter_c_neon( dstc, buf+8, width ); + x264_hpel_filter_h_neon( dsth, src, width ); + dsth += stride; + dstv += stride; + dstc += stride; + src += stride; + } +} + +PLANE_COPY(16, neon) +PLANE_COPY_SWAP(16, neon) +PLANE_INTERLEAVE(neon) +#endif // !HIGH_BIT_DEPTH + +PROPAGATE_LIST(neon) + +void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf ) +{ + if( !(cpu&X264_CPU_ARMV6) ) + return; + +#if !HIGH_BIT_DEPTH + pf->prefetch_fenc_420 = x264_prefetch_fenc_arm; + pf->prefetch_fenc_422 = x264_prefetch_fenc_arm; /* FIXME */ + pf->prefetch_ref = x264_prefetch_ref_arm; +#endif // !HIGH_BIT_DEPTH + + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + pf->copy_16x16_unaligned = x264_mc_copy_w16_neon; + pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_neon; + pf->copy[PIXEL_8x8] = x264_mc_copy_w8_neon; + pf->copy[PIXEL_4x4] = x264_mc_copy_w4_neon; + + pf->plane_copy = x264_plane_copy_neon; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_neon; + pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_neon; + pf->plane_copy_interleave = x264_plane_copy_interleave_neon; + pf->plane_copy_swap = x264_plane_copy_swap_neon; + + pf->store_interleave_chroma = x264_store_interleave_chroma_neon; + pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_neon; + pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_neon; + + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_neon; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_neon; + pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_neon; + pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_neon; + pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_neon; + pf->avg[PIXEL_4x16] = x264_pixel_avg_4x16_neon; + pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_neon; + pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_neon; + pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_neon; + + pf->weight = x264_mc_wtab_neon; + pf->offsetadd = x264_mc_offsetadd_wtab_neon; + pf->offsetsub = x264_mc_offsetsub_wtab_neon; + pf->weight_cache = x264_weight_cache_neon; + + pf->mc_chroma = x264_mc_chroma_neon; + pf->mc_luma = mc_luma_neon; + pf->get_ref = get_ref_neon; + pf->hpel_filter = hpel_filter_neon; + pf->frame_init_lowres_core = x264_frame_init_lowres_core_neon; + + pf->integral_init4h = x264_integral_init4h_neon; + pf->integral_init8h = x264_integral_init8h_neon; + pf->integral_init4v = x264_integral_init4v_neon; + pf->integral_init8v = x264_integral_init8v_neon; + + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_neon; + pf->mbtree_propagate_list = x264_mbtree_propagate_list_neon; + pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_neon; + pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_neon; +#endif // !HIGH_BIT_DEPTH + +// Apple's gcc stupidly cannot align stack variables, and ALIGNED_ARRAY can't work on structs +#ifndef SYS_MACOSX + pf->memcpy_aligned = x264_memcpy_aligned_neon; +#endif + pf->memzero_aligned = x264_memzero_aligned_neon; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc.h new file mode 100644 index 00000000..fc8802f7 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/mc.h @@ -0,0 +1,31 @@ +/***************************************************************************** + * mc.h: arm motion compensation + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ARM_MC_H +#define X264_ARM_MC_H + +void x264_mc_init_arm( int cpu, x264_mc_functions_t *pf ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/pixel.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/pixel.h new file mode 100644 index 00000000..d9b02c4c --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/pixel.h @@ -0,0 +1,81 @@ +/***************************************************************************** + * pixel.h: arm pixel metrics + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ARM_PIXEL_H +#define X264_ARM_PIXEL_H + +#define DECL_PIXELS( ret, name, suffix, args ) \ + ret x264_pixel_##name##_16x16_##suffix args;\ + ret x264_pixel_##name##_16x8_##suffix args;\ + ret x264_pixel_##name##_8x16_##suffix args;\ + ret x264_pixel_##name##_8x8_##suffix args;\ + ret x264_pixel_##name##_8x4_##suffix args;\ + ret x264_pixel_##name##_4x8_##suffix args;\ + ret x264_pixel_##name##_4x4_##suffix args;\ + +#define DECL_X1( name, suffix ) \ + DECL_PIXELS( int, name, suffix, ( uint8_t *, int, uint8_t *, int ) ) + +#define DECL_X4( name, suffix ) \ + DECL_PIXELS( void, name##_x3, suffix, ( uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, int * ) )\ + DECL_PIXELS( void, name##_x4, suffix, ( uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, intptr_t, int * ) ) + +int x264_pixel_sad_4x4_armv6( uint8_t *, intptr_t, uint8_t *, intptr_t ); +int x264_pixel_sad_4x8_armv6( uint8_t *, intptr_t, uint8_t *, intptr_t ); + +DECL_X1( sad, neon ) +DECL_X1( sad_aligned, neon ) +DECL_X1( sad_aligned, neon_dual ) +DECL_X4( sad, neon ) +DECL_X1( satd, neon ) +DECL_X1( ssd, neon ) + +void x264_pixel_ssd_nv12_core_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int, int, uint64_t *, uint64_t * ); + +int x264_pixel_vsad_neon( uint8_t *, intptr_t, int ); + +int x264_pixel_sa8d_8x8_neon ( uint8_t *, intptr_t, uint8_t *, intptr_t ); +int x264_pixel_sa8d_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t ); +uint64_t x264_pixel_sa8d_satd_16x16_neon( uint8_t *, intptr_t, uint8_t *, intptr_t ); + +uint64_t x264_pixel_var_8x8_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_var_8x16_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_var_16x16_neon( uint8_t *, intptr_t ); +int x264_pixel_var2_8x8_neon ( uint8_t *, uint8_t *, int * ); +int x264_pixel_var2_8x16_neon( uint8_t *, uint8_t *, int * ); + +uint64_t x264_pixel_hadamard_ac_8x8_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_hadamard_ac_8x16_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_hadamard_ac_16x8_neon ( uint8_t *, intptr_t ); +uint64_t x264_pixel_hadamard_ac_16x16_neon( uint8_t *, intptr_t ); + +void x264_pixel_ssim_4x4x2_core_neon( const uint8_t *, intptr_t, + const uint8_t *, intptr_t, + int sums[2][4] ); +float x264_pixel_ssim_end4_neon( int sum0[5][4], int sum1[5][4], int width ); + +int x264_pixel_asd8_neon( uint8_t *, intptr_t, uint8_t *, intptr_t, int ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict-c.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict-c.c new file mode 100644 index 00000000..1c8f9164 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict-c.c @@ -0,0 +1,108 @@ +/***************************************************************************** + * predict.c: arm intra prediction + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "predict.h" +#include "pixel.h" + +void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] ) +{ + if( !(cpu&X264_CPU_ARMV6) ) + return; + +#if !HIGH_BIT_DEPTH + pf[I_PRED_4x4_H] = x264_predict_4x4_h_armv6; + pf[I_PRED_4x4_V] = x264_predict_4x4_v_armv6; + pf[I_PRED_4x4_DC] = x264_predict_4x4_dc_armv6; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_armv6; + + if( !(cpu&X264_CPU_NEON) ) + return; + + pf[I_PRED_4x4_DC_TOP] = x264_predict_4x4_dc_top_neon; + pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_neon; +#endif // !HIGH_BIT_DEPTH +} + +void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_neon; + pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_neon; + pf[I_PRED_CHROMA_DC_LEFT] = x264_predict_8x8c_dc_left_neon; + pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_neon; + pf[I_PRED_CHROMA_V] = x264_predict_8x8c_v_neon; + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_neon; +#endif // !HIGH_BIT_DEPTH +} + +void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + /* The other functions weren't faster than C (gcc 4.7.3) on Cortex A8 and A9. */ + pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x16c_dc_top_neon; + pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_neon; + pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_neon; +#endif // !HIGH_BIT_DEPTH +} + +void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter ) +{ + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_neon; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_neon; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_neon; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_neon; + pf[I_PRED_8x8_DC] = x264_predict_8x8_dc_neon; + pf[I_PRED_8x8_H] = x264_predict_8x8_h_neon; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_neon; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_neon; + pf[I_PRED_8x8_V] = x264_predict_8x8_v_neon; +#endif // !HIGH_BIT_DEPTH +} + +void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_NEON) ) + return; + +#if !HIGH_BIT_DEPTH + pf[I_PRED_16x16_DC ] = x264_predict_16x16_dc_neon; + pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_neon; + pf[I_PRED_16x16_DC_LEFT]= x264_predict_16x16_dc_left_neon; + pf[I_PRED_16x16_H ] = x264_predict_16x16_h_neon; + pf[I_PRED_16x16_V ] = x264_predict_16x16_v_neon; + pf[I_PRED_16x16_P ] = x264_predict_16x16_p_neon; +#endif // !HIGH_BIT_DEPTH +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict.h new file mode 100644 index 00000000..35aeaaf3 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/predict.h @@ -0,0 +1,70 @@ +/***************************************************************************** + * predict.h: arm intra prediction + ***************************************************************************** + * Copyright (C) 2009-2017 x264 project + * + * Authors: David Conrad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ARM_PREDICT_H +#define X264_ARM_PREDICT_H + +void x264_predict_4x4_dc_armv6( uint8_t *src ); +void x264_predict_4x4_dc_top_neon( uint8_t *src ); +void x264_predict_4x4_v_armv6( uint8_t *src ); +void x264_predict_4x4_h_armv6( uint8_t *src ); +void x264_predict_4x4_ddr_armv6( uint8_t *src ); +void x264_predict_4x4_ddl_neon( uint8_t *src ); + +void x264_predict_8x8c_dc_neon( uint8_t *src ); +void x264_predict_8x8c_dc_top_neon( uint8_t *src ); +void x264_predict_8x8c_dc_left_neon( uint8_t *src ); +void x264_predict_8x8c_h_neon( uint8_t *src ); +void x264_predict_8x8c_v_neon( uint8_t *src ); +void x264_predict_8x8c_p_neon( uint8_t *src ); + +void x264_predict_8x16c_h_neon( uint8_t *src ); +void x264_predict_8x16c_dc_top_neon( uint8_t *src ); +void x264_predict_8x16c_p_neon( uint8_t *src ); + +void x264_predict_8x8_dc_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_v_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_h_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] ); + +void x264_predict_16x16_dc_neon( uint8_t *src ); +void x264_predict_16x16_dc_top_neon( uint8_t *src ); +void x264_predict_16x16_dc_left_neon( uint8_t *src ); +void x264_predict_16x16_h_neon( uint8_t *src ); +void x264_predict_16x16_v_neon( uint8_t *src ); +void x264_predict_16x16_p_neon( uint8_t *src ); + +void x264_predict_4x4_init_arm( int cpu, x264_predict_t pf[12] ); +void x264_predict_8x8_init_arm( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter ); +void x264_predict_8x8c_init_arm( int cpu, x264_predict_t pf[7] ); +void x264_predict_8x16c_init_arm( int cpu, x264_predict_t pf[7] ); +void x264_predict_16x16_init_arm( int cpu, x264_predict_t pf[7] ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/quant.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/quant.h new file mode 100644 index 00000000..2c71577f --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/arm/quant.h @@ -0,0 +1,53 @@ +/***************************************************************************** + * quant.h: arm quantization and level-run + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: David Conrad + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ARM_QUANT_H +#define X264_ARM_QUANT_H + +int x264_quant_2x2_dc_armv6( int16_t dct[4], int mf, int bias ); + +int x264_quant_2x2_dc_neon( int16_t dct[4], int mf, int bias ); +int x264_quant_4x4_dc_neon( int16_t dct[16], int mf, int bias ); +int x264_quant_4x4_neon( int16_t dct[16], uint16_t mf[16], uint16_t bias[16] ); +int x264_quant_4x4x4_neon( int16_t dct[4][16], uint16_t mf[16], uint16_t bias[16] ); +int x264_quant_8x8_neon( int16_t dct[64], uint16_t mf[64], uint16_t bias[64] ); + +void x264_dequant_4x4_dc_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_4x4_neon( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_neon( int16_t dct[64], int dequant_mf[6][64], int i_qp ); + +int x264_decimate_score15_neon( int16_t * ); +int x264_decimate_score16_neon( int16_t * ); +int x264_decimate_score64_neon( int16_t * ); + +int x264_coeff_last4_arm( int16_t * ); +int x264_coeff_last8_arm( int16_t * ); +int x264_coeff_last15_neon( int16_t * ); +int x264_coeff_last16_neon( int16_t * ); +int x264_coeff_last64_neon( int16_t * ); + +void x264_denoise_dct_neon( dctcoef *, uint32_t *, udctcoef *, int ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.c new file mode 100644 index 00000000..cc763000 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.c @@ -0,0 +1,176 @@ +/***************************************************************************** + * bitstream.c: bitstream writing + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +static uint8_t *x264_nal_escape_c( uint8_t *dst, uint8_t *src, uint8_t *end ) +{ + if( src < end ) *dst++ = *src++; + if( src < end ) *dst++ = *src++; + while( src < end ) + { + if( src[0] <= 0x03 && !dst[-2] && !dst[-1] ) + *dst++ = 0x03; + *dst++ = *src++; + } + return dst; +} + +uint8_t *x264_nal_escape_mmx2( uint8_t *dst, uint8_t *src, uint8_t *end ); +uint8_t *x264_nal_escape_sse2( uint8_t *dst, uint8_t *src, uint8_t *end ); +uint8_t *x264_nal_escape_avx2( uint8_t *dst, uint8_t *src, uint8_t *end ); +void x264_cabac_block_residual_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_8x8_rd_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_8x8_rd_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_8x8_rd_internal_ssse3 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_8x8_rd_internal_ssse3_lzcnt( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_8x8_rd_internal_avx512 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_internal_sse2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_internal_lzcnt ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_internal_avx2 ( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); +void x264_cabac_block_residual_internal_avx512( dctcoef *l, int b_interlaced, intptr_t ctx_block_cat, x264_cabac_t *cb ); + +uint8_t *x264_nal_escape_neon( uint8_t *dst, uint8_t *src, uint8_t *end ); + +/**************************************************************************** + * x264_nal_encode: + ****************************************************************************/ +void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal ) +{ + uint8_t *src = nal->p_payload; + uint8_t *end = nal->p_payload + nal->i_payload; + uint8_t *orig_dst = dst; + + if( h->param.b_annexb ) + { + if( nal->b_long_startcode ) + *dst++ = 0x00; + *dst++ = 0x00; + *dst++ = 0x00; + *dst++ = 0x01; + } + else /* save room for size later */ + dst += 4; + + /* nal header */ + *dst++ = ( 0x00 << 7 ) | ( nal->i_ref_idc << 5 ) | nal->i_type; + + dst = h->bsf.nal_escape( dst, src, end ); + int size = dst - orig_dst; + + /* Apply AVC-Intra padding */ + if( h->param.i_avcintra_class ) + { + int padding = nal->i_payload + nal->i_padding + NALU_OVERHEAD - size; + if( padding > 0 ) + { + memset( dst, 0, padding ); + size += padding; + } + nal->i_padding = X264_MAX( padding, 0 ); + } + + /* Write the size header for mp4/etc */ + if( !h->param.b_annexb ) + { + /* Size doesn't include the size of the header we're writing now. */ + int chunk_size = size - 4; + orig_dst[0] = chunk_size >> 24; + orig_dst[1] = chunk_size >> 16; + orig_dst[2] = chunk_size >> 8; + orig_dst[3] = chunk_size >> 0; + } + + nal->i_payload = size; + nal->p_payload = orig_dst; + x264_emms(); +} + +void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf ) +{ + memset( pf, 0, sizeof(*pf) ); + + pf->nal_escape = x264_nal_escape_c; +#if HAVE_MMX +#if ARCH_X86_64 && !defined( __MACH__ ) + pf->cabac_block_residual_internal = x264_cabac_block_residual_internal_sse2; + pf->cabac_block_residual_rd_internal = x264_cabac_block_residual_rd_internal_sse2; + pf->cabac_block_residual_8x8_rd_internal = x264_cabac_block_residual_8x8_rd_internal_sse2; +#endif + + if( cpu&X264_CPU_MMX2 ) + pf->nal_escape = x264_nal_escape_mmx2; + if( cpu&X264_CPU_SSE2 ) + { + if( cpu&X264_CPU_SSE2_IS_FAST ) + pf->nal_escape = x264_nal_escape_sse2; + } +#if ARCH_X86_64 && !defined( __MACH__ ) + if( cpu&X264_CPU_LZCNT ) + { + pf->cabac_block_residual_internal = x264_cabac_block_residual_internal_lzcnt; + pf->cabac_block_residual_rd_internal = x264_cabac_block_residual_rd_internal_lzcnt; + pf->cabac_block_residual_8x8_rd_internal = x264_cabac_block_residual_8x8_rd_internal_lzcnt; + } + + if( cpu&X264_CPU_SSSE3 ) + { + pf->cabac_block_residual_rd_internal = x264_cabac_block_residual_rd_internal_ssse3; + pf->cabac_block_residual_8x8_rd_internal = x264_cabac_block_residual_8x8_rd_internal_ssse3; + if( cpu&X264_CPU_LZCNT ) + { + pf->cabac_block_residual_rd_internal = x264_cabac_block_residual_rd_internal_ssse3_lzcnt; + pf->cabac_block_residual_8x8_rd_internal = x264_cabac_block_residual_8x8_rd_internal_ssse3_lzcnt; + } + } + + if( cpu&X264_CPU_AVX2 ) + { + pf->nal_escape = x264_nal_escape_avx2; + pf->cabac_block_residual_internal = x264_cabac_block_residual_internal_avx2; + } + + if( cpu&X264_CPU_AVX512 ) + { + pf->cabac_block_residual_internal = x264_cabac_block_residual_internal_avx512; + pf->cabac_block_residual_rd_internal = x264_cabac_block_residual_rd_internal_avx512; + pf->cabac_block_residual_8x8_rd_internal = x264_cabac_block_residual_8x8_rd_internal_avx512; + } +#endif +#endif +#if HAVE_ARMV6 + if( cpu&X264_CPU_NEON ) + pf->nal_escape = x264_nal_escape_neon; +#endif +#if ARCH_AARCH64 + if( cpu&X264_CPU_NEON ) + pf->nal_escape = x264_nal_escape_neon; +#endif +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.h new file mode 100644 index 00000000..2816ef33 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/bitstream.h @@ -0,0 +1,312 @@ +/***************************************************************************** + * bitstream.h: bitstream writing + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Fiona Glaser + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_BS_H +#define X264_BS_H + +typedef struct +{ + uint8_t i_bits; + uint8_t i_size; +} vlc_t; + +typedef struct +{ + uint16_t i_bits; + uint8_t i_size; + /* Next level table to use */ + uint8_t i_next; +} vlc_large_t; + +typedef struct bs_s +{ + uint8_t *p_start; + uint8_t *p; + uint8_t *p_end; + + uintptr_t cur_bits; + int i_left; /* i_count number of available bits */ + int i_bits_encoded; /* RD only */ +} bs_t; + +typedef struct +{ + int32_t last; + int32_t mask; + ALIGNED_16( dctcoef level[18] ); +} x264_run_level_t; + +extern const vlc_t x264_coeff0_token[6]; +extern const vlc_t x264_coeff_token[6][16][4]; +extern const vlc_t x264_total_zeros[15][16]; +extern const vlc_t x264_total_zeros_2x2_dc[3][4]; +extern const vlc_t x264_total_zeros_2x4_dc[7][8]; + +typedef struct +{ + uint8_t *(*nal_escape)( uint8_t *dst, uint8_t *src, uint8_t *end ); + void (*cabac_block_residual_internal)( dctcoef *l, int b_interlaced, + intptr_t ctx_block_cat, x264_cabac_t *cb ); + void (*cabac_block_residual_rd_internal)( dctcoef *l, int b_interlaced, + intptr_t ctx_block_cat, x264_cabac_t *cb ); + void (*cabac_block_residual_8x8_rd_internal)( dctcoef *l, int b_interlaced, + intptr_t ctx_block_cat, x264_cabac_t *cb ); +} x264_bitstream_function_t; + +void x264_bitstream_init( int cpu, x264_bitstream_function_t *pf ); + +/* A larger level table size theoretically could help a bit at extremely + * high bitrates, but the cost in cache is usually too high for it to be + * useful. + * This size appears to be optimal for QP18 encoding on a Nehalem CPU. + * FIXME: Do further testing? */ +#define LEVEL_TABLE_SIZE 128 +extern vlc_large_t x264_level_token[7][LEVEL_TABLE_SIZE]; + +/* The longest possible set of zero run codes sums to 25 bits. This leaves + * plenty of room for both the code (25 bits) and size (5 bits) in a uint32_t. */ + +extern uint32_t x264_run_before[1<<16]; + +static inline void bs_init( bs_t *s, void *p_data, int i_data ) +{ + int offset = ((intptr_t)p_data & 3); + s->p = s->p_start = (uint8_t*)p_data - offset; + s->p_end = (uint8_t*)p_data + i_data; + s->i_left = (WORD_SIZE - offset)*8; + s->cur_bits = endian_fix32( M32(s->p) ); + s->cur_bits >>= (4-offset)*8; +} +static inline int bs_pos( bs_t *s ) +{ + return( 8 * (s->p - s->p_start) + (WORD_SIZE*8) - s->i_left ); +} + +/* Write the rest of cur_bits to the bitstream; results in a bitstream no longer 32-bit aligned. */ +static inline void bs_flush( bs_t *s ) +{ + M32( s->p ) = endian_fix32( s->cur_bits << (s->i_left&31) ); + s->p += WORD_SIZE - (s->i_left >> 3); + s->i_left = WORD_SIZE*8; +} +/* The inverse of bs_flush: prepare the bitstream to be written to again. */ +static inline void bs_realign( bs_t *s ) +{ + int offset = ((intptr_t)s->p & 3); + if( offset ) + { + s->p = (uint8_t*)s->p - offset; + s->i_left = (WORD_SIZE - offset)*8; + s->cur_bits = endian_fix32( M32(s->p) ); + s->cur_bits >>= (4-offset)*8; + } +} + +static inline void bs_write( bs_t *s, int i_count, uint32_t i_bits ) +{ + if( WORD_SIZE == 8 ) + { + s->cur_bits = (s->cur_bits << i_count) | i_bits; + s->i_left -= i_count; + if( s->i_left <= 32 ) + { +#if WORDS_BIGENDIAN + M32( s->p ) = s->cur_bits >> (32 - s->i_left); +#else + M32( s->p ) = endian_fix( s->cur_bits << s->i_left ); +#endif + s->i_left += 32; + s->p += 4; + } + } + else + { + if( i_count < s->i_left ) + { + s->cur_bits = (s->cur_bits << i_count) | i_bits; + s->i_left -= i_count; + } + else + { + i_count -= s->i_left; + s->cur_bits = (s->cur_bits << s->i_left) | (i_bits >> i_count); + M32( s->p ) = endian_fix( s->cur_bits ); + s->p += 4; + s->cur_bits = i_bits; + s->i_left = 32 - i_count; + } + } +} + +/* Special case to eliminate branch in normal bs_write. */ +/* Golomb never writes an even-size code, so this is only used in slice headers. */ +static inline void bs_write32( bs_t *s, uint32_t i_bits ) +{ + bs_write( s, 16, i_bits >> 16 ); + bs_write( s, 16, i_bits ); +} + +static inline void bs_write1( bs_t *s, uint32_t i_bit ) +{ + s->cur_bits <<= 1; + s->cur_bits |= i_bit; + s->i_left--; + if( s->i_left == WORD_SIZE*8-32 ) + { + M32( s->p ) = endian_fix32( s->cur_bits ); + s->p += 4; + s->i_left = WORD_SIZE*8; + } +} + +static inline void bs_align_0( bs_t *s ) +{ + bs_write( s, s->i_left&7, 0 ); + bs_flush( s ); +} +static inline void bs_align_1( bs_t *s ) +{ + bs_write( s, s->i_left&7, (1 << (s->i_left&7)) - 1 ); + bs_flush( s ); +} +static inline void bs_align_10( bs_t *s ) +{ + if( s->i_left&7 ) + bs_write( s, s->i_left&7, 1 << ( (s->i_left&7) - 1 ) ); +} + +/* golomb functions */ + +static const uint8_t x264_ue_size_tab[256] = +{ + 1, 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, + 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, +}; + +static inline void bs_write_ue_big( bs_t *s, unsigned int val ) +{ + int size = 0; + int tmp = ++val; + if( tmp >= 0x10000 ) + { + size = 32; + tmp >>= 16; + } + if( tmp >= 0x100 ) + { + size += 16; + tmp >>= 8; + } + size += x264_ue_size_tab[tmp]; + bs_write( s, size>>1, 0 ); + bs_write( s, (size>>1)+1, val ); +} + +/* Only works on values under 255. */ +static inline void bs_write_ue( bs_t *s, int val ) +{ + bs_write( s, x264_ue_size_tab[val+1], val+1 ); +} + +static inline void bs_write_se( bs_t *s, int val ) +{ + int size = 0; + /* Faster than (val <= 0 ? -val*2+1 : val*2) */ + /* 4 instructions on x86, 3 on ARM */ + int tmp = 1 - val*2; + if( tmp < 0 ) tmp = val*2; + val = tmp; + + if( tmp >= 0x100 ) + { + size = 16; + tmp >>= 8; + } + size += x264_ue_size_tab[tmp]; + bs_write( s, size, val ); +} + +static inline void bs_write_te( bs_t *s, int x, int val ) +{ + if( x == 1 ) + bs_write1( s, 1^val ); + else //if( x > 1 ) + bs_write_ue( s, val ); +} + +static inline void bs_rbsp_trailing( bs_t *s ) +{ + bs_write1( s, 1 ); + bs_write( s, s->i_left&7, 0 ); +} + +static ALWAYS_INLINE int bs_size_ue( unsigned int val ) +{ + return x264_ue_size_tab[val+1]; +} + +static ALWAYS_INLINE int bs_size_ue_big( unsigned int val ) +{ + if( val < 255 ) + return x264_ue_size_tab[val+1]; + else + return x264_ue_size_tab[(val+1)>>8] + 16; +} + +static ALWAYS_INLINE int bs_size_se( int val ) +{ + int tmp = 1 - val*2; + if( tmp < 0 ) tmp = val*2; + if( tmp < 256 ) + return x264_ue_size_tab[tmp]; + else + return x264_ue_size_tab[tmp>>8]+16; +} + +static ALWAYS_INLINE int bs_size_te( int x, int val ) +{ + if( x == 1 ) + return 1; + else //if( x > 1 ) + return x264_ue_size_tab[val+1]; +} + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.c new file mode 100644 index 00000000..14db0cd3 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.c @@ -0,0 +1,1485 @@ +/***************************************************************************** + * cabac.c: arithmetic coder + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + + +static const int8_t x264_cabac_context_init_I[1024][2] = +{ + /* 0 - 10 */ + { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 }, + { 2, 54 }, { 3, 74 }, { -28,127 }, { -23, 104 }, + { -6, 53 }, { -1, 54 }, { 7, 51 }, + + /* 11 - 23 unused for I */ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, + + /* 24- 39 */ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + + /* 40 - 53 */ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, + + /* 54 - 59 */ + { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, + { 0, 0 }, { 0, 0 }, + + /* 60 - 69 */ + { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 }, + { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 }, + { 13, 41 }, { 3, 62 }, + + /* 70 -> 87 */ + { 0, 11 }, { 1, 55 }, { 0, 69 }, { -17, 127 }, + { -13, 102 },{ 0, 82 }, { -7, 74 }, { -21, 107 }, + { -27, 127 },{ -31, 127 },{ -24, 127 }, { -18, 95 }, + { -27, 127 },{ -21, 114 },{ -30, 127 }, { -17, 123 }, + { -12, 115 },{ -16, 122 }, + + /* 88 -> 104 */ + { -11, 115 },{ -12, 63 }, { -2, 68 }, { -15, 84 }, + { -13, 104 },{ -3, 70 }, { -8, 93 }, { -10, 90 }, + { -30, 127 },{ -1, 74 }, { -6, 97 }, { -7, 91 }, + { -20, 127 },{ -4, 56 }, { -5, 82 }, { -7, 76 }, + { -22, 125 }, + + /* 105 -> 135 */ + { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 }, + { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 }, + { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 }, + { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 }, + { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 }, + { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 }, + { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 }, + { 14, 62 }, { -13, 108 },{ -15, 100 }, + + /* 136 -> 165 */ + { -13, 101 },{ -13, 91 }, { -12, 94 }, { -10, 88 }, + { -16, 84 }, { -10, 86 }, { -7, 83 }, { -13, 87 }, + { -19, 94 }, { 1, 70 }, { 0, 72 }, { -5, 74 }, + { 18, 59 }, { -8, 102 }, { -15, 100 }, { 0, 95 }, + { -4, 75 }, { 2, 72 }, { -11, 75 }, { -3, 71 }, + { 15, 46 }, { -13, 69 }, { 0, 62 }, { 0, 65 }, + { 21, 37 }, { -15, 72 }, { 9, 57 }, { 16, 54 }, + { 0, 62 }, { 12, 72 }, + + /* 166 -> 196 */ + { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 }, + { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 }, + { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 }, + { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 }, + { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 }, + { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 }, + { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 }, + { 0, 89 }, { 26, -19 }, { 22, -17 }, + + /* 197 -> 226 */ + { 26, -17 }, { 30, -25 }, { 28, -20 }, { 33, -23 }, + { 37, -27 }, { 33, -23 }, { 40, -28 }, { 38, -17 }, + { 33, -11 }, { 40, -15 }, { 41, -6 }, { 38, 1 }, + { 41, 17 }, { 30, -6 }, { 27, 3 }, { 26, 22 }, + { 37, -16 }, { 35, -4 }, { 38, -8 }, { 38, -3 }, + { 37, 3 }, { 38, 5 }, { 42, 0 }, { 35, 16 }, + { 39, 22 }, { 14, 48 }, { 27, 37 }, { 21, 60 }, + { 12, 68 }, { 2, 97 }, + + /* 227 -> 251 */ + { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 }, + { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 }, + { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 }, + { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 }, + { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 }, + { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 }, + { -4, 65 }, + + /* 252 -> 275 */ + { -12, 73 }, { -8, 76 }, { -7, 80 }, { -9, 88 }, + { -17, 110 },{ -11, 97 }, { -20, 84 }, { -11, 79 }, + { -6, 73 }, { -4, 74 }, { -13, 86 }, { -13, 96 }, + { -11, 97 }, { -19, 117 },{ -8, 78 }, { -5, 33 }, + { -4, 48 }, { -2, 53 }, { -3, 62 }, { -13, 71 }, + { -10, 79 }, { -12, 86 }, { -13, 90 }, { -14, 97 }, + + /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */ + { 0, 0 }, + + /* 277 -> 307 */ + { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 }, + { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 }, + { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 }, + { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 }, + { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 }, + { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 }, + { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 }, + { 9, 64 }, { -12, 104 },{ -11, 97 }, + + /* 308 -> 337 */ + { -16, 96 }, { -7, 88 }, { -8, 85 }, { -7, 85 }, + { -9, 85 }, { -13, 88 }, { 4, 66 }, { -3, 77 }, + { -3, 76 }, { -6, 76 }, { 10, 58 }, { -1, 76 }, + { -1, 83 }, { -7, 99 }, { -14, 95 }, { 2, 95 }, + { 0, 76 }, { -5, 74 }, { 0, 70 }, { -11, 75 }, + { 1, 68 }, { 0, 65 }, { -14, 73 }, { 3, 62 }, + { 4, 62 }, { -1, 68 }, { -13, 75 }, { 11, 55 }, + { 5, 64 }, { 12, 70 }, + + /* 338 -> 368 */ + { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 }, + { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 }, + { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 }, + { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 }, + { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 }, + { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 }, + { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 }, + { -12, 109 },{ 36, -35 }, { 36, -34 }, + + /* 369 -> 398 */ + { 32, -26 }, { 37, -30 }, { 44, -32 }, { 34, -18 }, + { 34, -15 }, { 40, -15 }, { 33, -7 }, { 35, -5 }, + { 33, 0 }, { 38, 2 }, { 33, 13 }, { 23, 35 }, + { 13, 58 }, { 29, -3 }, { 26, 0 }, { 22, 30 }, + { 31, -7 }, { 35, -15 }, { 34, -3 }, { 34, 3 }, + { 36, -1 }, { 34, 5 }, { 32, 11 }, { 35, 5 }, + { 34, 12 }, { 39, 11 }, { 30, 29 }, { 34, 26 }, + { 29, 39 }, { 19, 66 }, + + /* 399 -> 435 */ + { 31, 21 }, { 31, 31 }, { 25, 50 }, + { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 }, + { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 }, + { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 }, + { -23, 68 }, { -24, 50 }, { -11, 74 }, { 23, -13 }, + { 26, -13 }, { 40, -15 }, { 49, -14 }, { 44, 3 }, + { 45, 6 }, { 44, 34 }, { 33, 54 }, { 19, 82 }, + { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 }, + { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 }, + { 0, 68 }, { -9, 92 }, + + /* 436 -> 459 */ + { -14, 106 }, { -13, 97 }, { -15, 90 }, { -12, 90 }, + { -18, 88 }, { -10, 73 }, { -9, 79 }, { -14, 86 }, + { -10, 73 }, { -10, 70 }, { -10, 69 }, { -5, 66 }, + { -9, 64 }, { -5, 58 }, { 2, 59 }, { 21, -10 }, + { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 }, + { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 }, + + /* 460 -> 1024 */ + { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 }, + { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 }, + { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }, + { -17, 123 }, { -12, 115 }, { -16, 122 }, { -11, 115 }, + { -12, 63 }, { -2, 68 }, { -15, 84 }, { -13, 104 }, + { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }, + { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 }, + { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 }, + { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 }, + { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 }, + { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 }, + { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 }, + { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 }, + { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 }, + { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 }, + { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 }, + { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 }, + { -7, 93 }, { -11, 87 }, { -3, 77 }, { -5, 71 }, + { -4, 63 }, { -4, 68 }, { -12, 84 }, { -7, 62 }, + { -7, 65 }, { 8, 61 }, { 5, 56 }, { -2, 66 }, + { 1, 64 }, { 0, 61 }, { -2, 78 }, { 1, 50 }, + { 7, 52 }, { 10, 35 }, { 0, 44 }, { 11, 38 }, + { 1, 45 }, { 0, 46 }, { 5, 44 }, { 31, 17 }, + { 1, 51 }, { 7, 50 }, { 28, 19 }, { 16, 33 }, + { 14, 62 }, { -13, 108 }, { -15, 100 }, { -13, 101 }, + { -13, 91 }, { -12, 94 }, { -10, 88 }, { -16, 84 }, + { -10, 86 }, { -7, 83 }, { -13, 87 }, { -19, 94 }, + { 1, 70 }, { 0, 72 }, { -5, 74 }, { 18, 59 }, + { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 }, + { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 }, + { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 }, + { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 }, + { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 }, + { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 }, + { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 }, + { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 }, + { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 }, + { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 }, + { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 }, + { 24, 0 }, { 15, 9 }, { 8, 25 }, { 13, 18 }, + { 15, 9 }, { 13, 19 }, { 10, 37 }, { 12, 18 }, + { 6, 29 }, { 20, 33 }, { 15, 30 }, { 4, 45 }, + { 1, 58 }, { 0, 62 }, { 7, 61 }, { 12, 38 }, + { 11, 45 }, { 15, 39 }, { 11, 42 }, { 13, 44 }, + { 16, 45 }, { 12, 41 }, { 10, 49 }, { 30, 34 }, + { 18, 42 }, { 10, 55 }, { 17, 51 }, { 17, 46 }, + { 0, 89 }, { 26, -19 }, { 22, -17 }, { 26, -17 }, + { 30, -25 }, { 28, -20 }, { 33, -23 }, { 37, -27 }, + { 33, -23 }, { 40, -28 }, { 38, -17 }, { 33, -11 }, + { 40, -15 }, { 41, -6 }, { 38, 1 }, { 41, 17 }, + { -17, 120 }, { -20, 112 }, { -18, 114 }, { -11, 85 }, + { -15, 92 }, { -14, 89 }, { -26, 71 }, { -15, 81 }, + { -14, 80 }, { 0, 68 }, { -14, 70 }, { -24, 56 }, + { -23, 68 }, { -24, 50 }, { -11, 74 }, { -14, 106 }, + { -13, 97 }, { -15, 90 }, { -12, 90 }, { -18, 88 }, + { -10, 73 }, { -9, 79 }, { -14, 86 }, { -10, 73 }, + { -10, 70 }, { -10, 69 }, { -5, 66 }, { -9, 64 }, + { -5, 58 }, { 2, 59 }, { 23, -13 }, { 26, -13 }, + { 40, -15 }, { 49, -14 }, { 44, 3 }, { 45, 6 }, + { 44, 34 }, { 33, 54 }, { 19, 82 }, { 21, -10 }, + { 24, -11 }, { 28, -8 }, { 28, -1 }, { 29, 3 }, + { 29, 9 }, { 35, 20 }, { 29, 36 }, { 14, 67 }, + { -3, 75 }, { -1, 23 }, { 1, 34 }, { 1, 43 }, + { 0, 54 }, { -2, 55 }, { 0, 61 }, { 1, 64 }, + { 0, 68 }, { -9, 92 }, { -17, 120 }, { -20, 112 }, + { -18, 114 }, { -11, 85 }, { -15, 92 }, { -14, 89 }, + { -26, 71 }, { -15, 81 }, { -14, 80 }, { 0, 68 }, + { -14, 70 }, { -24, 56 }, { -23, 68 }, { -24, 50 }, + { -11, 74 }, { -14, 106 }, { -13, 97 }, { -15, 90 }, + { -12, 90 }, { -18, 88 }, { -10, 73 }, { -9, 79 }, + { -14, 86 }, { -10, 73 }, { -10, 70 }, { -10, 69 }, + { -5, 66 }, { -9, 64 }, { -5, 58 }, { 2, 59 }, + { 23, -13 }, { 26, -13 }, { 40, -15 }, { 49, -14 }, + { 44, 3 }, { 45, 6 }, { 44, 34 }, { 33, 54 }, + { 19, 82 }, { 21, -10 }, { 24, -11 }, { 28, -8 }, + { 28, -1 }, { 29, 3 }, { 29, 9 }, { 35, 20 }, + { 29, 36 }, { 14, 67 }, { -3, 75 }, { -1, 23 }, + { 1, 34 }, { 1, 43 }, { 0, 54 }, { -2, 55 }, + { 0, 61 }, { 1, 64 }, { 0, 68 }, { -9, 92 }, + { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 }, + { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 }, + { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 }, + { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 }, + { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 }, + { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 }, + { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 }, + { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 }, + { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 }, + { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 }, + { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 }, + { -6, 93 }, { -6, 84 }, { -8, 79 }, { 0, 66 }, + { -1, 71 }, { 0, 62 }, { -2, 60 }, { -2, 59 }, + { -5, 75 }, { -3, 62 }, { -4, 58 }, { -9, 66 }, + { -1, 79 }, { 0, 71 }, { 3, 68 }, { 10, 44 }, + { -7, 62 }, { 15, 36 }, { 14, 40 }, { 16, 27 }, + { 12, 29 }, { 1, 44 }, { 20, 36 }, { 18, 32 }, + { 5, 42 }, { 1, 48 }, { 10, 62 }, { 17, 46 }, + { 9, 64 }, { -12, 104 }, { -11, 97 }, { -16, 96 }, + { -7, 88 }, { -8, 85 }, { -7, 85 }, { -9, 85 }, + { -13, 88 }, { 4, 66 }, { -3, 77 }, { -3, 76 }, + { -6, 76 }, { 10, 58 }, { -1, 76 }, { -1, 83 }, + { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 }, + { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 }, + { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 }, + { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 }, + { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 }, + { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 }, + { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 }, + { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 }, + { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 }, + { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 }, + { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 }, + { 15, 6 }, { 6, 19 }, { 7, 16 }, { 12, 14 }, + { 18, 13 }, { 13, 11 }, { 13, 15 }, { 15, 16 }, + { 12, 23 }, { 13, 23 }, { 15, 20 }, { 14, 26 }, + { 14, 44 }, { 17, 40 }, { 17, 47 }, { 24, 17 }, + { 21, 21 }, { 25, 22 }, { 31, 27 }, { 22, 29 }, + { 19, 35 }, { 14, 50 }, { 10, 57 }, { 7, 63 }, + { -2, 77 }, { -4, 82 }, { -3, 94 }, { 9, 69 }, + { -12, 109 }, { 36, -35 }, { 36, -34 }, { 32, -26 }, + { 37, -30 }, { 44, -32 }, { 34, -18 }, { 34, -15 }, + { 40, -15 }, { 33, -7 }, { 35, -5 }, { 33, 0 }, + { 38, 2 }, { 33, 13 }, { 23, 35 }, { 13, 58 }, + { -3, 71 }, { -6, 42 }, { -5, 50 }, { -3, 54 }, + { -2, 62 }, { 0, 58 }, { 1, 63 }, { -2, 72 }, + { -1, 74 }, { -9, 91 }, { -5, 67 }, { -5, 27 }, + { -3, 39 }, { -2, 44 }, { 0, 46 }, { -16, 64 }, + { -8, 68 }, { -10, 78 }, { -6, 77 }, { -10, 86 }, + { -12, 92 }, { -15, 55 }, { -10, 60 }, { -6, 62 }, + { -4, 65 }, { -12, 73 }, { -8, 76 }, { -7, 80 }, + { -9, 88 }, { -17, 110 }, { -3, 71 }, { -6, 42 }, + { -5, 50 }, { -3, 54 }, { -2, 62 }, { 0, 58 }, + { 1, 63 }, { -2, 72 }, { -1, 74 }, { -9, 91 }, + { -5, 67 }, { -5, 27 }, { -3, 39 }, { -2, 44 }, + { 0, 46 }, { -16, 64 }, { -8, 68 }, { -10, 78 }, + { -6, 77 }, { -10, 86 }, { -12, 92 }, { -15, 55 }, + { -10, 60 }, { -6, 62 }, { -4, 65 }, { -12, 73 }, + { -8, 76 }, { -7, 80 }, { -9, 88 }, { -17, 110 }, + { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }, + { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 }, + { -3, 70 }, { -8, 93 }, { -10, 90 }, { -30, 127 } +}; + +static const int8_t x264_cabac_context_init_PB[3][1024][2] = +{ + /* i_cabac_init_idc == 0 */ + { + /* 0 - 10 */ + { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 }, + { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 }, + { -6, 53 }, { -1, 54 }, { 7, 51 }, + + /* 11 - 23 */ + { 23, 33 }, { 23, 2 }, { 21, 0 }, { 1, 9 }, + { 0, 49 }, { -37, 118 }, { 5, 57 }, { -13, 78 }, + { -11, 65 }, { 1, 62 }, { 12, 49 }, { -4, 73 }, + { 17, 50 }, + + /* 24 - 39 */ + { 18, 64 }, { 9, 43 }, { 29, 0 }, { 26, 67 }, + { 16, 90 }, { 9, 104 }, { -46, 127 }, { -20, 104 }, + { 1, 67 }, { -13, 78 }, { -11, 65 }, { 1, 62 }, + { -6, 86 }, { -17, 95 }, { -6, 61 }, { 9, 45 }, + + /* 40 - 53 */ + { -3, 69 }, { -6, 81 }, { -11, 96 }, { 6, 55 }, + { 7, 67 }, { -5, 86 }, { 2, 88 }, { 0, 58 }, + { -3, 76 }, { -10, 94 }, { 5, 54 }, { 4, 69 }, + { -3, 81 }, { 0, 88 }, + + /* 54 - 59 */ + { -7, 67 }, { -5, 74 }, { -4, 74 }, { -5, 80 }, + { -7, 72 }, { 1, 58 }, + + /* 60 - 69 */ + { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 }, + { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 }, + { 13, 41 }, { 3, 62 }, + + /* 70 - 87 */ + { 0, 45 }, { -4, 78 }, { -3, 96 }, { -27, 126 }, + { -28, 98 }, { -25, 101 }, { -23, 67 }, { -28, 82 }, + { -20, 94 }, { -16, 83 }, { -22, 110 }, { -21, 91 }, + { -18, 102 }, { -13, 93 }, { -29, 127 }, { -7, 92 }, + { -5, 89 }, { -7, 96 }, { -13, 108 }, { -3, 46 }, + { -1, 65 }, { -1, 57 }, { -9, 93 }, { -3, 74 }, + { -9, 92 }, { -8, 87 }, { -23, 126 }, { 5, 54 }, + { 6, 60 }, { 6, 59 }, { 6, 69 }, { -1, 48 }, + { 0, 68 }, { -4, 69 }, { -8, 88 }, + + /* 105 -> 165 */ + { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 }, + { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 }, + { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 }, + { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 }, + { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 }, + { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 }, + { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 }, + { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 }, + { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 }, + { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 }, + { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 }, + { 3, 64 }, { 1, 61 }, { 9, 63 }, { 7, 50 }, + { 16, 39 }, { 5, 44 }, { 4, 52 }, { 11, 48 }, + { -5, 60 }, { -1, 59 }, { 0, 59 }, { 22, 33 }, + { 5, 44 }, { 14, 43 }, { -1, 78 }, { 0, 60 }, + { 9, 69 }, + + /* 166 - 226 */ + { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 }, + { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 }, + { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 }, + { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 }, + { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 }, + { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 }, + { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 }, + { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 }, + { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 }, + { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 }, + { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 }, + { 1, 67 }, { 5, 59 }, { 9, 67 }, { 16, 30 }, + { 18, 32 }, { 18, 35 }, { 22, 29 }, { 24, 31 }, + { 23, 38 }, { 18, 43 }, { 20, 41 }, { 11, 63 }, + { 9, 59 }, { 9, 64 }, { -1, 94 }, { -2, 89 }, + { -9, 108 }, + + /* 227 - 275 */ + { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 }, + { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 }, + { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 }, + { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 }, + { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 }, + { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 }, + { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 }, + { -3, 74 }, { -10, 90 }, { 0, 70 }, { -4, 29 }, + { 5, 31 }, { 7, 42 }, { 1, 59 }, { -2, 58 }, + { -3, 72 }, { -3, 81 }, { -11, 97 }, { 0, 58 }, + { 8, 5 }, { 10, 14 }, { 14, 18 }, { 13, 27 }, + { 2, 40 }, { 0, 58 }, { -3, 70 }, { -6, 79 }, + { -8, 85 }, + + /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */ + { 0, 0 }, + + /* 277 - 337 */ + { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 }, + { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 }, + { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 }, + { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 }, + { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 }, + { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 }, + { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 }, + { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 }, + { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 }, + { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 }, + { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 }, + { -2, 69 }, { -2, 59 }, { 6, 70 }, { 10, 44 }, + { 9, 31 }, { 12, 43 }, { 3, 53 }, { 14, 34 }, + { 10, 38 }, { -3, 52 }, { 13, 40 }, { 17, 32 }, + { 7, 44 }, { 7, 38 }, { 13, 50 }, { 10, 57 }, + { 26, 43 }, + + /* 338 - 398 */ + { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 }, + { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 }, + { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 }, + { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 }, + { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 }, + { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 }, + { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 }, + { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 }, + { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 }, + { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 }, + { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 }, + { 8, 60 }, { 6, 63 }, { 17, 65 }, { 21, 24 }, + { 23, 20 }, { 26, 23 }, { 27, 32 }, { 28, 23 }, + { 28, 24 }, { 23, 40 }, { 24, 32 }, { 28, 29 }, + { 23, 42 }, { 19, 57 }, { 22, 53 }, { 22, 61 }, + { 11, 86 }, + + /* 399 -> 435 */ + { 12, 40 }, { 11, 51 }, { 14, 59 }, + { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 }, + { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 }, + { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 }, + { -16, 66 }, { -22, 65 }, { -20, 63 }, { 9, -2 }, + { 26, -9 }, { 33, -9 }, { 39, -7 }, { 41, -2 }, + { 45, 3 }, { 49, 9 }, { 45, 27 }, { 36, 59 }, + { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 }, + { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 }, + { -8, 66 }, { -8, 76 }, + + /* 436 -> 459 */ + { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 }, + { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 }, + { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 }, + { -14, 66 }, { 0, 59 }, { 2, 59 }, { 21, -13 }, + { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 }, + { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 }, + + /* 460 - 1024 */ + { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 }, + { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 }, + { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }, + { -7, 92 }, { -5, 89 }, { -7, 96 }, { -13, 108 }, + { -3, 46 }, { -1, 65 }, { -1, 57 }, { -9, 93 }, + { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }, + { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 }, + { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 }, + { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 }, + { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 }, + { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 }, + { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 }, + { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 }, + { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 }, + { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 }, + { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 }, + { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 }, + { -2, 85 }, { -6, 78 }, { -1, 75 }, { -7, 77 }, + { 2, 54 }, { 5, 50 }, { -3, 68 }, { 1, 50 }, + { 6, 42 }, { -4, 81 }, { 1, 63 }, { -4, 70 }, + { 0, 67 }, { 2, 57 }, { -2, 76 }, { 11, 35 }, + { 4, 64 }, { 1, 61 }, { 11, 35 }, { 18, 25 }, + { 12, 24 }, { 13, 29 }, { 13, 36 }, { -10, 93 }, + { -7, 73 }, { -2, 73 }, { 13, 46 }, { 9, 49 }, + { -7, 100 }, { 9, 53 }, { 2, 53 }, { 5, 53 }, + { -2, 61 }, { 0, 56 }, { 0, 56 }, { -13, 63 }, + { -5, 60 }, { -1, 62 }, { 4, 57 }, { -6, 69 }, + { 4, 57 }, { 14, 39 }, { 4, 51 }, { 13, 68 }, + { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 }, + { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 }, + { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 }, + { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 }, + { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 }, + { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 }, + { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 }, + { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 }, + { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 }, + { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 }, + { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 }, + { 11, 28 }, { 2, 40 }, { 3, 44 }, { 0, 49 }, + { 0, 46 }, { 2, 44 }, { 2, 51 }, { 0, 47 }, + { 4, 39 }, { 2, 62 }, { 6, 46 }, { 0, 54 }, + { 3, 54 }, { 2, 58 }, { 4, 63 }, { 6, 51 }, + { 6, 57 }, { 7, 53 }, { 6, 52 }, { 6, 55 }, + { 11, 45 }, { 14, 36 }, { 8, 53 }, { -1, 82 }, + { 7, 55 }, { -3, 78 }, { 15, 46 }, { 22, 31 }, + { -1, 84 }, { 25, 7 }, { 30, -7 }, { 28, 3 }, + { 28, 4 }, { 32, 0 }, { 34, -1 }, { 30, 6 }, + { 30, 6 }, { 32, 9 }, { 31, 19 }, { 26, 27 }, + { 26, 30 }, { 37, 20 }, { 28, 34 }, { 17, 70 }, + { -4, 79 }, { -7, 71 }, { -5, 69 }, { -9, 70 }, + { -8, 66 }, { -10, 68 }, { -19, 73 }, { -12, 69 }, + { -16, 70 }, { -15, 67 }, { -20, 62 }, { -19, 70 }, + { -16, 66 }, { -22, 65 }, { -20, 63 }, { -5, 85 }, + { -6, 81 }, { -10, 77 }, { -7, 81 }, { -17, 80 }, + { -18, 73 }, { -4, 74 }, { -10, 83 }, { -9, 71 }, + { -9, 67 }, { -1, 61 }, { -8, 66 }, { -14, 66 }, + { 0, 59 }, { 2, 59 }, { 9, -2 }, { 26, -9 }, + { 33, -9 }, { 39, -7 }, { 41, -2 }, { 45, 3 }, + { 49, 9 }, { 45, 27 }, { 36, 59 }, { 21, -13 }, + { 33, -14 }, { 39, -7 }, { 46, -2 }, { 51, 2 }, + { 60, 6 }, { 61, 17 }, { 55, 34 }, { 42, 62 }, + { -6, 66 }, { -7, 35 }, { -7, 42 }, { -8, 45 }, + { -5, 48 }, { -12, 56 }, { -6, 60 }, { -5, 62 }, + { -8, 66 }, { -8, 76 }, { -4, 79 }, { -7, 71 }, + { -5, 69 }, { -9, 70 }, { -8, 66 }, { -10, 68 }, + { -19, 73 }, { -12, 69 }, { -16, 70 }, { -15, 67 }, + { -20, 62 }, { -19, 70 }, { -16, 66 }, { -22, 65 }, + { -20, 63 }, { -5, 85 }, { -6, 81 }, { -10, 77 }, + { -7, 81 }, { -17, 80 }, { -18, 73 }, { -4, 74 }, + { -10, 83 }, { -9, 71 }, { -9, 67 }, { -1, 61 }, + { -8, 66 }, { -14, 66 }, { 0, 59 }, { 2, 59 }, + { 9, -2 }, { 26, -9 }, { 33, -9 }, { 39, -7 }, + { 41, -2 }, { 45, 3 }, { 49, 9 }, { 45, 27 }, + { 36, 59 }, { 21, -13 }, { 33, -14 }, { 39, -7 }, + { 46, -2 }, { 51, 2 }, { 60, 6 }, { 61, 17 }, + { 55, 34 }, { 42, 62 }, { -6, 66 }, { -7, 35 }, + { -7, 42 }, { -8, 45 }, { -5, 48 }, { -12, 56 }, + { -6, 60 }, { -5, 62 }, { -8, 66 }, { -8, 76 }, + { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 }, + { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 }, + { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 }, + { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 }, + { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 }, + { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 }, + { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 }, + { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 }, + { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 }, + { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 }, + { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 }, + { -13, 106 }, { -16, 106 }, { -10, 87 }, { -21, 114 }, + { -18, 110 }, { -14, 98 }, { -22, 110 }, { -21, 106 }, + { -18, 103 }, { -21, 107 }, { -23, 108 }, { -26, 112 }, + { -10, 96 }, { -12, 95 }, { -5, 91 }, { -9, 93 }, + { -22, 94 }, { -5, 86 }, { 9, 67 }, { -4, 80 }, + { -10, 85 }, { -1, 70 }, { 7, 60 }, { 9, 58 }, + { 5, 61 }, { 12, 50 }, { 15, 50 }, { 18, 49 }, + { 17, 54 }, { 10, 41 }, { 7, 46 }, { -1, 51 }, + { 7, 49 }, { 8, 52 }, { 9, 41 }, { 6, 47 }, + { 2, 55 }, { 13, 41 }, { 10, 44 }, { 6, 50 }, + { 5, 53 }, { 13, 49 }, { 4, 63 }, { 6, 64 }, + { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 }, + { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 }, + { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 }, + { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 }, + { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 }, + { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 }, + { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 }, + { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 }, + { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 }, + { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 }, + { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 }, + { 14, 11 }, { 11, 14 }, { 9, 11 }, { 18, 11 }, + { 21, 9 }, { 23, -2 }, { 32, -15 }, { 32, -15 }, + { 34, -21 }, { 39, -23 }, { 42, -33 }, { 41, -31 }, + { 46, -28 }, { 38, -12 }, { 21, 29 }, { 45, -24 }, + { 53, -45 }, { 48, -26 }, { 65, -43 }, { 43, -19 }, + { 39, -10 }, { 30, 9 }, { 18, 26 }, { 20, 27 }, + { 0, 57 }, { -14, 82 }, { -5, 75 }, { -19, 97 }, + { -35, 125 }, { 27, 0 }, { 28, 0 }, { 31, -4 }, + { 27, 6 }, { 34, 8 }, { 30, 10 }, { 24, 22 }, + { 33, 19 }, { 22, 32 }, { 26, 31 }, { 21, 41 }, + { 26, 44 }, { 23, 47 }, { 16, 65 }, { 14, 71 }, + { -6, 76 }, { -2, 44 }, { 0, 45 }, { 0, 52 }, + { -3, 64 }, { -2, 59 }, { -4, 70 }, { -4, 75 }, + { -8, 82 }, { -17, 102 }, { -9, 77 }, { 3, 24 }, + { 0, 42 }, { 0, 48 }, { 0, 55 }, { -6, 59 }, + { -7, 71 }, { -12, 83 }, { -11, 87 }, { -30, 119 }, + { 1, 58 }, { -3, 29 }, { -1, 36 }, { 1, 38 }, + { 2, 43 }, { -6, 55 }, { 0, 58 }, { 0, 64 }, + { -3, 74 }, { -10, 90 }, { -6, 76 }, { -2, 44 }, + { 0, 45 }, { 0, 52 }, { -3, 64 }, { -2, 59 }, + { -4, 70 }, { -4, 75 }, { -8, 82 }, { -17, 102 }, + { -9, 77 }, { 3, 24 }, { 0, 42 }, { 0, 48 }, + { 0, 55 }, { -6, 59 }, { -7, 71 }, { -12, 83 }, + { -11, 87 }, { -30, 119 }, { 1, 58 }, { -3, 29 }, + { -1, 36 }, { 1, 38 }, { 2, 43 }, { -6, 55 }, + { 0, 58 }, { 0, 64 }, { -3, 74 }, { -10, 90 }, + { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }, + { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 }, + { -3, 74 }, { -9, 92 }, { -8, 87 }, { -23, 126 } + }, + + /* i_cabac_init_idc == 1 */ + { + /* 0 - 10 */ + { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 }, + { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 }, + { -6, 53 }, { -1, 54 }, { 7, 51 }, + + /* 11 - 23 */ + { 22, 25 }, { 34, 0 }, { 16, 0 }, { -2, 9 }, + { 4, 41 }, { -29, 118 }, { 2, 65 }, { -6, 71 }, + { -13, 79 }, { 5, 52 }, { 9, 50 }, { -3, 70 }, + { 10, 54 }, + + /* 24 - 39 */ + { 26, 34 }, { 19, 22 }, { 40, 0 }, { 57, 2 }, + { 41, 36 }, { 26, 69 }, { -45, 127 }, { -15, 101 }, + { -4, 76 }, { -6, 71 }, { -13, 79 }, { 5, 52 }, + { 6, 69 }, { -13, 90 }, { 0, 52 }, { 8, 43 }, + + /* 40 - 53 */ + { -2, 69 },{ -5, 82 },{ -10, 96 },{ 2, 59 }, + { 2, 75 },{ -3, 87 },{ -3, 100 },{ 1, 56 }, + { -3, 74 },{ -6, 85 },{ 0, 59 },{ -3, 81 }, + { -7, 86 },{ -5, 95 }, + + /* 54 - 59 */ + { -1, 66 },{ -1, 77 },{ 1, 70 },{ -2, 86 }, + { -5, 72 },{ 0, 61 }, + + /* 60 - 69 */ + { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 }, + { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 }, + { 13, 41 }, { 3, 62 }, + + /* 70 - 104 */ + { 13, 15 }, { 7, 51 }, { 2, 80 }, { -39, 127 }, + { -18, 91 }, { -17, 96 }, { -26, 81 }, { -35, 98 }, + { -24, 102 }, { -23, 97 }, { -27, 119 }, { -24, 99 }, + { -21, 110 }, { -18, 102 }, { -36, 127 }, { 0, 80 }, + { -5, 89 }, { -7, 94 }, { -4, 92 }, { 0, 39 }, + { 0, 65 }, { -15, 84 }, { -35, 127 }, { -2, 73 }, + { -12, 104 }, { -9, 91 }, { -31, 127 }, { 3, 55 }, + { 7, 56 }, { 7, 55 }, { 8, 61 }, { -3, 53 }, + { 0, 68 }, { -7, 74 }, { -9, 88 }, + + /* 105 -> 165 */ + { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 }, + { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 }, + { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 }, + { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 }, + { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 }, + { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 }, + { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 }, + { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 }, + { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 }, + { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 }, + { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 }, + { -4, 71 }, { 0, 58 }, { 7, 61 }, { 9, 41 }, + { 18, 25 }, { 9, 32 }, { 5, 43 }, { 9, 47 }, + { 0, 44 }, { 0, 51 }, { 2, 46 }, { 19, 38 }, + { -4, 66 }, { 15, 38 }, { 12, 42 }, { 9, 34 }, + { 0, 89 }, + + /* 166 - 226 */ + { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 }, + { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 }, + { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 }, + { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 }, + { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 }, + { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 }, + { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 }, + { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 }, + { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 }, + { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 }, + { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 }, + { 0, 75 }, { 2, 72 }, { 8, 77 }, { 14, 35 }, + { 18, 31 }, { 17, 35 }, { 21, 30 }, { 17, 45 }, + { 20, 42 }, { 18, 45 }, { 27, 26 }, { 16, 54 }, + { 7, 66 }, { 16, 56 }, { 11, 73 }, { 10, 67 }, + { -10, 116 }, + + /* 227 - 275 */ + { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 }, + { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 }, + { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 }, + { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 }, + { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 }, + { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 }, + { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 }, + { -5, 74 }, { -9, 86 }, { 2, 66 }, { -9, 34 }, + { 1, 32 }, { 11, 31 }, { 5, 52 }, { -2, 55 }, + { -2, 67 }, { 0, 73 }, { -8, 89 }, { 3, 52 }, + { 7, 4 }, { 10, 8 }, { 17, 8 }, { 16, 19 }, + { 3, 37 }, { -1, 61 }, { -5, 73 }, { -1, 70 }, + { -4, 78 }, + + /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */ + { 0, 0 }, + + /* 277 - 337 */ + { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 }, + { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 }, + { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 }, + { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 }, + { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 }, + { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 }, + { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 }, + { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 }, + { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 }, + { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 }, + { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 }, + { -1, 70 }, { -9, 72 }, { 14, 60 }, { 16, 37 }, + { 0, 47 }, { 18, 35 }, { 11, 37 }, { 12, 41 }, + { 10, 41 }, { 2, 48 }, { 12, 41 }, { 13, 41 }, + { 0, 59 }, { 3, 50 }, { 19, 40 }, { 3, 66 }, + { 18, 50 }, + + /* 338 - 398 */ + { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 }, + { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 }, + { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 }, + { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 }, + { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 }, + { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 }, + { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 }, + { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 }, + { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 }, + { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 }, + { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 }, + { 12, 48 }, { 11, 49 }, { 26, 45 }, { 22, 22 }, + { 23, 22 }, { 27, 21 }, { 33, 20 }, { 26, 28 }, + { 30, 24 }, { 27, 34 }, { 18, 42 }, { 25, 39 }, + { 18, 50 }, { 12, 70 }, { 21, 54 }, { 14, 71 }, + { 11, 83 }, + + /* 399 -> 435 */ + { 25, 32 }, { 21, 49 }, { 21, 54 }, + { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 }, + { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 }, + { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 }, + { -14, 66 }, { 0, 59 }, { 2, 59 }, { 17, -10 }, + { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 }, + { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 }, + { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 }, + { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 }, + { -4, 67 }, { -7, 82 }, + + /* 436 -> 459 */ + { -3, 81 }, { -3, 76 }, { -7, 72 }, { -6, 78 }, + { -12, 72 }, { -14, 68 }, { -3, 70 }, { -6, 76 }, + { -5, 66 }, { -5, 62 }, { 0, 57 }, { -4, 61 }, + { -9, 60 }, { 1, 54 }, { 2, 58 }, { 17, -10 }, + { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 }, + { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 }, + + /* 460 - 1024 */ + { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 }, + { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 }, + { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }, + { 0, 80 }, { -5, 89 }, { -7, 94 }, { -4, 92 }, + { 0, 39 }, { 0, 65 }, { -15, 84 }, { -35, 127 }, + { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }, + { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 }, + { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 }, + { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 }, + { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 }, + { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 }, + { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 }, + { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 }, + { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 }, + { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 }, + { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 }, + { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 }, + { -13, 103 }, { -13, 91 }, { -9, 89 }, { -14, 92 }, + { -8, 76 }, { -12, 87 }, { -23, 110 }, { -24, 105 }, + { -10, 78 }, { -20, 112 }, { -17, 99 }, { -78, 127 }, + { -70, 127 }, { -50, 127 }, { -46, 127 }, { -4, 66 }, + { -5, 78 }, { -4, 71 }, { -8, 72 }, { 2, 59 }, + { -1, 55 }, { -7, 70 }, { -6, 75 }, { -8, 89 }, + { -34, 119 }, { -3, 75 }, { 32, 20 }, { 30, 22 }, + { -44, 127 }, { 0, 54 }, { -5, 61 }, { 0, 58 }, + { -1, 60 }, { -3, 61 }, { -8, 67 }, { -25, 84 }, + { -14, 74 }, { -5, 65 }, { 5, 52 }, { 2, 57 }, + { 0, 61 }, { -9, 69 }, { -11, 70 }, { 18, 55 }, + { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 }, + { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 }, + { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 }, + { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 }, + { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 }, + { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 }, + { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 }, + { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 }, + { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 }, + { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 }, + { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 }, + { 4, 45 }, { 10, 28 }, { 10, 31 }, { 33, -11 }, + { 52, -43 }, { 18, 15 }, { 28, 0 }, { 35, -22 }, + { 38, -25 }, { 34, 0 }, { 39, -18 }, { 32, -12 }, + { 102, -94 }, { 0, 0 }, { 56, -15 }, { 33, -4 }, + { 29, 10 }, { 37, -5 }, { 51, -29 }, { 39, -9 }, + { 52, -34 }, { 69, -58 }, { 67, -63 }, { 44, -5 }, + { 32, 7 }, { 55, -29 }, { 32, 1 }, { 0, 0 }, + { 27, 36 }, { 33, -25 }, { 34, -30 }, { 36, -28 }, + { 38, -28 }, { 38, -27 }, { 34, -18 }, { 35, -16 }, + { 34, -14 }, { 32, -8 }, { 37, -6 }, { 35, 0 }, + { 30, 10 }, { 28, 18 }, { 26, 25 }, { 29, 41 }, + { -5, 85 }, { -6, 81 }, { -10, 77 }, { -7, 81 }, + { -17, 80 }, { -18, 73 }, { -4, 74 }, { -10, 83 }, + { -9, 71 }, { -9, 67 }, { -1, 61 }, { -8, 66 }, + { -14, 66 }, { 0, 59 }, { 2, 59 }, { -3, 81 }, + { -3, 76 }, { -7, 72 }, { -6, 78 }, { -12, 72 }, + { -14, 68 }, { -3, 70 }, { -6, 76 }, { -5, 66 }, + { -5, 62 }, { 0, 57 }, { -4, 61 }, { -9, 60 }, + { 1, 54 }, { 2, 58 }, { 17, -10 }, { 32, -13 }, + { 42, -9 }, { 49, -5 }, { 53, 0 }, { 64, 3 }, + { 68, 10 }, { 66, 27 }, { 47, 57 }, { 17, -10 }, + { 32, -13 }, { 42, -9 }, { 49, -5 }, { 53, 0 }, + { 64, 3 }, { 68, 10 }, { 66, 27 }, { 47, 57 }, + { -5, 71 }, { 0, 24 }, { -1, 36 }, { -2, 42 }, + { -2, 52 }, { -9, 57 }, { -6, 63 }, { -4, 65 }, + { -4, 67 }, { -7, 82 }, { -5, 85 }, { -6, 81 }, + { -10, 77 }, { -7, 81 }, { -17, 80 }, { -18, 73 }, + { -4, 74 }, { -10, 83 }, { -9, 71 }, { -9, 67 }, + { -1, 61 }, { -8, 66 }, { -14, 66 }, { 0, 59 }, + { 2, 59 }, { -3, 81 }, { -3, 76 }, { -7, 72 }, + { -6, 78 }, { -12, 72 }, { -14, 68 }, { -3, 70 }, + { -6, 76 }, { -5, 66 }, { -5, 62 }, { 0, 57 }, + { -4, 61 }, { -9, 60 }, { 1, 54 }, { 2, 58 }, + { 17, -10 }, { 32, -13 }, { 42, -9 }, { 49, -5 }, + { 53, 0 }, { 64, 3 }, { 68, 10 }, { 66, 27 }, + { 47, 57 }, { 17, -10 }, { 32, -13 }, { 42, -9 }, + { 49, -5 }, { 53, 0 }, { 64, 3 }, { 68, 10 }, + { 66, 27 }, { 47, 57 }, { -5, 71 }, { 0, 24 }, + { -1, 36 }, { -2, 42 }, { -2, 52 }, { -9, 57 }, + { -6, 63 }, { -4, 65 }, { -4, 67 }, { -7, 82 }, + { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 }, + { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 }, + { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 }, + { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 }, + { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 }, + { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 }, + { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 }, + { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 }, + { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 }, + { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 }, + { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 }, + { -21, 126 }, { -23, 124 }, { -20, 110 }, { -26, 126 }, + { -25, 124 }, { -17, 105 }, { -27, 121 }, { -27, 117 }, + { -17, 102 }, { -26, 117 }, { -27, 116 }, { -33, 122 }, + { -10, 95 }, { -14, 100 }, { -8, 95 }, { -17, 111 }, + { -28, 114 }, { -6, 89 }, { -2, 80 }, { -4, 82 }, + { -9, 85 }, { -8, 81 }, { -1, 72 }, { 5, 64 }, + { 1, 67 }, { 9, 56 }, { 0, 69 }, { 1, 69 }, + { 7, 69 }, { -7, 69 }, { -6, 67 }, { -16, 77 }, + { -2, 64 }, { 2, 61 }, { -6, 67 }, { -3, 64 }, + { 2, 57 }, { -3, 65 }, { -3, 66 }, { 0, 62 }, + { 9, 51 }, { -1, 66 }, { -2, 71 }, { -2, 75 }, + { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 }, + { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 }, + { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 }, + { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 }, + { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 }, + { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 }, + { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 }, + { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 }, + { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 }, + { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 }, + { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 }, + { 19, -6 }, { 18, -6 }, { 14, 0 }, { 26, -12 }, + { 31, -16 }, { 33, -25 }, { 33, -22 }, { 37, -28 }, + { 39, -30 }, { 42, -30 }, { 47, -42 }, { 45, -36 }, + { 49, -34 }, { 41, -17 }, { 32, 9 }, { 69, -71 }, + { 63, -63 }, { 66, -64 }, { 77, -74 }, { 54, -39 }, + { 52, -35 }, { 41, -10 }, { 36, 0 }, { 40, -1 }, + { 30, 14 }, { 28, 26 }, { 23, 37 }, { 12, 55 }, + { 11, 65 }, { 37, -33 }, { 39, -36 }, { 40, -37 }, + { 38, -30 }, { 46, -33 }, { 42, -30 }, { 40, -24 }, + { 49, -29 }, { 38, -12 }, { 40, -10 }, { 38, -3 }, + { 46, -5 }, { 31, 20 }, { 29, 30 }, { 25, 44 }, + { -23, 112 }, { -15, 71 }, { -7, 61 }, { 0, 53 }, + { -5, 66 }, { -11, 77 }, { -9, 80 }, { -9, 84 }, + { -10, 87 }, { -34, 127 }, { -21, 101 }, { -3, 39 }, + { -5, 53 }, { -7, 61 }, { -11, 75 }, { -15, 77 }, + { -17, 91 }, { -25, 107 }, { -25, 111 }, { -28, 122 }, + { -11, 76 }, { -10, 44 }, { -10, 52 }, { -10, 57 }, + { -9, 58 }, { -16, 72 }, { -7, 69 }, { -4, 69 }, + { -5, 74 }, { -9, 86 }, { -23, 112 }, { -15, 71 }, + { -7, 61 }, { 0, 53 }, { -5, 66 }, { -11, 77 }, + { -9, 80 }, { -9, 84 }, { -10, 87 }, { -34, 127 }, + { -21, 101 }, { -3, 39 }, { -5, 53 }, { -7, 61 }, + { -11, 75 }, { -15, 77 }, { -17, 91 }, { -25, 107 }, + { -25, 111 }, { -28, 122 }, { -11, 76 }, { -10, 44 }, + { -10, 52 }, { -10, 57 }, { -9, 58 }, { -16, 72 }, + { -7, 69 }, { -4, 69 }, { -5, 74 }, { -9, 86 }, + { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }, + { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 }, + { -2, 73 }, { -12, 104 }, { -9, 91 }, { -31, 127 } + }, + + /* i_cabac_init_idc == 2 */ + { + /* 0 - 10 */ + { 20, -15 }, { 2, 54 }, { 3, 74 }, { 20, -15 }, + { 2, 54 }, { 3, 74 }, { -28, 127 }, { -23, 104 }, + { -6, 53 }, { -1, 54 }, { 7, 51 }, + + /* 11 - 23 */ + { 29, 16 }, { 25, 0 }, { 14, 0 }, { -10, 51 }, + { -3, 62 }, { -27, 99 }, { 26, 16 }, { -4, 85 }, + { -24, 102 }, { 5, 57 }, { 6, 57 }, { -17, 73 }, + { 14, 57 }, + + /* 24 - 39 */ + { 20, 40 }, { 20, 10 }, { 29, 0 }, { 54, 0 }, + { 37, 42 }, { 12, 97 }, { -32, 127 }, { -22, 117 }, + { -2, 74 }, { -4, 85 }, { -24, 102 }, { 5, 57 }, + { -6, 93 }, { -14, 88 }, { -6, 44 }, { 4, 55 }, + + /* 40 - 53 */ + { -11, 89 },{ -15, 103 },{ -21, 116 },{ 19, 57 }, + { 20, 58 },{ 4, 84 },{ 6, 96 },{ 1, 63 }, + { -5, 85 },{ -13, 106 },{ 5, 63 },{ 6, 75 }, + { -3, 90 },{ -1, 101 }, + + /* 54 - 59 */ + { 3, 55 },{ -4, 79 },{ -2, 75 },{ -12, 97 }, + { -7, 50 },{ 1, 60 }, + + /* 60 - 69 */ + { 0, 41 }, { 0, 63 }, { 0, 63 }, { 0, 63 }, + { -9, 83 }, { 4, 86 }, { 0, 97 }, { -7, 72 }, + { 13, 41 }, { 3, 62 }, + + /* 70 - 104 */ + { 7, 34 }, { -9, 88 }, { -20, 127 }, { -36, 127 }, + { -17, 91 }, { -14, 95 }, { -25, 84 }, { -25, 86 }, + { -12, 89 }, { -17, 91 }, { -31, 127 }, { -14, 76 }, + { -18, 103 }, { -13, 90 }, { -37, 127 }, { 11, 80 }, + { 5, 76 }, { 2, 84 }, { 5, 78 }, { -6, 55 }, + { 4, 61 }, { -14, 83 }, { -37, 127 }, { -5, 79 }, + { -11, 104 }, { -11, 91 }, { -30, 127 }, { 0, 65 }, + { -2, 79 }, { 0, 72 }, { -4, 92 }, { -6, 56 }, + { 3, 68 }, { -8, 71 }, { -13, 98 }, + + /* 105 -> 165 */ + { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 }, + { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 }, + { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 }, + { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 }, + { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 }, + { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 }, + { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 }, + { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 }, + { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 }, + { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 }, + { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 }, + { 3, 65 }, { -7, 69 }, { 8, 77 }, { -10, 66 }, + { 3, 62 }, { -3, 68 }, { -20, 81 }, { 0, 30 }, + { 1, 7 }, { -3, 23 }, { -21, 74 }, { 16, 66 }, + { -23, 124 }, { 17, 37 }, { 44, -18 }, { 50, -34 }, + { -22, 127 }, + + /* 166 - 226 */ + { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 }, + { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 }, + { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 }, + { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 }, + { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 }, + { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 }, + { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 }, + { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 }, + { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 }, + { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 }, + { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 }, + { 20, 34 }, { 19, 31 }, { 27, 44 }, { 19, 16 }, + { 15, 36 }, { 15, 36 }, { 21, 28 }, { 25, 21 }, + { 30, 20 }, { 31, 12 }, { 27, 16 }, { 24, 42 }, + { 0, 93 }, { 14, 56 }, { 15, 57 }, { 26, 38 }, + { -24, 127 }, + + /* 227 - 275 */ + { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 }, + { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 }, + { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 }, + { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 }, + { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 }, + { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 }, + { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 }, + { -12, 92 }, { -18, 108 }, { -4, 79 }, { -22, 69 }, + { -16, 75 }, { -2, 58 }, { 1, 58 }, { -13, 78 }, + { -9, 83 }, { -4, 81 }, { -13, 99 }, { -13, 81 }, + { -6, 38 }, { -13, 62 }, { -6, 58 }, { -2, 59 }, + { -16, 73 }, { -10, 76 }, { -13, 86 }, { -9, 83 }, + { -10, 87 }, + + /* 276 a bit special (not used, x264_cabac_encode_bypass is used instead) */ + { 0, 0 }, + + /* 277 - 337 */ + { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 }, + { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 }, + { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 }, + { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 }, + { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 }, + { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 }, + { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 }, + { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 }, + { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 }, + { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 }, + { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 }, + { -2, 76 }, { -18, 86 }, { 12, 70 }, { 5, 64 }, + { -12, 70 }, { 11, 55 }, { 5, 56 }, { 0, 69 }, + { 2, 65 }, { -6, 74 }, { 5, 54 }, { 7, 54 }, + { -6, 76 }, { -11, 82 }, { -2, 77 }, { -2, 77 }, + { 25, 42 }, + + /* 338 - 398 */ + { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 }, + { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 }, + { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 }, + { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 }, + { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 }, + { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 }, + { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 }, + { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 }, + { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 }, + { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 }, + { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 }, + { 18, 31 }, { 19, 26 }, { 36, 24 }, { 24, 23 }, + { 27, 16 }, { 24, 30 }, { 31, 29 }, { 22, 41 }, + { 22, 42 }, { 16, 60 }, { 15, 52 }, { 14, 60 }, + { 3, 78 }, { -16, 123 }, { 21, 53 }, { 22, 56 }, + { 25, 61 }, + + /* 399 -> 435 */ + { 21, 33 }, { 19, 50 }, { 17, 61 }, + { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 }, + { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 }, + { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 }, + { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 }, + { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 }, + { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 }, + { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 }, + { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 }, + { -6, 68 }, { -10, 79 }, + + /* 436 -> 459 */ + { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 }, + { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 }, + { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 }, + { -14, 59 }, { -9, 52 }, { -11, 68 }, { 9, -2 }, + { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 }, + { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 }, + + /* 460 - 1024 */ + { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 }, + { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 }, + { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }, + { 11, 80 }, { 5, 76 }, { 2, 84 }, { 5, 78 }, + { -6, 55 }, { 4, 61 }, { -14, 83 }, { -37, 127 }, + { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }, + { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 }, + { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 }, + { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 }, + { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 }, + { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 }, + { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 }, + { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 }, + { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 }, + { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 }, + { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 }, + { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 }, + { -4, 86 }, { -12, 88 }, { -5, 82 }, { -3, 72 }, + { -4, 67 }, { -8, 72 }, { -16, 89 }, { -9, 69 }, + { -1, 59 }, { 5, 66 }, { 4, 57 }, { -4, 71 }, + { -2, 71 }, { 2, 58 }, { -1, 74 }, { -4, 44 }, + { -1, 69 }, { 0, 62 }, { -7, 51 }, { -4, 47 }, + { -6, 42 }, { -3, 41 }, { -6, 53 }, { 8, 76 }, + { -9, 78 }, { -11, 83 }, { 9, 52 }, { 0, 67 }, + { -5, 90 }, { 1, 67 }, { -15, 72 }, { -5, 75 }, + { -8, 80 }, { -21, 83 }, { -21, 64 }, { -13, 31 }, + { -25, 64 }, { -29, 94 }, { 9, 75 }, { 17, 63 }, + { -8, 74 }, { -5, 35 }, { -2, 27 }, { 13, 91 }, + { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 }, + { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 }, + { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 }, + { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 }, + { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 }, + { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 }, + { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 }, + { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 }, + { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 }, + { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 }, + { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 }, + { 4, 39 }, { 0, 42 }, { 7, 34 }, { 11, 29 }, + { 8, 31 }, { 6, 37 }, { 7, 42 }, { 3, 40 }, + { 8, 33 }, { 13, 43 }, { 13, 36 }, { 4, 47 }, + { 3, 55 }, { 2, 58 }, { 6, 60 }, { 8, 44 }, + { 11, 44 }, { 14, 42 }, { 7, 48 }, { 4, 56 }, + { 4, 52 }, { 13, 37 }, { 9, 49 }, { 19, 58 }, + { 10, 48 }, { 12, 45 }, { 0, 69 }, { 20, 33 }, + { 8, 63 }, { 35, -18 }, { 33, -25 }, { 28, -3 }, + { 24, 10 }, { 27, 0 }, { 34, -14 }, { 52, -44 }, + { 39, -24 }, { 19, 17 }, { 31, 25 }, { 36, 29 }, + { 24, 33 }, { 34, 15 }, { 30, 20 }, { 22, 73 }, + { -3, 78 }, { -8, 74 }, { -9, 72 }, { -10, 72 }, + { -18, 75 }, { -12, 71 }, { -11, 63 }, { -5, 70 }, + { -17, 75 }, { -14, 72 }, { -16, 67 }, { -8, 53 }, + { -14, 59 }, { -9, 52 }, { -11, 68 }, { -3, 78 }, + { -8, 74 }, { -9, 72 }, { -10, 72 }, { -18, 75 }, + { -12, 71 }, { -11, 63 }, { -5, 70 }, { -17, 75 }, + { -14, 72 }, { -16, 67 }, { -8, 53 }, { -14, 59 }, + { -9, 52 }, { -11, 68 }, { 9, -2 }, { 30, -10 }, + { 31, -4 }, { 33, -1 }, { 33, 7 }, { 31, 12 }, + { 37, 23 }, { 31, 38 }, { 20, 64 }, { 9, -2 }, + { 30, -10 }, { 31, -4 }, { 33, -1 }, { 33, 7 }, + { 31, 12 }, { 37, 23 }, { 31, 38 }, { 20, 64 }, + { -9, 71 }, { -7, 37 }, { -8, 44 }, { -11, 49 }, + { -10, 56 }, { -12, 59 }, { -8, 63 }, { -9, 67 }, + { -6, 68 }, { -10, 79 }, { -3, 78 }, { -8, 74 }, + { -9, 72 }, { -10, 72 }, { -18, 75 }, { -12, 71 }, + { -11, 63 }, { -5, 70 }, { -17, 75 }, { -14, 72 }, + { -16, 67 }, { -8, 53 }, { -14, 59 }, { -9, 52 }, + { -11, 68 }, { -3, 78 }, { -8, 74 }, { -9, 72 }, + { -10, 72 }, { -18, 75 }, { -12, 71 }, { -11, 63 }, + { -5, 70 }, { -17, 75 }, { -14, 72 }, { -16, 67 }, + { -8, 53 }, { -14, 59 }, { -9, 52 }, { -11, 68 }, + { 9, -2 }, { 30, -10 }, { 31, -4 }, { 33, -1 }, + { 33, 7 }, { 31, 12 }, { 37, 23 }, { 31, 38 }, + { 20, 64 }, { 9, -2 }, { 30, -10 }, { 31, -4 }, + { 33, -1 }, { 33, 7 }, { 31, 12 }, { 37, 23 }, + { 31, 38 }, { 20, 64 }, { -9, 71 }, { -7, 37 }, + { -8, 44 }, { -11, 49 }, { -10, 56 }, { -12, 59 }, + { -8, 63 }, { -9, 67 }, { -6, 68 }, { -10, 79 }, + { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 }, + { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 }, + { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 }, + { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 }, + { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 }, + { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 }, + { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 }, + { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 }, + { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 }, + { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 }, + { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 }, + { -22, 127 }, { -25, 127 }, { -25, 120 }, { -27, 127 }, + { -19, 114 }, { -23, 117 }, { -25, 118 }, { -26, 117 }, + { -24, 113 }, { -28, 118 }, { -31, 120 }, { -37, 124 }, + { -10, 94 }, { -15, 102 }, { -10, 99 }, { -13, 106 }, + { -50, 127 }, { -5, 92 }, { 17, 57 }, { -5, 86 }, + { -13, 94 }, { -12, 91 }, { -2, 77 }, { 0, 71 }, + { -1, 73 }, { 4, 64 }, { -7, 81 }, { 5, 64 }, + { 15, 57 }, { 1, 67 }, { 0, 68 }, { -10, 67 }, + { 1, 68 }, { 0, 77 }, { 2, 64 }, { 0, 68 }, + { -5, 78 }, { 7, 55 }, { 5, 59 }, { 2, 65 }, + { 14, 54 }, { 15, 44 }, { 5, 60 }, { 2, 70 }, + { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 }, + { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 }, + { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 }, + { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 }, + { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 }, + { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 }, + { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 }, + { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 }, + { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 }, + { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 }, + { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 }, + { 17, -13 }, { 16, -9 }, { 17, -12 }, { 27, -21 }, + { 37, -30 }, { 41, -40 }, { 42, -41 }, { 48, -47 }, + { 39, -32 }, { 46, -40 }, { 52, -51 }, { 46, -41 }, + { 52, -39 }, { 43, -19 }, { 32, 11 }, { 61, -55 }, + { 56, -46 }, { 62, -50 }, { 81, -67 }, { 45, -20 }, + { 35, -2 }, { 28, 15 }, { 34, 1 }, { 39, 1 }, + { 30, 17 }, { 20, 38 }, { 18, 45 }, { 15, 54 }, + { 0, 79 }, { 36, -16 }, { 37, -14 }, { 37, -17 }, + { 32, 1 }, { 34, 15 }, { 29, 15 }, { 24, 25 }, + { 34, 22 }, { 31, 16 }, { 35, 18 }, { 31, 28 }, + { 33, 41 }, { 36, 28 }, { 27, 47 }, { 21, 62 }, + { -24, 115 }, { -22, 82 }, { -9, 62 }, { 0, 53 }, + { 0, 59 }, { -14, 85 }, { -13, 89 }, { -13, 94 }, + { -11, 92 }, { -29, 127 }, { -21, 100 }, { -14, 57 }, + { -12, 67 }, { -11, 71 }, { -10, 77 }, { -21, 85 }, + { -16, 88 }, { -23, 104 }, { -15, 98 }, { -37, 127 }, + { -10, 82 }, { -8, 48 }, { -8, 61 }, { -8, 66 }, + { -7, 70 }, { -14, 75 }, { -10, 79 }, { -9, 83 }, + { -12, 92 }, { -18, 108 }, { -24, 115 }, { -22, 82 }, + { -9, 62 }, { 0, 53 }, { 0, 59 }, { -14, 85 }, + { -13, 89 }, { -13, 94 }, { -11, 92 }, { -29, 127 }, + { -21, 100 }, { -14, 57 }, { -12, 67 }, { -11, 71 }, + { -10, 77 }, { -21, 85 }, { -16, 88 }, { -23, 104 }, + { -15, 98 }, { -37, 127 }, { -10, 82 }, { -8, 48 }, + { -8, 61 }, { -8, 66 }, { -7, 70 }, { -14, 75 }, + { -10, 79 }, { -9, 83 }, { -12, 92 }, { -18, 108 }, + { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }, + { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 }, + { -5, 79 }, { -11, 104 }, { -11, 91 }, { -30, 127 } + } +}; + +const uint8_t x264_cabac_range_lps[64][4] = +{ + { 2, 2, 2, 2}, { 6, 7, 8, 9}, { 6, 7, 9, 10}, { 6, 8, 9, 11}, + { 7, 8, 10, 11}, { 7, 9, 10, 12}, { 7, 9, 11, 12}, { 8, 9, 11, 13}, + { 8, 10, 12, 14}, { 9, 11, 12, 14}, { 9, 11, 13, 15}, { 10, 12, 14, 16}, + { 10, 12, 15, 17}, { 11, 13, 15, 18}, { 11, 14, 16, 19}, { 12, 14, 17, 20}, + { 12, 15, 18, 21}, { 13, 16, 19, 22}, { 14, 17, 20, 23}, { 14, 18, 21, 24}, + { 15, 19, 22, 25}, { 16, 20, 23, 27}, { 17, 21, 25, 28}, { 18, 22, 26, 30}, + { 19, 23, 27, 31}, { 20, 24, 29, 33}, { 21, 26, 30, 35}, { 22, 27, 32, 37}, + { 23, 28, 33, 39}, { 24, 30, 35, 41}, { 26, 31, 37, 43}, { 27, 33, 39, 45}, + { 29, 35, 41, 48}, { 30, 37, 43, 50}, { 32, 39, 46, 53}, { 33, 41, 48, 56}, + { 35, 43, 51, 59}, { 37, 45, 54, 62}, { 39, 48, 56, 65}, { 41, 50, 59, 69}, + { 43, 53, 63, 72}, { 46, 56, 66, 76}, { 48, 59, 69, 80}, { 51, 62, 73, 85}, + { 53, 65, 77, 89}, { 56, 69, 81, 94}, { 59, 72, 86, 99}, { 62, 76, 90, 104}, + { 66, 80, 95, 110}, { 69, 85, 100, 116}, { 73, 89, 105, 122}, { 77, 94, 111, 128}, + { 81, 99, 117, 135}, { 85, 104, 123, 142}, { 90, 110, 130, 150}, { 95, 116, 137, 158}, + {100, 122, 144, 166}, {105, 128, 152, 175}, {111, 135, 160, 185}, {116, 142, 169, 195}, + {123, 150, 178, 205}, {128, 158, 187, 216}, {128, 167, 197, 227}, {128, 176, 208, 240} +}; + +const uint8_t x264_cabac_transition[128][2] = +{ + { 0, 0}, { 1, 1}, { 2, 50}, { 51, 3}, { 2, 50}, { 51, 3}, { 4, 52}, { 53, 5}, + { 6, 52}, { 53, 7}, { 8, 52}, { 53, 9}, { 10, 54}, { 55, 11}, { 12, 54}, { 55, 13}, + { 14, 54}, { 55, 15}, { 16, 56}, { 57, 17}, { 18, 56}, { 57, 19}, { 20, 56}, { 57, 21}, + { 22, 58}, { 59, 23}, { 24, 58}, { 59, 25}, { 26, 60}, { 61, 27}, { 28, 60}, { 61, 29}, + { 30, 60}, { 61, 31}, { 32, 62}, { 63, 33}, { 34, 62}, { 63, 35}, { 36, 64}, { 65, 37}, + { 38, 66}, { 67, 39}, { 40, 66}, { 67, 41}, { 42, 66}, { 67, 43}, { 44, 68}, { 69, 45}, + { 46, 68}, { 69, 47}, { 48, 70}, { 71, 49}, { 50, 72}, { 73, 51}, { 52, 72}, { 73, 53}, + { 54, 74}, { 75, 55}, { 56, 74}, { 75, 57}, { 58, 76}, { 77, 59}, { 60, 78}, { 79, 61}, + { 62, 78}, { 79, 63}, { 64, 80}, { 81, 65}, { 66, 82}, { 83, 67}, { 68, 82}, { 83, 69}, + { 70, 84}, { 85, 71}, { 72, 84}, { 85, 73}, { 74, 88}, { 89, 75}, { 76, 88}, { 89, 77}, + { 78, 90}, { 91, 79}, { 80, 90}, { 91, 81}, { 82, 94}, { 95, 83}, { 84, 94}, { 95, 85}, + { 86, 96}, { 97, 87}, { 88, 96}, { 97, 89}, { 90, 100}, {101, 91}, { 92, 100}, {101, 93}, + { 94, 102}, {103, 95}, { 96, 104}, {105, 97}, { 98, 104}, {105, 99}, {100, 108}, {109, 101}, + {102, 108}, {109, 103}, {104, 110}, {111, 105}, {106, 112}, {113, 107}, {108, 114}, {115, 109}, + {110, 116}, {117, 111}, {112, 118}, {119, 113}, {114, 118}, {119, 115}, {116, 122}, {123, 117}, + {118, 122}, {123, 119}, {120, 124}, {125, 121}, {122, 126}, {127, 123}, {124, 127}, {126, 125} +}; + +const uint8_t x264_cabac_renorm_shift[64] = +{ + 6,5,4,4,3,3,3,3,2,2,2,2,2,2,2,2, + 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, +}; + +/* -ln2(probability) */ +const uint16_t x264_cabac_entropy[128] = +{ + FIX8(0.0273), FIX8(5.7370), FIX8(0.0288), FIX8(5.6618), + FIX8(0.0303), FIX8(5.5866), FIX8(0.0320), FIX8(5.5114), + FIX8(0.0337), FIX8(5.4362), FIX8(0.0355), FIX8(5.3610), + FIX8(0.0375), FIX8(5.2859), FIX8(0.0395), FIX8(5.2106), + FIX8(0.0416), FIX8(5.1354), FIX8(0.0439), FIX8(5.0602), + FIX8(0.0463), FIX8(4.9851), FIX8(0.0488), FIX8(4.9099), + FIX8(0.0515), FIX8(4.8347), FIX8(0.0543), FIX8(4.7595), + FIX8(0.0572), FIX8(4.6843), FIX8(0.0604), FIX8(4.6091), + FIX8(0.0637), FIX8(4.5339), FIX8(0.0671), FIX8(4.4588), + FIX8(0.0708), FIX8(4.3836), FIX8(0.0747), FIX8(4.3083), + FIX8(0.0788), FIX8(4.2332), FIX8(0.0832), FIX8(4.1580), + FIX8(0.0878), FIX8(4.0828), FIX8(0.0926), FIX8(4.0076), + FIX8(0.0977), FIX8(3.9324), FIX8(0.1032), FIX8(3.8572), + FIX8(0.1089), FIX8(3.7820), FIX8(0.1149), FIX8(3.7068), + FIX8(0.1214), FIX8(3.6316), FIX8(0.1282), FIX8(3.5565), + FIX8(0.1353), FIX8(3.4813), FIX8(0.1429), FIX8(3.4061), + FIX8(0.1510), FIX8(3.3309), FIX8(0.1596), FIX8(3.2557), + FIX8(0.1686), FIX8(3.1805), FIX8(0.1782), FIX8(3.1053), + FIX8(0.1884), FIX8(3.0301), FIX8(0.1992), FIX8(2.9549), + FIX8(0.2107), FIX8(2.8797), FIX8(0.2229), FIX8(2.8046), + FIX8(0.2358), FIX8(2.7294), FIX8(0.2496), FIX8(2.6542), + FIX8(0.2642), FIX8(2.5790), FIX8(0.2798), FIX8(2.5038), + FIX8(0.2964), FIX8(2.4286), FIX8(0.3142), FIX8(2.3534), + FIX8(0.3331), FIX8(2.2782), FIX8(0.3532), FIX8(2.2030), + FIX8(0.3748), FIX8(2.1278), FIX8(0.3979), FIX8(2.0527), + FIX8(0.4226), FIX8(1.9775), FIX8(0.4491), FIX8(1.9023), + FIX8(0.4776), FIX8(1.8271), FIX8(0.5082), FIX8(1.7519), + FIX8(0.5412), FIX8(1.6767), FIX8(0.5768), FIX8(1.6015), + FIX8(0.6152), FIX8(1.5263), FIX8(0.6568), FIX8(1.4511), + FIX8(0.7020), FIX8(1.3759), FIX8(0.7513), FIX8(1.3008), + FIX8(0.8050), FIX8(1.2256), FIX8(0.8638), FIX8(1.1504), + FIX8(0.9285), FIX8(1.0752), FIX8(1.0000), FIX8(1.0000) +}; + +uint8_t x264_cabac_contexts[4][QP_MAX_SPEC+1][1024]; + +void x264_cabac_init( x264_t *h ) +{ + int ctx_count = CHROMA444 ? 1024 : 460; + for( int i = 0; i < 4; i++ ) + { + const int8_t (*cabac_context_init)[1024][2] = i == 0 ? &x264_cabac_context_init_I + : &x264_cabac_context_init_PB[i-1]; + for( int qp = 0; qp <= QP_MAX_SPEC; qp++ ) + for( int j = 0; j < ctx_count; j++ ) + { + int state = x264_clip3( (((*cabac_context_init)[j][0] * qp) >> 4) + (*cabac_context_init)[j][1], 1, 126 ); + x264_cabac_contexts[i][qp][j] = (X264_MIN( state, 127-state ) << 1) | (state >> 6); + } + } +} + +/***************************************************************************** + * + *****************************************************************************/ +void x264_cabac_context_init( x264_t *h, x264_cabac_t *cb, int i_slice_type, int i_qp, int i_model ) +{ + memcpy( cb->state, x264_cabac_contexts[i_slice_type == SLICE_TYPE_I ? 0 : i_model + 1][i_qp], CHROMA444 ? 1024 : 460 ); +} + +void x264_cabac_encode_init_core( x264_cabac_t *cb ) +{ + cb->i_low = 0; + cb->i_range = 0x01FE; + cb->i_queue = -9; // the first bit will be shifted away and not written + cb->i_bytes_outstanding = 0; +} + +void x264_cabac_encode_init( x264_cabac_t *cb, uint8_t *p_data, uint8_t *p_end ) +{ + x264_cabac_encode_init_core( cb ); + cb->p_start = p_data; + cb->p = p_data; + cb->p_end = p_end; +} + +static inline void x264_cabac_putbyte( x264_cabac_t *cb ) +{ + if( cb->i_queue >= 0 ) + { + int out = cb->i_low >> (cb->i_queue+10); + cb->i_low &= (0x400<i_queue)-1; + cb->i_queue -= 8; + + if( (out & 0xff) == 0xff ) + cb->i_bytes_outstanding++; + else + { + int carry = out >> 8; + int bytes_outstanding = cb->i_bytes_outstanding; + // this can't modify before the beginning of the stream because + // that would correspond to a probability > 1. + // it will write before the beginning of the stream, which is ok + // because a slice header always comes before cabac data. + // this can't carry beyond the one byte, because any 0xff bytes + // are in bytes_outstanding and thus not written yet. + cb->p[-1] += carry; + while( bytes_outstanding > 0 ) + { + *(cb->p++) = carry-1; + bytes_outstanding--; + } + *(cb->p++) = out; + cb->i_bytes_outstanding = 0; + } + } +} + +static inline void x264_cabac_encode_renorm( x264_cabac_t *cb ) +{ + int shift = x264_cabac_renorm_shift[cb->i_range>>3]; + cb->i_range <<= shift; + cb->i_low <<= shift; + cb->i_queue += shift; + x264_cabac_putbyte( cb ); +} + +/* Making custom versions of this function, even in asm, for the cases where + * b is known to be 0 or 1, proved to be somewhat useful on x86_32 with GCC 3.4 + * but nearly useless with GCC 4.3 and worse than useless on x86_64. */ +void x264_cabac_encode_decision_c( x264_cabac_t *cb, int i_ctx, int b ) +{ + int i_state = cb->state[i_ctx]; + int i_range_lps = x264_cabac_range_lps[i_state>>1][(cb->i_range>>6)-4]; + cb->i_range -= i_range_lps; + if( b != (i_state & 1) ) + { + cb->i_low += cb->i_range; + cb->i_range = i_range_lps; + } + cb->state[i_ctx] = x264_cabac_transition[i_state][b]; + x264_cabac_encode_renorm( cb ); +} + +/* Note: b is negated for this function */ +void x264_cabac_encode_bypass_c( x264_cabac_t *cb, int b ) +{ + cb->i_low <<= 1; + cb->i_low += b & cb->i_range; + cb->i_queue += 1; + x264_cabac_putbyte( cb ); +} + +static const int bypass_lut[16] = +{ + -1, 0x2, 0x14, 0x68, 0x1d0, 0x7a0, 0x1f40, 0x7e80, + 0x1fd00, 0x7fa00, 0x1ff400, 0x7fe800, 0x1ffd000, 0x7ffa000, 0x1fff4000, 0x7ffe8000 +}; + +void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val ) +{ + uint32_t v = val + (1<i_low <<= i; + cb->i_low += ((x>>k)&0xff) * cb->i_range; + cb->i_queue += i; + x264_cabac_putbyte( cb ); + i = 8; + } while( k > 0 ); +} + +void x264_cabac_encode_terminal_c( x264_cabac_t *cb ) +{ + cb->i_range -= 2; + x264_cabac_encode_renorm( cb ); +} + +void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb ) +{ + cb->i_low += cb->i_range - 2; + cb->i_low |= 1; + cb->i_low <<= 9; + cb->i_queue += 9; + x264_cabac_putbyte( cb ); + x264_cabac_putbyte( cb ); + cb->i_low <<= -cb->i_queue; + cb->i_low |= (0x35a4e4f5 >> (h->i_frame & 31) & 1) << 10; + cb->i_queue = 0; + x264_cabac_putbyte( cb ); + + while( cb->i_bytes_outstanding > 0 ) + { + *(cb->p++) = 0xff; + cb->i_bytes_outstanding--; + } +} + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.h new file mode 100644 index 00000000..13788342 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cabac.h @@ -0,0 +1,118 @@ +/***************************************************************************** + * cabac.h: arithmetic coder + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_CABAC_H +#define X264_CABAC_H + +typedef struct +{ + /* state */ + int i_low; + int i_range; + + /* bit stream */ + int i_queue; //stored with an offset of -8 for faster asm + int i_bytes_outstanding; + + uint8_t *p_start; + uint8_t *p; + uint8_t *p_end; + + /* aligned for memcpy_aligned starting here */ + ALIGNED_64( int f8_bits_encoded ); // only if using x264_cabac_size_decision() + + /* context */ + uint8_t state[1024]; + + /* for 16-byte alignment */ + uint8_t padding[12]; +} x264_cabac_t; + +extern const uint8_t x264_cabac_transition[128][2]; +extern const uint16_t x264_cabac_entropy[128]; + +/* init the contexts given i_slice_type, the quantif and the model */ +void x264_cabac_context_init( x264_t *h, x264_cabac_t *cb, int i_slice_type, int i_qp, int i_model ); + +void x264_cabac_encode_init_core( x264_cabac_t *cb ); +void x264_cabac_encode_init( x264_cabac_t *cb, uint8_t *p_data, uint8_t *p_end ); +void x264_cabac_encode_decision_c( x264_cabac_t *cb, int i_ctx, int b ); +void x264_cabac_encode_decision_asm( x264_cabac_t *cb, int i_ctx, int b ); +void x264_cabac_encode_bypass_c( x264_cabac_t *cb, int b ); +void x264_cabac_encode_bypass_asm( x264_cabac_t *cb, int b ); +void x264_cabac_encode_terminal_c( x264_cabac_t *cb ); +void x264_cabac_encode_terminal_asm( x264_cabac_t *cb ); +void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val ); +void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb ); + +#if HAVE_MMX +#define x264_cabac_encode_decision x264_cabac_encode_decision_asm +#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm +#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm +#elif defined(ARCH_AARCH64) +#define x264_cabac_encode_decision x264_cabac_encode_decision_asm +#define x264_cabac_encode_bypass x264_cabac_encode_bypass_asm +#define x264_cabac_encode_terminal x264_cabac_encode_terminal_asm +#else +#define x264_cabac_encode_decision x264_cabac_encode_decision_c +#define x264_cabac_encode_bypass x264_cabac_encode_bypass_c +#define x264_cabac_encode_terminal x264_cabac_encode_terminal_c +#endif +#define x264_cabac_encode_decision_noup x264_cabac_encode_decision + +static ALWAYS_INLINE int x264_cabac_pos( x264_cabac_t *cb ) +{ + return (cb->p - cb->p_start + cb->i_bytes_outstanding) * 8 + cb->i_queue; +} + +/* internal only. these don't write the bitstream, just calculate bit cost: */ + +static ALWAYS_INLINE void x264_cabac_size_decision( x264_cabac_t *cb, long i_ctx, long b ) +{ + int i_state = cb->state[i_ctx]; + cb->state[i_ctx] = x264_cabac_transition[i_state][b]; + cb->f8_bits_encoded += x264_cabac_entropy[i_state^b]; +} + +static ALWAYS_INLINE int x264_cabac_size_decision2( uint8_t *state, long b ) +{ + int i_state = *state; + *state = x264_cabac_transition[i_state][b]; + return x264_cabac_entropy[i_state^b]; +} + +static ALWAYS_INLINE void x264_cabac_size_decision_noup( x264_cabac_t *cb, long i_ctx, long b ) +{ + int i_state = cb->state[i_ctx]; + cb->f8_bits_encoded += x264_cabac_entropy[i_state^b]; +} + +static ALWAYS_INLINE int x264_cabac_size_decision_noup2( uint8_t *state, long b ) +{ + return x264_cabac_entropy[*state^b]; +} + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.c new file mode 100644 index 00000000..561212d3 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.c @@ -0,0 +1,1446 @@ +/***************************************************************************** + * common.c: misc common functions + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#include + +#if HAVE_MALLOC_H +#include +#endif +#if HAVE_THP +#include +#endif + +const int x264_bit_depth = BIT_DEPTH; + +const int x264_chroma_format = X264_CHROMA_FORMAT; + +static void x264_log_default( void *, int, const char *, va_list ); + +/**************************************************************************** + * x264_param_default: + ****************************************************************************/ +void x264_param_default( x264_param_t *param ) +{ + /* */ + memset( param, 0, sizeof( x264_param_t ) ); + + /* CPU autodetect */ + param->cpu = x264_cpu_detect(); + param->i_threads = X264_THREADS_AUTO; + param->i_lookahead_threads = X264_THREADS_AUTO; + param->b_deterministic = 1; + param->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO; + + /* Video properties */ + param->i_csp = X264_CHROMA_FORMAT ? X264_CHROMA_FORMAT : X264_CSP_I420; + param->i_width = 0; + param->i_height = 0; + param->vui.i_sar_width = 0; + param->vui.i_sar_height= 0; + param->vui.i_overscan = 0; /* undef */ + param->vui.i_vidformat = 5; /* undef */ + param->vui.b_fullrange = -1; /* default depends on input */ + param->vui.i_colorprim = 2; /* undef */ + param->vui.i_transfer = 2; /* undef */ + param->vui.i_colmatrix = -1; /* default depends on input */ + param->vui.i_chroma_loc= 0; /* left center */ + param->i_fps_num = 25; + param->i_fps_den = 1; + param->i_level_idc = -1; + param->i_slice_max_size = 0; + param->i_slice_max_mbs = 0; + param->i_slice_count = 0; + + /* Encoder parameters */ + param->i_frame_reference = 3; + param->i_keyint_max = 250; + param->i_keyint_min = X264_KEYINT_MIN_AUTO; + param->i_bframe = 3; + param->i_scenecut_threshold = 40; + param->i_bframe_adaptive = X264_B_ADAPT_FAST; + param->i_bframe_bias = 0; + param->i_bframe_pyramid = X264_B_PYRAMID_NORMAL; + param->b_interlaced = 0; + param->b_constrained_intra = 0; + + param->b_deblocking_filter = 1; + param->i_deblocking_filter_alphac0 = 0; + param->i_deblocking_filter_beta = 0; + + param->b_cabac = 1; + param->i_cabac_init_idc = 0; + + param->rc.i_rc_method = X264_RC_CRF; + param->rc.i_bitrate = 0; + param->rc.f_rate_tolerance = 1.0; + param->rc.i_vbv_max_bitrate = 0; + param->rc.i_vbv_buffer_size = 0; + param->rc.f_vbv_buffer_init = 0.9; + param->rc.i_qp_constant = 23 + QP_BD_OFFSET; + param->rc.f_rf_constant = 23; + param->rc.i_qp_min = 0; + param->rc.i_qp_max = QP_MAX; + param->rc.i_qp_step = 4; + param->rc.f_ip_factor = 1.4; + param->rc.f_pb_factor = 1.3; + param->rc.i_aq_mode = X264_AQ_VARIANCE; + param->rc.f_aq_strength = 1.0; + param->rc.i_lookahead = 40; + + param->rc.b_stat_write = 0; + param->rc.psz_stat_out = "x264_2pass.log"; + param->rc.b_stat_read = 0; + param->rc.psz_stat_in = "x264_2pass.log"; + param->rc.f_qcompress = 0.6; + param->rc.f_qblur = 0.5; + param->rc.f_complexity_blur = 20; + param->rc.i_zones = 0; + param->rc.b_mb_tree = 1; + + /* Log */ + param->pf_log = x264_log_default; + param->p_log_private = NULL; + param->i_log_level = X264_LOG_INFO; + + /* */ + param->analyse.intra = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8; + param->analyse.inter = X264_ANALYSE_I4x4 | X264_ANALYSE_I8x8 + | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_BSUB16x16; + param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL; + param->analyse.i_me_method = X264_ME_HEX; + param->analyse.f_psy_rd = 1.0; + param->analyse.b_psy = 1; + param->analyse.f_psy_trellis = 0; + param->analyse.i_me_range = 16; + param->analyse.i_subpel_refine = 7; + param->analyse.b_mixed_references = 1; + param->analyse.b_chroma_me = 1; + param->analyse.i_mv_range_thread = -1; + param->analyse.i_mv_range = -1; // set from level_idc + param->analyse.i_chroma_qp_offset = 0; + param->analyse.b_fast_pskip = 1; + param->analyse.b_weighted_bipred = 1; + param->analyse.i_weighted_pred = X264_WEIGHTP_SMART; + param->analyse.b_dct_decimate = 1; + param->analyse.b_transform_8x8 = 1; + param->analyse.i_trellis = 1; + param->analyse.i_luma_deadzone[0] = 21; + param->analyse.i_luma_deadzone[1] = 11; + param->analyse.b_psnr = 0; + param->analyse.b_ssim = 0; + + param->i_cqm_preset = X264_CQM_FLAT; + memset( param->cqm_4iy, 16, sizeof( param->cqm_4iy ) ); + memset( param->cqm_4py, 16, sizeof( param->cqm_4py ) ); + memset( param->cqm_4ic, 16, sizeof( param->cqm_4ic ) ); + memset( param->cqm_4pc, 16, sizeof( param->cqm_4pc ) ); + memset( param->cqm_8iy, 16, sizeof( param->cqm_8iy ) ); + memset( param->cqm_8py, 16, sizeof( param->cqm_8py ) ); + memset( param->cqm_8ic, 16, sizeof( param->cqm_8ic ) ); + memset( param->cqm_8pc, 16, sizeof( param->cqm_8pc ) ); + + param->b_repeat_headers = 1; + param->b_annexb = 1; + param->b_aud = 0; + param->b_vfr_input = 1; + param->i_nal_hrd = X264_NAL_HRD_NONE; + param->b_tff = 1; + param->b_pic_struct = 0; + param->b_fake_interlaced = 0; + param->i_frame_packing = -1; + param->b_opencl = 0; + param->i_opencl_device = 0; + param->opencl_device_id = NULL; + param->psz_clbin_file = NULL; +} + +static int x264_param_apply_preset( x264_param_t *param, const char *preset ) +{ + char *end; + int i = strtol( preset, &end, 10 ); + if( *end == 0 && i >= 0 && i < sizeof(x264_preset_names)/sizeof(*x264_preset_names)-1 ) + preset = x264_preset_names[i]; + + if( !strcasecmp( preset, "ultrafast" ) ) + { + param->i_frame_reference = 1; + param->i_scenecut_threshold = 0; + param->b_deblocking_filter = 0; + param->b_cabac = 0; + param->i_bframe = 0; + param->analyse.intra = 0; + param->analyse.inter = 0; + param->analyse.b_transform_8x8 = 0; + param->analyse.i_me_method = X264_ME_DIA; + param->analyse.i_subpel_refine = 0; + param->rc.i_aq_mode = 0; + param->analyse.b_mixed_references = 0; + param->analyse.i_trellis = 0; + param->i_bframe_adaptive = X264_B_ADAPT_NONE; + param->rc.b_mb_tree = 0; + param->analyse.i_weighted_pred = X264_WEIGHTP_NONE; + param->analyse.b_weighted_bipred = 0; + param->rc.i_lookahead = 0; + } + else if( !strcasecmp( preset, "superfast" ) ) + { + param->analyse.inter = X264_ANALYSE_I8x8|X264_ANALYSE_I4x4; + param->analyse.i_me_method = X264_ME_DIA; + param->analyse.i_subpel_refine = 1; + param->i_frame_reference = 1; + param->analyse.b_mixed_references = 0; + param->analyse.i_trellis = 0; + param->rc.b_mb_tree = 0; + param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE; + param->rc.i_lookahead = 0; + } + else if( !strcasecmp( preset, "veryfast" ) ) + { + param->analyse.i_subpel_refine = 2; + param->i_frame_reference = 1; + param->analyse.b_mixed_references = 0; + param->analyse.i_trellis = 0; + param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE; + param->rc.i_lookahead = 10; + } + else if( !strcasecmp( preset, "faster" ) ) + { + param->analyse.b_mixed_references = 0; + param->i_frame_reference = 2; + param->analyse.i_subpel_refine = 4; + param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE; + param->rc.i_lookahead = 20; + } + else if( !strcasecmp( preset, "fast" ) ) + { + param->i_frame_reference = 2; + param->analyse.i_subpel_refine = 6; + param->analyse.i_weighted_pred = X264_WEIGHTP_SIMPLE; + param->rc.i_lookahead = 30; + } + else if( !strcasecmp( preset, "medium" ) ) + { + /* Default is medium */ + } + else if( !strcasecmp( preset, "slow" ) ) + { + param->analyse.i_subpel_refine = 8; + param->i_frame_reference = 5; + param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO; + param->analyse.i_trellis = 2; + param->rc.i_lookahead = 50; + } + else if( !strcasecmp( preset, "slower" ) ) + { + param->analyse.i_me_method = X264_ME_UMH; + param->analyse.i_subpel_refine = 9; + param->i_frame_reference = 8; + param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS; + param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO; + param->analyse.inter |= X264_ANALYSE_PSUB8x8; + param->analyse.i_trellis = 2; + param->rc.i_lookahead = 60; + } + else if( !strcasecmp( preset, "veryslow" ) ) + { + param->analyse.i_me_method = X264_ME_UMH; + param->analyse.i_subpel_refine = 10; + param->analyse.i_me_range = 24; + param->i_frame_reference = 16; + param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS; + param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO; + param->analyse.inter |= X264_ANALYSE_PSUB8x8; + param->analyse.i_trellis = 2; + param->i_bframe = 8; + param->rc.i_lookahead = 60; + } + else if( !strcasecmp( preset, "placebo" ) ) + { + param->analyse.i_me_method = X264_ME_TESA; + param->analyse.i_subpel_refine = 11; + param->analyse.i_me_range = 24; + param->i_frame_reference = 16; + param->i_bframe_adaptive = X264_B_ADAPT_TRELLIS; + param->analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO; + param->analyse.inter |= X264_ANALYSE_PSUB8x8; + param->analyse.b_fast_pskip = 0; + param->analyse.i_trellis = 2; + param->i_bframe = 16; + param->rc.i_lookahead = 60; + } + else + { + x264_log( NULL, X264_LOG_ERROR, "invalid preset '%s'\n", preset ); + return -1; + } + return 0; +} + +static int x264_param_apply_tune( x264_param_t *param, const char *tune ) +{ + char *tmp = x264_malloc( strlen( tune ) + 1 ); + if( !tmp ) + return -1; + tmp = strcpy( tmp, tune ); + char *s = strtok( tmp, ",./-+" ); + int psy_tuning_used = 0; + while( s ) + { + if( !strncasecmp( s, "film", 4 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->i_deblocking_filter_alphac0 = -1; + param->i_deblocking_filter_beta = -1; + param->analyse.f_psy_trellis = 0.15; + } + else if( !strncasecmp( s, "animation", 9 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1; + param->i_deblocking_filter_alphac0 = 1; + param->i_deblocking_filter_beta = 1; + param->analyse.f_psy_rd = 0.4; + param->rc.f_aq_strength = 0.6; + param->i_bframe += 2; + } + else if( !strncasecmp( s, "grain", 5 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->i_deblocking_filter_alphac0 = -2; + param->i_deblocking_filter_beta = -2; + param->analyse.f_psy_trellis = 0.25; + param->analyse.b_dct_decimate = 0; + param->rc.f_pb_factor = 1.1; + param->rc.f_ip_factor = 1.1; + param->rc.f_aq_strength = 0.5; + param->analyse.i_luma_deadzone[0] = 6; + param->analyse.i_luma_deadzone[1] = 6; + param->rc.f_qcompress = 0.8; + } + else if( !strncasecmp( s, "stillimage", 10 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->i_deblocking_filter_alphac0 = -3; + param->i_deblocking_filter_beta = -3; + param->analyse.f_psy_rd = 2.0; + param->analyse.f_psy_trellis = 0.7; + param->rc.f_aq_strength = 1.2; + } + else if( !strncasecmp( s, "psnr", 4 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->rc.i_aq_mode = X264_AQ_NONE; + param->analyse.b_psy = 0; + } + else if( !strncasecmp( s, "ssim", 4 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->rc.i_aq_mode = X264_AQ_AUTOVARIANCE; + param->analyse.b_psy = 0; + } + else if( !strncasecmp( s, "fastdecode", 10 ) ) + { + param->b_deblocking_filter = 0; + param->b_cabac = 0; + param->analyse.b_weighted_bipred = 0; + param->analyse.i_weighted_pred = X264_WEIGHTP_NONE; + } + else if( !strncasecmp( s, "zerolatency", 11 ) ) + { + param->rc.i_lookahead = 0; + param->i_sync_lookahead = 0; + param->i_bframe = 0; + param->b_sliced_threads = 1; + param->b_vfr_input = 0; + param->rc.b_mb_tree = 0; + } + else if( !strncasecmp( s, "touhou", 6 ) ) + { + if( psy_tuning_used++ ) goto psy_failure; + param->i_frame_reference = param->i_frame_reference > 1 ? param->i_frame_reference*2 : 1; + param->i_deblocking_filter_alphac0 = -1; + param->i_deblocking_filter_beta = -1; + param->analyse.f_psy_trellis = 0.2; + param->rc.f_aq_strength = 1.3; + if( param->analyse.inter & X264_ANALYSE_PSUB16x16 ) + param->analyse.inter |= X264_ANALYSE_PSUB8x8; + } + else + { + x264_log( NULL, X264_LOG_ERROR, "invalid tune '%s'\n", s ); + x264_free( tmp ); + return -1; + } + if( 0 ) + { + psy_failure: + x264_log( NULL, X264_LOG_WARNING, "only 1 psy tuning can be used: ignoring tune %s\n", s ); + } + s = strtok( NULL, ",./-+" ); + } + x264_free( tmp ); + return 0; +} + +int x264_param_default_preset( x264_param_t *param, const char *preset, const char *tune ) +{ + x264_param_default( param ); + + if( preset && x264_param_apply_preset( param, preset ) < 0 ) + return -1; + if( tune && x264_param_apply_tune( param, tune ) < 0 ) + return -1; + return 0; +} + +void x264_param_apply_fastfirstpass( x264_param_t *param ) +{ + /* Set faster options in case of turbo firstpass. */ + if( param->rc.b_stat_write && !param->rc.b_stat_read ) + { + param->i_frame_reference = 1; + param->analyse.b_transform_8x8 = 0; + param->analyse.inter = 0; + param->analyse.i_me_method = X264_ME_DIA; + param->analyse.i_subpel_refine = X264_MIN( 2, param->analyse.i_subpel_refine ); + param->analyse.i_trellis = 0; + param->analyse.b_fast_pskip = 1; + } +} + +static int profile_string_to_int( const char *str ) +{ + if( !strcasecmp( str, "baseline" ) ) + return PROFILE_BASELINE; + if( !strcasecmp( str, "main" ) ) + return PROFILE_MAIN; + if( !strcasecmp( str, "high" ) ) + return PROFILE_HIGH; + if( !strcasecmp( str, "high10" ) ) + return PROFILE_HIGH10; + if( !strcasecmp( str, "high422" ) ) + return PROFILE_HIGH422; + if( !strcasecmp( str, "high444" ) ) + return PROFILE_HIGH444_PREDICTIVE; + return -1; +} + +int x264_param_apply_profile( x264_param_t *param, const char *profile ) +{ + if( !profile ) + return 0; + + int p = profile_string_to_int( profile ); + if( p < 0 ) + { + x264_log( NULL, X264_LOG_ERROR, "invalid profile: %s\n", profile ); + return -1; + } + if( p < PROFILE_HIGH444_PREDICTIVE && ((param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant <= 0) || + (param->rc.i_rc_method == X264_RC_CRF && (int)(param->rc.f_rf_constant + QP_BD_OFFSET) <= 0)) ) + { + x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support lossless\n", profile ); + return -1; + } + if( p < PROFILE_HIGH444_PREDICTIVE && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I444 ) + { + x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support 4:4:4\n", profile ); + return -1; + } + if( p < PROFILE_HIGH422 && (param->i_csp & X264_CSP_MASK) >= X264_CSP_I422 ) + { + x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support 4:2:2\n", profile ); + return -1; + } + if( p < PROFILE_HIGH10 && BIT_DEPTH > 8 ) + { + x264_log( NULL, X264_LOG_ERROR, "%s profile doesn't support a bit depth of %d\n", profile, BIT_DEPTH ); + return -1; + } + + if( p == PROFILE_BASELINE ) + { + param->analyse.b_transform_8x8 = 0; + param->b_cabac = 0; + param->i_cqm_preset = X264_CQM_FLAT; + param->psz_cqm_file = NULL; + param->i_bframe = 0; + param->analyse.i_weighted_pred = X264_WEIGHTP_NONE; + if( param->b_interlaced ) + { + x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support interlacing\n" ); + return -1; + } + if( param->b_fake_interlaced ) + { + x264_log( NULL, X264_LOG_ERROR, "baseline profile doesn't support fake interlacing\n" ); + return -1; + } + } + else if( p == PROFILE_MAIN ) + { + param->analyse.b_transform_8x8 = 0; + param->i_cqm_preset = X264_CQM_FLAT; + param->psz_cqm_file = NULL; + } + return 0; +} + +static int parse_enum( const char *arg, const char * const *names, int *dst ) +{ + for( int i = 0; names[i]; i++ ) + if( !strcasecmp( arg, names[i] ) ) + { + *dst = i; + return 0; + } + return -1; +} + +static int parse_cqm( const char *str, uint8_t *cqm, int length ) +{ + int i = 0; + do { + int coef; + if( !sscanf( str, "%d", &coef ) || coef < 1 || coef > 255 ) + return -1; + cqm[i++] = coef; + } while( i < length && (str = strchr( str, ',' )) && str++ ); + return (i == length) ? 0 : -1; +} + +static int x264_atobool( const char *str, int *b_error ) +{ + if( !strcmp(str, "1") || + !strcasecmp(str, "true") || + !strcasecmp(str, "yes") ) + return 1; + if( !strcmp(str, "0") || + !strcasecmp(str, "false") || + !strcasecmp(str, "no") ) + return 0; + *b_error = 1; + return 0; +} + +static int x264_atoi( const char *str, int *b_error ) +{ + char *end; + int v = strtol( str, &end, 0 ); + if( end == str || *end != '\0' ) + *b_error = 1; + return v; +} + +static double x264_atof( const char *str, int *b_error ) +{ + char *end; + double v = strtod( str, &end ); + if( end == str || *end != '\0' ) + *b_error = 1; + return v; +} + +#define atobool(str) ( name_was_bool = 1, x264_atobool( str, &b_error ) ) +#undef atoi +#undef atof +#define atoi(str) x264_atoi( str, &b_error ) +#define atof(str) x264_atof( str, &b_error ) + +int x264_param_parse( x264_param_t *p, const char *name, const char *value ) +{ + char *name_buf = NULL; + int b_error = 0; + int errortype = X264_PARAM_BAD_VALUE; + int name_was_bool; + int value_was_null = !value; + + if( !name ) + return X264_PARAM_BAD_NAME; + if( !value ) + value = "true"; + + if( value[0] == '=' ) + value++; + + if( strchr( name, '_' ) ) // s/_/-/g + { + char *c; + name_buf = strdup(name); + if( !name_buf ) + return X264_PARAM_BAD_NAME; + while( (c = strchr( name_buf, '_' )) ) + *c = '-'; + name = name_buf; + } + + if( !strncmp( name, "no", 2 ) ) + { + name += 2; + if( name[0] == '-' ) + name++; + value = atobool(value) ? "false" : "true"; + } + name_was_bool = 0; + +#define OPT(STR) else if( !strcmp( name, STR ) ) +#define OPT2(STR0, STR1) else if( !strcmp( name, STR0 ) || !strcmp( name, STR1 ) ) + if( 0 ); + OPT("asm") + { + p->cpu = isdigit(value[0]) ? atoi(value) : + !strcasecmp(value, "auto") || atobool(value) ? x264_cpu_detect() : 0; + if( b_error ) + { + char *buf = strdup( value ); + if( buf ) + { + char *tok, UNUSED *saveptr=NULL, *init; + b_error = 0; + p->cpu = 0; + for( init=buf; (tok=strtok_r(init, ",", &saveptr)); init=NULL ) + { + int i = 0; + while( x264_cpu_names[i].flags && strcasecmp(tok, x264_cpu_names[i].name) ) + i++; + p->cpu |= x264_cpu_names[i].flags; + if( !x264_cpu_names[i].flags ) + b_error = 1; + } + free( buf ); + if( (p->cpu&X264_CPU_SSSE3) && !(p->cpu&X264_CPU_SSE2_IS_SLOW) ) + p->cpu |= X264_CPU_SSE2_IS_FAST; + } + } + } + OPT("threads") + { + if( !strcasecmp(value, "auto") ) + p->i_threads = X264_THREADS_AUTO; + else + p->i_threads = atoi(value); + } + OPT("lookahead-threads") + { + if( !strcasecmp(value, "auto") ) + p->i_lookahead_threads = X264_THREADS_AUTO; + else + p->i_lookahead_threads = atoi(value); + } + OPT("sliced-threads") + p->b_sliced_threads = atobool(value); + OPT("sync-lookahead") + { + if( !strcasecmp(value, "auto") ) + p->i_sync_lookahead = X264_SYNC_LOOKAHEAD_AUTO; + else + p->i_sync_lookahead = atoi(value); + } + OPT2("deterministic", "n-deterministic") + p->b_deterministic = atobool(value); + OPT("cpu-independent") + p->b_cpu_independent = atobool(value); + OPT2("level", "level-idc") + { + if( !strcmp(value, "1b") ) + p->i_level_idc = 9; + else if( atof(value) < 7 ) + p->i_level_idc = (int)(10*atof(value)+.5); + else + p->i_level_idc = atoi(value); + } + OPT("bluray-compat") + p->b_bluray_compat = atobool(value); + OPT("avcintra-class") + p->i_avcintra_class = atoi(value); + OPT("sar") + { + b_error = ( 2 != sscanf( value, "%d:%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) && + 2 != sscanf( value, "%d/%d", &p->vui.i_sar_width, &p->vui.i_sar_height ) ); + } + OPT("overscan") + b_error |= parse_enum( value, x264_overscan_names, &p->vui.i_overscan ); + OPT("videoformat") + b_error |= parse_enum( value, x264_vidformat_names, &p->vui.i_vidformat ); + OPT("fullrange") + b_error |= parse_enum( value, x264_fullrange_names, &p->vui.b_fullrange ); + OPT("colorprim") + b_error |= parse_enum( value, x264_colorprim_names, &p->vui.i_colorprim ); + OPT("transfer") + b_error |= parse_enum( value, x264_transfer_names, &p->vui.i_transfer ); + OPT("colormatrix") + b_error |= parse_enum( value, x264_colmatrix_names, &p->vui.i_colmatrix ); + OPT("chromaloc") + { + p->vui.i_chroma_loc = atoi(value); + b_error = ( p->vui.i_chroma_loc < 0 || p->vui.i_chroma_loc > 5 ); + } + OPT("fps") + { + if( sscanf( value, "%u/%u", &p->i_fps_num, &p->i_fps_den ) != 2 ) + { + double fps = atof(value); + if( fps > 0.0 && fps <= INT_MAX/1000.0 ) + { + p->i_fps_num = (int)(fps * 1000.0 + .5); + p->i_fps_den = 1000; + } + else + { + p->i_fps_num = atoi(value); + p->i_fps_den = 1; + } + } + } + OPT2("ref", "frameref") + p->i_frame_reference = atoi(value); + OPT("dpb-size") + p->i_dpb_size = atoi(value); + OPT("keyint") + { + if( strstr( value, "infinite" ) ) + p->i_keyint_max = X264_KEYINT_MAX_INFINITE; + else + p->i_keyint_max = atoi(value); + } + OPT2("min-keyint", "keyint-min") + { + p->i_keyint_min = atoi(value); + if( p->i_keyint_max < p->i_keyint_min ) + p->i_keyint_max = p->i_keyint_min; + } + OPT("scenecut") + { + p->i_scenecut_threshold = atobool(value); + if( b_error || p->i_scenecut_threshold ) + { + b_error = 0; + p->i_scenecut_threshold = atoi(value); + } + } + OPT("intra-refresh") + p->b_intra_refresh = atobool(value); + OPT("bframes") + p->i_bframe = atoi(value); + OPT("b-adapt") + { + p->i_bframe_adaptive = atobool(value); + if( b_error ) + { + b_error = 0; + p->i_bframe_adaptive = atoi(value); + } + } + OPT("b-bias") + p->i_bframe_bias = atoi(value); + OPT("b-pyramid") + { + b_error |= parse_enum( value, x264_b_pyramid_names, &p->i_bframe_pyramid ); + if( b_error ) + { + b_error = 0; + p->i_bframe_pyramid = atoi(value); + } + } + OPT("open-gop") + p->b_open_gop = atobool(value); + OPT("nf") + p->b_deblocking_filter = !atobool(value); + OPT2("filter", "deblock") + { + if( 2 == sscanf( value, "%d:%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) || + 2 == sscanf( value, "%d,%d", &p->i_deblocking_filter_alphac0, &p->i_deblocking_filter_beta ) ) + { + p->b_deblocking_filter = 1; + } + else if( sscanf( value, "%d", &p->i_deblocking_filter_alphac0 ) ) + { + p->b_deblocking_filter = 1; + p->i_deblocking_filter_beta = p->i_deblocking_filter_alphac0; + } + else + p->b_deblocking_filter = atobool(value); + } + OPT("slice-max-size") + p->i_slice_max_size = atoi(value); + OPT("slice-max-mbs") + p->i_slice_max_mbs = atoi(value); + OPT("slice-min-mbs") + p->i_slice_min_mbs = atoi(value); + OPT("slices") + p->i_slice_count = atoi(value); + OPT("slices-max") + p->i_slice_count_max = atoi(value); + OPT("cabac") + p->b_cabac = atobool(value); + OPT("cabac-idc") + p->i_cabac_init_idc = atoi(value); + OPT("interlaced") + p->b_interlaced = atobool(value); + OPT("tff") + p->b_interlaced = p->b_tff = atobool(value); + OPT("bff") + { + p->b_interlaced = atobool(value); + p->b_tff = !p->b_interlaced; + } + OPT("constrained-intra") + p->b_constrained_intra = atobool(value); + OPT("cqm") + { + if( strstr( value, "flat" ) ) + p->i_cqm_preset = X264_CQM_FLAT; + else if( strstr( value, "jvt" ) ) + p->i_cqm_preset = X264_CQM_JVT; + else + p->psz_cqm_file = strdup(value); + } + OPT("cqmfile") + p->psz_cqm_file = strdup(value); + OPT("cqm4") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_4iy, 16 ); + b_error |= parse_cqm( value, p->cqm_4py, 16 ); + b_error |= parse_cqm( value, p->cqm_4ic, 16 ); + b_error |= parse_cqm( value, p->cqm_4pc, 16 ); + } + OPT("cqm8") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_8iy, 64 ); + b_error |= parse_cqm( value, p->cqm_8py, 64 ); + b_error |= parse_cqm( value, p->cqm_8ic, 64 ); + b_error |= parse_cqm( value, p->cqm_8pc, 64 ); + } + OPT("cqm4i") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_4iy, 16 ); + b_error |= parse_cqm( value, p->cqm_4ic, 16 ); + } + OPT("cqm4p") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_4py, 16 ); + b_error |= parse_cqm( value, p->cqm_4pc, 16 ); + } + OPT("cqm4iy") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_4iy, 16 ); + } + OPT("cqm4ic") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_4ic, 16 ); + } + OPT("cqm4py") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_4py, 16 ); + } + OPT("cqm4pc") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_4pc, 16 ); + } + OPT("cqm8i") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_8iy, 64 ); + b_error |= parse_cqm( value, p->cqm_8ic, 64 ); + } + OPT("cqm8p") + { + p->i_cqm_preset = X264_CQM_CUSTOM; + b_error |= parse_cqm( value, p->cqm_8py, 64 ); + b_error |= parse_cqm( value, p->cqm_8pc, 64 ); + } + OPT("log") + p->i_log_level = atoi(value); + OPT("dump-yuv") + p->psz_dump_yuv = strdup(value); + OPT2("analyse", "partitions") + { + p->analyse.inter = 0; + if( strstr( value, "none" ) ) p->analyse.inter = 0; + if( strstr( value, "all" ) ) p->analyse.inter = ~0; + + if( strstr( value, "i4x4" ) ) p->analyse.inter |= X264_ANALYSE_I4x4; + if( strstr( value, "i8x8" ) ) p->analyse.inter |= X264_ANALYSE_I8x8; + if( strstr( value, "p8x8" ) ) p->analyse.inter |= X264_ANALYSE_PSUB16x16; + if( strstr( value, "p4x4" ) ) p->analyse.inter |= X264_ANALYSE_PSUB8x8; + if( strstr( value, "b8x8" ) ) p->analyse.inter |= X264_ANALYSE_BSUB16x16; + } + OPT("8x8dct") + p->analyse.b_transform_8x8 = atobool(value); + OPT2("weightb", "weight-b") + p->analyse.b_weighted_bipred = atobool(value); + OPT("weightp") + p->analyse.i_weighted_pred = atoi(value); + OPT2("direct", "direct-pred") + b_error |= parse_enum( value, x264_direct_pred_names, &p->analyse.i_direct_mv_pred ); + OPT("chroma-qp-offset") + p->analyse.i_chroma_qp_offset = atoi(value); + OPT("me") + b_error |= parse_enum( value, x264_motion_est_names, &p->analyse.i_me_method ); + OPT2("merange", "me-range") + p->analyse.i_me_range = atoi(value); + OPT2("mvrange", "mv-range") + p->analyse.i_mv_range = atoi(value); + OPT2("mvrange-thread", "mv-range-thread") + p->analyse.i_mv_range_thread = atoi(value); + OPT2("subme", "subq") + p->analyse.i_subpel_refine = atoi(value); + OPT("psy-rd") + { + if( 2 == sscanf( value, "%f:%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) || + 2 == sscanf( value, "%f,%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis ) || + 2 == sscanf( value, "%f|%f", &p->analyse.f_psy_rd, &p->analyse.f_psy_trellis )) + { } + else if( sscanf( value, "%f", &p->analyse.f_psy_rd ) ) + { + p->analyse.f_psy_trellis = 0; + } + else + { + p->analyse.f_psy_rd = 0; + p->analyse.f_psy_trellis = 0; + } + } + OPT("psy") + p->analyse.b_psy = atobool(value); + OPT("chroma-me") + p->analyse.b_chroma_me = atobool(value); + OPT("mixed-refs") + p->analyse.b_mixed_references = atobool(value); + OPT("trellis") + p->analyse.i_trellis = atoi(value); + OPT("fast-pskip") + p->analyse.b_fast_pskip = atobool(value); + OPT("dct-decimate") + p->analyse.b_dct_decimate = atobool(value); + OPT("deadzone-inter") + p->analyse.i_luma_deadzone[0] = atoi(value); + OPT("deadzone-intra") + p->analyse.i_luma_deadzone[1] = atoi(value); + OPT("nr") + p->analyse.i_noise_reduction = atoi(value); + OPT("bitrate") + { + p->rc.i_bitrate = atoi(value); + p->rc.i_rc_method = X264_RC_ABR; + } + OPT2("qp", "qp_constant") + { + p->rc.i_qp_constant = atoi(value); + p->rc.i_rc_method = X264_RC_CQP; + } + OPT("crf") + { + p->rc.f_rf_constant = atof(value); + p->rc.i_rc_method = X264_RC_CRF; + } + OPT("crf-max") + p->rc.f_rf_constant_max = atof(value); + OPT("rc-lookahead") + p->rc.i_lookahead = atoi(value); + OPT2("qpmin", "qp-min") + p->rc.i_qp_min = atoi(value); + OPT2("qpmax", "qp-max") + p->rc.i_qp_max = atoi(value); + OPT2("qpstep", "qp-step") + p->rc.i_qp_step = atoi(value); + OPT("ratetol") + p->rc.f_rate_tolerance = !strncmp("inf", value, 3) ? 1e9 : atof(value); + OPT("vbv-maxrate") + p->rc.i_vbv_max_bitrate = atoi(value); + OPT("vbv-bufsize") + p->rc.i_vbv_buffer_size = atoi(value); + OPT("vbv-init") + p->rc.f_vbv_buffer_init = atof(value); + OPT2("ipratio", "ip-factor") + p->rc.f_ip_factor = atof(value); + OPT2("pbratio", "pb-factor") + p->rc.f_pb_factor = atof(value); + OPT("aq-mode") + p->rc.i_aq_mode = atoi(value); + OPT("aq-strength") + p->rc.f_aq_strength = atof(value); + OPT("pass") + { + int pass = x264_clip3( atoi(value), 0, 3 ); + p->rc.b_stat_write = pass & 1; + p->rc.b_stat_read = pass & 2; + } + OPT("stats") + { + p->rc.psz_stat_in = strdup(value); + p->rc.psz_stat_out = strdup(value); + } + OPT("qcomp") + p->rc.f_qcompress = atof(value); + OPT("mbtree") + p->rc.b_mb_tree = atobool(value); + OPT("qblur") + p->rc.f_qblur = atof(value); + OPT2("cplxblur", "cplx-blur") + p->rc.f_complexity_blur = atof(value); + OPT("zones") + p->rc.psz_zones = strdup(value); + OPT("crop-rect") + b_error |= sscanf( value, "%u,%u,%u,%u", &p->crop_rect.i_left, &p->crop_rect.i_top, + &p->crop_rect.i_right, &p->crop_rect.i_bottom ) != 4; + OPT("psnr") + p->analyse.b_psnr = atobool(value); + OPT("ssim") + p->analyse.b_ssim = atobool(value); + OPT("aud") + p->b_aud = atobool(value); + OPT("sps-id") + p->i_sps_id = atoi(value); + OPT("global-header") + p->b_repeat_headers = !atobool(value); + OPT("repeat-headers") + p->b_repeat_headers = atobool(value); + OPT("annexb") + p->b_annexb = atobool(value); + OPT("force-cfr") + p->b_vfr_input = !atobool(value); + OPT("nal-hrd") + b_error |= parse_enum( value, x264_nal_hrd_names, &p->i_nal_hrd ); + OPT("filler") + p->rc.b_filler = atobool(value); + OPT("pic-struct") + p->b_pic_struct = atobool(value); + OPT("fake-interlaced") + p->b_fake_interlaced = atobool(value); + OPT("frame-packing") + p->i_frame_packing = atoi(value); + OPT("stitchable") + p->b_stitchable = atobool(value); + OPT("opencl") + p->b_opencl = atobool( value ); + OPT("opencl-clbin") + p->psz_clbin_file = strdup( value ); + OPT("opencl-device") + p->i_opencl_device = atoi( value ); + else + { + b_error = 1; + errortype = X264_PARAM_BAD_NAME; + } +#undef OPT +#undef OPT2 +#undef atobool +#undef atoi +#undef atof + + if( name_buf ) + free( name_buf ); + + b_error |= value_was_null && !name_was_bool; + return b_error ? errortype : 0; +} + +/**************************************************************************** + * x264_log: + ****************************************************************************/ +void x264_log( x264_t *h, int i_level, const char *psz_fmt, ... ) +{ + if( !h || i_level <= h->param.i_log_level ) + { + va_list arg; + va_start( arg, psz_fmt ); + if( !h ) + x264_log_default( NULL, i_level, psz_fmt, arg ); + else + h->param.pf_log( h->param.p_log_private, i_level, psz_fmt, arg ); + va_end( arg ); + } +} + +static void x264_log_default( void *p_unused, int i_level, const char *psz_fmt, va_list arg ) +{ + char *psz_prefix; + switch( i_level ) + { + case X264_LOG_ERROR: + psz_prefix = "error"; + break; + case X264_LOG_WARNING: + psz_prefix = "warning"; + break; + case X264_LOG_INFO: + psz_prefix = "info"; + break; + case X264_LOG_DEBUG: + psz_prefix = "debug"; + break; + default: + psz_prefix = "unknown"; + break; + } + fprintf( stderr, "x264 [%s]: ", psz_prefix ); + x264_vfprintf( stderr, psz_fmt, arg ); +} + +/**************************************************************************** + * x264_picture_init: + ****************************************************************************/ +void x264_picture_init( x264_picture_t *pic ) +{ + memset( pic, 0, sizeof( x264_picture_t ) ); + pic->i_type = X264_TYPE_AUTO; + pic->i_qpplus1 = X264_QP_AUTO; + pic->i_pic_struct = PIC_STRUCT_AUTO; +} + +/**************************************************************************** + * x264_picture_alloc: + ****************************************************************************/ +int x264_picture_alloc( x264_picture_t *pic, int i_csp, int i_width, int i_height ) +{ + typedef struct + { + int planes; + int width_fix8[3]; + int height_fix8[3]; + } x264_csp_tab_t; + + static const x264_csp_tab_t x264_csp_tab[] = + { + [X264_CSP_I420] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } }, + [X264_CSP_YV12] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256/2, 256/2 } }, + [X264_CSP_NV12] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, }, + [X264_CSP_NV21] = { 2, { 256*1, 256*1 }, { 256*1, 256/2 }, }, + [X264_CSP_I422] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } }, + [X264_CSP_YV16] = { 3, { 256*1, 256/2, 256/2 }, { 256*1, 256*1, 256*1 } }, + [X264_CSP_NV16] = { 2, { 256*1, 256*1 }, { 256*1, 256*1 }, }, + [X264_CSP_YUYV] = { 1, { 256*2 }, { 256*1 }, }, + [X264_CSP_UYVY] = { 1, { 256*2 }, { 256*1 }, }, + [X264_CSP_I444] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } }, + [X264_CSP_YV24] = { 3, { 256*1, 256*1, 256*1 }, { 256*1, 256*1, 256*1 } }, + [X264_CSP_BGR] = { 1, { 256*3 }, { 256*1 }, }, + [X264_CSP_BGRA] = { 1, { 256*4 }, { 256*1 }, }, + [X264_CSP_RGB] = { 1, { 256*3 }, { 256*1 }, }, + }; + + int csp = i_csp & X264_CSP_MASK; + if( csp <= X264_CSP_NONE || csp >= X264_CSP_MAX || csp == X264_CSP_V210 ) + return -1; + x264_picture_init( pic ); + pic->img.i_csp = i_csp; + pic->img.i_plane = x264_csp_tab[csp].planes; + int depth_factor = i_csp & X264_CSP_HIGH_DEPTH ? 2 : 1; + int plane_offset[3] = {0}; + int frame_size = 0; + for( int i = 0; i < pic->img.i_plane; i++ ) + { + int stride = (((int64_t)i_width * x264_csp_tab[csp].width_fix8[i]) >> 8) * depth_factor; + int plane_size = (((int64_t)i_height * x264_csp_tab[csp].height_fix8[i]) >> 8) * stride; + pic->img.i_stride[i] = stride; + plane_offset[i] = frame_size; + frame_size += plane_size; + } + pic->img.plane[0] = x264_malloc( frame_size ); + if( !pic->img.plane[0] ) + return -1; + for( int i = 1; i < pic->img.i_plane; i++ ) + pic->img.plane[i] = pic->img.plane[0] + plane_offset[i]; + return 0; +} + +/**************************************************************************** + * x264_picture_clean: + ****************************************************************************/ +void x264_picture_clean( x264_picture_t *pic ) +{ + x264_free( pic->img.plane[0] ); + + /* just to be safe */ + memset( pic, 0, sizeof( x264_picture_t ) ); +} + +/**************************************************************************** + * x264_malloc: + ****************************************************************************/ +void *x264_malloc( int i_size ) +{ + uint8_t *align_buf = NULL; +#if HAVE_MALLOC_H +#if HAVE_THP +#define HUGE_PAGE_SIZE 2*1024*1024 +#define HUGE_PAGE_THRESHOLD HUGE_PAGE_SIZE*7/8 /* FIXME: Is this optimal? */ + /* Attempt to allocate huge pages to reduce TLB misses. */ + if( i_size >= HUGE_PAGE_THRESHOLD ) + { + align_buf = memalign( HUGE_PAGE_SIZE, i_size ); + if( align_buf ) + { + /* Round up to the next huge page boundary if we are close enough. */ + size_t madv_size = (i_size + HUGE_PAGE_SIZE - HUGE_PAGE_THRESHOLD) & ~(HUGE_PAGE_SIZE-1); + madvise( align_buf, madv_size, MADV_HUGEPAGE ); + } + } + else +#undef HUGE_PAGE_SIZE +#undef HUGE_PAGE_THRESHOLD +#endif + align_buf = memalign( NATIVE_ALIGN, i_size ); +#else + uint8_t *buf = malloc( i_size + (NATIVE_ALIGN-1) + sizeof(void **) ); + if( buf ) + { + align_buf = buf + (NATIVE_ALIGN-1) + sizeof(void **); + align_buf -= (intptr_t) align_buf & (NATIVE_ALIGN-1); + *( (void **) ( align_buf - sizeof(void **) ) ) = buf; + } +#endif + if( !align_buf ) + x264_log( NULL, X264_LOG_ERROR, "malloc of size %d failed\n", i_size ); + return align_buf; +} + +/**************************************************************************** + * x264_free: + ****************************************************************************/ +void x264_free( void *p ) +{ + if( p ) + { +#if HAVE_MALLOC_H + free( p ); +#else + free( *( ( ( void **) p ) - 1 ) ); +#endif + } +} + +/**************************************************************************** + * x264_reduce_fraction: + ****************************************************************************/ +#define REDUCE_FRACTION( name, type )\ +void name( type *n, type *d )\ +{ \ + type a = *n; \ + type b = *d; \ + type c; \ + if( !a || !b ) \ + return; \ + c = a % b; \ + while( c ) \ + { \ + a = b; \ + b = c; \ + c = a % b; \ + } \ + *n /= b; \ + *d /= b; \ +} + +REDUCE_FRACTION( x264_reduce_fraction , uint32_t ) +REDUCE_FRACTION( x264_reduce_fraction64, uint64_t ) + +/**************************************************************************** + * x264_slurp_file: + ****************************************************************************/ +char *x264_slurp_file( const char *filename ) +{ + int b_error = 0; + int64_t i_size; + char *buf; + FILE *fh = x264_fopen( filename, "rb" ); + if( !fh ) + return NULL; + + b_error |= fseek( fh, 0, SEEK_END ) < 0; + b_error |= ( i_size = ftell( fh ) ) <= 0; + if( WORD_SIZE == 4 ) + b_error |= i_size > INT32_MAX; + b_error |= fseek( fh, 0, SEEK_SET ) < 0; + if( b_error ) + goto error; + + buf = x264_malloc( i_size+2 ); + if( !buf ) + goto error; + + b_error |= fread( buf, 1, i_size, fh ) != i_size; + fclose( fh ); + if( b_error ) + { + x264_free( buf ); + return NULL; + } + + if( buf[i_size-1] != '\n' ) + buf[i_size++] = '\n'; + buf[i_size] = '\0'; + + return buf; +error: + fclose( fh ); + return NULL; +} + +/**************************************************************************** + * x264_param2string: + ****************************************************************************/ +char *x264_param2string( x264_param_t *p, int b_res ) +{ + int len = 1000; + char *buf, *s; + if( p->rc.psz_zones ) + len += strlen(p->rc.psz_zones); + buf = s = x264_malloc( len ); + if( !buf ) + return NULL; + + if( b_res ) + { + s += sprintf( s, "%dx%d ", p->i_width, p->i_height ); + s += sprintf( s, "fps=%u/%u ", p->i_fps_num, p->i_fps_den ); + s += sprintf( s, "timebase=%u/%u ", p->i_timebase_num, p->i_timebase_den ); + s += sprintf( s, "bitdepth=%d ", BIT_DEPTH ); + } + + if( p->b_opencl ) + s += sprintf( s, "opencl=%d ", p->b_opencl ); + s += sprintf( s, "cabac=%d", p->b_cabac ); + s += sprintf( s, " ref=%d", p->i_frame_reference ); + s += sprintf( s, " deblock=%d:%d:%d", p->b_deblocking_filter, + p->i_deblocking_filter_alphac0, p->i_deblocking_filter_beta ); + s += sprintf( s, " analyse=%#x:%#x", p->analyse.intra, p->analyse.inter ); + s += sprintf( s, " me=%s", x264_motion_est_names[ p->analyse.i_me_method ] ); + s += sprintf( s, " subme=%d", p->analyse.i_subpel_refine ); + s += sprintf( s, " psy=%d", p->analyse.b_psy ); + if( p->analyse.b_psy ) + s += sprintf( s, " psy_rd=%.2f:%.2f", p->analyse.f_psy_rd, p->analyse.f_psy_trellis ); + s += sprintf( s, " mixed_ref=%d", p->analyse.b_mixed_references ); + s += sprintf( s, " me_range=%d", p->analyse.i_me_range ); + s += sprintf( s, " chroma_me=%d", p->analyse.b_chroma_me ); + s += sprintf( s, " trellis=%d", p->analyse.i_trellis ); + s += sprintf( s, " 8x8dct=%d", p->analyse.b_transform_8x8 ); + s += sprintf( s, " cqm=%d", p->i_cqm_preset ); + s += sprintf( s, " deadzone=%d,%d", p->analyse.i_luma_deadzone[0], p->analyse.i_luma_deadzone[1] ); + s += sprintf( s, " fast_pskip=%d", p->analyse.b_fast_pskip ); + s += sprintf( s, " chroma_qp_offset=%d", p->analyse.i_chroma_qp_offset ); + s += sprintf( s, " threads=%d", p->i_threads ); + s += sprintf( s, " lookahead_threads=%d", p->i_lookahead_threads ); + s += sprintf( s, " sliced_threads=%d", p->b_sliced_threads ); + if( p->i_slice_count ) + s += sprintf( s, " slices=%d", p->i_slice_count ); + if( p->i_slice_count_max ) + s += sprintf( s, " slices_max=%d", p->i_slice_count_max ); + if( p->i_slice_max_size ) + s += sprintf( s, " slice_max_size=%d", p->i_slice_max_size ); + if( p->i_slice_max_mbs ) + s += sprintf( s, " slice_max_mbs=%d", p->i_slice_max_mbs ); + if( p->i_slice_min_mbs ) + s += sprintf( s, " slice_min_mbs=%d", p->i_slice_min_mbs ); + s += sprintf( s, " nr=%d", p->analyse.i_noise_reduction ); + s += sprintf( s, " decimate=%d", p->analyse.b_dct_decimate ); + s += sprintf( s, " interlaced=%s", p->b_interlaced ? p->b_tff ? "tff" : "bff" : p->b_fake_interlaced ? "fake" : "0" ); + s += sprintf( s, " bluray_compat=%d", p->b_bluray_compat ); + if( p->b_stitchable ) + s += sprintf( s, " stitchable=%d", p->b_stitchable ); + + s += sprintf( s, " constrained_intra=%d", p->b_constrained_intra ); + + s += sprintf( s, " bframes=%d", p->i_bframe ); + if( p->i_bframe ) + { + s += sprintf( s, " b_pyramid=%d b_adapt=%d b_bias=%d direct=%d weightb=%d open_gop=%d", + p->i_bframe_pyramid, p->i_bframe_adaptive, p->i_bframe_bias, + p->analyse.i_direct_mv_pred, p->analyse.b_weighted_bipred, p->b_open_gop ); + } + s += sprintf( s, " weightp=%d", p->analyse.i_weighted_pred > 0 ? p->analyse.i_weighted_pred : 0 ); + + if( p->i_keyint_max == X264_KEYINT_MAX_INFINITE ) + s += sprintf( s, " keyint=infinite" ); + else + s += sprintf( s, " keyint=%d", p->i_keyint_max ); + s += sprintf( s, " keyint_min=%d scenecut=%d intra_refresh=%d", + p->i_keyint_min, p->i_scenecut_threshold, p->b_intra_refresh ); + + if( p->rc.b_mb_tree || p->rc.i_vbv_buffer_size ) + s += sprintf( s, " rc_lookahead=%d", p->rc.i_lookahead ); + + s += sprintf( s, " rc=%s mbtree=%d", p->rc.i_rc_method == X264_RC_ABR ? + ( p->rc.b_stat_read ? "2pass" : p->rc.i_vbv_max_bitrate == p->rc.i_bitrate ? "cbr" : "abr" ) + : p->rc.i_rc_method == X264_RC_CRF ? "crf" : "cqp", p->rc.b_mb_tree ); + if( p->rc.i_rc_method == X264_RC_ABR || p->rc.i_rc_method == X264_RC_CRF ) + { + if( p->rc.i_rc_method == X264_RC_CRF ) + s += sprintf( s, " crf=%.1f", p->rc.f_rf_constant ); + else + s += sprintf( s, " bitrate=%d ratetol=%.1f", + p->rc.i_bitrate, p->rc.f_rate_tolerance ); + s += sprintf( s, " qcomp=%.2f qpmin=%d qpmax=%d qpstep=%d", + p->rc.f_qcompress, p->rc.i_qp_min, p->rc.i_qp_max, p->rc.i_qp_step ); + if( p->rc.b_stat_read ) + s += sprintf( s, " cplxblur=%.1f qblur=%.1f", + p->rc.f_complexity_blur, p->rc.f_qblur ); + if( p->rc.i_vbv_buffer_size ) + { + s += sprintf( s, " vbv_maxrate=%d vbv_bufsize=%d", + p->rc.i_vbv_max_bitrate, p->rc.i_vbv_buffer_size ); + if( p->rc.i_rc_method == X264_RC_CRF ) + s += sprintf( s, " crf_max=%.1f", p->rc.f_rf_constant_max ); + } + } + else if( p->rc.i_rc_method == X264_RC_CQP ) + s += sprintf( s, " qp=%d", p->rc.i_qp_constant ); + + if( p->rc.i_vbv_buffer_size ) + s += sprintf( s, " nal_hrd=%s filler=%d", x264_nal_hrd_names[p->i_nal_hrd], p->rc.b_filler ); + if( p->crop_rect.i_left | p->crop_rect.i_top | p->crop_rect.i_right | p->crop_rect.i_bottom ) + s += sprintf( s, " crop_rect=%u,%u,%u,%u", p->crop_rect.i_left, p->crop_rect.i_top, + p->crop_rect.i_right, p->crop_rect.i_bottom ); + if( p->i_frame_packing >= 0 ) + s += sprintf( s, " frame-packing=%d", p->i_frame_packing ); + + if( !(p->rc.i_rc_method == X264_RC_CQP && p->rc.i_qp_constant == 0) ) + { + s += sprintf( s, " ip_ratio=%.2f", p->rc.f_ip_factor ); + if( p->i_bframe && !p->rc.b_mb_tree ) + s += sprintf( s, " pb_ratio=%.2f", p->rc.f_pb_factor ); + s += sprintf( s, " aq=%d", p->rc.i_aq_mode ); + if( p->rc.i_aq_mode ) + s += sprintf( s, ":%.2f", p->rc.f_aq_strength ); + if( p->rc.psz_zones ) + s += sprintf( s, " zones=%s", p->rc.psz_zones ); + else if( p->rc.i_zones ) + s += sprintf( s, " zones" ); + } + + return buf; +} + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.h new file mode 100644 index 00000000..867b2073 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/common.h @@ -0,0 +1,1022 @@ +/***************************************************************************** + * common.h: misc common functions + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_COMMON_H +#define X264_COMMON_H + +/**************************************************************************** + * Macros + ****************************************************************************/ +#define X264_MIN(a,b) ( (a)<(b) ? (a) : (b) ) +#define X264_MAX(a,b) ( (a)>(b) ? (a) : (b) ) +#define X264_MIN3(a,b,c) X264_MIN((a),X264_MIN((b),(c))) +#define X264_MAX3(a,b,c) X264_MAX((a),X264_MAX((b),(c))) +#define X264_MIN4(a,b,c,d) X264_MIN((a),X264_MIN3((b),(c),(d))) +#define X264_MAX4(a,b,c,d) X264_MAX((a),X264_MAX3((b),(c),(d))) +#define XCHG(type,a,b) do { type t = a; a = b; b = t; } while( 0 ) +#define IS_DISPOSABLE(type) ( type == X264_TYPE_B ) +#define FIX8(f) ((int)(f*(1<<8)+.5)) +#define ALIGN(x,a) (((x)+((a)-1))&~((a)-1)) +#define ARRAY_ELEMS(a) ((sizeof(a))/(sizeof(a[0]))) + +#define CHECKED_MALLOC( var, size )\ +do {\ + var = x264_malloc( size );\ + if( !var )\ + goto fail;\ +} while( 0 ) +#define CHECKED_MALLOCZERO( var, size )\ +do {\ + CHECKED_MALLOC( var, size );\ + memset( var, 0, size );\ +} while( 0 ) + +/* Macros for merging multiple allocations into a single large malloc, for improved + * use with huge pages. */ + +/* Needs to be enough to contain any set of buffers that use combined allocations */ +#define PREALLOC_BUF_SIZE 1024 + +#define PREALLOC_INIT\ + int prealloc_idx = 0;\ + size_t prealloc_size = 0;\ + uint8_t **preallocs[PREALLOC_BUF_SIZE]; + +#define PREALLOC( var, size )\ +do {\ + var = (void*)prealloc_size;\ + preallocs[prealloc_idx++] = (uint8_t**)&var;\ + prealloc_size += ALIGN(size, NATIVE_ALIGN);\ +} while( 0 ) + +#define PREALLOC_END( ptr )\ +do {\ + CHECKED_MALLOC( ptr, prealloc_size );\ + while( prealloc_idx-- )\ + *preallocs[prealloc_idx] += (intptr_t)ptr;\ +} while( 0 ) + +#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0])) + +#define X264_BFRAME_MAX 16 +#define X264_REF_MAX 16 +#define X264_THREAD_MAX 128 +#define X264_LOOKAHEAD_THREAD_MAX 16 +#define X264_PCM_COST (FRAME_SIZE(256*BIT_DEPTH)+16) +#define X264_LOOKAHEAD_MAX 250 +#define QP_BD_OFFSET (6*(BIT_DEPTH-8)) +#define QP_MAX_SPEC (51+QP_BD_OFFSET) +#define QP_MAX (QP_MAX_SPEC+18) +#define QP_MAX_MAX (51+2*6+18) +#define PIXEL_MAX ((1 << BIT_DEPTH)-1) +// arbitrary, but low because SATD scores are 1/4 normal +#define X264_LOOKAHEAD_QP (12+QP_BD_OFFSET) +#define SPEC_QP(x) X264_MIN((x), QP_MAX_SPEC) + +// number of pixels (per thread) in progress at any given time. +// 16 for the macroblock in progress + 3 for deblocking + 3 for motion compensation filter + 2 for extra safety +#define X264_THREAD_HEIGHT 24 + +/* WEIGHTP_FAKE is set when mb_tree & psy are enabled, but normal weightp is disabled + * (such as in baseline). It checks for fades in lookahead and adjusts qp accordingly + * to increase quality. Defined as (-1) so that if(i_weighted_pred > 0) is true only when + * real weights are being used. */ + +#define X264_WEIGHTP_FAKE (-1) + +#define NALU_OVERHEAD 5 // startcode + NAL type costs 5 bytes per frame +#define FILLER_OVERHEAD (NALU_OVERHEAD+1) +#define SEI_OVERHEAD (NALU_OVERHEAD - (h->param.b_annexb && !h->param.i_avcintra_class && (h->out.i_nal-1))) + +/**************************************************************************** + * Includes + ****************************************************************************/ +#include "osdep.h" +#include +#include +#include +#include +#include +#include + +#if HAVE_INTERLACED +# define MB_INTERLACED h->mb.b_interlaced +# define SLICE_MBAFF h->sh.b_mbaff +# define PARAM_INTERLACED h->param.b_interlaced +#else +# define MB_INTERLACED 0 +# define SLICE_MBAFF 0 +# define PARAM_INTERLACED 0 +#endif + +#ifdef CHROMA_FORMAT +# define CHROMA_H_SHIFT (CHROMA_FORMAT == CHROMA_420 || CHROMA_FORMAT == CHROMA_422) +# define CHROMA_V_SHIFT (CHROMA_FORMAT == CHROMA_420) +#else +# define CHROMA_FORMAT h->sps->i_chroma_format_idc +# define CHROMA_H_SHIFT h->mb.chroma_h_shift +# define CHROMA_V_SHIFT h->mb.chroma_v_shift +#endif + +#define CHROMA_SIZE(s) ((s)>>(CHROMA_H_SHIFT+CHROMA_V_SHIFT)) +#define FRAME_SIZE(s) ((s)+2*CHROMA_SIZE(s)) +#define CHROMA444 (CHROMA_FORMAT == CHROMA_444) + +/* Unions for type-punning. + * Mn: load or store n bits, aligned, native-endian + * CPn: copy n bits, aligned, native-endian + * we don't use memcpy for CPn because memcpy's args aren't assumed to be aligned */ +typedef union { uint16_t i; uint8_t c[2]; } MAY_ALIAS x264_union16_t; +typedef union { uint32_t i; uint16_t b[2]; uint8_t c[4]; } MAY_ALIAS x264_union32_t; +typedef union { uint64_t i; uint32_t a[2]; uint16_t b[4]; uint8_t c[8]; } MAY_ALIAS x264_union64_t; +typedef struct { uint64_t i[2]; } x264_uint128_t; +typedef union { x264_uint128_t i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; uint8_t d[16]; } MAY_ALIAS x264_union128_t; +#define M16(src) (((x264_union16_t*)(src))->i) +#define M32(src) (((x264_union32_t*)(src))->i) +#define M64(src) (((x264_union64_t*)(src))->i) +#define M128(src) (((x264_union128_t*)(src))->i) +#define M128_ZERO ((x264_uint128_t){{0,0}}) +#define CP16(dst,src) M16(dst) = M16(src) +#define CP32(dst,src) M32(dst) = M32(src) +#define CP64(dst,src) M64(dst) = M64(src) +#define CP128(dst,src) M128(dst) = M128(src) + +#if HIGH_BIT_DEPTH + typedef uint16_t pixel; + typedef uint64_t pixel4; + typedef int32_t dctcoef; + typedef uint32_t udctcoef; + +# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL) +# define MPIXEL_X4(src) M64(src) +#else + typedef uint8_t pixel; + typedef uint32_t pixel4; + typedef int16_t dctcoef; + typedef uint16_t udctcoef; + +# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U) +# define MPIXEL_X4(src) M32(src) +#endif + +#define BIT_DEPTH X264_BIT_DEPTH + +#define CPPIXEL_X4(dst,src) MPIXEL_X4(dst) = MPIXEL_X4(src) + +#define X264_SCAN8_LUMA_SIZE (5*8) +#define X264_SCAN8_SIZE (X264_SCAN8_LUMA_SIZE*3) +#define X264_SCAN8_0 (4+1*8) + +/* Scan8 organization: + * 0 1 2 3 4 5 6 7 + * 0 DY y y y y y + * 1 y Y Y Y Y + * 2 y Y Y Y Y + * 3 y Y Y Y Y + * 4 y Y Y Y Y + * 5 DU u u u u u + * 6 u U U U U + * 7 u U U U U + * 8 u U U U U + * 9 u U U U U + * 10 DV v v v v v + * 11 v V V V V + * 12 v V V V V + * 13 v V V V V + * 14 v V V V V + * DY/DU/DV are for luma/chroma DC. + */ + +#define LUMA_DC 48 +#define CHROMA_DC 49 + +static const uint8_t x264_scan8[16*3 + 3] = +{ + 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8, + 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8, + 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8, + 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8, + 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8, + 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8, + 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8, + 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8, + 4+11*8, 5+11*8, 4+12*8, 5+12*8, + 6+11*8, 7+11*8, 6+12*8, 7+12*8, + 4+13*8, 5+13*8, 4+14*8, 5+14*8, + 6+13*8, 7+13*8, 6+14*8, 7+14*8, + 0+ 0*8, 0+ 5*8, 0+10*8 +}; + +#include "x264.h" +#if HAVE_OPENCL +#include "opencl.h" +#endif +#include "cabac.h" +#include "bitstream.h" +#include "set.h" +#include "predict.h" +#include "pixel.h" +#include "mc.h" +#include "frame.h" +#include "dct.h" +#include "quant.h" +#include "cpu.h" +#include "threadpool.h" + +/**************************************************************************** + * General functions + ****************************************************************************/ +/* x264_malloc : will do or emulate a memalign + * you have to use x264_free for buffers allocated with x264_malloc */ +void *x264_malloc( int ); +void x264_free( void * ); + +/* x264_slurp_file: malloc space for the whole file and read it */ +char *x264_slurp_file( const char *filename ); + +/* x264_param2string: return a (malloced) string containing most of + * the encoding options */ +char *x264_param2string( x264_param_t *p, int b_res ); + +/* log */ +void x264_log( x264_t *h, int i_level, const char *psz_fmt, ... ); + +void x264_reduce_fraction( uint32_t *n, uint32_t *d ); +void x264_reduce_fraction64( uint64_t *n, uint64_t *d ); +void x264_cavlc_init( x264_t *h ); +void x264_cabac_init( x264_t *h ); + +static ALWAYS_INLINE pixel x264_clip_pixel( int x ) +{ + return ( (x & ~PIXEL_MAX) ? (-x)>>31 & PIXEL_MAX : x ); +} + +static ALWAYS_INLINE int x264_clip3( int v, int i_min, int i_max ) +{ + return ( (v < i_min) ? i_min : (v > i_max) ? i_max : v ); +} + +static ALWAYS_INLINE double x264_clip3f( double v, double f_min, double f_max ) +{ + return ( (v < f_min) ? f_min : (v > f_max) ? f_max : v ); +} + +static ALWAYS_INLINE int x264_median( int a, int b, int c ) +{ + int t = (a-b)&((a-b)>>31); + a -= t; + b += t; + b -= (b-c)&((b-c)>>31); + b += (a-b)&((a-b)>>31); + return b; +} + +static ALWAYS_INLINE void x264_median_mv( int16_t *dst, int16_t *a, int16_t *b, int16_t *c ) +{ + dst[0] = x264_median( a[0], b[0], c[0] ); + dst[1] = x264_median( a[1], b[1], c[1] ); +} + +static ALWAYS_INLINE int x264_predictor_difference( int16_t (*mvc)[2], intptr_t i_mvc ) +{ + int sum = 0; + for( int i = 0; i < i_mvc-1; i++ ) + { + sum += abs( mvc[i][0] - mvc[i+1][0] ) + + abs( mvc[i][1] - mvc[i+1][1] ); + } + return sum; +} + +static ALWAYS_INLINE uint16_t x264_cabac_mvd_sum( uint8_t *mvdleft, uint8_t *mvdtop ) +{ + int amvd0 = mvdleft[0] + mvdtop[0]; + int amvd1 = mvdleft[1] + mvdtop[1]; + amvd0 = (amvd0 > 2) + (amvd0 > 32); + amvd1 = (amvd1 > 2) + (amvd1 > 32); + return amvd0 + (amvd1<<8); +} + +extern const uint8_t x264_exp2_lut[64]; +extern const float x264_log2_lut[128]; +extern const float x264_log2_lz_lut[32]; + +/* Not a general-purpose function; multiplies input by -1/6 to convert + * qp to qscale. */ +static ALWAYS_INLINE int x264_exp2fix8( float x ) +{ + int i = x*(-64.f/6.f) + 512.5f; + if( i < 0 ) return 0; + if( i > 1023 ) return 0xffff; + return (x264_exp2_lut[i&63]+256) << (i>>6) >> 8; +} + +static ALWAYS_INLINE float x264_log2( uint32_t x ) +{ + int lz = x264_clz( x ); + return x264_log2_lut[(x<>24)&0x7f] + x264_log2_lz_lut[lz]; +} + +/**************************************************************************** + * + ****************************************************************************/ +enum slice_type_e +{ + SLICE_TYPE_P = 0, + SLICE_TYPE_B = 1, + SLICE_TYPE_I = 2, +}; + +static const char slice_type_to_char[] = { 'P', 'B', 'I' }; + +enum sei_payload_type_e +{ + SEI_BUFFERING_PERIOD = 0, + SEI_PIC_TIMING = 1, + SEI_PAN_SCAN_RECT = 2, + SEI_FILLER = 3, + SEI_USER_DATA_REGISTERED = 4, + SEI_USER_DATA_UNREGISTERED = 5, + SEI_RECOVERY_POINT = 6, + SEI_DEC_REF_PIC_MARKING = 7, + SEI_FRAME_PACKING = 45, +}; + +typedef struct +{ + x264_sps_t *sps; + x264_pps_t *pps; + + int i_type; + int i_first_mb; + int i_last_mb; + + int i_pps_id; + + int i_frame_num; + + int b_mbaff; + int b_field_pic; + int b_bottom_field; + + int i_idr_pic_id; /* -1 if nal_type != 5 */ + + int i_poc; + int i_delta_poc_bottom; + + int i_delta_poc[2]; + int i_redundant_pic_cnt; + + int b_direct_spatial_mv_pred; + + int b_num_ref_idx_override; + int i_num_ref_idx_l0_active; + int i_num_ref_idx_l1_active; + + int b_ref_pic_list_reordering[2]; + struct + { + int idc; + int arg; + } ref_pic_list_order[2][X264_REF_MAX]; + + /* P-frame weighting */ + int b_weighted_pred; + x264_weight_t weight[X264_REF_MAX*2][3]; + + int i_mmco_remove_from_end; + int i_mmco_command_count; + struct /* struct for future expansion */ + { + int i_difference_of_pic_nums; + int i_poc; + } mmco[X264_REF_MAX]; + + int i_cabac_init_idc; + + int i_qp; + int i_qp_delta; + int b_sp_for_swidth; + int i_qs_delta; + + /* deblocking filter */ + int i_disable_deblocking_filter_idc; + int i_alpha_c0_offset; + int i_beta_offset; + +} x264_slice_header_t; + +typedef struct x264_lookahead_t +{ + volatile uint8_t b_exit_thread; + uint8_t b_thread_active; + uint8_t b_analyse_keyframe; + int i_last_keyframe; + int i_slicetype_length; + x264_frame_t *last_nonb; + x264_pthread_t thread_handle; + x264_sync_frame_list_t ifbuf; + x264_sync_frame_list_t next; + x264_sync_frame_list_t ofbuf; +} x264_lookahead_t; + +typedef struct x264_ratecontrol_t x264_ratecontrol_t; + +typedef struct x264_left_table_t +{ + uint8_t intra[4]; + uint8_t nnz[4]; + uint8_t nnz_chroma[4]; + uint8_t mv[4]; + uint8_t ref[4]; +} x264_left_table_t; + +/* Current frame stats */ +typedef struct +{ + /* MV bits (MV+Ref+Block Type) */ + int i_mv_bits; + /* Texture bits (DCT coefs) */ + int i_tex_bits; + /* ? */ + int i_misc_bits; + /* MB type counts */ + int i_mb_count[19]; + int i_mb_count_i; + int i_mb_count_p; + int i_mb_count_skip; + int i_mb_count_8x8dct[2]; + int i_mb_count_ref[2][X264_REF_MAX*2]; + int i_mb_partition[17]; + int i_mb_cbp[6]; + int i_mb_pred_mode[4][13]; + int i_mb_field[3]; + /* Adaptive direct mv pred */ + int i_direct_score[2]; + /* Metrics */ + int64_t i_ssd[3]; + double f_ssim; + int i_ssim_cnt; +} x264_frame_stat_t; + +struct x264_t +{ + /* encoder parameters */ + x264_param_t param; + + x264_t *thread[X264_THREAD_MAX+1]; + x264_t *lookahead_thread[X264_LOOKAHEAD_THREAD_MAX]; + int b_thread_active; + int i_thread_phase; /* which thread to use for the next frame */ + int i_thread_idx; /* which thread this is */ + int i_threadslice_start; /* first row in this thread slice */ + int i_threadslice_end; /* row after the end of this thread slice */ + int i_threadslice_pass; /* which pass of encoding we are on */ + x264_threadpool_t *threadpool; + x264_threadpool_t *lookaheadpool; + x264_pthread_mutex_t mutex; + x264_pthread_cond_t cv; + + /* bitstream output */ + struct + { + int i_nal; + int i_nals_allocated; + x264_nal_t *nal; + int i_bitstream; /* size of p_bitstream */ + uint8_t *p_bitstream; /* will hold data for all nal */ + bs_t bs; + } out; + + uint8_t *nal_buffer; + int nal_buffer_size; + + x264_t *reconfig_h; + int reconfig; + + /**** thread synchronization starts here ****/ + + /* frame number/poc */ + int i_frame; + int i_frame_num; + + int i_thread_frames; /* Number of different frames being encoded by threads; + * 1 when sliced-threads is on. */ + int i_nal_type; + int i_nal_ref_idc; + + int64_t i_disp_fields; /* Number of displayed fields (both coded and implied via pic_struct) */ + int i_disp_fields_last_frame; + int64_t i_prev_duration; /* Duration of previous frame */ + int64_t i_coded_fields; /* Number of coded fields (both coded and implied via pic_struct) */ + int64_t i_cpb_delay; /* Equal to number of fields preceding this field + * since last buffering_period SEI */ + int64_t i_coded_fields_lookahead; /* Use separate counters for lookahead */ + int64_t i_cpb_delay_lookahead; + + int64_t i_cpb_delay_pir_offset; + int64_t i_cpb_delay_pir_offset_next; + + int b_queued_intra_refresh; + int64_t i_last_idr_pts; + + int i_idr_pic_id; + + /* quantization matrix for decoding, [cqm][qp%6][coef] */ + int (*dequant4_mf[4])[16]; /* [4][6][16] */ + int (*dequant8_mf[4])[64]; /* [4][6][64] */ + /* quantization matrix for trellis, [cqm][qp][coef] */ + int (*unquant4_mf[4])[16]; /* [4][QP_MAX_SPEC+1][16] */ + int (*unquant8_mf[4])[64]; /* [4][QP_MAX_SPEC+1][64] */ + /* quantization matrix for deadzone */ + udctcoef (*quant4_mf[4])[16]; /* [4][QP_MAX_SPEC+1][16] */ + udctcoef (*quant8_mf[4])[64]; /* [4][QP_MAX_SPEC+1][64] */ + udctcoef (*quant4_bias[4])[16]; /* [4][QP_MAX_SPEC+1][16] */ + udctcoef (*quant8_bias[4])[64]; /* [4][QP_MAX_SPEC+1][64] */ + udctcoef (*quant4_bias0[4])[16]; /* [4][QP_MAX_SPEC+1][16] */ + udctcoef (*quant8_bias0[4])[64]; /* [4][QP_MAX_SPEC+1][64] */ + udctcoef (*nr_offset_emergency)[4][64]; + + /* mv/ref cost arrays. */ + uint16_t *cost_mv[QP_MAX+1]; + uint16_t *cost_mv_fpel[QP_MAX+1][4]; + + const uint8_t *chroma_qp_table; /* includes both the nonlinear luma->chroma mapping and chroma_qp_offset */ + + /* Slice header */ + x264_slice_header_t sh; + + /* SPS / PPS */ + x264_sps_t sps[1]; + x264_pps_t pps[1]; + + /* Slice header backup, for SEI_DEC_REF_PIC_MARKING */ + int b_sh_backup; + x264_slice_header_t sh_backup; + + /* cabac context */ + x264_cabac_t cabac; + + struct + { + /* Frames to be encoded (whose types have been decided) */ + x264_frame_t **current; + /* Unused frames: 0 = fenc, 1 = fdec */ + x264_frame_t **unused[2]; + + /* Unused blank frames (for duplicates) */ + x264_frame_t **blank_unused; + + /* frames used for reference + sentinels */ + x264_frame_t *reference[X264_REF_MAX+2]; + + int i_last_keyframe; /* Frame number of the last keyframe */ + int i_last_idr; /* Frame number of the last IDR (not RP)*/ + int i_poc_last_open_gop; /* Poc of the I frame of the last open-gop. The value + * is only assigned during the period between that + * I frame and the next P or I frame, else -1 */ + + int i_input; /* Number of input frames already accepted */ + + int i_max_dpb; /* Number of frames allocated in the decoded picture buffer */ + int i_max_ref0; + int i_max_ref1; + int i_delay; /* Number of frames buffered for B reordering */ + int i_bframe_delay; + int64_t i_bframe_delay_time; + int64_t i_first_pts; + int64_t i_prev_reordered_pts[2]; + int64_t i_largest_pts; + int64_t i_second_largest_pts; + int b_have_lowres; /* Whether 1/2 resolution luma planes are being used */ + int b_have_sub8x8_esa; + } frames; + + /* current frame being encoded */ + x264_frame_t *fenc; + + /* frame being reconstructed */ + x264_frame_t *fdec; + + /* references lists */ + int i_ref[2]; + x264_frame_t *fref[2][X264_REF_MAX+3]; + x264_frame_t *fref_nearest[2]; + int b_ref_reorder[2]; + + /* hrd */ + int initial_cpb_removal_delay; + int initial_cpb_removal_delay_offset; + int64_t i_reordered_pts_delay; + + /* Current MB DCT coeffs */ + struct + { + ALIGNED_64( dctcoef luma16x16_dc[3][16] ); + ALIGNED_16( dctcoef chroma_dc[2][8] ); + // FIXME share memory? + ALIGNED_64( dctcoef luma8x8[12][64] ); + ALIGNED_64( dctcoef luma4x4[16*3][16] ); + } dct; + + /* MB table and cache for current frame/mb */ + struct + { + int i_mb_width; + int i_mb_height; + int i_mb_count; /* number of mbs in a frame */ + + /* Chroma subsampling */ + int chroma_h_shift; + int chroma_v_shift; + + /* Strides */ + int i_mb_stride; + int i_b8_stride; + int i_b4_stride; + int left_b8[2]; + int left_b4[2]; + + /* Current index */ + int i_mb_x; + int i_mb_y; + int i_mb_xy; + int i_b8_xy; + int i_b4_xy; + + /* Search parameters */ + int i_me_method; + int i_subpel_refine; + int b_chroma_me; + int b_trellis; + int b_noise_reduction; + int b_dct_decimate; + int i_psy_rd; /* Psy RD strength--fixed point value*/ + int i_psy_trellis; /* Psy trellis strength--fixed point value*/ + + int b_interlaced; + int b_adaptive_mbaff; /* MBAFF+subme 0 requires non-adaptive MBAFF i.e. all field mbs */ + + /* Allowed qpel MV range to stay within the picture + emulated edge pixels */ + int mv_min[2]; + int mv_max[2]; + int mv_miny_row[3]; /* 0 == top progressive, 1 == bot progressive, 2 == interlaced */ + int mv_maxy_row[3]; + /* Subpel MV range for motion search. + * same mv_min/max but includes levels' i_mv_range. */ + int mv_min_spel[2]; + int mv_max_spel[2]; + int mv_miny_spel_row[3]; + int mv_maxy_spel_row[3]; + /* Fullpel MV range for motion search */ + ALIGNED_8( int16_t mv_limit_fpel[2][2] ); /* min_x, min_y, max_x, max_y */ + int mv_miny_fpel_row[3]; + int mv_maxy_fpel_row[3]; + + /* neighboring MBs */ + unsigned int i_neighbour; + unsigned int i_neighbour8[4]; /* neighbours of each 8x8 or 4x4 block that are available */ + unsigned int i_neighbour4[16]; /* at the time the block is coded */ + unsigned int i_neighbour_intra; /* for constrained intra pred */ + unsigned int i_neighbour_frame; /* ignoring slice boundaries */ + int i_mb_type_top; + int i_mb_type_left[2]; + int i_mb_type_topleft; + int i_mb_type_topright; + int i_mb_prev_xy; + int i_mb_left_xy[2]; + int i_mb_top_xy; + int i_mb_topleft_xy; + int i_mb_topright_xy; + int i_mb_top_y; + int i_mb_topleft_y; + int i_mb_topright_y; + const x264_left_table_t *left_index_table; + int i_mb_top_mbpair_xy; + int topleft_partition; + int b_allow_skip; + int field_decoding_flag; + + /**** thread synchronization ends here ****/ + /* subsequent variables are either thread-local or constant, + * and won't be copied from one thread to another */ + + /* mb table */ + uint8_t *base; /* base pointer for all malloced data in this mb */ + int8_t *type; /* mb type */ + uint8_t *partition; /* mb partition */ + int8_t *qp; /* mb qp */ + int16_t *cbp; /* mb cbp: 0x0?: luma, 0x?0: chroma, 0x100: luma dc, 0x200 and 0x400: chroma dc, 0x1000 PCM (all set for PCM) */ + int8_t (*intra4x4_pred_mode)[8]; /* intra4x4 pred mode. for non I4x4 set to I_PRED_4x4_DC(2) */ + /* actually has only 7 entries; set to 8 for write-combining optimizations */ + uint8_t (*non_zero_count)[16*3]; /* nzc. for I_PCM set to 16 */ + int8_t *chroma_pred_mode; /* chroma_pred_mode. cabac only. for non intra I_PRED_CHROMA_DC(0) */ + int16_t (*mv[2])[2]; /* mb mv. set to 0 for intra mb */ + uint8_t (*mvd[2])[8][2]; /* absolute value of mb mv difference with predict, clipped to [0,33]. set to 0 if intra. cabac only */ + int8_t *ref[2]; /* mb ref. set to -1 if non used (intra or Lx only) */ + int16_t (*mvr[2][X264_REF_MAX*2])[2];/* 16x16 mv for each possible ref */ + int8_t *skipbp; /* block pattern for SKIP or DIRECT (sub)mbs. B-frames + cabac only */ + int8_t *mb_transform_size; /* transform_size_8x8_flag of each mb */ + uint32_t *slice_table; /* sh->first_mb of the slice that the indexed mb is part of */ + uint8_t *field; + + /* buffer for weighted versions of the reference frames */ + pixel *p_weight_buf[X264_REF_MAX]; + + /* current value */ + int i_type; + int i_partition; + ALIGNED_4( uint8_t i_sub_partition[4] ); + int b_transform_8x8; + + int i_cbp_luma; + int i_cbp_chroma; + + int i_intra16x16_pred_mode; + int i_chroma_pred_mode; + + /* skip flags for i4x4 and i8x8 + * 0 = encode as normal. + * 1 (non-RD only) = the DCT is still in h->dct, restore fdec and skip reconstruction. + * 2 (RD only) = the DCT has since been overwritten by RD; restore that too. */ + int i_skip_intra; + /* skip flag for motion compensation */ + /* if we've already done MC, we don't need to do it again */ + int b_skip_mc; + /* set to true if we are re-encoding a macroblock. */ + int b_reencode_mb; + int ip_offset; /* Used by PIR to offset the quantizer of intra-refresh blocks. */ + int b_deblock_rdo; + int b_overflow; /* If CAVLC had a level code overflow during bitstream writing. */ + + struct + { + /* space for p_fenc and p_fdec */ +#define FENC_STRIDE 16 +#define FDEC_STRIDE 32 + ALIGNED_64( pixel fenc_buf[48*FENC_STRIDE] ); + ALIGNED_64( pixel fdec_buf[54*FDEC_STRIDE] ); + + /* i4x4 and i8x8 backup data, for skipping the encode stage when possible */ + ALIGNED_16( pixel i4x4_fdec_buf[16*16] ); + ALIGNED_16( pixel i8x8_fdec_buf[16*16] ); + ALIGNED_64( dctcoef i8x8_dct_buf[3][64] ); + ALIGNED_64( dctcoef i4x4_dct_buf[15][16] ); + uint32_t i4x4_nnz_buf[4]; + uint32_t i8x8_nnz_buf[4]; + + /* Psy trellis DCT data */ + ALIGNED_16( dctcoef fenc_dct8[4][64] ); + ALIGNED_16( dctcoef fenc_dct4[16][16] ); + + /* Psy RD SATD/SA8D scores cache */ + ALIGNED_64( uint32_t fenc_satd_cache[32] ); + ALIGNED_16( uint64_t fenc_hadamard_cache[9] ); + + int i4x4_cbp; + int i8x8_cbp; + + /* pointer over mb of the frame to be compressed */ + pixel *p_fenc[3]; /* y,u,v */ + /* pointer to the actual source frame, not a block copy */ + pixel *p_fenc_plane[3]; + + /* pointer over mb of the frame to be reconstructed */ + pixel *p_fdec[3]; + + /* pointer over mb of the references */ + int i_fref[2]; + /* [12]: yN, yH, yV, yHV, (NV12 ? uv : I444 ? (uN, uH, uV, uHV, vN, ...)) */ + pixel *p_fref[2][X264_REF_MAX*2][12]; + pixel *p_fref_w[X264_REF_MAX*2]; /* weighted fullpel luma */ + uint16_t *p_integral[2][X264_REF_MAX]; + + /* fref stride */ + int i_stride[3]; + } pic; + + /* cache */ + struct + { + /* real intra4x4_pred_mode if I_4X4 or I_8X8, I_PRED_4x4_DC if mb available, -1 if not */ + ALIGNED_16( int8_t intra4x4_pred_mode[X264_SCAN8_LUMA_SIZE] ); + + /* i_non_zero_count if available else 0x80. intentionally misaligned by 8 for asm */ + ALIGNED_8( uint8_t non_zero_count[X264_SCAN8_SIZE] ); + + /* -1 if unused, -2 if unavailable */ + ALIGNED_4( int8_t ref[2][X264_SCAN8_LUMA_SIZE] ); + + /* 0 if not available */ + ALIGNED_16( int16_t mv[2][X264_SCAN8_LUMA_SIZE][2] ); + ALIGNED_8( uint8_t mvd[2][X264_SCAN8_LUMA_SIZE][2] ); + + /* 1 if SKIP or DIRECT. set only for B-frames + CABAC */ + ALIGNED_4( int8_t skip[X264_SCAN8_LUMA_SIZE] ); + + ALIGNED_4( int16_t direct_mv[2][4][2] ); + ALIGNED_4( int8_t direct_ref[2][4] ); + int direct_partition; + ALIGNED_4( int16_t pskip_mv[2] ); + + /* number of neighbors (top and left) that used 8x8 dct */ + int i_neighbour_transform_size; + int i_neighbour_skip; + + /* neighbor CBPs */ + int i_cbp_top; + int i_cbp_left; + + /* extra data required for mbaff in mv prediction */ + int16_t topright_mv[2][3][2]; + int8_t topright_ref[2][3]; + + /* current mb deblock strength */ + uint8_t (*deblock_strength)[8][4]; + } cache; + + /* */ + int i_qp; /* current qp */ + int i_chroma_qp; + int i_last_qp; /* last qp */ + int i_last_dqp; /* last delta qp */ + int b_variable_qp; /* whether qp is allowed to vary per macroblock */ + int b_lossless; + int b_direct_auto_read; /* take stats for --direct auto from the 2pass log */ + int b_direct_auto_write; /* analyse direct modes, to use and/or save */ + + /* lambda values */ + int i_trellis_lambda2[2][2]; /* [luma,chroma][inter,intra] */ + int i_psy_rd_lambda; + int i_chroma_lambda2_offset; + + /* B_direct and weighted prediction */ + int16_t dist_scale_factor_buf[2][2][X264_REF_MAX*2][4]; + int16_t (*dist_scale_factor)[4]; + int8_t bipred_weight_buf[2][2][X264_REF_MAX*2][4]; + int8_t (*bipred_weight)[4]; + /* maps fref1[0]'s ref indices into the current list0 */ +#define map_col_to_list0(col) h->mb.map_col_to_list0[(col)+2] + int8_t map_col_to_list0[X264_REF_MAX+2]; + int ref_blind_dupe; /* The index of the blind reference frame duplicate. */ + int8_t deblock_ref_table[X264_REF_MAX*2+2]; +#define deblock_ref_table(x) h->mb.deblock_ref_table[(x)+2] + } mb; + + /* rate control encoding only */ + x264_ratecontrol_t *rc; + + /* stats */ + struct + { + /* Cumulated stats */ + + /* per slice info */ + int i_frame_count[3]; + int64_t i_frame_size[3]; + double f_frame_qp[3]; + int i_consecutive_bframes[X264_BFRAME_MAX+1]; + /* */ + double f_ssd_global[3]; + double f_psnr_average[3]; + double f_psnr_mean_y[3]; + double f_psnr_mean_u[3]; + double f_psnr_mean_v[3]; + double f_ssim_mean_y[3]; + double f_frame_duration[3]; + /* */ + int64_t i_mb_count[3][19]; + int64_t i_mb_partition[2][17]; + int64_t i_mb_count_8x8dct[2]; + int64_t i_mb_count_ref[2][2][X264_REF_MAX*2]; + int64_t i_mb_cbp[6]; + int64_t i_mb_pred_mode[4][13]; + int64_t i_mb_field[3]; + /* */ + int i_direct_score[2]; + int i_direct_frames[2]; + /* num p-frames weighted */ + int i_wpred[2]; + + /* Current frame stats */ + x264_frame_stat_t frame; + } stat; + + /* 0 = luma 4x4, 1 = luma 8x8, 2 = chroma 4x4, 3 = chroma 8x8 */ + udctcoef (*nr_offset)[64]; + uint32_t (*nr_residual_sum)[64]; + uint32_t *nr_count; + + ALIGNED_32( udctcoef nr_offset_denoise[4][64] ); + ALIGNED_32( uint32_t nr_residual_sum_buf[2][4][64] ); + uint32_t nr_count_buf[2][4]; + + uint8_t luma2chroma_pixel[7]; /* Subsampled pixel size */ + + /* Buffers that are allocated per-thread even in sliced threads. */ + void *scratch_buffer; /* for any temporary storage that doesn't want repeated malloc */ + void *scratch_buffer2; /* if the first one's already in use */ + pixel *intra_border_backup[5][3]; /* bottom pixels of the previous mb row, used for intra prediction after the framebuffer has been deblocked */ + /* Deblock strength values are stored for each 4x4 partition. In MBAFF + * there are four extra values that need to be stored, located in [4][i]. */ + uint8_t (*deblock_strength[2])[2][8][4]; + + /* CPU functions dependents */ + x264_predict_t predict_16x16[4+3]; + x264_predict8x8_t predict_8x8[9+3]; + x264_predict_t predict_4x4[9+3]; + x264_predict_t predict_chroma[4+3]; + x264_predict_t predict_8x8c[4+3]; + x264_predict_t predict_8x16c[4+3]; + x264_predict_8x8_filter_t predict_8x8_filter; + + x264_pixel_function_t pixf; + x264_mc_functions_t mc; + x264_dct_function_t dctf; + x264_zigzag_function_t zigzagf; + x264_zigzag_function_t zigzagf_interlaced; + x264_zigzag_function_t zigzagf_progressive; + x264_quant_function_t quantf; + x264_deblock_function_t loopf; + x264_bitstream_function_t bsf; + + x264_lookahead_t *lookahead; + +#if HAVE_OPENCL + x264_opencl_t opencl; +#endif +}; + +typedef struct +{ + int sad; + int16_t mv[2]; +} mvsad_t; + +// included at the end because it needs x264_t +#include "macroblock.h" + +static int ALWAYS_INLINE x264_predictor_roundclip( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv ) +{ + int cnt = 0; + for( int i = 0; i < i_mvc; i++ ) + { + int mx = (mvc[i][0] + 2) >> 2; + int my = (mvc[i][1] + 2) >> 2; + uint32_t mv = pack16to32_mask(mx, my); + if( !mv || mv == pmv ) continue; + dst[cnt][0] = x264_clip3( mx, mv_limit[0][0], mv_limit[1][0] ); + dst[cnt][1] = x264_clip3( my, mv_limit[0][1], mv_limit[1][1] ); + cnt++; + } + return cnt; +} + +static int ALWAYS_INLINE x264_predictor_clip( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv ) +{ + int cnt = 0; + int qpel_limit[4] = {mv_limit[0][0] << 2, mv_limit[0][1] << 2, mv_limit[1][0] << 2, mv_limit[1][1] << 2}; + for( int i = 0; i < i_mvc; i++ ) + { + uint32_t mv = M32( mvc[i] ); + int mx = mvc[i][0]; + int my = mvc[i][1]; + if( !mv || mv == pmv ) continue; + dst[cnt][0] = x264_clip3( mx, qpel_limit[0], qpel_limit[2] ); + dst[cnt][1] = x264_clip3( my, qpel_limit[1], qpel_limit[3] ); + cnt++; + } + return cnt; +} + +#if ARCH_X86 || ARCH_X86_64 +#include "x86/util.h" +#endif + +#include "rectangle.h" + +#endif + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.c new file mode 100644 index 00000000..f365482f --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.c @@ -0,0 +1,490 @@ +/***************************************************************************** + * cpu.c: cpu detection + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#if HAVE_POSIXTHREAD && SYS_LINUX +#include +#endif +#if SYS_BEOS +#include +#endif +#if SYS_MACOSX || SYS_FREEBSD +#include +#include +#endif +#if SYS_OPENBSD +#include +#include +#include +#endif + +const x264_cpu_name_t x264_cpu_names[] = +{ +#if HAVE_MMX +// {"MMX", X264_CPU_MMX}, // we don't support asm on mmx1 cpus anymore +#define MMX2 X264_CPU_MMX|X264_CPU_MMX2 + {"MMX2", MMX2}, + {"MMXEXT", MMX2}, + {"SSE", MMX2|X264_CPU_SSE}, +#define SSE2 MMX2|X264_CPU_SSE|X264_CPU_SSE2 + {"SSE2Slow", SSE2|X264_CPU_SSE2_IS_SLOW}, + {"SSE2", SSE2}, + {"SSE2Fast", SSE2|X264_CPU_SSE2_IS_FAST}, + {"LZCNT", SSE2|X264_CPU_LZCNT}, + {"SSE3", SSE2|X264_CPU_SSE3}, + {"SSSE3", SSE2|X264_CPU_SSE3|X264_CPU_SSSE3}, + {"SSE4.1", SSE2|X264_CPU_SSE3|X264_CPU_SSSE3|X264_CPU_SSE4}, + {"SSE4", SSE2|X264_CPU_SSE3|X264_CPU_SSSE3|X264_CPU_SSE4}, + {"SSE4.2", SSE2|X264_CPU_SSE3|X264_CPU_SSSE3|X264_CPU_SSE4|X264_CPU_SSE42}, +#define AVX SSE2|X264_CPU_SSE3|X264_CPU_SSSE3|X264_CPU_SSE4|X264_CPU_SSE42|X264_CPU_AVX + {"AVX", AVX}, + {"XOP", AVX|X264_CPU_XOP}, + {"FMA4", AVX|X264_CPU_FMA4}, + {"FMA3", AVX|X264_CPU_FMA3}, + {"BMI1", AVX|X264_CPU_LZCNT|X264_CPU_BMI1}, + {"BMI2", AVX|X264_CPU_LZCNT|X264_CPU_BMI1|X264_CPU_BMI2}, +#define AVX2 AVX|X264_CPU_FMA3|X264_CPU_LZCNT|X264_CPU_BMI1|X264_CPU_BMI2|X264_CPU_AVX2 + {"AVX2", AVX2}, + {"AVX512", AVX2|X264_CPU_AVX512}, +#undef AVX2 +#undef AVX +#undef SSE2 +#undef MMX2 + {"Cache32", X264_CPU_CACHELINE_32}, + {"Cache64", X264_CPU_CACHELINE_64}, + {"SlowAtom", X264_CPU_SLOW_ATOM}, + {"SlowPshufb", X264_CPU_SLOW_PSHUFB}, + {"SlowPalignr", X264_CPU_SLOW_PALIGNR}, + {"SlowShuffle", X264_CPU_SLOW_SHUFFLE}, + {"UnalignedStack", X264_CPU_STACK_MOD4}, +#elif ARCH_PPC + {"Altivec", X264_CPU_ALTIVEC}, +#elif ARCH_ARM + {"ARMv6", X264_CPU_ARMV6}, + {"NEON", X264_CPU_NEON}, + {"FastNeonMRC", X264_CPU_FAST_NEON_MRC}, +#elif ARCH_AARCH64 + {"ARMv8", X264_CPU_ARMV8}, + {"NEON", X264_CPU_NEON}, +#elif ARCH_MIPS + {"MSA", X264_CPU_MSA}, +#endif + {"", 0}, +}; + +#if (ARCH_PPC && SYS_LINUX) || (ARCH_ARM && !HAVE_NEON) +#include +#include +static sigjmp_buf jmpbuf; +static volatile sig_atomic_t canjump = 0; + +static void sigill_handler( int sig ) +{ + if( !canjump ) + { + signal( sig, SIG_DFL ); + raise( sig ); + } + + canjump = 0; + siglongjmp( jmpbuf, 1 ); +} +#endif + +#if HAVE_MMX +int x264_cpu_cpuid_test( void ); +void x264_cpu_cpuid( uint32_t op, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx ); +uint64_t x264_cpu_xgetbv( int xcr ); + +uint32_t x264_cpu_detect( void ) +{ + uint32_t cpu = 0; + uint32_t eax, ebx, ecx, edx; + uint32_t vendor[4] = {0}; + uint32_t max_extended_cap, max_basic_cap; + +#if !ARCH_X86_64 + if( !x264_cpu_cpuid_test() ) + return 0; +#endif + + x264_cpu_cpuid( 0, &max_basic_cap, vendor+0, vendor+2, vendor+1 ); + if( max_basic_cap == 0 ) + return 0; + + x264_cpu_cpuid( 1, &eax, &ebx, &ecx, &edx ); + if( edx&0x00800000 ) + cpu |= X264_CPU_MMX; + else + return cpu; + if( edx&0x02000000 ) + cpu |= X264_CPU_MMX2|X264_CPU_SSE; + if( edx&0x04000000 ) + cpu |= X264_CPU_SSE2; + if( ecx&0x00000001 ) + cpu |= X264_CPU_SSE3; + if( ecx&0x00000200 ) + cpu |= X264_CPU_SSSE3|X264_CPU_SSE2_IS_FAST; + if( ecx&0x00080000 ) + cpu |= X264_CPU_SSE4; + if( ecx&0x00100000 ) + cpu |= X264_CPU_SSE42; + + if( ecx&0x08000000 ) /* XGETBV supported and XSAVE enabled by OS */ + { + uint64_t xcr0 = x264_cpu_xgetbv( 0 ); + if( (xcr0&0x6) == 0x6 ) /* XMM/YMM state */ + { + if( ecx&0x10000000 ) + cpu |= X264_CPU_AVX; + if( ecx&0x00001000 ) + cpu |= X264_CPU_FMA3; + + if( max_basic_cap >= 7 ) + { + x264_cpu_cpuid( 7, &eax, &ebx, &ecx, &edx ); + if( ebx&0x00000008 ) + cpu |= X264_CPU_BMI1; + if( ebx&0x00000100 ) + cpu |= X264_CPU_BMI2; + if( ebx&0x00000020 ) + cpu |= X264_CPU_AVX2; + + if( (xcr0&0xE0) == 0xE0 ) /* OPMASK/ZMM state */ + { + if( (ebx&0xD0030000) == 0xD0030000 ) + cpu |= X264_CPU_AVX512; + } + } + } + } + + x264_cpu_cpuid( 0x80000000, &eax, &ebx, &ecx, &edx ); + max_extended_cap = eax; + + if( max_extended_cap >= 0x80000001 ) + { + x264_cpu_cpuid( 0x80000001, &eax, &ebx, &ecx, &edx ); + + if( ecx&0x00000020 ) + cpu |= X264_CPU_LZCNT; /* Supported by Intel chips starting with Haswell */ + if( ecx&0x00000040 ) /* SSE4a, AMD only */ + { + int family = ((eax>>8)&0xf) + ((eax>>20)&0xff); + cpu |= X264_CPU_SSE2_IS_FAST; /* Phenom and later CPUs have fast SSE units */ + if( family == 0x14 ) + { + cpu &= ~X264_CPU_SSE2_IS_FAST; /* SSSE3 doesn't imply fast SSE anymore... */ + cpu |= X264_CPU_SSE2_IS_SLOW; /* Bobcat has 64-bit SIMD units */ + cpu |= X264_CPU_SLOW_PALIGNR; /* palignr is insanely slow on Bobcat */ + } + if( family == 0x16 ) + { + cpu |= X264_CPU_SLOW_PSHUFB; /* Jaguar's pshufb isn't that slow, but it's slow enough + * compared to alternate instruction sequences that this + * is equal or faster on almost all such functions. */ + } + } + + if( cpu & X264_CPU_AVX ) + { + if( ecx&0x00000800 ) /* XOP */ + cpu |= X264_CPU_XOP; + if( ecx&0x00010000 ) /* FMA4 */ + cpu |= X264_CPU_FMA4; + } + + if( !strcmp((char*)vendor, "AuthenticAMD") ) + { + if( edx&0x00400000 ) + cpu |= X264_CPU_MMX2; + if( (cpu&X264_CPU_SSE2) && !(cpu&X264_CPU_SSE2_IS_FAST) ) + cpu |= X264_CPU_SSE2_IS_SLOW; /* AMD CPUs come in two types: terrible at SSE and great at it */ + } + } + + if( !strcmp((char*)vendor, "GenuineIntel") ) + { + x264_cpu_cpuid( 1, &eax, &ebx, &ecx, &edx ); + int family = ((eax>>8)&0xf) + ((eax>>20)&0xff); + int model = ((eax>>4)&0xf) + ((eax>>12)&0xf0); + if( family == 6 ) + { + /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and 6/14 (core1 "yonah") + * theoretically support sse2, but it's significantly slower than mmx for + * almost all of x264's functions, so let's just pretend they don't. */ + if( model == 9 || model == 13 || model == 14 ) + { + cpu &= ~(X264_CPU_SSE2|X264_CPU_SSE3); + assert(!(cpu&(X264_CPU_SSSE3|X264_CPU_SSE4))); + } + /* Detect Atom CPU */ + else if( model == 28 ) + { + cpu |= X264_CPU_SLOW_ATOM; + cpu |= X264_CPU_SLOW_PSHUFB; + } + /* Conroe has a slow shuffle unit. Check the model number to make sure not + * to include crippled low-end Penryns and Nehalems that don't have SSE4. */ + else if( (cpu&X264_CPU_SSSE3) && !(cpu&X264_CPU_SSE4) && model < 23 ) + cpu |= X264_CPU_SLOW_SHUFFLE; + } + } + + if( (!strcmp((char*)vendor, "GenuineIntel") || !strcmp((char*)vendor, "CyrixInstead")) && !(cpu&X264_CPU_SSE42)) + { + /* cacheline size is specified in 3 places, any of which may be missing */ + x264_cpu_cpuid( 1, &eax, &ebx, &ecx, &edx ); + int cache = (ebx&0xff00)>>5; // cflush size + if( !cache && max_extended_cap >= 0x80000006 ) + { + x264_cpu_cpuid( 0x80000006, &eax, &ebx, &ecx, &edx ); + cache = ecx&0xff; // cacheline size + } + if( !cache && max_basic_cap >= 2 ) + { + // Cache and TLB Information + static const char cache32_ids[] = { 0x0a, 0x0c, 0x41, 0x42, 0x43, 0x44, 0x45, 0x82, 0x83, 0x84, 0x85, 0 }; + static const char cache64_ids[] = { 0x22, 0x23, 0x25, 0x29, 0x2c, 0x46, 0x47, 0x49, 0x60, 0x66, 0x67, + 0x68, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7c, 0x7f, 0x86, 0x87, 0 }; + uint32_t buf[4]; + int max, i = 0; + do { + x264_cpu_cpuid( 2, buf+0, buf+1, buf+2, buf+3 ); + max = buf[0]&0xff; + buf[0] &= ~0xff; + for( int j = 0; j < 4; j++ ) + if( !(buf[j]>>31) ) + while( buf[j] ) + { + if( strchr( cache32_ids, buf[j]&0xff ) ) + cache = 32; + if( strchr( cache64_ids, buf[j]&0xff ) ) + cache = 64; + buf[j] >>= 8; + } + } while( ++i < max ); + } + + if( cache == 32 ) + cpu |= X264_CPU_CACHELINE_32; + else if( cache == 64 ) + cpu |= X264_CPU_CACHELINE_64; + else + x264_log( NULL, X264_LOG_WARNING, "unable to determine cacheline size\n" ); + } + +#if STACK_ALIGNMENT < 16 + cpu |= X264_CPU_STACK_MOD4; +#endif + + return cpu; +} + +#elif ARCH_PPC && HAVE_ALTIVEC + +#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD +#include +uint32_t x264_cpu_detect( void ) +{ + /* Thank you VLC */ + uint32_t cpu = 0; +#if SYS_OPENBSD + int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC }; +#elif SYS_MACOSX + int selectors[2] = { CTL_HW, HW_VECTORUNIT }; +#endif + int has_altivec = 0; + size_t length = sizeof( has_altivec ); +#if SYS_MACOSX || SYS_OPENBSD + int error = sysctl( selectors, 2, &has_altivec, &length, NULL, 0 ); +#else + int error = sysctlbyname( "hw.altivec", &has_altivec, &length, NULL, 0 ); +#endif + + if( error == 0 && has_altivec != 0 ) + cpu |= X264_CPU_ALTIVEC; + + return cpu; +} + +#elif SYS_LINUX + +uint32_t x264_cpu_detect( void ) +{ +#ifdef __NO_FPRS__ + return 0; +#else + static void (*oldsig)( int ); + + oldsig = signal( SIGILL, sigill_handler ); + if( sigsetjmp( jmpbuf, 1 ) ) + { + signal( SIGILL, oldsig ); + return 0; + } + + canjump = 1; + asm volatile( "mtspr 256, %0\n\t" + "vand 0, 0, 0\n\t" + : + : "r"(-1) ); + canjump = 0; + + signal( SIGILL, oldsig ); + + return X264_CPU_ALTIVEC; +#endif +} +#endif + +#elif ARCH_ARM + +void x264_cpu_neon_test( void ); +int x264_cpu_fast_neon_mrc_test( void ); + +uint32_t x264_cpu_detect( void ) +{ + int flags = 0; +#if HAVE_ARMV6 + flags |= X264_CPU_ARMV6; + + // don't do this hack if compiled with -mfpu=neon +#if !HAVE_NEON + static void (* oldsig)( int ); + oldsig = signal( SIGILL, sigill_handler ); + if( sigsetjmp( jmpbuf, 1 ) ) + { + signal( SIGILL, oldsig ); + return flags; + } + + canjump = 1; + x264_cpu_neon_test(); + canjump = 0; + signal( SIGILL, oldsig ); +#endif + + flags |= X264_CPU_NEON; + + // fast neon -> arm (Cortex-A9) detection relies on user access to the + // cycle counter; this assumes ARMv7 performance counters. + // NEON requires at least ARMv7, ARMv8 may require changes here, but + // hopefully this hacky detection method will have been replaced by then. + // Note that there is potential for a race condition if another program or + // x264 instance disables or reinits the counters while x264 is using them, + // which may result in incorrect detection and the counters stuck enabled. + // right now Apple does not seem to support performance counters for this test +#ifndef __MACH__ + flags |= x264_cpu_fast_neon_mrc_test() ? X264_CPU_FAST_NEON_MRC : 0; +#endif + // TODO: write dual issue test? currently it's A8 (dual issue) vs. A9 (fast mrc) +#endif + return flags; +} + +#elif ARCH_AARCH64 + +uint32_t x264_cpu_detect( void ) +{ + return X264_CPU_ARMV8 | X264_CPU_NEON; +} + +#elif ARCH_MIPS + +uint32_t x264_cpu_detect( void ) +{ + uint32_t flags = 0; +#if HAVE_MSA + flags |= X264_CPU_MSA; +#endif + return flags; +} + +#else + +uint32_t x264_cpu_detect( void ) +{ + return 0; +} + +#endif + +int x264_cpu_num_processors( void ) +{ +#if !HAVE_THREAD + return 1; + +#elif SYS_WINDOWS + return x264_pthread_num_processors_np(); + +#elif SYS_CYGWIN || SYS_SunOS + return sysconf( _SC_NPROCESSORS_ONLN ); + +#elif SYS_LINUX +#ifdef __ANDROID__ + // Android NDK does not expose sched_getaffinity + return sysconf( _SC_NPROCESSORS_CONF ); +#else + cpu_set_t p_aff; + memset( &p_aff, 0, sizeof(p_aff) ); + if( sched_getaffinity( 0, sizeof(p_aff), &p_aff ) ) + return 1; +#if HAVE_CPU_COUNT + return CPU_COUNT(&p_aff); +#else + int np = 0; + for( unsigned int bit = 0; bit < 8 * sizeof(p_aff); bit++ ) + np += (((uint8_t *)&p_aff)[bit / 8] >> (bit % 8)) & 1; + return np; +#endif +#endif + +#elif SYS_BEOS + system_info info; + get_system_info( &info ); + return info.cpu_count; + +#elif SYS_MACOSX || SYS_FREEBSD || SYS_OPENBSD + int ncpu; + size_t length = sizeof( ncpu ); +#if SYS_OPENBSD + int mib[2] = { CTL_HW, HW_NCPU }; + if( sysctl(mib, 2, &ncpu, &length, NULL, 0) ) +#else + if( sysctlbyname("hw.ncpu", &ncpu, &length, NULL, 0) ) +#endif + { + ncpu = 1; + } + return ncpu; + +#else + return 1; +#endif +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.h new file mode 100644 index 00000000..845034c4 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/cpu.h @@ -0,0 +1,73 @@ +/***************************************************************************** + * cpu.h: cpu detection + ***************************************************************************** + * Copyright (C) 2004-2017 x264 project + * + * Authors: Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_CPU_H +#define X264_CPU_H + +uint32_t x264_cpu_detect( void ); +int x264_cpu_num_processors( void ); +void x264_cpu_emms( void ); +void x264_cpu_sfence( void ); +#if HAVE_MMX +/* There is no way to forbid the compiler from using float instructions + * before the emms so miscompilation could theoretically occur in the + * unlikely event that the compiler reorders emms and float instructions. */ +#if HAVE_X86_INLINE_ASM +/* Clobbering memory makes the compiler less likely to reorder code. */ +#define x264_emms() asm volatile( "emms":::"memory","st","st(1)","st(2)", \ + "st(3)","st(4)","st(5)","st(6)","st(7)" ) +#else +#define x264_emms() x264_cpu_emms() +#endif +#else +#define x264_emms() +#endif +#define x264_sfence x264_cpu_sfence + +/* kludge: + * gcc can't give variables any greater alignment than the stack frame has. + * We need 32 byte alignment for AVX2, so here we make sure that the stack is + * aligned to 32 bytes. + * gcc 4.2 introduced __attribute__((force_align_arg_pointer)) to fix this + * problem, but I don't want to require such a new version. + * aligning to 32 bytes only works if the compiler supports keeping that + * alignment between functions (osdep.h handles manual alignment of arrays + * if it doesn't). + */ +#if HAVE_MMX && (STACK_ALIGNMENT > 16 || (ARCH_X86 && STACK_ALIGNMENT > 4)) +intptr_t x264_stack_align( void (*func)(), ... ); +#define x264_stack_align(func,...) x264_stack_align((void (*)())func, __VA_ARGS__) +#else +#define x264_stack_align(func,...) func(__VA_ARGS__) +#endif + +typedef struct +{ + const char *name; + uint32_t flags; +} x264_cpu_name_t; +extern const x264_cpu_name_t x264_cpu_names[]; + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.c new file mode 100644 index 00000000..a2010433 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.c @@ -0,0 +1,1155 @@ +/***************************************************************************** + * dct.c: transform and zigzag + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" +#if HAVE_MMX +# include "x86/dct.h" +#endif +#if ARCH_PPC +# include "ppc/dct.h" +#endif +#if ARCH_ARM +# include "arm/dct.h" +#endif +#if ARCH_AARCH64 +# include "aarch64/dct.h" +#endif +#if ARCH_MIPS +# include "mips/dct.h" +#endif + +/* the inverse of the scaling factors introduced by 8x8 fdct */ +/* uint32 is for the asm implementation of trellis. the actual values fit in uint16. */ +#define W(i) (i==0 ? FIX8(1.0000) :\ + i==1 ? FIX8(0.8859) :\ + i==2 ? FIX8(1.6000) :\ + i==3 ? FIX8(0.9415) :\ + i==4 ? FIX8(1.2651) :\ + i==5 ? FIX8(1.1910) :0) +const uint32_t x264_dct8_weight_tab[64] = { + W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1), + W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1), + + W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1), + W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1) +}; +#undef W + +#define W(i) (i==0 ? FIX8(1.76777) :\ + i==1 ? FIX8(1.11803) :\ + i==2 ? FIX8(0.70711) :0) +const uint32_t x264_dct4_weight_tab[16] = { + W(0), W(1), W(0), W(1), + W(1), W(2), W(1), W(2), + W(0), W(1), W(0), W(1), + W(1), W(2), W(1), W(2) +}; +#undef W + +/* inverse squared */ +#define W(i) (i==0 ? FIX8(3.125) :\ + i==1 ? FIX8(1.25) :\ + i==2 ? FIX8(0.5) :0) +const uint32_t x264_dct4_weight2_tab[16] = { + W(0), W(1), W(0), W(1), + W(1), W(2), W(1), W(2), + W(0), W(1), W(0), W(1), + W(1), W(2), W(1), W(2) +}; +#undef W + +#define W(i) (i==0 ? FIX8(1.00000) :\ + i==1 ? FIX8(0.78487) :\ + i==2 ? FIX8(2.56132) :\ + i==3 ? FIX8(0.88637) :\ + i==4 ? FIX8(1.60040) :\ + i==5 ? FIX8(1.41850) :0) +const uint32_t x264_dct8_weight2_tab[64] = { + W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1), + W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1), + + W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1), + W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5), + W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1) +}; +#undef W + + +static void dct4x4dc( dctcoef d[16] ) +{ + dctcoef tmp[16]; + + for( int i = 0; i < 4; i++ ) + { + int s01 = d[i*4+0] + d[i*4+1]; + int d01 = d[i*4+0] - d[i*4+1]; + int s23 = d[i*4+2] + d[i*4+3]; + int d23 = d[i*4+2] - d[i*4+3]; + + tmp[0*4+i] = s01 + s23; + tmp[1*4+i] = s01 - s23; + tmp[2*4+i] = d01 - d23; + tmp[3*4+i] = d01 + d23; + } + + for( int i = 0; i < 4; i++ ) + { + int s01 = tmp[i*4+0] + tmp[i*4+1]; + int d01 = tmp[i*4+0] - tmp[i*4+1]; + int s23 = tmp[i*4+2] + tmp[i*4+3]; + int d23 = tmp[i*4+2] - tmp[i*4+3]; + + d[i*4+0] = ( s01 + s23 + 1 ) >> 1; + d[i*4+1] = ( s01 - s23 + 1 ) >> 1; + d[i*4+2] = ( d01 - d23 + 1 ) >> 1; + d[i*4+3] = ( d01 + d23 + 1 ) >> 1; + } +} + +static void idct4x4dc( dctcoef d[16] ) +{ + dctcoef tmp[16]; + + for( int i = 0; i < 4; i++ ) + { + int s01 = d[i*4+0] + d[i*4+1]; + int d01 = d[i*4+0] - d[i*4+1]; + int s23 = d[i*4+2] + d[i*4+3]; + int d23 = d[i*4+2] - d[i*4+3]; + + tmp[0*4+i] = s01 + s23; + tmp[1*4+i] = s01 - s23; + tmp[2*4+i] = d01 - d23; + tmp[3*4+i] = d01 + d23; + } + + for( int i = 0; i < 4; i++ ) + { + int s01 = tmp[i*4+0] + tmp[i*4+1]; + int d01 = tmp[i*4+0] - tmp[i*4+1]; + int s23 = tmp[i*4+2] + tmp[i*4+3]; + int d23 = tmp[i*4+2] - tmp[i*4+3]; + + d[i*4+0] = s01 + s23; + d[i*4+1] = s01 - s23; + d[i*4+2] = d01 - d23; + d[i*4+3] = d01 + d23; + } +} + +static void dct2x4dc( dctcoef dct[8], dctcoef dct4x4[8][16] ) +{ + int a0 = dct4x4[0][0] + dct4x4[1][0]; + int a1 = dct4x4[2][0] + dct4x4[3][0]; + int a2 = dct4x4[4][0] + dct4x4[5][0]; + int a3 = dct4x4[6][0] + dct4x4[7][0]; + int a4 = dct4x4[0][0] - dct4x4[1][0]; + int a5 = dct4x4[2][0] - dct4x4[3][0]; + int a6 = dct4x4[4][0] - dct4x4[5][0]; + int a7 = dct4x4[6][0] - dct4x4[7][0]; + int b0 = a0 + a1; + int b1 = a2 + a3; + int b2 = a4 + a5; + int b3 = a6 + a7; + int b4 = a0 - a1; + int b5 = a2 - a3; + int b6 = a4 - a5; + int b7 = a6 - a7; + dct[0] = b0 + b1; + dct[1] = b2 + b3; + dct[2] = b0 - b1; + dct[3] = b2 - b3; + dct[4] = b4 - b5; + dct[5] = b6 - b7; + dct[6] = b4 + b5; + dct[7] = b6 + b7; + dct4x4[0][0] = 0; + dct4x4[1][0] = 0; + dct4x4[2][0] = 0; + dct4x4[3][0] = 0; + dct4x4[4][0] = 0; + dct4x4[5][0] = 0; + dct4x4[6][0] = 0; + dct4x4[7][0] = 0; +} + +static inline void pixel_sub_wxh( dctcoef *diff, int i_size, + pixel *pix1, int i_pix1, pixel *pix2, int i_pix2 ) +{ + for( int y = 0; y < i_size; y++ ) + { + for( int x = 0; x < i_size; x++ ) + diff[x + y*i_size] = pix1[x] - pix2[x]; + pix1 += i_pix1; + pix2 += i_pix2; + } +} + +static void sub4x4_dct( dctcoef dct[16], pixel *pix1, pixel *pix2 ) +{ + dctcoef d[16]; + dctcoef tmp[16]; + + pixel_sub_wxh( d, 4, pix1, FENC_STRIDE, pix2, FDEC_STRIDE ); + + for( int i = 0; i < 4; i++ ) + { + int s03 = d[i*4+0] + d[i*4+3]; + int s12 = d[i*4+1] + d[i*4+2]; + int d03 = d[i*4+0] - d[i*4+3]; + int d12 = d[i*4+1] - d[i*4+2]; + + tmp[0*4+i] = s03 + s12; + tmp[1*4+i] = 2*d03 + d12; + tmp[2*4+i] = s03 - s12; + tmp[3*4+i] = d03 - 2*d12; + } + + for( int i = 0; i < 4; i++ ) + { + int s03 = tmp[i*4+0] + tmp[i*4+3]; + int s12 = tmp[i*4+1] + tmp[i*4+2]; + int d03 = tmp[i*4+0] - tmp[i*4+3]; + int d12 = tmp[i*4+1] - tmp[i*4+2]; + + dct[i*4+0] = s03 + s12; + dct[i*4+1] = 2*d03 + d12; + dct[i*4+2] = s03 - s12; + dct[i*4+3] = d03 - 2*d12; + } +} + +static void sub8x8_dct( dctcoef dct[4][16], pixel *pix1, pixel *pix2 ) +{ + sub4x4_dct( dct[0], &pix1[0], &pix2[0] ); + sub4x4_dct( dct[1], &pix1[4], &pix2[4] ); + sub4x4_dct( dct[2], &pix1[4*FENC_STRIDE+0], &pix2[4*FDEC_STRIDE+0] ); + sub4x4_dct( dct[3], &pix1[4*FENC_STRIDE+4], &pix2[4*FDEC_STRIDE+4] ); +} + +static void sub16x16_dct( dctcoef dct[16][16], pixel *pix1, pixel *pix2 ) +{ + sub8x8_dct( &dct[ 0], &pix1[0], &pix2[0] ); + sub8x8_dct( &dct[ 4], &pix1[8], &pix2[8] ); + sub8x8_dct( &dct[ 8], &pix1[8*FENC_STRIDE+0], &pix2[8*FDEC_STRIDE+0] ); + sub8x8_dct( &dct[12], &pix1[8*FENC_STRIDE+8], &pix2[8*FDEC_STRIDE+8] ); +} + +static int sub4x4_dct_dc( pixel *pix1, pixel *pix2 ) +{ + int sum = 0; + for( int i=0; i<4; i++, pix1 += FENC_STRIDE, pix2 += FDEC_STRIDE ) + sum += pix1[0] + pix1[1] + pix1[2] + pix1[3] + - pix2[0] - pix2[1] - pix2[2] - pix2[3]; + return sum; +} + +static void sub8x8_dct_dc( dctcoef dct[4], pixel *pix1, pixel *pix2 ) +{ + dct[0] = sub4x4_dct_dc( &pix1[0], &pix2[0] ); + dct[1] = sub4x4_dct_dc( &pix1[4], &pix2[4] ); + dct[2] = sub4x4_dct_dc( &pix1[4*FENC_STRIDE+0], &pix2[4*FDEC_STRIDE+0] ); + dct[3] = sub4x4_dct_dc( &pix1[4*FENC_STRIDE+4], &pix2[4*FDEC_STRIDE+4] ); + + /* 2x2 DC transform */ + int d0 = dct[0] + dct[1]; + int d1 = dct[2] + dct[3]; + int d2 = dct[0] - dct[1]; + int d3 = dct[2] - dct[3]; + dct[0] = d0 + d1; + dct[1] = d0 - d1; + dct[2] = d2 + d3; + dct[3] = d2 - d3; +} + +static void sub8x16_dct_dc( dctcoef dct[8], pixel *pix1, pixel *pix2 ) +{ + int a0 = sub4x4_dct_dc( &pix1[ 0*FENC_STRIDE+0], &pix2[ 0*FDEC_STRIDE+0] ); + int a1 = sub4x4_dct_dc( &pix1[ 0*FENC_STRIDE+4], &pix2[ 0*FDEC_STRIDE+4] ); + int a2 = sub4x4_dct_dc( &pix1[ 4*FENC_STRIDE+0], &pix2[ 4*FDEC_STRIDE+0] ); + int a3 = sub4x4_dct_dc( &pix1[ 4*FENC_STRIDE+4], &pix2[ 4*FDEC_STRIDE+4] ); + int a4 = sub4x4_dct_dc( &pix1[ 8*FENC_STRIDE+0], &pix2[ 8*FDEC_STRIDE+0] ); + int a5 = sub4x4_dct_dc( &pix1[ 8*FENC_STRIDE+4], &pix2[ 8*FDEC_STRIDE+4] ); + int a6 = sub4x4_dct_dc( &pix1[12*FENC_STRIDE+0], &pix2[12*FDEC_STRIDE+0] ); + int a7 = sub4x4_dct_dc( &pix1[12*FENC_STRIDE+4], &pix2[12*FDEC_STRIDE+4] ); + + /* 2x4 DC transform */ + int b0 = a0 + a1; + int b1 = a2 + a3; + int b2 = a4 + a5; + int b3 = a6 + a7; + int b4 = a0 - a1; + int b5 = a2 - a3; + int b6 = a4 - a5; + int b7 = a6 - a7; + a0 = b0 + b1; + a1 = b2 + b3; + a2 = b4 + b5; + a3 = b6 + b7; + a4 = b0 - b1; + a5 = b2 - b3; + a6 = b4 - b5; + a7 = b6 - b7; + dct[0] = a0 + a1; + dct[1] = a2 + a3; + dct[2] = a0 - a1; + dct[3] = a2 - a3; + dct[4] = a4 - a5; + dct[5] = a6 - a7; + dct[6] = a4 + a5; + dct[7] = a6 + a7; +} + +static void add4x4_idct( pixel *p_dst, dctcoef dct[16] ) +{ + dctcoef d[16]; + dctcoef tmp[16]; + + for( int i = 0; i < 4; i++ ) + { + int s02 = dct[0*4+i] + dct[2*4+i]; + int d02 = dct[0*4+i] - dct[2*4+i]; + int s13 = dct[1*4+i] + (dct[3*4+i]>>1); + int d13 = (dct[1*4+i]>>1) - dct[3*4+i]; + + tmp[i*4+0] = s02 + s13; + tmp[i*4+1] = d02 + d13; + tmp[i*4+2] = d02 - d13; + tmp[i*4+3] = s02 - s13; + } + + for( int i = 0; i < 4; i++ ) + { + int s02 = tmp[0*4+i] + tmp[2*4+i]; + int d02 = tmp[0*4+i] - tmp[2*4+i]; + int s13 = tmp[1*4+i] + (tmp[3*4+i]>>1); + int d13 = (tmp[1*4+i]>>1) - tmp[3*4+i]; + + d[0*4+i] = ( s02 + s13 + 32 ) >> 6; + d[1*4+i] = ( d02 + d13 + 32 ) >> 6; + d[2*4+i] = ( d02 - d13 + 32 ) >> 6; + d[3*4+i] = ( s02 - s13 + 32 ) >> 6; + } + + + for( int y = 0; y < 4; y++ ) + { + for( int x = 0; x < 4; x++ ) + p_dst[x] = x264_clip_pixel( p_dst[x] + d[y*4+x] ); + p_dst += FDEC_STRIDE; + } +} + +static void add8x8_idct( pixel *p_dst, dctcoef dct[4][16] ) +{ + add4x4_idct( &p_dst[0], dct[0] ); + add4x4_idct( &p_dst[4], dct[1] ); + add4x4_idct( &p_dst[4*FDEC_STRIDE+0], dct[2] ); + add4x4_idct( &p_dst[4*FDEC_STRIDE+4], dct[3] ); +} + +static void add16x16_idct( pixel *p_dst, dctcoef dct[16][16] ) +{ + add8x8_idct( &p_dst[0], &dct[0] ); + add8x8_idct( &p_dst[8], &dct[4] ); + add8x8_idct( &p_dst[8*FDEC_STRIDE+0], &dct[8] ); + add8x8_idct( &p_dst[8*FDEC_STRIDE+8], &dct[12] ); +} + +/**************************************************************************** + * 8x8 transform: + ****************************************************************************/ + +#define DCT8_1D {\ + int s07 = SRC(0) + SRC(7);\ + int s16 = SRC(1) + SRC(6);\ + int s25 = SRC(2) + SRC(5);\ + int s34 = SRC(3) + SRC(4);\ + int a0 = s07 + s34;\ + int a1 = s16 + s25;\ + int a2 = s07 - s34;\ + int a3 = s16 - s25;\ + int d07 = SRC(0) - SRC(7);\ + int d16 = SRC(1) - SRC(6);\ + int d25 = SRC(2) - SRC(5);\ + int d34 = SRC(3) - SRC(4);\ + int a4 = d16 + d25 + (d07 + (d07>>1));\ + int a5 = d07 - d34 - (d25 + (d25>>1));\ + int a6 = d07 + d34 - (d16 + (d16>>1));\ + int a7 = d16 - d25 + (d34 + (d34>>1));\ + DST(0) = a0 + a1 ;\ + DST(1) = a4 + (a7>>2);\ + DST(2) = a2 + (a3>>1);\ + DST(3) = a5 + (a6>>2);\ + DST(4) = a0 - a1 ;\ + DST(5) = a6 - (a5>>2);\ + DST(6) = (a2>>1) - a3 ;\ + DST(7) = (a4>>2) - a7 ;\ +} + +static void sub8x8_dct8( dctcoef dct[64], pixel *pix1, pixel *pix2 ) +{ + dctcoef tmp[64]; + + pixel_sub_wxh( tmp, 8, pix1, FENC_STRIDE, pix2, FDEC_STRIDE ); + +#undef SRC +#define SRC(x) tmp[x*8+i] +#define DST(x) tmp[x*8+i] + for( int i = 0; i < 8; i++ ) + DCT8_1D +#undef SRC +#undef DST + +#define SRC(x) tmp[i*8+x] +#define DST(x) dct[x*8+i] + for( int i = 0; i < 8; i++ ) + DCT8_1D +#undef SRC +#undef DST +} + +static void sub16x16_dct8( dctcoef dct[4][64], pixel *pix1, pixel *pix2 ) +{ + sub8x8_dct8( dct[0], &pix1[0], &pix2[0] ); + sub8x8_dct8( dct[1], &pix1[8], &pix2[8] ); + sub8x8_dct8( dct[2], &pix1[8*FENC_STRIDE+0], &pix2[8*FDEC_STRIDE+0] ); + sub8x8_dct8( dct[3], &pix1[8*FENC_STRIDE+8], &pix2[8*FDEC_STRIDE+8] ); +} + +#define IDCT8_1D {\ + int a0 = SRC(0) + SRC(4);\ + int a2 = SRC(0) - SRC(4);\ + int a4 = (SRC(2)>>1) - SRC(6);\ + int a6 = (SRC(6)>>1) + SRC(2);\ + int b0 = a0 + a6;\ + int b2 = a2 + a4;\ + int b4 = a2 - a4;\ + int b6 = a0 - a6;\ + int a1 = -SRC(3) + SRC(5) - SRC(7) - (SRC(7)>>1);\ + int a3 = SRC(1) + SRC(7) - SRC(3) - (SRC(3)>>1);\ + int a5 = -SRC(1) + SRC(7) + SRC(5) + (SRC(5)>>1);\ + int a7 = SRC(3) + SRC(5) + SRC(1) + (SRC(1)>>1);\ + int b1 = (a7>>2) + a1;\ + int b3 = a3 + (a5>>2);\ + int b5 = (a3>>2) - a5;\ + int b7 = a7 - (a1>>2);\ + DST(0, b0 + b7);\ + DST(1, b2 + b5);\ + DST(2, b4 + b3);\ + DST(3, b6 + b1);\ + DST(4, b6 - b1);\ + DST(5, b4 - b3);\ + DST(6, b2 - b5);\ + DST(7, b0 - b7);\ +} + +static void add8x8_idct8( pixel *dst, dctcoef dct[64] ) +{ + dct[0] += 32; // rounding for the >>6 at the end + +#define SRC(x) dct[x*8+i] +#define DST(x,rhs) dct[x*8+i] = (rhs) + for( int i = 0; i < 8; i++ ) + IDCT8_1D +#undef SRC +#undef DST + +#define SRC(x) dct[i*8+x] +#define DST(x,rhs) dst[i + x*FDEC_STRIDE] = x264_clip_pixel( dst[i + x*FDEC_STRIDE] + ((rhs) >> 6) ); + for( int i = 0; i < 8; i++ ) + IDCT8_1D +#undef SRC +#undef DST +} + +static void add16x16_idct8( pixel *dst, dctcoef dct[4][64] ) +{ + add8x8_idct8( &dst[0], dct[0] ); + add8x8_idct8( &dst[8], dct[1] ); + add8x8_idct8( &dst[8*FDEC_STRIDE+0], dct[2] ); + add8x8_idct8( &dst[8*FDEC_STRIDE+8], dct[3] ); +} + +static void inline add4x4_idct_dc( pixel *p_dst, dctcoef dc ) +{ + dc = (dc + 32) >> 6; + for( int i = 0; i < 4; i++, p_dst += FDEC_STRIDE ) + { + p_dst[0] = x264_clip_pixel( p_dst[0] + dc ); + p_dst[1] = x264_clip_pixel( p_dst[1] + dc ); + p_dst[2] = x264_clip_pixel( p_dst[2] + dc ); + p_dst[3] = x264_clip_pixel( p_dst[3] + dc ); + } +} + +static void add8x8_idct_dc( pixel *p_dst, dctcoef dct[4] ) +{ + add4x4_idct_dc( &p_dst[0], dct[0] ); + add4x4_idct_dc( &p_dst[4], dct[1] ); + add4x4_idct_dc( &p_dst[4*FDEC_STRIDE+0], dct[2] ); + add4x4_idct_dc( &p_dst[4*FDEC_STRIDE+4], dct[3] ); +} + +static void add16x16_idct_dc( pixel *p_dst, dctcoef dct[16] ) +{ + for( int i = 0; i < 4; i++, dct += 4, p_dst += 4*FDEC_STRIDE ) + { + add4x4_idct_dc( &p_dst[ 0], dct[0] ); + add4x4_idct_dc( &p_dst[ 4], dct[1] ); + add4x4_idct_dc( &p_dst[ 8], dct[2] ); + add4x4_idct_dc( &p_dst[12], dct[3] ); + } +} + + +/**************************************************************************** + * x264_dct_init: + ****************************************************************************/ +void x264_dct_init( int cpu, x264_dct_function_t *dctf ) +{ + dctf->sub4x4_dct = sub4x4_dct; + dctf->add4x4_idct = add4x4_idct; + + dctf->sub8x8_dct = sub8x8_dct; + dctf->sub8x8_dct_dc = sub8x8_dct_dc; + dctf->add8x8_idct = add8x8_idct; + dctf->add8x8_idct_dc = add8x8_idct_dc; + + dctf->sub8x16_dct_dc = sub8x16_dct_dc; + + dctf->sub16x16_dct = sub16x16_dct; + dctf->add16x16_idct = add16x16_idct; + dctf->add16x16_idct_dc = add16x16_idct_dc; + + dctf->sub8x8_dct8 = sub8x8_dct8; + dctf->add8x8_idct8 = add8x8_idct8; + + dctf->sub16x16_dct8 = sub16x16_dct8; + dctf->add16x16_idct8 = add16x16_idct8; + + dctf->dct4x4dc = dct4x4dc; + dctf->idct4x4dc = idct4x4dc; + + dctf->dct2x4dc = dct2x4dc; + +#if HIGH_BIT_DEPTH +#if HAVE_MMX + if( cpu&X264_CPU_MMX ) + { + dctf->sub4x4_dct = x264_sub4x4_dct_mmx; + dctf->sub8x8_dct = x264_sub8x8_dct_mmx; + dctf->sub16x16_dct = x264_sub16x16_dct_mmx; + } + if( cpu&X264_CPU_SSE2 ) + { + dctf->add4x4_idct = x264_add4x4_idct_sse2; + dctf->dct4x4dc = x264_dct4x4dc_sse2; + dctf->idct4x4dc = x264_idct4x4dc_sse2; + dctf->dct2x4dc = x264_dct2x4dc_sse2; + dctf->sub8x8_dct8 = x264_sub8x8_dct8_sse2; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_sse2; + dctf->add8x8_idct = x264_add8x8_idct_sse2; + dctf->add16x16_idct = x264_add16x16_idct_sse2; + dctf->add8x8_idct8 = x264_add8x8_idct8_sse2; + dctf->add16x16_idct8 = x264_add16x16_idct8_sse2; + dctf->sub8x8_dct_dc = x264_sub8x8_dct_dc_sse2; + dctf->add8x8_idct_dc = x264_add8x8_idct_dc_sse2; + dctf->sub8x16_dct_dc = x264_sub8x16_dct_dc_sse2; + dctf->add16x16_idct_dc= x264_add16x16_idct_dc_sse2; + } + if( cpu&X264_CPU_SSE4 ) + { + dctf->sub8x8_dct8 = x264_sub8x8_dct8_sse4; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_sse4; + } + if( cpu&X264_CPU_AVX ) + { + dctf->add4x4_idct = x264_add4x4_idct_avx; + dctf->dct4x4dc = x264_dct4x4dc_avx; + dctf->idct4x4dc = x264_idct4x4dc_avx; + dctf->dct2x4dc = x264_dct2x4dc_avx; + dctf->sub8x8_dct8 = x264_sub8x8_dct8_avx; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_avx; + dctf->add8x8_idct = x264_add8x8_idct_avx; + dctf->add16x16_idct = x264_add16x16_idct_avx; + dctf->add8x8_idct8 = x264_add8x8_idct8_avx; + dctf->add16x16_idct8 = x264_add16x16_idct8_avx; + dctf->add8x8_idct_dc = x264_add8x8_idct_dc_avx; + dctf->sub8x16_dct_dc = x264_sub8x16_dct_dc_avx; + dctf->add16x16_idct_dc= x264_add16x16_idct_dc_avx; + } +#endif // HAVE_MMX +#else // !HIGH_BIT_DEPTH +#if HAVE_MMX + if( cpu&X264_CPU_MMX ) + { + dctf->sub4x4_dct = x264_sub4x4_dct_mmx; + dctf->add4x4_idct = x264_add4x4_idct_mmx; + dctf->idct4x4dc = x264_idct4x4dc_mmx; + dctf->sub8x8_dct_dc = x264_sub8x8_dct_dc_mmx2; + +#if !ARCH_X86_64 + dctf->sub8x8_dct = x264_sub8x8_dct_mmx; + dctf->sub16x16_dct = x264_sub16x16_dct_mmx; + dctf->add8x8_idct = x264_add8x8_idct_mmx; + dctf->add16x16_idct = x264_add16x16_idct_mmx; + + dctf->sub8x8_dct8 = x264_sub8x8_dct8_mmx; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_mmx; + dctf->add8x8_idct8 = x264_add8x8_idct8_mmx; + dctf->add16x16_idct8= x264_add16x16_idct8_mmx; +#endif + } + + if( cpu&X264_CPU_MMX2 ) + { + dctf->dct4x4dc = x264_dct4x4dc_mmx2; + dctf->dct2x4dc = x264_dct2x4dc_mmx2; + dctf->add8x8_idct_dc = x264_add8x8_idct_dc_mmx2; + dctf->add16x16_idct_dc = x264_add16x16_idct_dc_mmx2; + } + + if( cpu&X264_CPU_SSE2 ) + { + dctf->sub8x8_dct8 = x264_sub8x8_dct8_sse2; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_sse2; + dctf->sub8x8_dct_dc = x264_sub8x8_dct_dc_sse2; + dctf->sub8x16_dct_dc= x264_sub8x16_dct_dc_sse2; + dctf->add8x8_idct8 = x264_add8x8_idct8_sse2; + dctf->add16x16_idct8= x264_add16x16_idct8_sse2; + + if( !(cpu&X264_CPU_SSE2_IS_SLOW) ) + { + dctf->sub8x8_dct = x264_sub8x8_dct_sse2; + dctf->sub16x16_dct = x264_sub16x16_dct_sse2; + dctf->add8x8_idct = x264_add8x8_idct_sse2; + dctf->add16x16_idct = x264_add16x16_idct_sse2; + dctf->add16x16_idct_dc = x264_add16x16_idct_dc_sse2; + } + } + + if( (cpu&X264_CPU_SSSE3) && !(cpu&X264_CPU_SSE2_IS_SLOW) ) + { + dctf->sub8x16_dct_dc = x264_sub8x16_dct_dc_ssse3; + if( !(cpu&X264_CPU_SLOW_ATOM) ) + { + dctf->sub4x4_dct = x264_sub4x4_dct_ssse3; + dctf->sub8x8_dct = x264_sub8x8_dct_ssse3; + dctf->sub16x16_dct = x264_sub16x16_dct_ssse3; + dctf->sub8x8_dct8 = x264_sub8x8_dct8_ssse3; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_ssse3; + if( !(cpu&X264_CPU_SLOW_PSHUFB) ) + { + dctf->add8x8_idct_dc = x264_add8x8_idct_dc_ssse3; + dctf->add16x16_idct_dc = x264_add16x16_idct_dc_ssse3; + } + } + } + + if( cpu&X264_CPU_SSE4 ) + dctf->add4x4_idct = x264_add4x4_idct_sse4; + + if( cpu&X264_CPU_AVX ) + { + dctf->add4x4_idct = x264_add4x4_idct_avx; + dctf->add8x8_idct = x264_add8x8_idct_avx; + dctf->add16x16_idct = x264_add16x16_idct_avx; + dctf->add8x8_idct8 = x264_add8x8_idct8_avx; + dctf->add16x16_idct8 = x264_add16x16_idct8_avx; + dctf->add16x16_idct_dc = x264_add16x16_idct_dc_avx; + dctf->sub8x8_dct = x264_sub8x8_dct_avx; + dctf->sub16x16_dct = x264_sub16x16_dct_avx; + dctf->sub8x8_dct8 = x264_sub8x8_dct8_avx; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_avx; + } + + if( cpu&X264_CPU_XOP ) + { + dctf->sub8x8_dct = x264_sub8x8_dct_xop; + dctf->sub16x16_dct = x264_sub16x16_dct_xop; + } + + if( cpu&X264_CPU_AVX2 ) + { + dctf->add8x8_idct = x264_add8x8_idct_avx2; + dctf->add16x16_idct = x264_add16x16_idct_avx2; + dctf->sub8x8_dct = x264_sub8x8_dct_avx2; + dctf->sub16x16_dct = x264_sub16x16_dct_avx2; + dctf->add16x16_idct_dc = x264_add16x16_idct_dc_avx2; +#if ARCH_X86_64 + dctf->sub16x16_dct8 = x264_sub16x16_dct8_avx2; +#endif + } + + if( cpu&X264_CPU_AVX512 ) + { + dctf->sub4x4_dct = x264_sub4x4_dct_avx512; + dctf->sub8x8_dct = x264_sub8x8_dct_avx512; + dctf->sub16x16_dct = x264_sub16x16_dct_avx512; + dctf->sub8x8_dct_dc = x264_sub8x8_dct_dc_avx512; + dctf->sub8x16_dct_dc = x264_sub8x16_dct_dc_avx512; + dctf->add8x8_idct = x264_add8x8_idct_avx512; + } +#endif //HAVE_MMX + +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + { + dctf->sub4x4_dct = x264_sub4x4_dct_altivec; + dctf->sub8x8_dct = x264_sub8x8_dct_altivec; + dctf->sub16x16_dct = x264_sub16x16_dct_altivec; + + dctf->add8x8_idct_dc = x264_add8x8_idct_dc_altivec; + + dctf->add4x4_idct = x264_add4x4_idct_altivec; + dctf->add8x8_idct = x264_add8x8_idct_altivec; + dctf->add16x16_idct = x264_add16x16_idct_altivec; + + dctf->sub8x8_dct_dc = x264_sub8x8_dct_dc_altivec; + dctf->sub8x8_dct8 = x264_sub8x8_dct8_altivec; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_altivec; + + dctf->add8x8_idct8 = x264_add8x8_idct8_altivec; + dctf->add16x16_idct8= x264_add16x16_idct8_altivec; + } +#endif + +#if HAVE_ARMV6 || ARCH_AARCH64 + if( cpu&X264_CPU_NEON ) + { + dctf->sub4x4_dct = x264_sub4x4_dct_neon; + dctf->sub8x8_dct = x264_sub8x8_dct_neon; + dctf->sub16x16_dct = x264_sub16x16_dct_neon; + dctf->add8x8_idct_dc = x264_add8x8_idct_dc_neon; + dctf->add16x16_idct_dc = x264_add16x16_idct_dc_neon; + dctf->sub8x8_dct_dc = x264_sub8x8_dct_dc_neon; + dctf->dct4x4dc = x264_dct4x4dc_neon; + dctf->idct4x4dc = x264_idct4x4dc_neon; + + dctf->add4x4_idct = x264_add4x4_idct_neon; + dctf->add8x8_idct = x264_add8x8_idct_neon; + dctf->add16x16_idct = x264_add16x16_idct_neon; + + dctf->sub8x8_dct8 = x264_sub8x8_dct8_neon; + dctf->sub16x16_dct8 = x264_sub16x16_dct8_neon; + + dctf->add8x8_idct8 = x264_add8x8_idct8_neon; + dctf->add16x16_idct8= x264_add16x16_idct8_neon; + dctf->sub8x16_dct_dc= x264_sub8x16_dct_dc_neon; + } +#endif + +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + dctf->sub4x4_dct = x264_sub4x4_dct_msa; + dctf->sub8x8_dct = x264_sub8x8_dct_msa; + dctf->sub16x16_dct = x264_sub16x16_dct_msa; + dctf->sub8x8_dct_dc = x264_sub8x8_dct_dc_msa; + dctf->sub8x16_dct_dc = x264_sub8x16_dct_dc_msa; + dctf->dct4x4dc = x264_dct4x4dc_msa; + dctf->idct4x4dc = x264_idct4x4dc_msa; + dctf->add4x4_idct = x264_add4x4_idct_msa; + dctf->add8x8_idct = x264_add8x8_idct_msa; + dctf->add8x8_idct_dc = x264_add8x8_idct_dc_msa; + dctf->add16x16_idct = x264_add16x16_idct_msa; + dctf->add16x16_idct_dc = x264_add16x16_idct_dc_msa; + dctf->add8x8_idct8 = x264_add8x8_idct8_msa; + dctf->add16x16_idct8 = x264_add16x16_idct8_msa; + } +#endif + +#endif // HIGH_BIT_DEPTH +} + + +#define ZIG(i,y,x) level[i] = dct[x*8+y]; +#define ZIGZAG8_FRAME\ + ZIG( 0,0,0) ZIG( 1,0,1) ZIG( 2,1,0) ZIG( 3,2,0)\ + ZIG( 4,1,1) ZIG( 5,0,2) ZIG( 6,0,3) ZIG( 7,1,2)\ + ZIG( 8,2,1) ZIG( 9,3,0) ZIG(10,4,0) ZIG(11,3,1)\ + ZIG(12,2,2) ZIG(13,1,3) ZIG(14,0,4) ZIG(15,0,5)\ + ZIG(16,1,4) ZIG(17,2,3) ZIG(18,3,2) ZIG(19,4,1)\ + ZIG(20,5,0) ZIG(21,6,0) ZIG(22,5,1) ZIG(23,4,2)\ + ZIG(24,3,3) ZIG(25,2,4) ZIG(26,1,5) ZIG(27,0,6)\ + ZIG(28,0,7) ZIG(29,1,6) ZIG(30,2,5) ZIG(31,3,4)\ + ZIG(32,4,3) ZIG(33,5,2) ZIG(34,6,1) ZIG(35,7,0)\ + ZIG(36,7,1) ZIG(37,6,2) ZIG(38,5,3) ZIG(39,4,4)\ + ZIG(40,3,5) ZIG(41,2,6) ZIG(42,1,7) ZIG(43,2,7)\ + ZIG(44,3,6) ZIG(45,4,5) ZIG(46,5,4) ZIG(47,6,3)\ + ZIG(48,7,2) ZIG(49,7,3) ZIG(50,6,4) ZIG(51,5,5)\ + ZIG(52,4,6) ZIG(53,3,7) ZIG(54,4,7) ZIG(55,5,6)\ + ZIG(56,6,5) ZIG(57,7,4) ZIG(58,7,5) ZIG(59,6,6)\ + ZIG(60,5,7) ZIG(61,6,7) ZIG(62,7,6) ZIG(63,7,7)\ + +#define ZIGZAG8_FIELD\ + ZIG( 0,0,0) ZIG( 1,1,0) ZIG( 2,2,0) ZIG( 3,0,1)\ + ZIG( 4,1,1) ZIG( 5,3,0) ZIG( 6,4,0) ZIG( 7,2,1)\ + ZIG( 8,0,2) ZIG( 9,3,1) ZIG(10,5,0) ZIG(11,6,0)\ + ZIG(12,7,0) ZIG(13,4,1) ZIG(14,1,2) ZIG(15,0,3)\ + ZIG(16,2,2) ZIG(17,5,1) ZIG(18,6,1) ZIG(19,7,1)\ + ZIG(20,3,2) ZIG(21,1,3) ZIG(22,0,4) ZIG(23,2,3)\ + ZIG(24,4,2) ZIG(25,5,2) ZIG(26,6,2) ZIG(27,7,2)\ + ZIG(28,3,3) ZIG(29,1,4) ZIG(30,0,5) ZIG(31,2,4)\ + ZIG(32,4,3) ZIG(33,5,3) ZIG(34,6,3) ZIG(35,7,3)\ + ZIG(36,3,4) ZIG(37,1,5) ZIG(38,0,6) ZIG(39,2,5)\ + ZIG(40,4,4) ZIG(41,5,4) ZIG(42,6,4) ZIG(43,7,4)\ + ZIG(44,3,5) ZIG(45,1,6) ZIG(46,2,6) ZIG(47,4,5)\ + ZIG(48,5,5) ZIG(49,6,5) ZIG(50,7,5) ZIG(51,3,6)\ + ZIG(52,0,7) ZIG(53,1,7) ZIG(54,4,6) ZIG(55,5,6)\ + ZIG(56,6,6) ZIG(57,7,6) ZIG(58,2,7) ZIG(59,3,7)\ + ZIG(60,4,7) ZIG(61,5,7) ZIG(62,6,7) ZIG(63,7,7) + +#define ZIGZAG4_FRAME\ + ZIGDC( 0,0,0) ZIG( 1,0,1) ZIG( 2,1,0) ZIG( 3,2,0)\ + ZIG( 4,1,1) ZIG( 5,0,2) ZIG( 6,0,3) ZIG( 7,1,2)\ + ZIG( 8,2,1) ZIG( 9,3,0) ZIG(10,3,1) ZIG(11,2,2)\ + ZIG(12,1,3) ZIG(13,2,3) ZIG(14,3,2) ZIG(15,3,3) + +#define ZIGZAG4_FIELD\ + ZIGDC( 0,0,0) ZIG( 1,1,0) ZIG( 2,0,1) ZIG( 3,2,0)\ + ZIG( 4,3,0) ZIG( 5,1,1) ZIG( 6,2,1) ZIG( 7,3,1)\ + ZIG( 8,0,2) ZIG( 9,1,2) ZIG(10,2,2) ZIG(11,3,2)\ + ZIG(12,0,3) ZIG(13,1,3) ZIG(14,2,3) ZIG(15,3,3) + +static void zigzag_scan_8x8_frame( dctcoef level[64], dctcoef dct[64] ) +{ + ZIGZAG8_FRAME +} + +static void zigzag_scan_8x8_field( dctcoef level[64], dctcoef dct[64] ) +{ + ZIGZAG8_FIELD +} + +#undef ZIG +#define ZIG(i,y,x) level[i] = dct[x*4+y]; +#define ZIGDC(i,y,x) ZIG(i,y,x) + +static void zigzag_scan_4x4_frame( dctcoef level[16], dctcoef dct[16] ) +{ + ZIGZAG4_FRAME +} + +static void zigzag_scan_4x4_field( dctcoef level[16], dctcoef dct[16] ) +{ + memcpy( level, dct, 2 * sizeof(dctcoef) ); + ZIG(2,0,1) ZIG(3,2,0) ZIG(4,3,0) ZIG(5,1,1) + memcpy( level+6, dct+6, 10 * sizeof(dctcoef) ); +} + +#undef ZIG +#define ZIG(i,y,x) {\ + int oe = x+y*FENC_STRIDE;\ + int od = x+y*FDEC_STRIDE;\ + level[i] = p_src[oe] - p_dst[od];\ + nz |= level[i];\ +} +#define COPY4x4\ + CPPIXEL_X4( p_dst+0*FDEC_STRIDE, p_src+0*FENC_STRIDE );\ + CPPIXEL_X4( p_dst+1*FDEC_STRIDE, p_src+1*FENC_STRIDE );\ + CPPIXEL_X4( p_dst+2*FDEC_STRIDE, p_src+2*FENC_STRIDE );\ + CPPIXEL_X4( p_dst+3*FDEC_STRIDE, p_src+3*FENC_STRIDE ); +#define CPPIXEL_X8(dst,src) ( CPPIXEL_X4(dst,src), CPPIXEL_X4(dst+4,src+4) ) +#define COPY8x8\ + CPPIXEL_X8( p_dst+0*FDEC_STRIDE, p_src+0*FENC_STRIDE );\ + CPPIXEL_X8( p_dst+1*FDEC_STRIDE, p_src+1*FENC_STRIDE );\ + CPPIXEL_X8( p_dst+2*FDEC_STRIDE, p_src+2*FENC_STRIDE );\ + CPPIXEL_X8( p_dst+3*FDEC_STRIDE, p_src+3*FENC_STRIDE );\ + CPPIXEL_X8( p_dst+4*FDEC_STRIDE, p_src+4*FENC_STRIDE );\ + CPPIXEL_X8( p_dst+5*FDEC_STRIDE, p_src+5*FENC_STRIDE );\ + CPPIXEL_X8( p_dst+6*FDEC_STRIDE, p_src+6*FENC_STRIDE );\ + CPPIXEL_X8( p_dst+7*FDEC_STRIDE, p_src+7*FENC_STRIDE ); + +static int zigzag_sub_4x4_frame( dctcoef level[16], const pixel *p_src, pixel *p_dst ) +{ + int nz = 0; + ZIGZAG4_FRAME + COPY4x4 + return !!nz; +} + +static int zigzag_sub_4x4_field( dctcoef level[16], const pixel *p_src, pixel *p_dst ) +{ + int nz = 0; + ZIGZAG4_FIELD + COPY4x4 + return !!nz; +} + +#undef ZIGDC +#define ZIGDC(i,y,x) {\ + int oe = x+y*FENC_STRIDE;\ + int od = x+y*FDEC_STRIDE;\ + *dc = p_src[oe] - p_dst[od];\ + level[0] = 0;\ +} + +static int zigzag_sub_4x4ac_frame( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc ) +{ + int nz = 0; + ZIGZAG4_FRAME + COPY4x4 + return !!nz; +} + +static int zigzag_sub_4x4ac_field( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc ) +{ + int nz = 0; + ZIGZAG4_FIELD + COPY4x4 + return !!nz; +} + +static int zigzag_sub_8x8_frame( dctcoef level[64], const pixel *p_src, pixel *p_dst ) +{ + int nz = 0; + ZIGZAG8_FRAME + COPY8x8 + return !!nz; +} +static int zigzag_sub_8x8_field( dctcoef level[64], const pixel *p_src, pixel *p_dst ) +{ + int nz = 0; + ZIGZAG8_FIELD + COPY8x8 + return !!nz; +} + +#undef ZIG +#undef COPY4x4 + +static void zigzag_interleave_8x8_cavlc( dctcoef *dst, dctcoef *src, uint8_t *nnz ) +{ + for( int i = 0; i < 4; i++ ) + { + int nz = 0; + for( int j = 0; j < 16; j++ ) + { + nz |= src[i+j*4]; + dst[i*16+j] = src[i+j*4]; + } + nnz[(i&1) + (i>>1)*8] = !!nz; + } +} + +void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced ) +{ + pf_interlaced->scan_8x8 = zigzag_scan_8x8_field; + pf_progressive->scan_8x8 = zigzag_scan_8x8_frame; + pf_interlaced->scan_4x4 = zigzag_scan_4x4_field; + pf_progressive->scan_4x4 = zigzag_scan_4x4_frame; + pf_interlaced->sub_8x8 = zigzag_sub_8x8_field; + pf_progressive->sub_8x8 = zigzag_sub_8x8_frame; + pf_interlaced->sub_4x4 = zigzag_sub_4x4_field; + pf_progressive->sub_4x4 = zigzag_sub_4x4_frame; + pf_interlaced->sub_4x4ac = zigzag_sub_4x4ac_field; + pf_progressive->sub_4x4ac = zigzag_sub_4x4ac_frame; + +#if HIGH_BIT_DEPTH +#if HAVE_MMX + if( cpu&X264_CPU_SSE2 ) + { + pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_sse2; + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_sse2; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_sse2; + } + if( cpu&X264_CPU_SSE4 ) + pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_sse4; + if( cpu&X264_CPU_AVX ) + pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_avx; +#if ARCH_X86_64 + if( cpu&X264_CPU_AVX ) + { + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_avx; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_avx; + } +#endif // ARCH_X86_64 + if( cpu&X264_CPU_AVX512 ) + { + pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_avx512; + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_avx512; + pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_avx512; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_avx512; + } +#endif // HAVE_MMX +#else +#if HAVE_MMX + if( cpu&X264_CPU_MMX ) + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_mmx; + if( cpu&X264_CPU_MMX2 ) + { + pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_mmx2; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_mmx2; + } + if( cpu&X264_CPU_SSE ) + pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_sse; + if( cpu&X264_CPU_SSE2_IS_FAST ) + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_sse2; + if( cpu&X264_CPU_SSSE3 ) + { + pf_interlaced->sub_4x4 = x264_zigzag_sub_4x4_field_ssse3; + pf_progressive->sub_4x4 = x264_zigzag_sub_4x4_frame_ssse3; + pf_interlaced->sub_4x4ac = x264_zigzag_sub_4x4ac_field_ssse3; + pf_progressive->sub_4x4ac= x264_zigzag_sub_4x4ac_frame_ssse3; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_ssse3; + if( !(cpu&X264_CPU_SLOW_SHUFFLE) ) + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_ssse3; + } + if( cpu&X264_CPU_AVX ) + { + pf_interlaced->sub_4x4 = x264_zigzag_sub_4x4_field_avx; + pf_progressive->sub_4x4 = x264_zigzag_sub_4x4_frame_avx; +#if ARCH_X86_64 + pf_interlaced->sub_4x4ac = x264_zigzag_sub_4x4ac_field_avx; + pf_progressive->sub_4x4ac= x264_zigzag_sub_4x4ac_frame_avx; +#endif + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_avx; + } + if( cpu&X264_CPU_XOP ) + { + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_xop; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_xop; + pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_xop; + } + if( cpu&X264_CPU_AVX512 ) + { + pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_avx512; + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_avx512; + pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_avx512; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_avx512; + } +#endif // HAVE_MMX +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + { + pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_altivec; + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_altivec; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_altivec; + } +#endif +#if HAVE_ARMV6 || ARCH_AARCH64 + if( cpu&X264_CPU_NEON ) + { + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_neon; +#if ARCH_AARCH64 + pf_interlaced->scan_4x4 = x264_zigzag_scan_4x4_field_neon; + pf_interlaced->scan_8x8 = x264_zigzag_scan_8x8_field_neon; + pf_interlaced->sub_4x4 = x264_zigzag_sub_4x4_field_neon; + pf_interlaced->sub_4x4ac = x264_zigzag_sub_4x4ac_field_neon; + pf_interlaced->sub_8x8 = x264_zigzag_sub_8x8_field_neon; + pf_progressive->scan_8x8 = x264_zigzag_scan_8x8_frame_neon; + pf_progressive->sub_4x4 = x264_zigzag_sub_4x4_frame_neon; + pf_progressive->sub_4x4ac = x264_zigzag_sub_4x4ac_frame_neon; + pf_progressive->sub_8x8 = x264_zigzag_sub_8x8_frame_neon; +#endif // ARCH_AARCH64 + } +#endif // HAVE_ARMV6 || ARCH_AARCH64 +#endif // HIGH_BIT_DEPTH + + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = zigzag_interleave_8x8_cavlc; +#if HAVE_MMX +#if HIGH_BIT_DEPTH + if( cpu&X264_CPU_SSE2 ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_sse2; + } + if( cpu&X264_CPU_AVX ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_avx; + } + if( cpu&X264_CPU_AVX512 ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_avx512; + } +#else + if( cpu&X264_CPU_MMX ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_mmx; + } + if( (cpu&X264_CPU_SSE2) && !(cpu&(X264_CPU_SLOW_SHUFFLE|X264_CPU_SSE2_IS_SLOW)) ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_sse2; + } + + if( cpu&X264_CPU_AVX ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_avx; + } + + if( cpu&X264_CPU_AVX2 ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_avx2; + } + if( cpu&X264_CPU_AVX512 ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_avx512; + } +#endif // HIGH_BIT_DEPTH +#endif +#if !HIGH_BIT_DEPTH +#if ARCH_AARCH64 + if( cpu&X264_CPU_NEON ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_neon; + } +#endif // ARCH_AARCH64 + +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + { + pf_interlaced->interleave_8x8_cavlc = + pf_progressive->interleave_8x8_cavlc = x264_zigzag_interleave_8x8_cavlc_altivec; + } +#endif // HAVE_ALTIVEC + +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + pf_progressive->scan_4x4 = x264_zigzag_scan_4x4_frame_msa; + } +#endif +#endif // !HIGH_BIT_DEPTH +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.h new file mode 100644 index 00000000..d443e228 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/dct.h @@ -0,0 +1,80 @@ +/***************************************************************************** + * dct.h: transform and zigzag + ***************************************************************************** + * Copyright (C) 2004-2017 x264 project + * + * Authors: Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_DCT_H +#define X264_DCT_H + +extern const uint32_t x264_dct4_weight_tab[16]; +extern const uint32_t x264_dct8_weight_tab[64]; +extern const uint32_t x264_dct4_weight2_tab[16]; +extern const uint32_t x264_dct8_weight2_tab[64]; + +typedef struct +{ + // pix1 stride = FENC_STRIDE + // pix2 stride = FDEC_STRIDE + // p_dst stride = FDEC_STRIDE + void (*sub4x4_dct) ( dctcoef dct[16], pixel *pix1, pixel *pix2 ); + void (*add4x4_idct)( pixel *p_dst, dctcoef dct[16] ); + + void (*sub8x8_dct) ( dctcoef dct[4][16], pixel *pix1, pixel *pix2 ); + void (*sub8x8_dct_dc) ( dctcoef dct[4], pixel *pix1, pixel *pix2 ); + void (*add8x8_idct) ( pixel *p_dst, dctcoef dct[4][16] ); + void (*add8x8_idct_dc)( pixel *p_dst, dctcoef dct[4] ); + + void (*sub8x16_dct_dc)( dctcoef dct[8], pixel *pix1, pixel *pix2 ); + + void (*sub16x16_dct) ( dctcoef dct[16][16], pixel *pix1, pixel *pix2 ); + void (*add16x16_idct) ( pixel *p_dst, dctcoef dct[16][16] ); + void (*add16x16_idct_dc)( pixel *p_dst, dctcoef dct[16] ); + + void (*sub8x8_dct8) ( dctcoef dct[64], pixel *pix1, pixel *pix2 ); + void (*add8x8_idct8)( pixel *p_dst, dctcoef dct[64] ); + + void (*sub16x16_dct8) ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 ); + void (*add16x16_idct8)( pixel *p_dst, dctcoef dct[4][64] ); + + void (*dct4x4dc) ( dctcoef d[16] ); + void (*idct4x4dc)( dctcoef d[16] ); + + void (*dct2x4dc)( dctcoef dct[8], dctcoef dct4x4[8][16] ); + +} x264_dct_function_t; + +typedef struct +{ + void (*scan_8x8)( dctcoef level[64], dctcoef dct[64] ); + void (*scan_4x4)( dctcoef level[16], dctcoef dct[16] ); + int (*sub_8x8) ( dctcoef level[64], const pixel *p_src, pixel *p_dst ); + int (*sub_4x4) ( dctcoef level[16], const pixel *p_src, pixel *p_dst ); + int (*sub_4x4ac)( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc ); + void (*interleave_8x8_cavlc)( dctcoef *dst, dctcoef *src, uint8_t *nnz ); + +} x264_zigzag_function_t; + +void x264_dct_init( int cpu, x264_dct_function_t *dctf ); +void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/deblock.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/deblock.c new file mode 100644 index 00000000..0c7f128c --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/deblock.c @@ -0,0 +1,908 @@ +/***************************************************************************** + * deblock.c: deblocking + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +/* Deblocking filter */ +static const uint8_t i_alpha_table[52+12*3] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 4, 4, 5, 6, + 7, 8, 9, 10, 12, 13, 15, 17, 20, 22, + 25, 28, 32, 36, 40, 45, 50, 56, 63, 71, + 80, 90,101,113,127,144,162,182,203,226, + 255,255, + 255,255,255,255,255,255,255,255,255,255,255,255, +}; +static const uint8_t i_beta_table[52+12*3] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2, 2, 2, 3, + 3, 3, 3, 4, 4, 4, 6, 6, 7, 7, + 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, + 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, + 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, +}; +static const int8_t i_tc0_table[52+12*3][4] = +{ + {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, + {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, + {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, + {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, + {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, + {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, + {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 1 }, + {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 0, 1 }, {-1, 0, 1, 1 }, {-1, 0, 1, 1 }, {-1, 1, 1, 1 }, + {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 1 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, {-1, 1, 1, 2 }, + {-1, 1, 1, 2 }, {-1, 1, 2, 3 }, {-1, 1, 2, 3 }, {-1, 2, 2, 3 }, {-1, 2, 2, 4 }, {-1, 2, 3, 4 }, + {-1, 2, 3, 4 }, {-1, 3, 3, 5 }, {-1, 3, 4, 6 }, {-1, 3, 4, 6 }, {-1, 4, 5, 7 }, {-1, 4, 5, 8 }, + {-1, 4, 6, 9 }, {-1, 5, 7,10 }, {-1, 6, 8,11 }, {-1, 6, 8,13 }, {-1, 7,10,14 }, {-1, 8,11,16 }, + {-1, 9,12,18 }, {-1,10,13,20 }, {-1,11,15,23 }, {-1,13,17,25 }, + {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, + {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, +}; +#define alpha_table(x) i_alpha_table[(x)+24] +#define beta_table(x) i_beta_table[(x)+24] +#define tc0_table(x) i_tc0_table[(x)+24] + +/* From ffmpeg */ +static ALWAYS_INLINE void deblock_edge_luma_c( pixel *pix, intptr_t xstride, int alpha, int beta, int8_t tc0 ) +{ + int p2 = pix[-3*xstride]; + int p1 = pix[-2*xstride]; + int p0 = pix[-1*xstride]; + int q0 = pix[ 0*xstride]; + int q1 = pix[ 1*xstride]; + int q2 = pix[ 2*xstride]; + + if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta ) + { + int tc = tc0; + int delta; + if( abs( p2 - p0 ) < beta ) + { + if( tc0 ) + pix[-2*xstride] = p1 + x264_clip3( (( p2 + ((p0 + q0 + 1) >> 1)) >> 1) - p1, -tc0, tc0 ); + tc++; + } + if( abs( q2 - q0 ) < beta ) + { + if( tc0 ) + pix[ 1*xstride] = q1 + x264_clip3( (( q2 + ((p0 + q0 + 1) >> 1)) >> 1) - q1, -tc0, tc0 ); + tc++; + } + + delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); + pix[-1*xstride] = x264_clip_pixel( p0 + delta ); /* p0' */ + pix[ 0*xstride] = x264_clip_pixel( q0 - delta ); /* q0' */ + } +} +static inline void deblock_luma_c( pixel *pix, intptr_t xstride, intptr_t ystride, int alpha, int beta, int8_t *tc0 ) +{ + for( int i = 0; i < 4; i++ ) + { + if( tc0[i] < 0 ) + { + pix += 4*ystride; + continue; + } + for( int d = 0; d < 4; d++, pix += ystride ) + deblock_edge_luma_c( pix, xstride, alpha, beta, tc0[i] ); + } +} +static void deblock_h_luma_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + for( int d = 0; d < 8; d++, pix += stride ) + deblock_edge_luma_c( pix, 1, alpha, beta, tc0[d>>1] ); +} +static void deblock_v_luma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + deblock_luma_c( pix, stride, 1, alpha, beta, tc0 ); +} +static void deblock_h_luma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + deblock_luma_c( pix, 1, stride, alpha, beta, tc0 ); +} + +static ALWAYS_INLINE void deblock_edge_chroma_c( pixel *pix, intptr_t xstride, int alpha, int beta, int8_t tc ) +{ + int p1 = pix[-2*xstride]; + int p0 = pix[-1*xstride]; + int q0 = pix[ 0*xstride]; + int q1 = pix[ 1*xstride]; + + if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta ) + { + int delta = x264_clip3( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); + pix[-1*xstride] = x264_clip_pixel( p0 + delta ); /* p0' */ + pix[ 0*xstride] = x264_clip_pixel( q0 - delta ); /* q0' */ + } +} +static ALWAYS_INLINE void deblock_chroma_c( pixel *pix, int height, intptr_t xstride, intptr_t ystride, int alpha, int beta, int8_t *tc0 ) +{ + for( int i = 0; i < 4; i++ ) + { + int tc = tc0[i]; + if( tc <= 0 ) + { + pix += height*ystride; + continue; + } + for( int d = 0; d < height; d++, pix += ystride-2 ) + for( int e = 0; e < 2; e++, pix++ ) + deblock_edge_chroma_c( pix, xstride, alpha, beta, tc0[i] ); + } +} +static void deblock_h_chroma_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + deblock_chroma_c( pix, 1, 2, stride, alpha, beta, tc0 ); +} +static void deblock_v_chroma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + deblock_chroma_c( pix, 2, stride, 2, alpha, beta, tc0 ); +} +static void deblock_h_chroma_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + deblock_chroma_c( pix, 2, 2, stride, alpha, beta, tc0 ); +} +static void deblock_h_chroma_422_c( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + deblock_chroma_c( pix, 4, 2, stride, alpha, beta, tc0 ); +} + +static ALWAYS_INLINE void deblock_edge_luma_intra_c( pixel *pix, intptr_t xstride, int alpha, int beta ) +{ + int p2 = pix[-3*xstride]; + int p1 = pix[-2*xstride]; + int p0 = pix[-1*xstride]; + int q0 = pix[ 0*xstride]; + int q1 = pix[ 1*xstride]; + int q2 = pix[ 2*xstride]; + + if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta ) + { + if( abs( p0 - q0 ) < ((alpha >> 2) + 2) ) + { + if( abs( p2 - p0 ) < beta ) /* p0', p1', p2' */ + { + const int p3 = pix[-4*xstride]; + pix[-1*xstride] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3; + pix[-2*xstride] = ( p2 + p1 + p0 + q0 + 2 ) >> 2; + pix[-3*xstride] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3; + } + else /* p0' */ + pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; + if( abs( q2 - q0 ) < beta ) /* q0', q1', q2' */ + { + const int q3 = pix[3*xstride]; + pix[0*xstride] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3; + pix[1*xstride] = ( p0 + q0 + q1 + q2 + 2 ) >> 2; + pix[2*xstride] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3; + } + else /* q0' */ + pix[0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; + } + else /* p0', q0' */ + { + pix[-1*xstride] = ( 2*p1 + p0 + q1 + 2 ) >> 2; + pix[ 0*xstride] = ( 2*q1 + q0 + p1 + 2 ) >> 2; + } + } +} +static inline void deblock_luma_intra_c( pixel *pix, intptr_t xstride, intptr_t ystride, int alpha, int beta ) +{ + for( int d = 0; d < 16; d++, pix += ystride ) + deblock_edge_luma_intra_c( pix, xstride, alpha, beta ); +} +static void deblock_h_luma_intra_mbaff_c( pixel *pix, intptr_t ystride, int alpha, int beta ) +{ + for( int d = 0; d < 8; d++, pix += ystride ) + deblock_edge_luma_intra_c( pix, 1, alpha, beta ); +} +static void deblock_v_luma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta ) +{ + deblock_luma_intra_c( pix, stride, 1, alpha, beta ); +} +static void deblock_h_luma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta ) +{ + deblock_luma_intra_c( pix, 1, stride, alpha, beta ); +} + +static ALWAYS_INLINE void deblock_edge_chroma_intra_c( pixel *pix, intptr_t xstride, int alpha, int beta ) +{ + int p1 = pix[-2*xstride]; + int p0 = pix[-1*xstride]; + int q0 = pix[ 0*xstride]; + int q1 = pix[ 1*xstride]; + + if( abs( p0 - q0 ) < alpha && abs( p1 - p0 ) < beta && abs( q1 - q0 ) < beta ) + { + pix[-1*xstride] = (2*p1 + p0 + q1 + 2) >> 2; /* p0' */ + pix[ 0*xstride] = (2*q1 + q0 + p1 + 2) >> 2; /* q0' */ + } +} +static ALWAYS_INLINE void deblock_chroma_intra_c( pixel *pix, int width, int height, intptr_t xstride, intptr_t ystride, int alpha, int beta ) +{ + for( int d = 0; d < height; d++, pix += ystride-2 ) + for( int e = 0; e < width; e++, pix++ ) + deblock_edge_chroma_intra_c( pix, xstride, alpha, beta ); +} +static void deblock_h_chroma_intra_mbaff_c( pixel *pix, intptr_t stride, int alpha, int beta ) +{ + deblock_chroma_intra_c( pix, 2, 4, 2, stride, alpha, beta ); +} +static void deblock_v_chroma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta ) +{ + deblock_chroma_intra_c( pix, 1, 16, stride, 2, alpha, beta ); +} +static void deblock_h_chroma_intra_c( pixel *pix, intptr_t stride, int alpha, int beta ) +{ + deblock_chroma_intra_c( pix, 2, 8, 2, stride, alpha, beta ); +} +static void deblock_h_chroma_422_intra_c( pixel *pix, intptr_t stride, int alpha, int beta ) +{ + deblock_chroma_intra_c( pix, 2, 16, 2, stride, alpha, beta ); +} + +static void deblock_strength_c( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit, + int bframe ) +{ + for( int dir = 0; dir < 2; dir++ ) + { + int s1 = dir ? 1 : 8; + int s2 = dir ? 8 : 1; + for( int edge = 0; edge < 4; edge++ ) + for( int i = 0, loc = X264_SCAN8_0+edge*s2; i < 4; i++, loc += s1 ) + { + int locn = loc - s2; + if( nnz[loc] || nnz[locn] ) + bs[dir][edge][i] = 2; + else if( ref[0][loc] != ref[0][locn] || + abs( mv[0][loc][0] - mv[0][locn][0] ) >= 4 || + abs( mv[0][loc][1] - mv[0][locn][1] ) >= mvy_limit || + (bframe && (ref[1][loc] != ref[1][locn] || + abs( mv[1][loc][0] - mv[1][locn][0] ) >= 4 || + abs( mv[1][loc][1] - mv[1][locn][1] ) >= mvy_limit ))) + { + bs[dir][edge][i] = 1; + } + else + bs[dir][edge][i] = 0; + } + } +} + +static ALWAYS_INLINE void deblock_edge( x264_t *h, pixel *pix, intptr_t i_stride, uint8_t bS[4], int i_qp, + int a, int b, int b_chroma, x264_deblock_inter_t pf_inter ) +{ + int index_a = i_qp + a; + int index_b = i_qp + b; + int alpha = alpha_table(index_a) << (BIT_DEPTH-8); + int beta = beta_table(index_b) << (BIT_DEPTH-8); + int8_t tc[4]; + + if( !M32(bS) || !alpha || !beta ) + return; + + tc[0] = (tc0_table(index_a)[bS[0]] << (BIT_DEPTH-8)) + b_chroma; + tc[1] = (tc0_table(index_a)[bS[1]] << (BIT_DEPTH-8)) + b_chroma; + tc[2] = (tc0_table(index_a)[bS[2]] << (BIT_DEPTH-8)) + b_chroma; + tc[3] = (tc0_table(index_a)[bS[3]] << (BIT_DEPTH-8)) + b_chroma; + + pf_inter( pix, i_stride, alpha, beta, tc ); +} + +static ALWAYS_INLINE void deblock_edge_intra( x264_t *h, pixel *pix, intptr_t i_stride, uint8_t bS[4], int i_qp, + int a, int b, int b_chroma, x264_deblock_intra_t pf_intra ) +{ + int index_a = i_qp + a; + int index_b = i_qp + b; + int alpha = alpha_table(index_a) << (BIT_DEPTH-8); + int beta = beta_table(index_b) << (BIT_DEPTH-8); + + if( !alpha || !beta ) + return; + + pf_intra( pix, i_stride, alpha, beta ); +} + +static ALWAYS_INLINE void x264_macroblock_cache_load_neighbours_deblock( x264_t *h, int mb_x, int mb_y ) +{ + int deblock_on_slice_edges = h->sh.i_disable_deblocking_filter_idc != 2; + + h->mb.i_neighbour = 0; + h->mb.i_mb_xy = mb_y * h->mb.i_mb_stride + mb_x; + h->mb.b_interlaced = PARAM_INTERLACED && h->mb.field[h->mb.i_mb_xy]; + h->mb.i_mb_top_y = mb_y - (1 << MB_INTERLACED); + h->mb.i_mb_top_xy = mb_x + h->mb.i_mb_stride*h->mb.i_mb_top_y; + h->mb.i_mb_left_xy[1] = + h->mb.i_mb_left_xy[0] = h->mb.i_mb_xy - 1; + if( SLICE_MBAFF ) + { + if( mb_y&1 ) + { + if( mb_x && h->mb.field[h->mb.i_mb_xy - 1] != MB_INTERLACED ) + h->mb.i_mb_left_xy[0] -= h->mb.i_mb_stride; + } + else + { + if( h->mb.i_mb_top_xy >= 0 && MB_INTERLACED && !h->mb.field[h->mb.i_mb_top_xy] ) + { + h->mb.i_mb_top_xy += h->mb.i_mb_stride; + h->mb.i_mb_top_y++; + } + if( mb_x && h->mb.field[h->mb.i_mb_xy - 1] != MB_INTERLACED ) + h->mb.i_mb_left_xy[1] += h->mb.i_mb_stride; + } + } + + if( mb_x > 0 && (deblock_on_slice_edges || + h->mb.slice_table[h->mb.i_mb_left_xy[0]] == h->mb.slice_table[h->mb.i_mb_xy]) ) + h->mb.i_neighbour |= MB_LEFT; + if( mb_y > MB_INTERLACED && (deblock_on_slice_edges + || h->mb.slice_table[h->mb.i_mb_top_xy] == h->mb.slice_table[h->mb.i_mb_xy]) ) + h->mb.i_neighbour |= MB_TOP; +} + +void x264_frame_deblock_row( x264_t *h, int mb_y ) +{ + int b_interlaced = SLICE_MBAFF; + int a = h->sh.i_alpha_c0_offset - QP_BD_OFFSET; + int b = h->sh.i_beta_offset - QP_BD_OFFSET; + int qp_thresh = 15 - X264_MIN( a, b ) - X264_MAX( 0, h->pps->i_chroma_qp_index_offset ); + int stridey = h->fdec->i_stride[0]; + int strideuv = h->fdec->i_stride[1]; + int chroma444 = CHROMA444; + int chroma_height = 16 >> CHROMA_V_SHIFT; + intptr_t uvdiff = chroma444 ? h->fdec->plane[2] - h->fdec->plane[1] : 1; + + for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x += (~b_interlaced | mb_y)&1, mb_y ^= b_interlaced ) + { + x264_prefetch_fenc( h, h->fdec, mb_x, mb_y ); + x264_macroblock_cache_load_neighbours_deblock( h, mb_x, mb_y ); + + int mb_xy = h->mb.i_mb_xy; + int transform_8x8 = h->mb.mb_transform_size[mb_xy]; + int intra_cur = IS_INTRA( h->mb.type[mb_xy] ); + uint8_t (*bs)[8][4] = h->deblock_strength[mb_y&1][h->param.b_sliced_threads?mb_xy:mb_x]; + + pixel *pixy = h->fdec->plane[0] + 16*mb_y*stridey + 16*mb_x; + pixel *pixuv = h->fdec->plane[1] + chroma_height*mb_y*strideuv + 16*mb_x; + + if( mb_y & MB_INTERLACED ) + { + pixy -= 15*stridey; + pixuv -= (chroma_height-1)*strideuv; + } + + int stride2y = stridey << MB_INTERLACED; + int stride2uv = strideuv << MB_INTERLACED; + int qp = h->mb.qp[mb_xy]; + int qpc = h->chroma_qp_table[qp]; + int first_edge_only = (h->mb.partition[mb_xy] == D_16x16 && !h->mb.cbp[mb_xy] && !intra_cur) || qp <= qp_thresh; + + #define FILTER( intra, dir, edge, qp, chroma_qp )\ + do\ + {\ + if( !(edge & 1) || !transform_8x8 )\ + {\ + deblock_edge##intra( h, pixy + 4*edge*(dir?stride2y:1),\ + stride2y, bs[dir][edge], qp, a, b, 0,\ + h->loopf.deblock_luma##intra[dir] );\ + if( CHROMA_FORMAT == CHROMA_444 )\ + {\ + deblock_edge##intra( h, pixuv + 4*edge*(dir?stride2uv:1),\ + stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\ + h->loopf.deblock_luma##intra[dir] );\ + deblock_edge##intra( h, pixuv + uvdiff + 4*edge*(dir?stride2uv:1),\ + stride2uv, bs[dir][edge], chroma_qp, a, b, 0,\ + h->loopf.deblock_luma##intra[dir] );\ + }\ + else if( CHROMA_FORMAT == CHROMA_420 && !(edge & 1) )\ + {\ + deblock_edge##intra( h, pixuv + edge*(dir?2*stride2uv:4),\ + stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\ + h->loopf.deblock_chroma##intra[dir] );\ + }\ + }\ + if( CHROMA_FORMAT == CHROMA_422 && (dir || !(edge & 1)) )\ + {\ + deblock_edge##intra( h, pixuv + edge*(dir?4*stride2uv:4),\ + stride2uv, bs[dir][edge], chroma_qp, a, b, 1,\ + h->loopf.deblock_chroma##intra[dir] );\ + }\ + } while( 0 ) + + if( h->mb.i_neighbour & MB_LEFT ) + { + if( b_interlaced && h->mb.field[h->mb.i_mb_left_xy[0]] != MB_INTERLACED ) + { + int luma_qp[2]; + int chroma_qp[2]; + int left_qp[2]; + x264_deblock_inter_t luma_deblock = h->loopf.deblock_luma_mbaff; + x264_deblock_inter_t chroma_deblock = h->loopf.deblock_chroma_mbaff; + x264_deblock_intra_t luma_intra_deblock = h->loopf.deblock_luma_intra_mbaff; + x264_deblock_intra_t chroma_intra_deblock = h->loopf.deblock_chroma_intra_mbaff; + int c = chroma444 ? 0 : 1; + + left_qp[0] = h->mb.qp[h->mb.i_mb_left_xy[0]]; + luma_qp[0] = (qp + left_qp[0] + 1) >> 1; + chroma_qp[0] = (qpc + h->chroma_qp_table[left_qp[0]] + 1) >> 1; + if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[0]] ) ) + { + deblock_edge_intra( h, pixy, 2*stridey, bs[0][0], luma_qp[0], a, b, 0, luma_intra_deblock ); + deblock_edge_intra( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock ); + if( chroma444 ) + deblock_edge_intra( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_intra_deblock ); + } + else + { + deblock_edge( h, pixy, 2*stridey, bs[0][0], luma_qp[0], a, b, 0, luma_deblock ); + deblock_edge( h, pixuv, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock ); + if( chroma444 ) + deblock_edge( h, pixuv + uvdiff, 2*strideuv, bs[0][0], chroma_qp[0], a, b, c, chroma_deblock ); + } + + int offy = MB_INTERLACED ? 4 : 0; + int offuv = MB_INTERLACED ? 4-CHROMA_V_SHIFT : 0; + left_qp[1] = h->mb.qp[h->mb.i_mb_left_xy[1]]; + luma_qp[1] = (qp + left_qp[1] + 1) >> 1; + chroma_qp[1] = (qpc + h->chroma_qp_table[left_qp[1]] + 1) >> 1; + if( intra_cur || IS_INTRA( h->mb.type[h->mb.i_mb_left_xy[1]] ) ) + { + deblock_edge_intra( h, pixy + (stridey<mb.qp[h->mb.i_mb_xy-1]; + int qp_left = (qp + qpl + 1) >> 1; + int qpc_left = (qpc + h->chroma_qp_table[qpl] + 1) >> 1; + int intra_left = IS_INTRA( h->mb.type[h->mb.i_mb_xy-1] ); + int intra_deblock = intra_cur || intra_left; + + /* Any MB that was coded, or that analysis decided to skip, has quality commensurate with its QP. + * But if deblocking affects neighboring MBs that were force-skipped, blur might accumulate there. + * So reset their effective QP to max, to indicate that lack of guarantee. */ + if( h->fdec->mb_info && M32( bs[0][0] ) ) + { +#define RESET_EFFECTIVE_QP(xy) h->fdec->effective_qp[xy] |= 0xff * !!(h->fdec->mb_info[xy] & X264_MBINFO_CONSTANT); + RESET_EFFECTIVE_QP(mb_xy); + RESET_EFFECTIVE_QP(h->mb.i_mb_left_xy[0]); + } + + if( intra_deblock ) + FILTER( _intra, 0, 0, qp_left, qpc_left ); + else + FILTER( , 0, 0, qp_left, qpc_left ); + } + } + if( !first_edge_only ) + { + FILTER( , 0, 1, qp, qpc ); + FILTER( , 0, 2, qp, qpc ); + FILTER( , 0, 3, qp, qpc ); + } + + if( h->mb.i_neighbour & MB_TOP ) + { + if( b_interlaced && !(mb_y&1) && !MB_INTERLACED && h->mb.field[h->mb.i_mb_top_xy] ) + { + int mbn_xy = mb_xy - 2 * h->mb.i_mb_stride; + + for( int j = 0; j < 2; j++, mbn_xy += h->mb.i_mb_stride ) + { + int qpt = h->mb.qp[mbn_xy]; + int qp_top = (qp + qpt + 1) >> 1; + int qpc_top = (qpc + h->chroma_qp_table[qpt] + 1) >> 1; + int intra_top = IS_INTRA( h->mb.type[mbn_xy] ); + if( intra_cur || intra_top ) + M32( bs[1][4*j] ) = 0x03030303; + + // deblock the first horizontal edge of the even rows, then the first horizontal edge of the odd rows + deblock_edge( h, pixy + j*stridey, 2* stridey, bs[1][4*j], qp_top, a, b, 0, h->loopf.deblock_luma[1] ); + if( chroma444 ) + { + deblock_edge( h, pixuv + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] ); + deblock_edge( h, pixuv + uvdiff + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 0, h->loopf.deblock_luma[1] ); + } + else + deblock_edge( h, pixuv + j*strideuv, 2*strideuv, bs[1][4*j], qpc_top, a, b, 1, h->loopf.deblock_chroma[1] ); + } + } + else + { + int qpt = h->mb.qp[h->mb.i_mb_top_xy]; + int qp_top = (qp + qpt + 1) >> 1; + int qpc_top = (qpc + h->chroma_qp_table[qpt] + 1) >> 1; + int intra_top = IS_INTRA( h->mb.type[h->mb.i_mb_top_xy] ); + int intra_deblock = intra_cur || intra_top; + + /* This edge has been modified, reset effective qp to max. */ + if( h->fdec->mb_info && M32( bs[1][0] ) ) + { + RESET_EFFECTIVE_QP(mb_xy); + RESET_EFFECTIVE_QP(h->mb.i_mb_top_xy); + } + + if( (!b_interlaced || (!MB_INTERLACED && !h->mb.field[h->mb.i_mb_top_xy])) && intra_deblock ) + { + FILTER( _intra, 1, 0, qp_top, qpc_top ); + } + else + { + if( intra_deblock ) + M32( bs[1][0] ) = 0x03030303; + FILTER( , 1, 0, qp_top, qpc_top ); + } + } + } + + if( !first_edge_only ) + { + FILTER( , 1, 1, qp, qpc ); + FILTER( , 1, 2, qp, qpc ); + FILTER( , 1, 3, qp, qpc ); + } + + #undef FILTER + } +} + +/* For deblock-aware RD. + * TODO: + * deblock macroblock edges + * support analysis partitions smaller than 16x16 + * deblock chroma for 4:2:0/4:2:2 + * handle duplicate refs correctly + */ +void x264_macroblock_deblock( x264_t *h ) +{ + int a = h->sh.i_alpha_c0_offset - QP_BD_OFFSET; + int b = h->sh.i_beta_offset - QP_BD_OFFSET; + int qp_thresh = 15 - X264_MIN( a, b ) - X264_MAX( 0, h->pps->i_chroma_qp_index_offset ); + int intra_cur = IS_INTRA( h->mb.i_type ); + int qp = h->mb.i_qp; + int qpc = h->mb.i_chroma_qp; + if( (h->mb.i_partition == D_16x16 && !h->mb.i_cbp_luma && !intra_cur) || qp <= qp_thresh ) + return; + + uint8_t (*bs)[8][4] = h->mb.cache.deblock_strength; + if( intra_cur ) + { + M32( bs[0][1] ) = 0x03030303; + M64( bs[0][2] ) = 0x0303030303030303ULL; + M32( bs[1][1] ) = 0x03030303; + M64( bs[1][2] ) = 0x0303030303030303ULL; + } + else + h->loopf.deblock_strength( h->mb.cache.non_zero_count, h->mb.cache.ref, h->mb.cache.mv, + bs, 4 >> MB_INTERLACED, h->sh.i_type == SLICE_TYPE_B ); + + int transform_8x8 = h->mb.b_transform_8x8; + + #define FILTER( dir, edge )\ + do\ + {\ + deblock_edge( h, h->mb.pic.p_fdec[0] + 4*edge*(dir?FDEC_STRIDE:1),\ + FDEC_STRIDE, bs[dir][edge], qp, a, b, 0,\ + h->loopf.deblock_luma[dir] );\ + if( CHROMA444 )\ + {\ + deblock_edge( h, h->mb.pic.p_fdec[1] + 4*edge*(dir?FDEC_STRIDE:1),\ + FDEC_STRIDE, bs[dir][edge], qpc, a, b, 0,\ + h->loopf.deblock_luma[dir] );\ + deblock_edge( h, h->mb.pic.p_fdec[2] + 4*edge*(dir?FDEC_STRIDE:1),\ + FDEC_STRIDE, bs[dir][edge], qpc, a, b, 0,\ + h->loopf.deblock_luma[dir] );\ + }\ + } while( 0 ) + + if( !transform_8x8 ) FILTER( 0, 1 ); + FILTER( 0, 2 ); + if( !transform_8x8 ) FILTER( 0, 3 ); + + if( !transform_8x8 ) FILTER( 1, 1 ); + FILTER( 1, 2 ); + if( !transform_8x8 ) FILTER( 1, 3 ); + + #undef FILTER +} + +#if HAVE_MMX +void x264_deblock_v_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_luma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_luma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_422_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_422_sse2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_422_avx ( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_luma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_luma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_422_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_422_intra_sse2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_422_intra_avx ( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_strength_sse2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], + int mvy_limit, int bframe ); +void x264_deblock_strength_ssse3 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], + int mvy_limit, int bframe ); +void x264_deblock_strength_avx ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], + int mvy_limit, int bframe ); +void x264_deblock_strength_avx2 ( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], + int mvy_limit, int bframe ); +void x264_deblock_strength_avx512( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], + int mvy_limit, int bframe ); + +void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_mbaff_sse2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_mbaff_avx ( pixel *pix, intptr_t stride, int alpha, int beta ); +#if ARCH_X86 +void x264_deblock_h_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v8_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v8_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_mbaff_mmx2( pixel *pix, intptr_t stride, int alpha, int beta ); + +#if HIGH_BIT_DEPTH +void x264_deblock_v_luma_mmx2( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_luma_intra_mmx2( pixel *pix, intptr_t stride, int alpha, int beta ); +#else +// FIXME this wrapper has a significant cpu cost +static void x264_deblock_v_luma_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ) +{ + x264_deblock_v8_luma_mmx2( pix, stride, alpha, beta, tc0 ); + x264_deblock_v8_luma_mmx2( pix+8, stride, alpha, beta, tc0+2 ); +} +static void x264_deblock_v_luma_intra_mmx2( uint8_t *pix, intptr_t stride, int alpha, int beta ) +{ + x264_deblock_v8_luma_intra_mmx2( pix, stride, alpha, beta ); + x264_deblock_v8_luma_intra_mmx2( pix+8, stride, alpha, beta ); +} +#endif // HIGH_BIT_DEPTH +#endif +#endif + +#if ARCH_PPC +void x264_deblock_v_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_luma_altivec( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +#endif // ARCH_PPC + +#if HAVE_ARMV6 || ARCH_AARCH64 +void x264_deblock_v_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_luma_neon ( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_strength_neon( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], + int mvy_limit, int bframe ); +void x264_deblock_h_chroma_422_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_intra_mbaff_neon( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_422_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v_chroma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v_luma_intra_neon( uint8_t *pix, intptr_t stride, int alpha, int beta ); +#endif + +#if !HIGH_BIT_DEPTH +#if HAVE_MSA +void x264_deblock_v_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_luma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_h_chroma_msa( uint8_t *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +void x264_deblock_v_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_luma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_v_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_h_chroma_intra_msa( uint8_t *pix, intptr_t stride, int alpha, int beta ); +void x264_deblock_strength_msa( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit, + int bframe ); +#endif +#endif + +void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff ) +{ + pf->deblock_luma[1] = deblock_v_luma_c; + pf->deblock_luma[0] = deblock_h_luma_c; + pf->deblock_chroma[1] = deblock_v_chroma_c; + pf->deblock_h_chroma_420 = deblock_h_chroma_c; + pf->deblock_h_chroma_422 = deblock_h_chroma_422_c; + pf->deblock_luma_intra[1] = deblock_v_luma_intra_c; + pf->deblock_luma_intra[0] = deblock_h_luma_intra_c; + pf->deblock_chroma_intra[1] = deblock_v_chroma_intra_c; + pf->deblock_h_chroma_420_intra = deblock_h_chroma_intra_c; + pf->deblock_h_chroma_422_intra = deblock_h_chroma_422_intra_c; + pf->deblock_luma_mbaff = deblock_h_luma_mbaff_c; + pf->deblock_chroma_420_mbaff = deblock_h_chroma_mbaff_c; + pf->deblock_luma_intra_mbaff = deblock_h_luma_intra_mbaff_c; + pf->deblock_chroma_420_intra_mbaff = deblock_h_chroma_intra_mbaff_c; + pf->deblock_strength = deblock_strength_c; + +#if HAVE_MMX + if( cpu&X264_CPU_MMX2 ) + { +#if ARCH_X86 + pf->deblock_luma[1] = x264_deblock_v_luma_mmx2; + pf->deblock_luma[0] = x264_deblock_h_luma_mmx2; + pf->deblock_chroma[1] = x264_deblock_v_chroma_mmx2; + pf->deblock_h_chroma_420 = x264_deblock_h_chroma_mmx2; + pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_mmx2; + pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_mmx2; + pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_mmx2; + pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_mmx2; + pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_mmx2; + pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_mmx2; + pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_mmx2; + pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_mmx2; +#endif +#if !HIGH_BIT_DEPTH + pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_mmx2; +#endif + if( cpu&X264_CPU_SSE2 ) + { + pf->deblock_strength = x264_deblock_strength_sse2; + pf->deblock_h_chroma_420 = x264_deblock_h_chroma_sse2; + pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_sse2; + pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_sse2; + pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_sse2; + pf->deblock_luma[1] = x264_deblock_v_luma_sse2; + pf->deblock_luma[0] = x264_deblock_h_luma_sse2; + pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_sse2; + pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_sse2; + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + pf->deblock_chroma[1] = x264_deblock_v_chroma_sse2; + pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_sse2; + pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_sse2; +#if HIGH_BIT_DEPTH + pf->deblock_chroma_420_intra_mbaff= x264_deblock_h_chroma_intra_mbaff_sse2; +#endif + } + } + if( cpu&X264_CPU_SSSE3 ) + pf->deblock_strength = x264_deblock_strength_ssse3; + if( cpu&X264_CPU_AVX ) + { + pf->deblock_strength = x264_deblock_strength_avx; + pf->deblock_h_chroma_420 = x264_deblock_h_chroma_avx; + pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_avx; + pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_avx; + pf->deblock_luma[1] = x264_deblock_v_luma_avx; + pf->deblock_luma[0] = x264_deblock_h_luma_avx; + pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_avx; + pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_avx; + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + pf->deblock_chroma[1] = x264_deblock_v_chroma_avx; + pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_avx; + pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_avx; +#if HIGH_BIT_DEPTH + pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_avx; + pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_avx; +#endif + } + } + if( cpu&X264_CPU_AVX2 ) + { + pf->deblock_strength = x264_deblock_strength_avx2; + } + if( cpu&X264_CPU_AVX512 ) + { + pf->deblock_strength = x264_deblock_strength_avx512; + } + } +#endif + +#if !HIGH_BIT_DEPTH +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + { + pf->deblock_luma[1] = x264_deblock_v_luma_altivec; + pf->deblock_luma[0] = x264_deblock_h_luma_altivec; + } +#endif // HAVE_ALTIVEC + +#if HAVE_ARMV6 || ARCH_AARCH64 + if( cpu&X264_CPU_NEON ) + { + pf->deblock_luma[1] = x264_deblock_v_luma_neon; + pf->deblock_luma[0] = x264_deblock_h_luma_neon; + pf->deblock_chroma[1] = x264_deblock_v_chroma_neon; + pf->deblock_h_chroma_420 = x264_deblock_h_chroma_neon; + pf->deblock_h_chroma_422 = x264_deblock_h_chroma_422_neon; + pf->deblock_chroma_420_mbaff = x264_deblock_h_chroma_mbaff_neon; + pf->deblock_chroma_420_intra_mbaff = x264_deblock_h_chroma_intra_mbaff_neon; + pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_neon; + pf->deblock_h_chroma_422_intra = x264_deblock_h_chroma_422_intra_neon; + pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_neon; + pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_neon; + pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_neon; + pf->deblock_strength = x264_deblock_strength_neon; + } +#endif + +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + pf->deblock_luma[1] = x264_deblock_v_luma_msa; + pf->deblock_luma[0] = x264_deblock_h_luma_msa; + pf->deblock_chroma[1] = x264_deblock_v_chroma_msa; + pf->deblock_h_chroma_420 = x264_deblock_h_chroma_msa; + pf->deblock_luma_intra[1] = x264_deblock_v_luma_intra_msa; + pf->deblock_luma_intra[0] = x264_deblock_h_luma_intra_msa; + pf->deblock_chroma_intra[1] = x264_deblock_v_chroma_intra_msa; + pf->deblock_h_chroma_420_intra = x264_deblock_h_chroma_intra_msa; + pf->deblock_strength = x264_deblock_strength_msa; + } +#endif +#endif // !HIGH_BIT_DEPTH + + /* These functions are equivalent, so don't duplicate them. */ + pf->deblock_chroma_422_mbaff = pf->deblock_h_chroma_420; + pf->deblock_chroma_422_intra_mbaff = pf->deblock_h_chroma_420_intra; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.c new file mode 100644 index 00000000..4d80cbb0 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.c @@ -0,0 +1,899 @@ +/***************************************************************************** + * frame.c: frame handling + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +static int align_stride( int x, int align, int disalign ) +{ + x = ALIGN( x, align ); + if( !(x&(disalign-1)) ) + x += align; + return x; +} + +static int align_plane_size( int x, int disalign ) +{ + if( !(x&(disalign-1)) ) + x += 128; + return x; +} + +static int x264_frame_internal_csp( int external_csp ) +{ + switch( external_csp & X264_CSP_MASK ) + { + case X264_CSP_NV12: + case X264_CSP_NV21: + case X264_CSP_I420: + case X264_CSP_YV12: + return X264_CSP_NV12; + case X264_CSP_NV16: + case X264_CSP_I422: + case X264_CSP_YV16: + case X264_CSP_YUYV: + case X264_CSP_UYVY: + case X264_CSP_V210: + return X264_CSP_NV16; + case X264_CSP_I444: + case X264_CSP_YV24: + case X264_CSP_BGR: + case X264_CSP_BGRA: + case X264_CSP_RGB: + return X264_CSP_I444; + default: + return X264_CSP_NONE; + } +} + +static x264_frame_t *x264_frame_new( x264_t *h, int b_fdec ) +{ + x264_frame_t *frame; + int i_csp = x264_frame_internal_csp( h->param.i_csp ); + int i_mb_count = h->mb.i_mb_count; + int i_stride, i_width, i_lines, luma_plane_count; + int i_padv = PADV << PARAM_INTERLACED; + int align = 16; +#if ARCH_X86 || ARCH_X86_64 + if( h->param.cpu&X264_CPU_CACHELINE_64 || h->param.cpu&X264_CPU_AVX512 ) + align = 64; + else if( h->param.cpu&X264_CPU_CACHELINE_32 || h->param.cpu&X264_CPU_AVX ) + align = 32; +#endif +#if ARCH_PPC + int disalign = 1<<9; +#else + int disalign = 1<<10; +#endif + + CHECKED_MALLOCZERO( frame, sizeof(x264_frame_t) ); + PREALLOC_INIT + + /* allocate frame data (+64 for extra data for me) */ + i_width = h->mb.i_mb_width*16; + i_lines = h->mb.i_mb_height*16; + i_stride = align_stride( i_width + 2*PADH, align, disalign ); + + if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 ) + { + luma_plane_count = 1; + frame->i_plane = 2; + for( int i = 0; i < 2; i++ ) + { + frame->i_width[i] = i_width >> i; + frame->i_lines[i] = i_lines >> (i && i_csp == X264_CSP_NV12); + frame->i_stride[i] = i_stride; + } + } + else if( i_csp == X264_CSP_I444 ) + { + luma_plane_count = 3; + frame->i_plane = 3; + for( int i = 0; i < 3; i++ ) + { + frame->i_width[i] = i_width; + frame->i_lines[i] = i_lines; + frame->i_stride[i] = i_stride; + } + } + else + goto fail; + + frame->i_csp = i_csp; + frame->i_width_lowres = frame->i_width[0]/2; + frame->i_lines_lowres = frame->i_lines[0]/2; + frame->i_stride_lowres = align_stride( frame->i_width_lowres + 2*PADH, align, disalign<<1 ); + + for( int i = 0; i < h->param.i_bframe + 2; i++ ) + for( int j = 0; j < h->param.i_bframe + 2; j++ ) + PREALLOC( frame->i_row_satds[i][j], i_lines/16 * sizeof(int) ); + + frame->i_poc = -1; + frame->i_type = X264_TYPE_AUTO; + frame->i_qpplus1 = X264_QP_AUTO; + frame->i_pts = -1; + frame->i_frame = -1; + frame->i_frame_num = -1; + frame->i_lines_completed = -1; + frame->b_fdec = b_fdec; + frame->i_pic_struct = PIC_STRUCT_AUTO; + frame->i_field_cnt = -1; + frame->i_duration = + frame->i_cpb_duration = + frame->i_dpb_output_delay = + frame->i_cpb_delay = 0; + frame->i_coded_fields_lookahead = + frame->i_cpb_delay_lookahead = -1; + + frame->orig = frame; + + if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 ) + { + int chroma_padv = i_padv >> (i_csp == X264_CSP_NV12); + int chroma_plane_size = (frame->i_stride[1] * (frame->i_lines[1] + 2*chroma_padv)); + PREALLOC( frame->buffer[1], chroma_plane_size * sizeof(pixel) ); + if( PARAM_INTERLACED ) + PREALLOC( frame->buffer_fld[1], chroma_plane_size * sizeof(pixel) ); + } + + /* all 4 luma planes allocated together, since the cacheline split code + * requires them to be in-phase wrt cacheline alignment. */ + + for( int p = 0; p < luma_plane_count; p++ ) + { + int luma_plane_size = align_plane_size( frame->i_stride[p] * (frame->i_lines[p] + 2*i_padv), disalign ); + if( h->param.analyse.i_subpel_refine && b_fdec ) + { + /* FIXME: Don't allocate both buffers in non-adaptive MBAFF. */ + PREALLOC( frame->buffer[p], 4*luma_plane_size * sizeof(pixel) ); + if( PARAM_INTERLACED ) + PREALLOC( frame->buffer_fld[p], 4*luma_plane_size * sizeof(pixel) ); + } + else + { + PREALLOC( frame->buffer[p], luma_plane_size * sizeof(pixel) ); + if( PARAM_INTERLACED ) + PREALLOC( frame->buffer_fld[p], luma_plane_size * sizeof(pixel) ); + } + } + + frame->b_duplicate = 0; + + if( b_fdec ) /* fdec frame */ + { + PREALLOC( frame->mb_type, i_mb_count * sizeof(int8_t) ); + PREALLOC( frame->mb_partition, i_mb_count * sizeof(uint8_t) ); + PREALLOC( frame->mv[0], 2*16 * i_mb_count * sizeof(int16_t) ); + PREALLOC( frame->mv16x16, 2*(i_mb_count+1) * sizeof(int16_t) ); + PREALLOC( frame->ref[0], 4 * i_mb_count * sizeof(int8_t) ); + if( h->param.i_bframe ) + { + PREALLOC( frame->mv[1], 2*16 * i_mb_count * sizeof(int16_t) ); + PREALLOC( frame->ref[1], 4 * i_mb_count * sizeof(int8_t) ); + } + else + { + frame->mv[1] = NULL; + frame->ref[1] = NULL; + } + PREALLOC( frame->i_row_bits, i_lines/16 * sizeof(int) ); + PREALLOC( frame->f_row_qp, i_lines/16 * sizeof(float) ); + PREALLOC( frame->f_row_qscale, i_lines/16 * sizeof(float) ); + if( h->param.analyse.i_me_method >= X264_ME_ESA ) + PREALLOC( frame->buffer[3], frame->i_stride[0] * (frame->i_lines[0] + 2*i_padv) * sizeof(uint16_t) << h->frames.b_have_sub8x8_esa ); + if( PARAM_INTERLACED ) + PREALLOC( frame->field, i_mb_count * sizeof(uint8_t) ); + if( h->param.analyse.b_mb_info ) + PREALLOC( frame->effective_qp, i_mb_count * sizeof(uint8_t) ); + } + else /* fenc frame */ + { + if( h->frames.b_have_lowres ) + { + int luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign ); + + PREALLOC( frame->buffer_lowres[0], 4 * luma_plane_size * sizeof(pixel) ); + + for( int j = 0; j <= !!h->param.i_bframe; j++ ) + for( int i = 0; i <= h->param.i_bframe; i++ ) + { + PREALLOC( frame->lowres_mvs[j][i], 2*h->mb.i_mb_count*sizeof(int16_t) ); + PREALLOC( frame->lowres_mv_costs[j][i], h->mb.i_mb_count*sizeof(int) ); + } + PREALLOC( frame->i_propagate_cost, i_mb_count * sizeof(uint16_t) ); + for( int j = 0; j <= h->param.i_bframe+1; j++ ) + for( int i = 0; i <= h->param.i_bframe+1; i++ ) + PREALLOC( frame->lowres_costs[j][i], i_mb_count * sizeof(uint16_t) ); + + /* mbtree asm can overread the input buffers, make sure we don't read outside of allocated memory. */ + prealloc_size += NATIVE_ALIGN; + } + if( h->param.rc.i_aq_mode ) + { + PREALLOC( frame->f_qp_offset, h->mb.i_mb_count * sizeof(float) ); + PREALLOC( frame->f_qp_offset_aq, h->mb.i_mb_count * sizeof(float) ); + if( h->frames.b_have_lowres ) + PREALLOC( frame->i_inv_qscale_factor, (h->mb.i_mb_count+3) * sizeof(uint16_t) ); + } + } + + PREALLOC_END( frame->base ); + + if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 ) + { + int chroma_padv = i_padv >> (i_csp == X264_CSP_NV12); + frame->plane[1] = frame->buffer[1] + frame->i_stride[1] * chroma_padv + PADH; + if( PARAM_INTERLACED ) + frame->plane_fld[1] = frame->buffer_fld[1] + frame->i_stride[1] * chroma_padv + PADH; + } + + for( int p = 0; p < luma_plane_count; p++ ) + { + int luma_plane_size = align_plane_size( frame->i_stride[p] * (frame->i_lines[p] + 2*i_padv), disalign ); + if( h->param.analyse.i_subpel_refine && b_fdec ) + { + for( int i = 0; i < 4; i++ ) + { + frame->filtered[p][i] = frame->buffer[p] + i*luma_plane_size + frame->i_stride[p] * i_padv + PADH; + frame->filtered_fld[p][i] = frame->buffer_fld[p] + i*luma_plane_size + frame->i_stride[p] * i_padv + PADH; + } + frame->plane[p] = frame->filtered[p][0]; + frame->plane_fld[p] = frame->filtered_fld[p][0]; + } + else + { + frame->filtered[p][0] = frame->plane[p] = frame->buffer[p] + frame->i_stride[p] * i_padv + PADH; + frame->filtered_fld[p][0] = frame->plane_fld[p] = frame->buffer_fld[p] + frame->i_stride[p] * i_padv + PADH; + } + } + + if( b_fdec ) + { + M32( frame->mv16x16[0] ) = 0; + frame->mv16x16++; + + if( h->param.analyse.i_me_method >= X264_ME_ESA ) + frame->integral = (uint16_t*)frame->buffer[3] + frame->i_stride[0] * i_padv + PADH; + } + else + { + if( h->frames.b_have_lowres ) + { + int luma_plane_size = align_plane_size( frame->i_stride_lowres * (frame->i_lines[0]/2 + 2*PADV), disalign ); + for( int i = 0; i < 4; i++ ) + frame->lowres[i] = frame->buffer_lowres[0] + (frame->i_stride_lowres * PADV + PADH) + i * luma_plane_size; + + for( int j = 0; j <= !!h->param.i_bframe; j++ ) + for( int i = 0; i <= h->param.i_bframe; i++ ) + memset( frame->lowres_mvs[j][i], 0, 2*h->mb.i_mb_count*sizeof(int16_t) ); + + frame->i_intra_cost = frame->lowres_costs[0][0]; + memset( frame->i_intra_cost, -1, (i_mb_count+3) * sizeof(uint16_t) ); + + if( h->param.rc.i_aq_mode ) + /* shouldn't really be initialized, just silences a valgrind false-positive in x264_mbtree_propagate_cost_sse2 */ + memset( frame->i_inv_qscale_factor, 0, (h->mb.i_mb_count+3) * sizeof(uint16_t) ); + } + } + + if( x264_pthread_mutex_init( &frame->mutex, NULL ) ) + goto fail; + if( x264_pthread_cond_init( &frame->cv, NULL ) ) + goto fail; + +#if HAVE_OPENCL + frame->opencl.ocl = h->opencl.ocl; +#endif + + return frame; + +fail: + x264_free( frame ); + return NULL; +} + +void x264_frame_delete( x264_frame_t *frame ) +{ + /* Duplicate frames are blank copies of real frames (including pointers), + * so freeing those pointers would cause a double free later. */ + if( !frame->b_duplicate ) + { + x264_free( frame->base ); + + if( frame->param && frame->param->param_free ) + frame->param->param_free( frame->param ); + if( frame->mb_info_free ) + frame->mb_info_free( frame->mb_info ); + if( frame->extra_sei.sei_free ) + { + for( int i = 0; i < frame->extra_sei.num_payloads; i++ ) + frame->extra_sei.sei_free( frame->extra_sei.payloads[i].payload ); + frame->extra_sei.sei_free( frame->extra_sei.payloads ); + } + x264_pthread_mutex_destroy( &frame->mutex ); + x264_pthread_cond_destroy( &frame->cv ); +#if HAVE_OPENCL + x264_opencl_frame_delete( frame ); +#endif + } + x264_free( frame ); +} + +static int get_plane_ptr( x264_t *h, x264_picture_t *src, uint8_t **pix, int *stride, int plane, int xshift, int yshift ) +{ + int width = h->param.i_width >> xshift; + int height = h->param.i_height >> yshift; + *pix = src->img.plane[plane]; + *stride = src->img.i_stride[plane]; + if( src->img.i_csp & X264_CSP_VFLIP ) + { + *pix += (height-1) * *stride; + *stride = -*stride; + } + if( width > abs(*stride) ) + { + x264_log( h, X264_LOG_ERROR, "Input picture width (%d) is greater than stride (%d)\n", width, *stride ); + return -1; + } + return 0; +} + +#define get_plane_ptr(...) do { if( get_plane_ptr(__VA_ARGS__) < 0 ) return -1; } while( 0 ) + +int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src ) +{ + int i_csp = src->img.i_csp & X264_CSP_MASK; + if( dst->i_csp != x264_frame_internal_csp( i_csp ) ) + { + x264_log( h, X264_LOG_ERROR, "Invalid input colorspace\n" ); + return -1; + } + +#if HIGH_BIT_DEPTH + if( !(src->img.i_csp & X264_CSP_HIGH_DEPTH) ) + { + x264_log( h, X264_LOG_ERROR, "This build of x264 requires high depth input. Rebuild to support 8-bit input.\n" ); + return -1; + } +#else + if( src->img.i_csp & X264_CSP_HIGH_DEPTH ) + { + x264_log( h, X264_LOG_ERROR, "This build of x264 requires 8-bit input. Rebuild to support high depth input.\n" ); + return -1; + } +#endif + + if( BIT_DEPTH != 10 && i_csp == X264_CSP_V210 ) + { + x264_log( h, X264_LOG_ERROR, "v210 input is only compatible with bit-depth of 10 bits\n" ); + return -1; + } + + if( src->i_type < X264_TYPE_AUTO || src->i_type > X264_TYPE_KEYFRAME ) + { + x264_log( h, X264_LOG_WARNING, "forced frame type (%d) at %d is unknown\n", src->i_type, h->frames.i_input ); + dst->i_forced_type = X264_TYPE_AUTO; + } + else + dst->i_forced_type = src->i_type; + + dst->i_type = dst->i_forced_type; + dst->i_qpplus1 = src->i_qpplus1; + dst->i_pts = dst->i_reordered_pts = src->i_pts; + dst->param = src->param; + dst->i_pic_struct = src->i_pic_struct; + dst->extra_sei = src->extra_sei; + dst->opaque = src->opaque; + dst->mb_info = h->param.analyse.b_mb_info ? src->prop.mb_info : NULL; + dst->mb_info_free = h->param.analyse.b_mb_info ? src->prop.mb_info_free : NULL; + + uint8_t *pix[3]; + int stride[3]; + if( i_csp == X264_CSP_YUYV || i_csp == X264_CSP_UYVY ) + { + int p = i_csp == X264_CSP_UYVY; + h->mc.plane_copy_deinterleave_yuyv( dst->plane[p], dst->i_stride[p], dst->plane[p^1], dst->i_stride[p^1], + (pixel*)src->img.plane[0], src->img.i_stride[0], h->param.i_width, h->param.i_height ); + } + else if( i_csp == X264_CSP_V210 ) + { + stride[0] = src->img.i_stride[0]; + pix[0] = src->img.plane[0]; + + h->mc.plane_copy_deinterleave_v210( dst->plane[0], dst->i_stride[0], + dst->plane[1], dst->i_stride[1], + (uint32_t *)pix[0], stride[0]/sizeof(uint32_t), h->param.i_width, h->param.i_height ); + } + else if( i_csp >= X264_CSP_BGR ) + { + stride[0] = src->img.i_stride[0]; + pix[0] = src->img.plane[0]; + if( src->img.i_csp & X264_CSP_VFLIP ) + { + pix[0] += (h->param.i_height-1) * stride[0]; + stride[0] = -stride[0]; + } + int b = i_csp==X264_CSP_RGB; + h->mc.plane_copy_deinterleave_rgb( dst->plane[1+b], dst->i_stride[1+b], + dst->plane[0], dst->i_stride[0], + dst->plane[2-b], dst->i_stride[2-b], + (pixel*)pix[0], stride[0]/sizeof(pixel), i_csp==X264_CSP_BGRA ? 4 : 3, h->param.i_width, h->param.i_height ); + } + else + { + int v_shift = CHROMA_V_SHIFT; + get_plane_ptr( h, src, &pix[0], &stride[0], 0, 0, 0 ); + h->mc.plane_copy( dst->plane[0], dst->i_stride[0], (pixel*)pix[0], + stride[0]/sizeof(pixel), h->param.i_width, h->param.i_height ); + if( i_csp == X264_CSP_NV12 || i_csp == X264_CSP_NV16 ) + { + get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift ); + h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1], + stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height>>v_shift ); + } + else if( i_csp == X264_CSP_NV21 ) + { + get_plane_ptr( h, src, &pix[1], &stride[1], 1, 0, v_shift ); + h->mc.plane_copy_swap( dst->plane[1], dst->i_stride[1], (pixel*)pix[1], + stride[1]/sizeof(pixel), h->param.i_width>>1, h->param.i_height>>v_shift ); + } + else if( i_csp == X264_CSP_I420 || i_csp == X264_CSP_I422 || i_csp == X264_CSP_YV12 || i_csp == X264_CSP_YV16 ) + { + int uv_swap = i_csp == X264_CSP_YV12 || i_csp == X264_CSP_YV16; + get_plane_ptr( h, src, &pix[1], &stride[1], uv_swap ? 2 : 1, 1, v_shift ); + get_plane_ptr( h, src, &pix[2], &stride[2], uv_swap ? 1 : 2, 1, v_shift ); + h->mc.plane_copy_interleave( dst->plane[1], dst->i_stride[1], + (pixel*)pix[1], stride[1]/sizeof(pixel), + (pixel*)pix[2], stride[2]/sizeof(pixel), + h->param.i_width>>1, h->param.i_height>>v_shift ); + } + else //if( i_csp == X264_CSP_I444 || i_csp == X264_CSP_YV24 ) + { + get_plane_ptr( h, src, &pix[1], &stride[1], i_csp==X264_CSP_I444 ? 1 : 2, 0, 0 ); + get_plane_ptr( h, src, &pix[2], &stride[2], i_csp==X264_CSP_I444 ? 2 : 1, 0, 0 ); + h->mc.plane_copy( dst->plane[1], dst->i_stride[1], (pixel*)pix[1], + stride[1]/sizeof(pixel), h->param.i_width, h->param.i_height ); + h->mc.plane_copy( dst->plane[2], dst->i_stride[2], (pixel*)pix[2], + stride[2]/sizeof(pixel), h->param.i_width, h->param.i_height ); + } + } + return 0; +} + +static void ALWAYS_INLINE pixel_memset( pixel *dst, pixel *src, int len, int size ) +{ + uint8_t *dstp = (uint8_t*)dst; + uint32_t v1 = *src; + uint32_t v2 = size == 1 ? v1 + (v1 << 8) : M16( src ); + uint32_t v4 = size <= 2 ? v2 + (v2 << 16) : M32( src ); + int i = 0; + len *= size; + + /* Align the input pointer if it isn't already */ + if( (intptr_t)dstp & (WORD_SIZE - 1) ) + { + if( size <= 2 && ((intptr_t)dstp & 3) ) + { + if( size == 1 && ((intptr_t)dstp & 1) ) + dstp[i++] = v1; + if( (intptr_t)dstp & 2 ) + { + M16( dstp+i ) = v2; + i += 2; + } + } + if( WORD_SIZE == 8 && (intptr_t)dstp & 4 ) + { + M32( dstp+i ) = v4; + i += 4; + } + } + + /* Main copy loop */ + if( WORD_SIZE == 8 ) + { + uint64_t v8 = v4 + ((uint64_t)v4<<32); + for( ; i < len - 7; i+=8 ) + M64( dstp+i ) = v8; + } + for( ; i < len - 3; i+=4 ) + M32( dstp+i ) = v4; + + /* Finish up the last few bytes */ + if( size <= 2 ) + { + if( i < len - 1 ) + { + M16( dstp+i ) = v2; + i += 2; + } + if( size == 1 && i != len ) + dstp[i] = v1; + } +} + +static void ALWAYS_INLINE plane_expand_border( pixel *pix, int i_stride, int i_width, int i_height, int i_padh, int i_padv, int b_pad_top, int b_pad_bottom, int b_chroma ) +{ +#define PPIXEL(x, y) ( pix + (x) + (y)*i_stride ) + for( int y = 0; y < i_height; y++ ) + { + /* left band */ + pixel_memset( PPIXEL(-i_padh, y), PPIXEL(0, y), i_padh>>b_chroma, sizeof(pixel)<>b_chroma, sizeof(pixel)<mb.i_mb_height - (1 << SLICE_MBAFF); + int b_start = mb_y == h->i_threadslice_start; + int b_end = mb_y == h->i_threadslice_end - (1 << SLICE_MBAFF); + if( mb_y & SLICE_MBAFF ) + return; + for( int i = 0; i < frame->i_plane; i++ ) + { + int h_shift = i && CHROMA_H_SHIFT; + int v_shift = i && CHROMA_V_SHIFT; + int stride = frame->i_stride[i]; + int width = 16*h->mb.i_mb_width; + int height = (pad_bot ? 16*(h->mb.i_mb_height - mb_y) >> SLICE_MBAFF : 16) >> v_shift; + int padh = PADH; + int padv = PADV >> v_shift; + // buffer: 2 chroma, 3 luma (rounded to 4) because deblocking goes beyond the top of the mb + if( b_end && !b_start ) + height += 4 >> (v_shift + SLICE_MBAFF); + pixel *pix; + int starty = 16*mb_y - 4*!b_start; + if( SLICE_MBAFF ) + { + // border samples for each field are extended separately + pix = frame->plane_fld[i] + (starty*stride >> v_shift); + plane_expand_border( pix, stride*2, width, height, padh, padv, pad_top, pad_bot, h_shift ); + plane_expand_border( pix+stride, stride*2, width, height, padh, padv, pad_top, pad_bot, h_shift ); + + height = (pad_bot ? 16*(h->mb.i_mb_height - mb_y) : 32) >> v_shift; + if( b_end && !b_start ) + height += 4 >> v_shift; + pix = frame->plane[i] + (starty*stride >> v_shift); + plane_expand_border( pix, stride, width, height, padh, padv, pad_top, pad_bot, h_shift ); + } + else + { + pix = frame->plane[i] + (starty*stride >> v_shift); + plane_expand_border( pix, stride, width, height, padh, padv, pad_top, pad_bot, h_shift ); + } + } +} + +void x264_frame_expand_border_filtered( x264_t *h, x264_frame_t *frame, int mb_y, int b_end ) +{ + /* during filtering, 8 extra pixels were filtered on each edge, + * but up to 3 of the horizontal ones may be wrong. + we want to expand border from the last filtered pixel */ + int b_start = !mb_y; + int width = 16*h->mb.i_mb_width + 8; + int height = b_end ? (16*(h->mb.i_mb_height - mb_y) >> SLICE_MBAFF) + 16 : 16; + int padh = PADH - 4; + int padv = PADV - 8; + for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ ) + for( int i = 1; i < 4; i++ ) + { + int stride = frame->i_stride[p]; + // buffer: 8 luma, to match the hpel filter + pixel *pix; + if( SLICE_MBAFF ) + { + pix = frame->filtered_fld[p][i] + (16*mb_y - 16) * stride - 4; + plane_expand_border( pix, stride*2, width, height, padh, padv, b_start, b_end, 0 ); + plane_expand_border( pix+stride, stride*2, width, height, padh, padv, b_start, b_end, 0 ); + } + + pix = frame->filtered[p][i] + (16*mb_y - 8) * stride - 4; + plane_expand_border( pix, stride, width, height << SLICE_MBAFF, padh, padv, b_start, b_end, 0 ); + } +} + +void x264_frame_expand_border_lowres( x264_frame_t *frame ) +{ + for( int i = 0; i < 4; i++ ) + plane_expand_border( frame->lowres[i], frame->i_stride_lowres, frame->i_width_lowres, frame->i_lines_lowres, PADH, PADV, 1, 1, 0 ); +} + +void x264_frame_expand_border_chroma( x264_t *h, x264_frame_t *frame, int plane ) +{ + int v_shift = CHROMA_V_SHIFT; + plane_expand_border( frame->plane[plane], frame->i_stride[plane], 16*h->mb.i_mb_width, 16*h->mb.i_mb_height>>v_shift, + PADH, PADV>>v_shift, 1, 1, CHROMA_H_SHIFT ); +} + +void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame ) +{ + for( int i = 0; i < frame->i_plane; i++ ) + { + int i_width = h->param.i_width; + int h_shift = i && CHROMA_H_SHIFT; + int v_shift = i && CHROMA_V_SHIFT; + int i_height = h->param.i_height >> v_shift; + int i_padx = (h->mb.i_mb_width * 16 - h->param.i_width); + int i_pady = (h->mb.i_mb_height * 16 - h->param.i_height) >> v_shift; + + if( i_padx ) + { + for( int y = 0; y < i_height; y++ ) + pixel_memset( &frame->plane[i][y*frame->i_stride[i] + i_width], + &frame->plane[i][y*frame->i_stride[i] + i_width - 1-h_shift], + i_padx>>h_shift, sizeof(pixel)<plane[i][y*frame->i_stride[i]], + &frame->plane[i][(i_height-(~y&PARAM_INTERLACED)-1)*frame->i_stride[i]], + (i_width + i_padx) * sizeof(pixel) ); + } + } +} + +void x264_expand_border_mbpair( x264_t *h, int mb_x, int mb_y ) +{ + for( int i = 0; i < h->fenc->i_plane; i++ ) + { + int v_shift = i && CHROMA_V_SHIFT; + int stride = h->fenc->i_stride[i]; + int height = h->param.i_height >> v_shift; + int pady = (h->mb.i_mb_height * 16 - h->param.i_height) >> v_shift; + pixel *fenc = h->fenc->plane[i] + 16*mb_x; + for( int y = height; y < height + pady; y++ ) + memcpy( fenc + y*stride, fenc + (height-1)*stride, 16*sizeof(pixel) ); + } +} + +/* threading */ +void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed ) +{ + x264_pthread_mutex_lock( &frame->mutex ); + frame->i_lines_completed = i_lines_completed; + x264_pthread_cond_broadcast( &frame->cv ); + x264_pthread_mutex_unlock( &frame->mutex ); +} + +void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed ) +{ + x264_pthread_mutex_lock( &frame->mutex ); + while( frame->i_lines_completed < i_lines_completed ) + x264_pthread_cond_wait( &frame->cv, &frame->mutex ); + x264_pthread_mutex_unlock( &frame->mutex ); +} + +void x264_threadslice_cond_broadcast( x264_t *h, int pass ) +{ + x264_pthread_mutex_lock( &h->mutex ); + h->i_threadslice_pass = pass; + if( pass > 0 ) + x264_pthread_cond_broadcast( &h->cv ); + x264_pthread_mutex_unlock( &h->mutex ); +} + +void x264_threadslice_cond_wait( x264_t *h, int pass ) +{ + x264_pthread_mutex_lock( &h->mutex ); + while( h->i_threadslice_pass < pass ) + x264_pthread_cond_wait( &h->cv, &h->mutex ); + x264_pthread_mutex_unlock( &h->mutex ); +} + +int x264_frame_new_slice( x264_t *h, x264_frame_t *frame ) +{ + if( h->param.i_slice_count_max ) + { + int slice_count; + if( h->param.b_sliced_threads ) + slice_count = x264_pthread_fetch_and_add( &frame->i_slice_count, 1, &frame->mutex ); + else + slice_count = frame->i_slice_count++; + if( slice_count >= h->param.i_slice_count_max ) + return -1; + } + return 0; +} + +/* list operators */ + +void x264_frame_push( x264_frame_t **list, x264_frame_t *frame ) +{ + int i = 0; + while( list[i] ) i++; + list[i] = frame; +} + +x264_frame_t *x264_frame_pop( x264_frame_t **list ) +{ + x264_frame_t *frame; + int i = 0; + assert( list[0] ); + while( list[i+1] ) i++; + frame = list[i]; + list[i] = NULL; + return frame; +} + +void x264_frame_unshift( x264_frame_t **list, x264_frame_t *frame ) +{ + int i = 0; + while( list[i] ) i++; + while( i-- ) + list[i+1] = list[i]; + list[0] = frame; +} + +x264_frame_t *x264_frame_shift( x264_frame_t **list ) +{ + x264_frame_t *frame = list[0]; + int i; + for( i = 0; list[i]; i++ ) + list[i] = list[i+1]; + assert(frame); + return frame; +} + +void x264_frame_push_unused( x264_t *h, x264_frame_t *frame ) +{ + assert( frame->i_reference_count > 0 ); + frame->i_reference_count--; + if( frame->i_reference_count == 0 ) + x264_frame_push( h->frames.unused[frame->b_fdec], frame ); +} + +x264_frame_t *x264_frame_pop_unused( x264_t *h, int b_fdec ) +{ + x264_frame_t *frame; + if( h->frames.unused[b_fdec][0] ) + frame = x264_frame_pop( h->frames.unused[b_fdec] ); + else + frame = x264_frame_new( h, b_fdec ); + if( !frame ) + return NULL; + frame->b_last_minigop_bframe = 0; + frame->i_reference_count = 1; + frame->b_intra_calculated = 0; + frame->b_scenecut = 1; + frame->b_keyframe = 0; + frame->b_corrupt = 0; + frame->i_slice_count = h->param.b_sliced_threads ? h->param.i_threads : 1; + + memset( frame->weight, 0, sizeof(frame->weight) ); + memset( frame->f_weighted_cost_delta, 0, sizeof(frame->f_weighted_cost_delta) ); + + return frame; +} + +void x264_frame_push_blank_unused( x264_t *h, x264_frame_t *frame ) +{ + assert( frame->i_reference_count > 0 ); + frame->i_reference_count--; + if( frame->i_reference_count == 0 ) + x264_frame_push( h->frames.blank_unused, frame ); +} + +x264_frame_t *x264_frame_pop_blank_unused( x264_t *h ) +{ + x264_frame_t *frame; + if( h->frames.blank_unused[0] ) + frame = x264_frame_pop( h->frames.blank_unused ); + else + frame = x264_malloc( sizeof(x264_frame_t) ); + if( !frame ) + return NULL; + frame->b_duplicate = 1; + frame->i_reference_count = 1; + return frame; +} + +void x264_weight_scale_plane( x264_t *h, pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, + int i_width, int i_height, x264_weight_t *w ) +{ + /* Weight horizontal strips of height 16. This was found to be the optimal height + * in terms of the cache loads. */ + while( i_height > 0 ) + { + int x; + for( x = 0; x < i_width-8; x += 16 ) + w->weightfn[16>>2]( dst+x, i_dst_stride, src+x, i_src_stride, w, X264_MIN( i_height, 16 ) ); + if( x < i_width ) + w->weightfn[ 8>>2]( dst+x, i_dst_stride, src+x, i_src_stride, w, X264_MIN( i_height, 16 ) ); + i_height -= 16; + dst += 16 * i_dst_stride; + src += 16 * i_src_stride; + } +} + +void x264_frame_delete_list( x264_frame_t **list ) +{ + int i = 0; + if( !list ) + return; + while( list[i] ) + x264_frame_delete( list[i++] ); + x264_free( list ); +} + +int x264_sync_frame_list_init( x264_sync_frame_list_t *slist, int max_size ) +{ + if( max_size < 0 ) + return -1; + slist->i_max_size = max_size; + slist->i_size = 0; + CHECKED_MALLOCZERO( slist->list, (max_size+1) * sizeof(x264_frame_t*) ); + if( x264_pthread_mutex_init( &slist->mutex, NULL ) || + x264_pthread_cond_init( &slist->cv_fill, NULL ) || + x264_pthread_cond_init( &slist->cv_empty, NULL ) ) + return -1; + return 0; +fail: + return -1; +} + +void x264_sync_frame_list_delete( x264_sync_frame_list_t *slist ) +{ + x264_pthread_mutex_destroy( &slist->mutex ); + x264_pthread_cond_destroy( &slist->cv_fill ); + x264_pthread_cond_destroy( &slist->cv_empty ); + x264_frame_delete_list( slist->list ); +} + +void x264_sync_frame_list_push( x264_sync_frame_list_t *slist, x264_frame_t *frame ) +{ + x264_pthread_mutex_lock( &slist->mutex ); + while( slist->i_size == slist->i_max_size ) + x264_pthread_cond_wait( &slist->cv_empty, &slist->mutex ); + slist->list[ slist->i_size++ ] = frame; + x264_pthread_mutex_unlock( &slist->mutex ); + x264_pthread_cond_broadcast( &slist->cv_fill ); +} + +x264_frame_t *x264_sync_frame_list_pop( x264_sync_frame_list_t *slist ) +{ + x264_frame_t *frame; + x264_pthread_mutex_lock( &slist->mutex ); + while( !slist->i_size ) + x264_pthread_cond_wait( &slist->cv_fill, &slist->mutex ); + frame = slist->list[ --slist->i_size ]; + slist->list[ slist->i_size ] = NULL; + x264_pthread_cond_broadcast( &slist->cv_empty ); + x264_pthread_mutex_unlock( &slist->mutex ); + return frame; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.h new file mode 100644 index 00000000..18eb427f --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/frame.h @@ -0,0 +1,262 @@ +/***************************************************************************** + * frame.h: frame handling + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_FRAME_H +#define X264_FRAME_H + +/* number of pixels past the edge of the frame, for motion estimation/compensation */ +#define PADH 32 +#define PADV 32 + +typedef struct x264_frame +{ + /* */ + uint8_t *base; /* Base pointer for all malloced data in this frame. */ + int i_poc; + int i_delta_poc[2]; + int i_type; + int i_forced_type; + int i_qpplus1; + int64_t i_pts; + int64_t i_dts; + int64_t i_reordered_pts; + int64_t i_duration; /* in SPS time_scale units (i.e 2 * timebase units) used for vfr */ + float f_duration; /* in seconds */ + int64_t i_cpb_duration; + int64_t i_cpb_delay; /* in SPS time_scale units (i.e 2 * timebase units) */ + int64_t i_dpb_output_delay; + x264_param_t *param; + + int i_frame; /* Presentation frame number */ + int i_coded; /* Coded frame number */ + int64_t i_field_cnt; /* Presentation field count */ + int i_frame_num; /* 7.4.3 frame_num */ + int b_kept_as_ref; + int i_pic_struct; + int b_keyframe; + uint8_t b_fdec; + uint8_t b_last_minigop_bframe; /* this frame is the last b in a sequence of bframes */ + uint8_t i_bframes; /* number of bframes following this nonb in coded order */ + float f_qp_avg_rc; /* QPs as decided by ratecontrol */ + float f_qp_avg_aq; /* QPs as decided by AQ in addition to ratecontrol */ + float f_crf_avg; /* Average effective CRF for this frame */ + int i_poc_l0ref0; /* poc of first refframe in L0, used to check if direct temporal is possible */ + + /* YUV buffer */ + int i_csp; /* Internal csp */ + int i_plane; + int i_stride[3]; + int i_width[3]; + int i_lines[3]; + int i_stride_lowres; + int i_width_lowres; + int i_lines_lowres; + pixel *plane[3]; + pixel *plane_fld[3]; + pixel *filtered[3][4]; /* plane[0], H, V, HV */ + pixel *filtered_fld[3][4]; + pixel *lowres[4]; /* half-size copy of input frame: Orig, H, V, HV */ + uint16_t *integral; + + /* for unrestricted mv we allocate more data than needed + * allocated data are stored in buffer */ + pixel *buffer[4]; + pixel *buffer_fld[4]; + pixel *buffer_lowres[4]; + + x264_weight_t weight[X264_REF_MAX][3]; /* [ref_index][plane] */ + pixel *weighted[X264_REF_MAX]; /* plane[0] weighted of the reference frames */ + int b_duplicate; + struct x264_frame *orig; + + /* motion data */ + int8_t *mb_type; + uint8_t *mb_partition; + int16_t (*mv[2])[2]; + int16_t (*mv16x16)[2]; + int16_t (*lowres_mvs[2][X264_BFRAME_MAX+1])[2]; + uint8_t *field; + uint8_t *effective_qp; + + /* Stored as (lists_used << LOWRES_COST_SHIFT) + (cost). + * Doesn't need special addressing for intra cost because + * lists_used is guaranteed to be zero in that cast. */ + uint16_t (*lowres_costs[X264_BFRAME_MAX+2][X264_BFRAME_MAX+2]); + #define LOWRES_COST_MASK ((1<<14)-1) + #define LOWRES_COST_SHIFT 14 + + int *lowres_mv_costs[2][X264_BFRAME_MAX+1]; + int8_t *ref[2]; + int i_ref[2]; + int ref_poc[2][X264_REF_MAX]; + int16_t inv_ref_poc[2]; // inverse values of ref0 poc to avoid divisions in temporal MV prediction + + /* for adaptive B-frame decision. + * contains the SATD cost of the lowres frame encoded in various modes + * FIXME: how big an array do we need? */ + int i_cost_est[X264_BFRAME_MAX+2][X264_BFRAME_MAX+2]; + int i_cost_est_aq[X264_BFRAME_MAX+2][X264_BFRAME_MAX+2]; + int i_satd; // the i_cost_est of the selected frametype + int i_intra_mbs[X264_BFRAME_MAX+2]; + int *i_row_satds[X264_BFRAME_MAX+2][X264_BFRAME_MAX+2]; + int *i_row_satd; + int *i_row_bits; + float *f_row_qp; + float *f_row_qscale; + float *f_qp_offset; + float *f_qp_offset_aq; + int b_intra_calculated; + uint16_t *i_intra_cost; + uint16_t *i_propagate_cost; + uint16_t *i_inv_qscale_factor; + int b_scenecut; /* Set to zero if the frame cannot possibly be part of a real scenecut. */ + float f_weighted_cost_delta[X264_BFRAME_MAX+2]; + uint32_t i_pixel_sum[3]; + uint64_t i_pixel_ssd[3]; + + /* hrd */ + x264_hrd_t hrd_timing; + + /* vbv */ + uint8_t i_planned_type[X264_LOOKAHEAD_MAX+1]; + int i_planned_satd[X264_LOOKAHEAD_MAX+1]; + double f_planned_cpb_duration[X264_LOOKAHEAD_MAX+1]; + int64_t i_coded_fields_lookahead; + int64_t i_cpb_delay_lookahead; + + /* threading */ + int i_lines_completed; /* in pixels */ + int i_lines_weighted; /* FIXME: this only supports weighting of one reference frame */ + int i_reference_count; /* number of threads using this frame (not necessarily the number of pointers) */ + x264_pthread_mutex_t mutex; + x264_pthread_cond_t cv; + int i_slice_count; /* Atomically written to/read from with slice threads */ + + /* periodic intra refresh */ + float f_pir_position; + int i_pir_start_col; + int i_pir_end_col; + int i_frames_since_pir; + + /* interactive encoder control */ + int b_corrupt; + + /* user sei */ + x264_sei_t extra_sei; + + /* user data */ + void *opaque; + + /* user frame properties */ + uint8_t *mb_info; + void (*mb_info_free)( void* ); + +#if HAVE_OPENCL + x264_frame_opencl_t opencl; +#endif +} x264_frame_t; + +/* synchronized frame list */ +typedef struct +{ + x264_frame_t **list; + int i_max_size; + int i_size; + x264_pthread_mutex_t mutex; + x264_pthread_cond_t cv_fill; /* event signaling that the list became fuller */ + x264_pthread_cond_t cv_empty; /* event signaling that the list became emptier */ +} x264_sync_frame_list_t; + +typedef void (*x264_deblock_inter_t)( pixel *pix, intptr_t stride, int alpha, int beta, int8_t *tc0 ); +typedef void (*x264_deblock_intra_t)( pixel *pix, intptr_t stride, int alpha, int beta ); +typedef struct +{ + x264_deblock_inter_t deblock_luma[2]; + x264_deblock_inter_t deblock_chroma[2]; + x264_deblock_inter_t deblock_h_chroma_420; + x264_deblock_inter_t deblock_h_chroma_422; + x264_deblock_intra_t deblock_luma_intra[2]; + x264_deblock_intra_t deblock_chroma_intra[2]; + x264_deblock_intra_t deblock_h_chroma_420_intra; + x264_deblock_intra_t deblock_h_chroma_422_intra; + x264_deblock_inter_t deblock_luma_mbaff; + x264_deblock_inter_t deblock_chroma_mbaff; + x264_deblock_inter_t deblock_chroma_420_mbaff; + x264_deblock_inter_t deblock_chroma_422_mbaff; + x264_deblock_intra_t deblock_luma_intra_mbaff; + x264_deblock_intra_t deblock_chroma_intra_mbaff; + x264_deblock_intra_t deblock_chroma_420_intra_mbaff; + x264_deblock_intra_t deblock_chroma_422_intra_mbaff; + void (*deblock_strength)( uint8_t nnz[X264_SCAN8_SIZE], int8_t ref[2][X264_SCAN8_LUMA_SIZE], + int16_t mv[2][X264_SCAN8_LUMA_SIZE][2], uint8_t bs[2][8][4], int mvy_limit, + int bframe ); +} x264_deblock_function_t; + +void x264_frame_delete( x264_frame_t *frame ); + +int x264_frame_copy_picture( x264_t *h, x264_frame_t *dst, x264_picture_t *src ); + +void x264_frame_expand_border( x264_t *h, x264_frame_t *frame, int mb_y ); +void x264_frame_expand_border_filtered( x264_t *h, x264_frame_t *frame, int mb_y, int b_end ); +void x264_frame_expand_border_lowres( x264_frame_t *frame ); +void x264_frame_expand_border_chroma( x264_t *h, x264_frame_t *frame, int plane ); +void x264_frame_expand_border_mod16( x264_t *h, x264_frame_t *frame ); +void x264_expand_border_mbpair( x264_t *h, int mb_x, int mb_y ); + +void x264_frame_deblock_row( x264_t *h, int mb_y ); +void x264_macroblock_deblock( x264_t *h ); + +void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b_end ); +void x264_frame_init_lowres( x264_t *h, x264_frame_t *frame ); + +void x264_deblock_init( int cpu, x264_deblock_function_t *pf, int b_mbaff ); + +void x264_frame_cond_broadcast( x264_frame_t *frame, int i_lines_completed ); +void x264_frame_cond_wait( x264_frame_t *frame, int i_lines_completed ); +int x264_frame_new_slice( x264_t *h, x264_frame_t *frame ); + +void x264_threadslice_cond_broadcast( x264_t *h, int pass ); +void x264_threadslice_cond_wait( x264_t *h, int pass ); + +void x264_frame_push( x264_frame_t **list, x264_frame_t *frame ); +x264_frame_t *x264_frame_pop( x264_frame_t **list ); +void x264_frame_unshift( x264_frame_t **list, x264_frame_t *frame ); +x264_frame_t *x264_frame_shift( x264_frame_t **list ); +void x264_frame_push_unused( x264_t *h, x264_frame_t *frame ); +void x264_frame_push_blank_unused( x264_t *h, x264_frame_t *frame ); +x264_frame_t *x264_frame_pop_blank_unused( x264_t *h ); +void x264_weight_scale_plane( x264_t *h, pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, + int i_width, int i_height, x264_weight_t *w ); +x264_frame_t *x264_frame_pop_unused( x264_t *h, int b_fdec ); +void x264_frame_delete_list( x264_frame_t **list ); + +int x264_sync_frame_list_init( x264_sync_frame_list_t *slist, int nelem ); +void x264_sync_frame_list_delete( x264_sync_frame_list_t *slist ); +void x264_sync_frame_list_push( x264_sync_frame_list_t *slist, x264_frame_t *frame ); +x264_frame_t *x264_sync_frame_list_pop( x264_sync_frame_list_t *slist ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.c new file mode 100644 index 00000000..61686715 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.c @@ -0,0 +1,1914 @@ +/***************************************************************************** + * macroblock.c: macroblock common functions + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Fiona Glaser + * Laurent Aimar + * Loren Merritt + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#define MC_LUMA(list,p) \ + h->mc.mc_luma( &h->mb.pic.p_fdec[p][4*y*FDEC_STRIDE+4*x], FDEC_STRIDE, \ + &h->mb.pic.p_fref[list][i_ref][p*4], h->mb.pic.i_stride[p], \ + mvx, mvy, 4*width, 4*height, \ + list ? x264_weight_none : &h->sh.weight[i_ref][p] ); + +static NOINLINE void x264_mb_mc_0xywh( x264_t *h, int x, int y, int width, int height ) +{ + int i8 = x264_scan8[0]+x+8*y; + int i_ref = h->mb.cache.ref[0][i8]; + int mvx = x264_clip3( h->mb.cache.mv[0][i8][0], h->mb.mv_min[0], h->mb.mv_max[0] ) + 4*4*x; + int mvy = x264_clip3( h->mb.cache.mv[0][i8][1], h->mb.mv_min[1], h->mb.mv_max[1] ) + 4*4*y; + + MC_LUMA( 0, 0 ); + + if( CHROMA444 ) + { + MC_LUMA( 0, 1 ); + MC_LUMA( 0, 2 ); + } + else + { + int v_shift = CHROMA_V_SHIFT; + // Chroma in 4:2:0 is offset if MCing from a field of opposite parity + if( v_shift & MB_INTERLACED & i_ref ) + mvy += (h->mb.i_mb_y & 1)*4 - 2; + + int offset = (4*FDEC_STRIDE>>v_shift)*y + 2*x; + height = 4*height >> v_shift; + + h->mc.mc_chroma( &h->mb.pic.p_fdec[1][offset], + &h->mb.pic.p_fdec[2][offset], FDEC_STRIDE, + h->mb.pic.p_fref[0][i_ref][4], h->mb.pic.i_stride[1], + mvx, 2*mvy>>v_shift, 2*width, height ); + + if( h->sh.weight[i_ref][1].weightfn ) + h->sh.weight[i_ref][1].weightfn[width>>1]( &h->mb.pic.p_fdec[1][offset], FDEC_STRIDE, + &h->mb.pic.p_fdec[1][offset], FDEC_STRIDE, + &h->sh.weight[i_ref][1], height ); + if( h->sh.weight[i_ref][2].weightfn ) + h->sh.weight[i_ref][2].weightfn[width>>1]( &h->mb.pic.p_fdec[2][offset], FDEC_STRIDE, + &h->mb.pic.p_fdec[2][offset], FDEC_STRIDE, + &h->sh.weight[i_ref][2], height ); + } +} +static NOINLINE void x264_mb_mc_1xywh( x264_t *h, int x, int y, int width, int height ) +{ + int i8 = x264_scan8[0]+x+8*y; + int i_ref = h->mb.cache.ref[1][i8]; + int mvx = x264_clip3( h->mb.cache.mv[1][i8][0], h->mb.mv_min[0], h->mb.mv_max[0] ) + 4*4*x; + int mvy = x264_clip3( h->mb.cache.mv[1][i8][1], h->mb.mv_min[1], h->mb.mv_max[1] ) + 4*4*y; + + MC_LUMA( 1, 0 ); + + if( CHROMA444 ) + { + MC_LUMA( 1, 1 ); + MC_LUMA( 1, 2 ); + } + else + { + int v_shift = CHROMA_V_SHIFT; + if( v_shift & MB_INTERLACED & i_ref ) + mvy += (h->mb.i_mb_y & 1)*4 - 2; + + int offset = (4*FDEC_STRIDE>>v_shift)*y + 2*x; + h->mc.mc_chroma( &h->mb.pic.p_fdec[1][offset], + &h->mb.pic.p_fdec[2][offset], FDEC_STRIDE, + h->mb.pic.p_fref[1][i_ref][4], h->mb.pic.i_stride[1], + mvx, 2*mvy>>v_shift, 2*width, 4*height>>v_shift ); + } +} + +#define MC_LUMA_BI(p) \ + src0 = h->mc.get_ref( tmp0, &i_stride0, &h->mb.pic.p_fref[0][i_ref0][p*4], h->mb.pic.i_stride[p], \ + mvx0, mvy0, 4*width, 4*height, x264_weight_none ); \ + src1 = h->mc.get_ref( tmp1, &i_stride1, &h->mb.pic.p_fref[1][i_ref1][p*4], h->mb.pic.i_stride[p], \ + mvx1, mvy1, 4*width, 4*height, x264_weight_none ); \ + h->mc.avg[i_mode]( &h->mb.pic.p_fdec[p][4*y*FDEC_STRIDE+4*x], FDEC_STRIDE, \ + src0, i_stride0, src1, i_stride1, weight ); + +static NOINLINE void x264_mb_mc_01xywh( x264_t *h, int x, int y, int width, int height ) +{ + int i8 = x264_scan8[0]+x+8*y; + int i_ref0 = h->mb.cache.ref[0][i8]; + int i_ref1 = h->mb.cache.ref[1][i8]; + int weight = h->mb.bipred_weight[i_ref0][i_ref1]; + int mvx0 = x264_clip3( h->mb.cache.mv[0][i8][0], h->mb.mv_min[0], h->mb.mv_max[0] ) + 4*4*x; + int mvx1 = x264_clip3( h->mb.cache.mv[1][i8][0], h->mb.mv_min[0], h->mb.mv_max[0] ) + 4*4*x; + int mvy0 = x264_clip3( h->mb.cache.mv[0][i8][1], h->mb.mv_min[1], h->mb.mv_max[1] ) + 4*4*y; + int mvy1 = x264_clip3( h->mb.cache.mv[1][i8][1], h->mb.mv_min[1], h->mb.mv_max[1] ) + 4*4*y; + int i_mode = x264_size2pixel[height][width]; + intptr_t i_stride0 = 16, i_stride1 = 16; + ALIGNED_ARRAY_32( pixel, tmp0,[16*16] ); + ALIGNED_ARRAY_32( pixel, tmp1,[16*16] ); + pixel *src0, *src1; + + MC_LUMA_BI( 0 ); + + if( CHROMA444 ) + { + MC_LUMA_BI( 1 ); + MC_LUMA_BI( 2 ); + } + else + { + int v_shift = CHROMA_V_SHIFT; + if( v_shift & MB_INTERLACED & i_ref0 ) + mvy0 += (h->mb.i_mb_y & 1)*4 - 2; + if( v_shift & MB_INTERLACED & i_ref1 ) + mvy1 += (h->mb.i_mb_y & 1)*4 - 2; + + h->mc.mc_chroma( tmp0, tmp0+8, 16, h->mb.pic.p_fref[0][i_ref0][4], h->mb.pic.i_stride[1], + mvx0, 2*mvy0>>v_shift, 2*width, 4*height>>v_shift ); + h->mc.mc_chroma( tmp1, tmp1+8, 16, h->mb.pic.p_fref[1][i_ref1][4], h->mb.pic.i_stride[1], + mvx1, 2*mvy1>>v_shift, 2*width, 4*height>>v_shift ); + + int chromapix = h->luma2chroma_pixel[i_mode]; + int offset = (4*FDEC_STRIDE>>v_shift)*y + 2*x; + h->mc.avg[chromapix]( &h->mb.pic.p_fdec[1][offset], FDEC_STRIDE, tmp0, 16, tmp1, 16, weight ); + h->mc.avg[chromapix]( &h->mb.pic.p_fdec[2][offset], FDEC_STRIDE, tmp0+8, 16, tmp1+8, 16, weight ); + } +} + +#undef MC_LUMA +#undef MC_LUMA_BI + +void x264_mb_mc_8x8( x264_t *h, int i8 ) +{ + int x = 2*(i8&1); + int y = 2*(i8>>1); + + if( h->sh.i_type == SLICE_TYPE_P ) + { + switch( h->mb.i_sub_partition[i8] ) + { + case D_L0_8x8: + x264_mb_mc_0xywh( h, x, y, 2, 2 ); + break; + case D_L0_8x4: + x264_mb_mc_0xywh( h, x, y+0, 2, 1 ); + x264_mb_mc_0xywh( h, x, y+1, 2, 1 ); + break; + case D_L0_4x8: + x264_mb_mc_0xywh( h, x+0, y, 1, 2 ); + x264_mb_mc_0xywh( h, x+1, y, 1, 2 ); + break; + case D_L0_4x4: + x264_mb_mc_0xywh( h, x+0, y+0, 1, 1 ); + x264_mb_mc_0xywh( h, x+1, y+0, 1, 1 ); + x264_mb_mc_0xywh( h, x+0, y+1, 1, 1 ); + x264_mb_mc_0xywh( h, x+1, y+1, 1, 1 ); + break; + } + } + else + { + int scan8 = x264_scan8[0] + x + 8*y; + + if( h->mb.cache.ref[0][scan8] >= 0 ) + if( h->mb.cache.ref[1][scan8] >= 0 ) + x264_mb_mc_01xywh( h, x, y, 2, 2 ); + else + x264_mb_mc_0xywh( h, x, y, 2, 2 ); + else + x264_mb_mc_1xywh( h, x, y, 2, 2 ); + } +} + +void x264_mb_mc( x264_t *h ) +{ + if( h->mb.i_partition == D_8x8 ) + { + for( int i = 0; i < 4; i++ ) + x264_mb_mc_8x8( h, i ); + } + else + { + int ref0a = h->mb.cache.ref[0][x264_scan8[ 0]]; + int ref0b = h->mb.cache.ref[0][x264_scan8[12]]; + int ref1a = h->mb.cache.ref[1][x264_scan8[ 0]]; + int ref1b = h->mb.cache.ref[1][x264_scan8[12]]; + + if( h->mb.i_partition == D_16x16 ) + { + if( ref0a >= 0 ) + if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 4, 4 ); + else x264_mb_mc_0xywh ( h, 0, 0, 4, 4 ); + else x264_mb_mc_1xywh ( h, 0, 0, 4, 4 ); + } + else if( h->mb.i_partition == D_16x8 ) + { + if( ref0a >= 0 ) + if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 4, 2 ); + else x264_mb_mc_0xywh ( h, 0, 0, 4, 2 ); + else x264_mb_mc_1xywh ( h, 0, 0, 4, 2 ); + + if( ref0b >= 0 ) + if( ref1b >= 0 ) x264_mb_mc_01xywh( h, 0, 2, 4, 2 ); + else x264_mb_mc_0xywh ( h, 0, 2, 4, 2 ); + else x264_mb_mc_1xywh ( h, 0, 2, 4, 2 ); + } + else if( h->mb.i_partition == D_8x16 ) + { + if( ref0a >= 0 ) + if( ref1a >= 0 ) x264_mb_mc_01xywh( h, 0, 0, 2, 4 ); + else x264_mb_mc_0xywh ( h, 0, 0, 2, 4 ); + else x264_mb_mc_1xywh ( h, 0, 0, 2, 4 ); + + if( ref0b >= 0 ) + if( ref1b >= 0 ) x264_mb_mc_01xywh( h, 2, 0, 2, 4 ); + else x264_mb_mc_0xywh ( h, 2, 0, 2, 4 ); + else x264_mb_mc_1xywh ( h, 2, 0, 2, 4 ); + } + } +} + +int x264_macroblock_cache_allocate( x264_t *h ) +{ + int i_mb_count = h->mb.i_mb_count; + + h->mb.i_mb_stride = h->mb.i_mb_width; + h->mb.i_b8_stride = h->mb.i_mb_width * 2; + h->mb.i_b4_stride = h->mb.i_mb_width * 4; + + h->mb.b_interlaced = PARAM_INTERLACED; + + PREALLOC_INIT + + PREALLOC( h->mb.qp, i_mb_count * sizeof(int8_t) ); + PREALLOC( h->mb.cbp, i_mb_count * sizeof(int16_t) ); + PREALLOC( h->mb.mb_transform_size, i_mb_count * sizeof(int8_t) ); + PREALLOC( h->mb.slice_table, i_mb_count * sizeof(uint32_t) ); + + /* 0 -> 3 top(4), 4 -> 6 : left(3) */ + PREALLOC( h->mb.intra4x4_pred_mode, i_mb_count * 8 * sizeof(int8_t) ); + + /* all coeffs */ + PREALLOC( h->mb.non_zero_count, i_mb_count * 48 * sizeof(uint8_t) ); + + if( h->param.b_cabac ) + { + PREALLOC( h->mb.skipbp, i_mb_count * sizeof(int8_t) ); + PREALLOC( h->mb.chroma_pred_mode, i_mb_count * sizeof(int8_t) ); + PREALLOC( h->mb.mvd[0], i_mb_count * sizeof( **h->mb.mvd ) ); + if( h->param.i_bframe ) + PREALLOC( h->mb.mvd[1], i_mb_count * sizeof( **h->mb.mvd ) ); + } + + for( int i = 0; i < 2; i++ ) + { + int i_refs = X264_MIN(X264_REF_MAX, (i ? 1 + !!h->param.i_bframe_pyramid : h->param.i_frame_reference) ) << PARAM_INTERLACED; + if( h->param.analyse.i_weighted_pred == X264_WEIGHTP_SMART ) + i_refs = X264_MIN(X264_REF_MAX, i_refs + 1 + (BIT_DEPTH == 8)); //smart weights add two duplicate frames, one in >8-bit + + for( int j = !i; j < i_refs; j++ ) + PREALLOC( h->mb.mvr[i][j], 2 * (i_mb_count + 1) * sizeof(int16_t) ); + } + + if( h->param.analyse.i_weighted_pred ) + { + int i_padv = PADV << PARAM_INTERLACED; + int luma_plane_size = 0; + int numweightbuf; + + if( h->param.analyse.i_weighted_pred == X264_WEIGHTP_FAKE ) + { + // only need buffer for lookahead + if( !h->param.i_sync_lookahead || h == h->thread[h->param.i_threads] ) + { + // Fake analysis only works on lowres + luma_plane_size = h->fdec->i_stride_lowres * (h->mb.i_mb_height*8+2*i_padv); + // Only need 1 buffer for analysis + numweightbuf = 1; + } + else + numweightbuf = 0; + } + else + { + /* Both ref and fenc is stored for 4:2:0 and 4:2:2 which means that 4:2:0 and 4:4:4 + * needs the same amount of space and 4:2:2 needs twice that much */ + luma_plane_size = h->fdec->i_stride[0] * (h->mb.i_mb_height*(16<<(CHROMA_FORMAT==CHROMA_422))+2*i_padv); + + if( h->param.analyse.i_weighted_pred == X264_WEIGHTP_SMART ) + //smart can weight one ref and one offset -1 in 8-bit + numweightbuf = 1 + (BIT_DEPTH == 8); + else + //simple only has one weighted ref + numweightbuf = 1; + } + + for( int i = 0; i < numweightbuf; i++ ) + PREALLOC( h->mb.p_weight_buf[i], luma_plane_size * sizeof(pixel) ); + } + + PREALLOC_END( h->mb.base ); + + memset( h->mb.slice_table, -1, i_mb_count * sizeof(uint32_t) ); + + for( int i = 0; i < 2; i++ ) + { + int i_refs = X264_MIN(X264_REF_MAX, (i ? 1 + !!h->param.i_bframe_pyramid : h->param.i_frame_reference) ) << PARAM_INTERLACED; + if( h->param.analyse.i_weighted_pred == X264_WEIGHTP_SMART ) + i_refs = X264_MIN(X264_REF_MAX, i_refs + 1 + (BIT_DEPTH == 8)); //smart weights add two duplicate frames, one in >8-bit + + for( int j = !i; j < i_refs; j++ ) + { + M32( h->mb.mvr[i][j][0] ) = 0; + h->mb.mvr[i][j]++; + } + } + + return 0; +fail: + return -1; +} +void x264_macroblock_cache_free( x264_t *h ) +{ + x264_free( h->mb.base ); +} + +int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead ) +{ + if( !b_lookahead ) + { + for( int i = 0; i < (PARAM_INTERLACED ? 5 : 2); i++ ) + for( int j = 0; j < (CHROMA444 ? 3 : 2); j++ ) + { + CHECKED_MALLOC( h->intra_border_backup[i][j], (h->sps->i_mb_width*16+32) * sizeof(pixel) ); + h->intra_border_backup[i][j] += 16; + } + for( int i = 0; i <= PARAM_INTERLACED; i++ ) + { + if( h->param.b_sliced_threads ) + { + /* Only allocate the first one, and allocate it for the whole frame, because we + * won't be deblocking until after the frame is fully encoded. */ + if( h == h->thread[0] && !i ) + CHECKED_MALLOC( h->deblock_strength[0], sizeof(**h->deblock_strength) * h->mb.i_mb_count ); + else + h->deblock_strength[i] = h->thread[0]->deblock_strength[0]; + } + else + CHECKED_MALLOC( h->deblock_strength[i], sizeof(**h->deblock_strength) * h->mb.i_mb_width ); + h->deblock_strength[1] = h->deblock_strength[i]; + } + } + + /* Allocate scratch buffer */ + int scratch_size = 0; + if( !b_lookahead ) + { + int buf_hpel = (h->thread[0]->fdec->i_width[0]+48+32) * sizeof(int16_t); + int buf_ssim = h->param.analyse.b_ssim * 8 * (h->param.i_width/4+3) * sizeof(int); + int me_range = X264_MIN(h->param.analyse.i_me_range, h->param.analyse.i_mv_range); + int buf_tesa = (h->param.analyse.i_me_method >= X264_ME_ESA) * + ((me_range*2+24) * sizeof(int16_t) + (me_range+4) * (me_range+1) * 4 * sizeof(mvsad_t)); + scratch_size = X264_MAX3( buf_hpel, buf_ssim, buf_tesa ); + } + int buf_mbtree = h->param.rc.b_mb_tree * ((h->mb.i_mb_width+15)&~15) * sizeof(int16_t); + scratch_size = X264_MAX( scratch_size, buf_mbtree ); + if( scratch_size ) + CHECKED_MALLOC( h->scratch_buffer, scratch_size ); + else + h->scratch_buffer = NULL; + + int buf_lookahead_threads = (h->mb.i_mb_height + (4 + 32) * h->param.i_lookahead_threads) * sizeof(int) * 2; + int buf_mbtree2 = buf_mbtree * 12; /* size of the internal propagate_list asm buffer */ + scratch_size = X264_MAX( buf_lookahead_threads, buf_mbtree2 ); + CHECKED_MALLOC( h->scratch_buffer2, scratch_size ); + + return 0; +fail: + return -1; +} + +void x264_macroblock_thread_free( x264_t *h, int b_lookahead ) +{ + if( !b_lookahead ) + { + for( int i = 0; i <= PARAM_INTERLACED; i++ ) + if( !h->param.b_sliced_threads || (h == h->thread[0] && !i) ) + x264_free( h->deblock_strength[i] ); + for( int i = 0; i < (PARAM_INTERLACED ? 5 : 2); i++ ) + for( int j = 0; j < (CHROMA444 ? 3 : 2); j++ ) + x264_free( h->intra_border_backup[i][j] - 16 ); + } + x264_free( h->scratch_buffer ); + x264_free( h->scratch_buffer2 ); +} + +void x264_macroblock_slice_init( x264_t *h ) +{ + h->mb.mv[0] = h->fdec->mv[0]; + h->mb.mv[1] = h->fdec->mv[1]; + h->mb.mvr[0][0] = h->fdec->mv16x16; + h->mb.ref[0] = h->fdec->ref[0]; + h->mb.ref[1] = h->fdec->ref[1]; + h->mb.type = h->fdec->mb_type; + h->mb.partition = h->fdec->mb_partition; + h->mb.field = h->fdec->field; + + h->fdec->i_ref[0] = h->i_ref[0]; + h->fdec->i_ref[1] = h->i_ref[1]; + for( int i = 0; i < h->i_ref[0]; i++ ) + h->fdec->ref_poc[0][i] = h->fref[0][i]->i_poc; + if( h->sh.i_type == SLICE_TYPE_B ) + { + for( int i = 0; i < h->i_ref[1]; i++ ) + h->fdec->ref_poc[1][i] = h->fref[1][i]->i_poc; + + map_col_to_list0(-1) = -1; + map_col_to_list0(-2) = -2; + for( int i = 0; i < h->fref[1][0]->i_ref[0]; i++ ) + { + int poc = h->fref[1][0]->ref_poc[0][i]; + map_col_to_list0(i) = -2; + for( int j = 0; j < h->i_ref[0]; j++ ) + if( h->fref[0][j]->i_poc == poc ) + { + map_col_to_list0(i) = j; + break; + } + } + } + else if( h->sh.i_type == SLICE_TYPE_P ) + { + if( h->sh.i_disable_deblocking_filter_idc != 1 && h->param.analyse.i_weighted_pred == X264_WEIGHTP_SMART ) + { + deblock_ref_table(-2) = -2; + deblock_ref_table(-1) = -1; + for( int i = 0; i < h->i_ref[0] << SLICE_MBAFF; i++ ) + { + /* Mask off high bits to avoid frame num collisions with -1/-2. + * In current x264 frame num values don't cover a range of more + * than 32, so 6 bits is enough for uniqueness. */ + if( !MB_INTERLACED ) + deblock_ref_table(i) = h->fref[0][i]->i_frame_num&63; + else + deblock_ref_table(i) = ((h->fref[0][i>>1]->i_frame_num&63)<<1) + (i&1); + } + } + } + + /* init with not available (for top right idx=7,15) */ + memset( h->mb.cache.ref, -2, sizeof( h->mb.cache.ref ) ); + + if( h->i_ref[0] > 0 ) + for( int field = 0; field <= SLICE_MBAFF; field++ ) + { + int curpoc = h->fdec->i_poc + h->fdec->i_delta_poc[field]; + int refpoc = h->fref[0][0]->i_poc + h->fref[0][0]->i_delta_poc[field]; + int delta = curpoc - refpoc; + + h->fdec->inv_ref_poc[field] = (256 + delta/2) / delta; + } + + h->mb.i_neighbour4[6] = + h->mb.i_neighbour4[9] = + h->mb.i_neighbour4[12] = + h->mb.i_neighbour4[14] = MB_LEFT|MB_TOP|MB_TOPLEFT|MB_TOPRIGHT; + h->mb.i_neighbour4[3] = + h->mb.i_neighbour4[7] = + h->mb.i_neighbour4[11] = + h->mb.i_neighbour4[13] = + h->mb.i_neighbour4[15] = + h->mb.i_neighbour8[3] = MB_LEFT|MB_TOP|MB_TOPLEFT; +} + +void x264_macroblock_thread_init( x264_t *h ) +{ + h->mb.i_me_method = h->param.analyse.i_me_method; + h->mb.i_subpel_refine = h->param.analyse.i_subpel_refine; + if( h->sh.i_type == SLICE_TYPE_B && (h->mb.i_subpel_refine == 6 || h->mb.i_subpel_refine == 8) ) + h->mb.i_subpel_refine--; + h->mb.b_chroma_me = h->param.analyse.b_chroma_me && + ((h->sh.i_type == SLICE_TYPE_P && h->mb.i_subpel_refine >= 5) || + (h->sh.i_type == SLICE_TYPE_B && h->mb.i_subpel_refine >= 9)); + h->mb.b_dct_decimate = h->sh.i_type == SLICE_TYPE_B || + (h->param.analyse.b_dct_decimate && h->sh.i_type != SLICE_TYPE_I); + h->mb.i_mb_prev_xy = -1; + + /* 4:2:0 4:2:2 4:4:4 + * fdec fenc fdec fenc fdec fenc + * y y y y y y y Y Y Y Y y y y y y y y Y Y Y Y y y y y y y y Y Y Y Y + * y Y Y Y Y Y Y Y Y y Y Y Y Y Y Y Y Y y Y Y Y Y Y Y Y Y + * y Y Y Y Y Y Y Y Y y Y Y Y Y Y Y Y Y y Y Y Y Y Y Y Y Y + * y Y Y Y Y Y Y Y Y y Y Y Y Y Y Y Y Y y Y Y Y Y Y Y Y Y + * y Y Y Y Y U U V V y Y Y Y Y U U V V y Y Y Y Y U U U U + * u u u v v v U U V V u u u v v v U U V V u u u u u u u U U U U + * u U U v V V u U U v V V U U V V u U U U U U U U U + * u U U v V V u U U v V V U U V V u U U U U U U U U + * u U U v V V u U U U U V V V V + * u U U v V V u U U U U V V V V + * v v v v v v v V V V V + * v V V V V V V V V + * v V V V V + * v V V V V + * v V V V V + */ + h->mb.pic.p_fenc[0] = h->mb.pic.fenc_buf; + h->mb.pic.p_fdec[0] = h->mb.pic.fdec_buf + 2*FDEC_STRIDE; + h->mb.pic.p_fenc[1] = h->mb.pic.fenc_buf + 16*FENC_STRIDE; + h->mb.pic.p_fdec[1] = h->mb.pic.fdec_buf + 20*FDEC_STRIDE; + if( CHROMA444 ) + { + h->mb.pic.p_fenc[2] = h->mb.pic.fenc_buf + 32*FENC_STRIDE; + h->mb.pic.p_fdec[2] = h->mb.pic.fdec_buf + 38*FDEC_STRIDE; + } + else + { + h->mb.pic.p_fenc[2] = h->mb.pic.fenc_buf + 16*FENC_STRIDE + 8; + h->mb.pic.p_fdec[2] = h->mb.pic.fdec_buf + 20*FDEC_STRIDE + 16; + } +} + +void x264_prefetch_fenc( x264_t *h, x264_frame_t *fenc, int i_mb_x, int i_mb_y ) +{ + int stride_y = fenc->i_stride[0]; + int stride_uv = fenc->i_stride[1]; + int off_y = 16 * i_mb_x + 16 * i_mb_y * stride_y; + int off_uv = 16 * i_mb_x + (16 * i_mb_y * stride_uv >> CHROMA_V_SHIFT); + h->mc.prefetch_fenc( fenc->plane[0]+off_y, stride_y, + fenc->plane[1]+off_uv, stride_uv, i_mb_x ); +} + +NOINLINE void x264_copy_column8( pixel *dst, pixel *src ) +{ + // input pointers are offset by 4 rows because that's faster (smaller instruction size on x86) + for( int i = -4; i < 4; i++ ) + dst[i*FDEC_STRIDE] = src[i*FDEC_STRIDE]; +} + +static void ALWAYS_INLINE x264_macroblock_load_pic_pointers( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff ) +{ + int mb_interlaced = b_mbaff && MB_INTERLACED; + int height = b_chroma ? 16 >> CHROMA_V_SHIFT : 16; + int i_stride = h->fdec->i_stride[i]; + int i_stride2 = i_stride << mb_interlaced; + int i_pix_offset = mb_interlaced + ? 16 * mb_x + height * (mb_y&~1) * i_stride + (mb_y&1) * i_stride + : 16 * mb_x + height * mb_y * i_stride; + pixel *plane_fdec = &h->fdec->plane[i][i_pix_offset]; + int fdec_idx = b_mbaff ? (mb_interlaced ? (3 + (mb_y&1)) : (mb_y&1) ? 2 : 4) : !(mb_y&1); + pixel *intra_fdec = &h->intra_border_backup[fdec_idx][i][mb_x*16]; + int ref_pix_offset[2] = { i_pix_offset, i_pix_offset }; + /* ref_pix_offset[0] references the current field and [1] the opposite field. */ + if( mb_interlaced ) + ref_pix_offset[1] += (1-2*(mb_y&1)) * i_stride; + h->mb.pic.i_stride[i] = i_stride2; + h->mb.pic.p_fenc_plane[i] = &h->fenc->plane[i][i_pix_offset]; + if( b_chroma ) + { + h->mc.load_deinterleave_chroma_fenc( h->mb.pic.p_fenc[1], h->mb.pic.p_fenc_plane[1], i_stride2, height ); + memcpy( h->mb.pic.p_fdec[1]-FDEC_STRIDE, intra_fdec, 8*sizeof(pixel) ); + memcpy( h->mb.pic.p_fdec[2]-FDEC_STRIDE, intra_fdec+8, 8*sizeof(pixel) ); + h->mb.pic.p_fdec[1][-FDEC_STRIDE-1] = intra_fdec[-1-8]; + h->mb.pic.p_fdec[2][-FDEC_STRIDE-1] = intra_fdec[-1]; + } + else + { + h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fenc[i], FENC_STRIDE, h->mb.pic.p_fenc_plane[i], i_stride2, 16 ); + memcpy( h->mb.pic.p_fdec[i]-FDEC_STRIDE, intra_fdec, 24*sizeof(pixel) ); + h->mb.pic.p_fdec[i][-FDEC_STRIDE-1] = intra_fdec[-1]; + } + if( b_mbaff || h->mb.b_reencode_mb ) + { + for( int j = 0; j < height; j++ ) + if( b_chroma ) + { + h->mb.pic.p_fdec[1][-1+j*FDEC_STRIDE] = plane_fdec[-2+j*i_stride2]; + h->mb.pic.p_fdec[2][-1+j*FDEC_STRIDE] = plane_fdec[-1+j*i_stride2]; + } + else + h->mb.pic.p_fdec[i][-1+j*FDEC_STRIDE] = plane_fdec[-1+j*i_stride2]; + } + pixel *plane_src, **filtered_src; + for( int j = 0; j < h->mb.pic.i_fref[0]; j++ ) + { + // Interpolate between pixels in same field. + if( mb_interlaced ) + { + plane_src = h->fref[0][j>>1]->plane_fld[i]; + filtered_src = h->fref[0][j>>1]->filtered_fld[i]; + } + else + { + plane_src = h->fref[0][j]->plane[i]; + filtered_src = h->fref[0][j]->filtered[i]; + } + h->mb.pic.p_fref[0][j][i*4] = plane_src + ref_pix_offset[j&1]; + + if( !b_chroma ) + { + for( int k = 1; k < 4; k++ ) + h->mb.pic.p_fref[0][j][i*4+k] = filtered_src[k] + ref_pix_offset[j&1]; + if( !i ) + { + if( h->sh.weight[j][0].weightfn ) + h->mb.pic.p_fref_w[j] = &h->fenc->weighted[j >> mb_interlaced][ref_pix_offset[j&1]]; + else + h->mb.pic.p_fref_w[j] = h->mb.pic.p_fref[0][j][0]; + } + } + } + if( h->sh.i_type == SLICE_TYPE_B ) + for( int j = 0; j < h->mb.pic.i_fref[1]; j++ ) + { + if( mb_interlaced ) + { + plane_src = h->fref[1][j>>1]->plane_fld[i]; + filtered_src = h->fref[1][j>>1]->filtered_fld[i]; + } + else + { + plane_src = h->fref[1][j]->plane[i]; + filtered_src = h->fref[1][j]->filtered[i]; + } + h->mb.pic.p_fref[1][j][i*4] = plane_src + ref_pix_offset[j&1]; + + if( !b_chroma ) + for( int k = 1; k < 4; k++ ) + h->mb.pic.p_fref[1][j][i*4+k] = filtered_src[k] + ref_pix_offset[j&1]; + } +} + +static const x264_left_table_t left_indices[4] = +{ + /* Current is progressive */ + {{ 4, 4, 5, 5}, { 3, 3, 7, 7}, {16+1, 16+1, 32+1, 32+1}, {0, 0, 1, 1}, {0, 0, 0, 0}}, + {{ 6, 6, 3, 3}, {11, 11, 15, 15}, {16+5, 16+5, 32+5, 32+5}, {2, 2, 3, 3}, {1, 1, 1, 1}}, + /* Current is interlaced */ + {{ 4, 6, 4, 6}, { 3, 11, 3, 11}, {16+1, 16+1, 32+1, 32+1}, {0, 2, 0, 2}, {0, 1, 0, 1}}, + /* Both same */ + {{ 4, 5, 6, 3}, { 3, 7, 11, 15}, {16+1, 16+5, 32+1, 32+5}, {0, 1, 2, 3}, {0, 0, 1, 1}} +}; + +static void ALWAYS_INLINE x264_macroblock_cache_load_neighbours( x264_t *h, int mb_x, int mb_y, int b_interlaced ) +{ + const int mb_interlaced = b_interlaced && MB_INTERLACED; + int top_y = mb_y - (1 << mb_interlaced); + int top = top_y * h->mb.i_mb_stride + mb_x; + + h->mb.i_mb_x = mb_x; + h->mb.i_mb_y = mb_y; + h->mb.i_mb_xy = mb_y * h->mb.i_mb_stride + mb_x; + h->mb.i_b8_xy = 2*(mb_y * h->mb.i_b8_stride + mb_x); + h->mb.i_b4_xy = 4*(mb_y * h->mb.i_b4_stride + mb_x); + h->mb.left_b8[0] = + h->mb.left_b8[1] = -1; + h->mb.left_b4[0] = + h->mb.left_b4[1] = -1; + h->mb.i_neighbour = 0; + h->mb.i_neighbour_intra = 0; + h->mb.i_neighbour_frame = 0; + h->mb.i_mb_top_xy = -1; + h->mb.i_mb_top_y = -1; + h->mb.i_mb_left_xy[0] = h->mb.i_mb_left_xy[1] = -1; + h->mb.i_mb_topleft_xy = -1; + h->mb.i_mb_topright_xy = -1; + h->mb.i_mb_type_top = -1; + h->mb.i_mb_type_left[0] = h->mb.i_mb_type_left[1] = -1; + h->mb.i_mb_type_topleft = -1; + h->mb.i_mb_type_topright = -1; + h->mb.left_index_table = &left_indices[3]; + h->mb.topleft_partition = 0; + + int topleft_y = top_y; + int topright_y = top_y; + int left[2]; + + left[0] = left[1] = h->mb.i_mb_xy - 1; + h->mb.left_b8[0] = h->mb.left_b8[1] = h->mb.i_b8_xy - 2; + h->mb.left_b4[0] = h->mb.left_b4[1] = h->mb.i_b4_xy - 4; + + if( b_interlaced ) + { + h->mb.i_mb_top_mbpair_xy = h->mb.i_mb_xy - 2*h->mb.i_mb_stride; + h->mb.i_mb_topleft_y = -1; + h->mb.i_mb_topright_y = -1; + + if( mb_y&1 ) + { + if( mb_x && mb_interlaced != h->mb.field[h->mb.i_mb_xy-1] ) + { + left[0] = left[1] = h->mb.i_mb_xy - 1 - h->mb.i_mb_stride; + h->mb.left_b8[0] = h->mb.left_b8[1] = h->mb.i_b8_xy - 2 - 2*h->mb.i_b8_stride; + h->mb.left_b4[0] = h->mb.left_b4[1] = h->mb.i_b4_xy - 4 - 4*h->mb.i_b4_stride; + + if( mb_interlaced ) + { + h->mb.left_index_table = &left_indices[2]; + left[1] += h->mb.i_mb_stride; + h->mb.left_b8[1] += 2*h->mb.i_b8_stride; + h->mb.left_b4[1] += 4*h->mb.i_b4_stride; + } + else + { + h->mb.left_index_table = &left_indices[1]; + topleft_y++; + h->mb.topleft_partition = 1; + } + } + if( !mb_interlaced ) + topright_y = -1; + } + else + { + if( mb_interlaced && top >= 0 ) + { + if( !h->mb.field[top] ) + { + top += h->mb.i_mb_stride; + top_y++; + } + if( mb_x ) + topleft_y += !h->mb.field[h->mb.i_mb_stride*topleft_y + mb_x - 1]; + if( mb_x < h->mb.i_mb_width-1 ) + topright_y += !h->mb.field[h->mb.i_mb_stride*topright_y + mb_x + 1]; + } + if( mb_x && mb_interlaced != h->mb.field[h->mb.i_mb_xy-1] ) + { + if( mb_interlaced ) + { + h->mb.left_index_table = &left_indices[2]; + left[1] += h->mb.i_mb_stride; + h->mb.left_b8[1] += 2*h->mb.i_b8_stride; + h->mb.left_b4[1] += 4*h->mb.i_b4_stride; + } + else + h->mb.left_index_table = &left_indices[0]; + } + } + } + + if( mb_x > 0 ) + { + h->mb.i_neighbour_frame |= MB_LEFT; + h->mb.i_mb_left_xy[0] = left[0]; + h->mb.i_mb_left_xy[1] = left[1]; + h->mb.i_mb_type_left[0] = h->mb.type[h->mb.i_mb_left_xy[0]]; + h->mb.i_mb_type_left[1] = h->mb.type[h->mb.i_mb_left_xy[1]]; + if( h->mb.slice_table[left[0]] == h->sh.i_first_mb ) + { + h->mb.i_neighbour |= MB_LEFT; + + // FIXME: We don't currently support constrained intra + mbaff. + if( !h->param.b_constrained_intra || IS_INTRA( h->mb.i_mb_type_left[0] ) ) + h->mb.i_neighbour_intra |= MB_LEFT; + } + } + + /* We can't predict from the previous threadslice since it hasn't been encoded yet. */ + if( (h->i_threadslice_start >> mb_interlaced) != (mb_y >> mb_interlaced) ) + { + if( top >= 0 ) + { + h->mb.i_neighbour_frame |= MB_TOP; + h->mb.i_mb_top_xy = top; + h->mb.i_mb_top_y = top_y; + h->mb.i_mb_type_top = h->mb.type[h->mb.i_mb_top_xy]; + if( h->mb.slice_table[top] == h->sh.i_first_mb ) + { + h->mb.i_neighbour |= MB_TOP; + + if( !h->param.b_constrained_intra || IS_INTRA( h->mb.i_mb_type_top ) ) + h->mb.i_neighbour_intra |= MB_TOP; + + /* We only need to prefetch the top blocks because the left was just written + * to as part of the previous cache_save. Since most target CPUs use write-allocate + * caches, left blocks are near-guaranteed to be in L1 cache. Top--not so much. */ + x264_prefetch( &h->mb.cbp[top] ); + x264_prefetch( h->mb.intra4x4_pred_mode[top] ); + x264_prefetch( &h->mb.non_zero_count[top][12] ); + /* These aren't always allocated, but prefetching an invalid address can't hurt. */ + x264_prefetch( &h->mb.mb_transform_size[top] ); + x264_prefetch( &h->mb.skipbp[top] ); + } + } + + if( mb_x > 0 && topleft_y >= 0 ) + { + h->mb.i_neighbour_frame |= MB_TOPLEFT; + h->mb.i_mb_topleft_xy = h->mb.i_mb_stride*topleft_y + mb_x - 1; + h->mb.i_mb_topleft_y = topleft_y; + h->mb.i_mb_type_topleft = h->mb.type[h->mb.i_mb_topleft_xy]; + if( h->mb.slice_table[h->mb.i_mb_topleft_xy] == h->sh.i_first_mb ) + { + h->mb.i_neighbour |= MB_TOPLEFT; + + if( !h->param.b_constrained_intra || IS_INTRA( h->mb.i_mb_type_topleft ) ) + h->mb.i_neighbour_intra |= MB_TOPLEFT; + } + } + + if( mb_x < h->mb.i_mb_width - 1 && topright_y >= 0 ) + { + h->mb.i_neighbour_frame |= MB_TOPRIGHT; + h->mb.i_mb_topright_xy = h->mb.i_mb_stride*topright_y + mb_x + 1; + h->mb.i_mb_topright_y = topright_y; + h->mb.i_mb_type_topright = h->mb.type[h->mb.i_mb_topright_xy]; + if( h->mb.slice_table[h->mb.i_mb_topright_xy] == h->sh.i_first_mb ) + { + h->mb.i_neighbour |= MB_TOPRIGHT; + + if( !h->param.b_constrained_intra || IS_INTRA( h->mb.i_mb_type_topright ) ) + h->mb.i_neighbour_intra |= MB_TOPRIGHT; + } + } + } +} + +#define LTOP 0 +#if HAVE_INTERLACED +# define LBOT 1 +#else +# define LBOT 0 +#endif + +static void ALWAYS_INLINE x264_macroblock_cache_load( x264_t *h, int mb_x, int mb_y, int b_mbaff ) +{ + x264_macroblock_cache_load_neighbours( h, mb_x, mb_y, b_mbaff ); + + int *left = h->mb.i_mb_left_xy; + int top = h->mb.i_mb_top_xy; + int top_y = h->mb.i_mb_top_y; + int s8x8 = h->mb.i_b8_stride; + int s4x4 = h->mb.i_b4_stride; + int top_8x8 = (2*top_y+1) * s8x8 + 2*mb_x; + int top_4x4 = (4*top_y+3) * s4x4 + 4*mb_x; + int lists = (1 << h->sh.i_type) & 3; + + /* GCC pessimizes direct loads from heap-allocated arrays due to aliasing. */ + /* By only dereferencing them once, we avoid this issue. */ + int8_t (*i4x4)[8] = h->mb.intra4x4_pred_mode; + uint8_t (*nnz)[48] = h->mb.non_zero_count; + int16_t *cbp = h->mb.cbp; + + const x264_left_table_t *left_index_table = h->mb.left_index_table; + + h->mb.cache.deblock_strength = h->deblock_strength[mb_y&1][h->param.b_sliced_threads?h->mb.i_mb_xy:mb_x]; + + /* load cache */ + if( h->mb.i_neighbour & MB_TOP ) + { + h->mb.cache.i_cbp_top = cbp[top]; + /* load intra4x4 */ + CP32( &h->mb.cache.intra4x4_pred_mode[x264_scan8[0] - 8], &i4x4[top][0] ); + + /* load non_zero_count */ + CP32( &h->mb.cache.non_zero_count[x264_scan8[ 0] - 8], &nnz[top][12] ); + CP32( &h->mb.cache.non_zero_count[x264_scan8[16] - 8], &nnz[top][16-4 + (16>>CHROMA_V_SHIFT)] ); + CP32( &h->mb.cache.non_zero_count[x264_scan8[32] - 8], &nnz[top][32-4 + (16>>CHROMA_V_SHIFT)] ); + + /* Finish the prefetching */ + for( int l = 0; l < lists; l++ ) + { + x264_prefetch( &h->mb.mv[l][top_4x4-1] ); + /* Top right being not in the same cacheline as top left will happen + * once every 4 MBs, so one extra prefetch is worthwhile */ + x264_prefetch( &h->mb.mv[l][top_4x4+4] ); + x264_prefetch( &h->mb.ref[l][top_8x8-1] ); + x264_prefetch( &h->mb.mvd[l][top] ); + } + } + else + { + h->mb.cache.i_cbp_top = -1; + + /* load intra4x4 */ + M32( &h->mb.cache.intra4x4_pred_mode[x264_scan8[0] - 8] ) = 0xFFFFFFFFU; + + /* load non_zero_count */ + M32( &h->mb.cache.non_zero_count[x264_scan8[ 0] - 8] ) = 0x80808080U; + M32( &h->mb.cache.non_zero_count[x264_scan8[16] - 8] ) = 0x80808080U; + M32( &h->mb.cache.non_zero_count[x264_scan8[32] - 8] ) = 0x80808080U; + } + + if( h->mb.i_neighbour & MB_LEFT ) + { + int ltop = left[LTOP]; + int lbot = b_mbaff ? left[LBOT] : ltop; + if( b_mbaff ) + { + const int16_t top_luma = (cbp[ltop] >> (left_index_table->mv[0]&(~1))) & 2; + const int16_t bot_luma = (cbp[lbot] >> (left_index_table->mv[2]&(~1))) & 2; + h->mb.cache.i_cbp_left = (cbp[ltop] & 0xfff0) | (bot_luma<<2) | top_luma; + } + else + h->mb.cache.i_cbp_left = cbp[ltop]; + + /* load intra4x4 */ + h->mb.cache.intra4x4_pred_mode[x264_scan8[ 0] - 1] = i4x4[ltop][left_index_table->intra[0]]; + h->mb.cache.intra4x4_pred_mode[x264_scan8[ 2] - 1] = i4x4[ltop][left_index_table->intra[1]]; + h->mb.cache.intra4x4_pred_mode[x264_scan8[ 8] - 1] = i4x4[lbot][left_index_table->intra[2]]; + h->mb.cache.intra4x4_pred_mode[x264_scan8[10] - 1] = i4x4[lbot][left_index_table->intra[3]]; + + /* load non_zero_count */ + h->mb.cache.non_zero_count[x264_scan8[ 0] - 1] = nnz[ltop][left_index_table->nnz[0]]; + h->mb.cache.non_zero_count[x264_scan8[ 2] - 1] = nnz[ltop][left_index_table->nnz[1]]; + h->mb.cache.non_zero_count[x264_scan8[ 8] - 1] = nnz[lbot][left_index_table->nnz[2]]; + h->mb.cache.non_zero_count[x264_scan8[10] - 1] = nnz[lbot][left_index_table->nnz[3]]; + + if( CHROMA_FORMAT >= CHROMA_422 ) + { + int offset = (4>>CHROMA_H_SHIFT) - 4; + h->mb.cache.non_zero_count[x264_scan8[16+ 0] - 1] = nnz[ltop][left_index_table->nnz[0]+16+offset]; + h->mb.cache.non_zero_count[x264_scan8[16+ 2] - 1] = nnz[ltop][left_index_table->nnz[1]+16+offset]; + h->mb.cache.non_zero_count[x264_scan8[16+ 8] - 1] = nnz[lbot][left_index_table->nnz[2]+16+offset]; + h->mb.cache.non_zero_count[x264_scan8[16+10] - 1] = nnz[lbot][left_index_table->nnz[3]+16+offset]; + h->mb.cache.non_zero_count[x264_scan8[32+ 0] - 1] = nnz[ltop][left_index_table->nnz[0]+32+offset]; + h->mb.cache.non_zero_count[x264_scan8[32+ 2] - 1] = nnz[ltop][left_index_table->nnz[1]+32+offset]; + h->mb.cache.non_zero_count[x264_scan8[32+ 8] - 1] = nnz[lbot][left_index_table->nnz[2]+32+offset]; + h->mb.cache.non_zero_count[x264_scan8[32+10] - 1] = nnz[lbot][left_index_table->nnz[3]+32+offset]; + } + else + { + h->mb.cache.non_zero_count[x264_scan8[16+ 0] - 1] = nnz[ltop][left_index_table->nnz_chroma[0]]; + h->mb.cache.non_zero_count[x264_scan8[16+ 2] - 1] = nnz[lbot][left_index_table->nnz_chroma[1]]; + h->mb.cache.non_zero_count[x264_scan8[32+ 0] - 1] = nnz[ltop][left_index_table->nnz_chroma[2]]; + h->mb.cache.non_zero_count[x264_scan8[32+ 2] - 1] = nnz[lbot][left_index_table->nnz_chroma[3]]; + } + } + else + { + h->mb.cache.i_cbp_left = -1; + + h->mb.cache.intra4x4_pred_mode[x264_scan8[ 0] - 1] = + h->mb.cache.intra4x4_pred_mode[x264_scan8[ 2] - 1] = + h->mb.cache.intra4x4_pred_mode[x264_scan8[ 8] - 1] = + h->mb.cache.intra4x4_pred_mode[x264_scan8[10] - 1] = -1; + + /* load non_zero_count */ + h->mb.cache.non_zero_count[x264_scan8[ 0] - 1] = + h->mb.cache.non_zero_count[x264_scan8[ 2] - 1] = + h->mb.cache.non_zero_count[x264_scan8[ 8] - 1] = + h->mb.cache.non_zero_count[x264_scan8[10] - 1] = + h->mb.cache.non_zero_count[x264_scan8[16+ 0] - 1] = + h->mb.cache.non_zero_count[x264_scan8[16+ 2] - 1] = + h->mb.cache.non_zero_count[x264_scan8[32+ 0] - 1] = + h->mb.cache.non_zero_count[x264_scan8[32+ 2] - 1] = 0x80; + if( CHROMA_FORMAT >= CHROMA_422 ) + { + h->mb.cache.non_zero_count[x264_scan8[16+ 8] - 1] = + h->mb.cache.non_zero_count[x264_scan8[16+10] - 1] = + h->mb.cache.non_zero_count[x264_scan8[32+ 8] - 1] = + h->mb.cache.non_zero_count[x264_scan8[32+10] - 1] = 0x80; + } + } + + if( h->pps->b_transform_8x8_mode ) + { + h->mb.cache.i_neighbour_transform_size = + ( (h->mb.i_neighbour & MB_LEFT) && h->mb.mb_transform_size[left[0]] ) + + ( (h->mb.i_neighbour & MB_TOP) && h->mb.mb_transform_size[top] ); + } + + if( b_mbaff ) + { + h->mb.pic.i_fref[0] = h->i_ref[0] << MB_INTERLACED; + h->mb.pic.i_fref[1] = h->i_ref[1] << MB_INTERLACED; + } + + if( !b_mbaff ) + { + x264_copy_column8( h->mb.pic.p_fdec[0]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[0]+15+ 4*FDEC_STRIDE ); + x264_copy_column8( h->mb.pic.p_fdec[0]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[0]+15+12*FDEC_STRIDE ); + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 0 ); + if( CHROMA444 ) + { + x264_copy_column8( h->mb.pic.p_fdec[1]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[1]+15+ 4*FDEC_STRIDE ); + x264_copy_column8( h->mb.pic.p_fdec[1]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[1]+15+12*FDEC_STRIDE ); + x264_copy_column8( h->mb.pic.p_fdec[2]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[2]+15+ 4*FDEC_STRIDE ); + x264_copy_column8( h->mb.pic.p_fdec[2]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[2]+15+12*FDEC_STRIDE ); + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 0 ); + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 0 ); + } + else + { + x264_copy_column8( h->mb.pic.p_fdec[1]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[1]+ 7+ 4*FDEC_STRIDE ); + x264_copy_column8( h->mb.pic.p_fdec[2]-1+ 4*FDEC_STRIDE, h->mb.pic.p_fdec[2]+ 7+ 4*FDEC_STRIDE ); + if( CHROMA_FORMAT == CHROMA_422 ) + { + x264_copy_column8( h->mb.pic.p_fdec[1]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[1]+ 7+12*FDEC_STRIDE ); + x264_copy_column8( h->mb.pic.p_fdec[2]-1+12*FDEC_STRIDE, h->mb.pic.p_fdec[2]+ 7+12*FDEC_STRIDE ); + } + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 0 ); + } + } + else + { + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 0, 0, 1 ); + if( CHROMA444 ) + { + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 0, 1 ); + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 2, 0, 1 ); + } + else + x264_macroblock_load_pic_pointers( h, mb_x, mb_y, 1, 1, 1 ); + } + + if( h->fdec->integral ) + { + int offset = 16 * (mb_x + mb_y * h->fdec->i_stride[0]); + for( int list = 0; list < 2; list++ ) + for( int i = 0; i < h->mb.pic.i_fref[list]; i++ ) + h->mb.pic.p_integral[list][i] = &h->fref[list][i]->integral[offset]; + } + + x264_prefetch_fenc( h, h->fenc, mb_x, mb_y ); + + /* load ref/mv/mvd */ + for( int l = 0; l < lists; l++ ) + { + int16_t (*mv)[2] = h->mb.mv[l]; + int8_t *ref = h->mb.ref[l]; + + int i8 = x264_scan8[0] - 1 - 1*8; + if( h->mb.i_neighbour & MB_TOPLEFT ) + { + int ir = b_mbaff ? 2*(s8x8*h->mb.i_mb_topleft_y + mb_x-1)+1+s8x8 : top_8x8 - 1; + int iv = b_mbaff ? 4*(s4x4*h->mb.i_mb_topleft_y + mb_x-1)+3+3*s4x4 : top_4x4 - 1; + if( b_mbaff && h->mb.topleft_partition ) + { + /* Take motion vector from the middle of macroblock instead of + * the bottom right as usual. */ + iv -= 2*s4x4; + ir -= s8x8; + } + h->mb.cache.ref[l][i8] = ref[ir]; + CP32( h->mb.cache.mv[l][i8], mv[iv] ); + } + else + { + h->mb.cache.ref[l][i8] = -2; + M32( h->mb.cache.mv[l][i8] ) = 0; + } + + i8 = x264_scan8[0] - 8; + if( h->mb.i_neighbour & MB_TOP ) + { + h->mb.cache.ref[l][i8+0] = + h->mb.cache.ref[l][i8+1] = ref[top_8x8 + 0]; + h->mb.cache.ref[l][i8+2] = + h->mb.cache.ref[l][i8+3] = ref[top_8x8 + 1]; + CP128( h->mb.cache.mv[l][i8], mv[top_4x4] ); + } + else + { + M128( h->mb.cache.mv[l][i8] ) = M128_ZERO; + M32( &h->mb.cache.ref[l][i8] ) = (uint8_t)(-2) * 0x01010101U; + } + + i8 = x264_scan8[0] + 4 - 1*8; + if( h->mb.i_neighbour & MB_TOPRIGHT ) + { + int ir = b_mbaff ? 2*(s8x8*h->mb.i_mb_topright_y + (mb_x+1))+s8x8 : top_8x8 + 2; + int iv = b_mbaff ? 4*(s4x4*h->mb.i_mb_topright_y + (mb_x+1))+3*s4x4 : top_4x4 + 4; + h->mb.cache.ref[l][i8] = ref[ir]; + CP32( h->mb.cache.mv[l][i8], mv[iv] ); + } + else + h->mb.cache.ref[l][i8] = -2; + + i8 = x264_scan8[0] - 1; + if( h->mb.i_neighbour & MB_LEFT ) + { + if( b_mbaff ) + { + h->mb.cache.ref[l][i8+0*8] = ref[h->mb.left_b8[LTOP] + 1 + s8x8*left_index_table->ref[0]]; + h->mb.cache.ref[l][i8+1*8] = ref[h->mb.left_b8[LTOP] + 1 + s8x8*left_index_table->ref[1]]; + h->mb.cache.ref[l][i8+2*8] = ref[h->mb.left_b8[LBOT] + 1 + s8x8*left_index_table->ref[2]]; + h->mb.cache.ref[l][i8+3*8] = ref[h->mb.left_b8[LBOT] + 1 + s8x8*left_index_table->ref[3]]; + + CP32( h->mb.cache.mv[l][i8+0*8], mv[h->mb.left_b4[LTOP] + 3 + s4x4*left_index_table->mv[0]] ); + CP32( h->mb.cache.mv[l][i8+1*8], mv[h->mb.left_b4[LTOP] + 3 + s4x4*left_index_table->mv[1]] ); + CP32( h->mb.cache.mv[l][i8+2*8], mv[h->mb.left_b4[LBOT] + 3 + s4x4*left_index_table->mv[2]] ); + CP32( h->mb.cache.mv[l][i8+3*8], mv[h->mb.left_b4[LBOT] + 3 + s4x4*left_index_table->mv[3]] ); + } + else + { + const int ir = h->mb.i_b8_xy - 1; + const int iv = h->mb.i_b4_xy - 1; + h->mb.cache.ref[l][i8+0*8] = + h->mb.cache.ref[l][i8+1*8] = ref[ir + 0*s8x8]; + h->mb.cache.ref[l][i8+2*8] = + h->mb.cache.ref[l][i8+3*8] = ref[ir + 1*s8x8]; + + CP32( h->mb.cache.mv[l][i8+0*8], mv[iv + 0*s4x4] ); + CP32( h->mb.cache.mv[l][i8+1*8], mv[iv + 1*s4x4] ); + CP32( h->mb.cache.mv[l][i8+2*8], mv[iv + 2*s4x4] ); + CP32( h->mb.cache.mv[l][i8+3*8], mv[iv + 3*s4x4] ); + } + } + else + { + for( int i = 0; i < 4; i++ ) + { + h->mb.cache.ref[l][i8+i*8] = -2; + M32( h->mb.cache.mv[l][i8+i*8] ) = 0; + } + } + + /* Extra logic for top right mv in mbaff. + * . . . d . . a . + * . . . e . . . . + * . . . f b . c . + * . . . . . . . . + * + * If the top right of the 4x4 partitions labeled a, b and c in the + * above diagram do not exist, but the entries d, e and f exist (in + * the macroblock to the left) then use those instead. + */ + if( b_mbaff && (h->mb.i_neighbour & MB_LEFT) ) + { + if( MB_INTERLACED && !h->mb.field[h->mb.i_mb_xy-1] ) + { + h->mb.cache.topright_ref[l][0] = ref[h->mb.left_b8[0] + 1 + s8x8*0]; + h->mb.cache.topright_ref[l][1] = ref[h->mb.left_b8[0] + 1 + s8x8*1]; + h->mb.cache.topright_ref[l][2] = ref[h->mb.left_b8[1] + 1 + s8x8*0]; + CP32( h->mb.cache.topright_mv[l][0], mv[h->mb.left_b4[0] + 3 + s4x4*(left_index_table->mv[0]+1)] ); + CP32( h->mb.cache.topright_mv[l][1], mv[h->mb.left_b4[0] + 3 + s4x4*(left_index_table->mv[1]+1)] ); + CP32( h->mb.cache.topright_mv[l][2], mv[h->mb.left_b4[1] + 3 + s4x4*(left_index_table->mv[2]+1)] ); + } + else if( !MB_INTERLACED && h->mb.field[h->mb.i_mb_xy-1] ) + { + // Looking at the bottom field so always take the bottom macroblock of the pair. + h->mb.cache.topright_ref[l][0] = ref[h->mb.left_b8[0] + 1 + s8x8*2 + s8x8*left_index_table->ref[0]]; + h->mb.cache.topright_ref[l][1] = ref[h->mb.left_b8[0] + 1 + s8x8*2 + s8x8*left_index_table->ref[1]]; + h->mb.cache.topright_ref[l][2] = ref[h->mb.left_b8[0] + 1 + s8x8*2 + s8x8*left_index_table->ref[2]]; + CP32( h->mb.cache.topright_mv[l][0], mv[h->mb.left_b4[0] + 3 + s4x4*4 + s4x4*left_index_table->mv[0]] ); + CP32( h->mb.cache.topright_mv[l][1], mv[h->mb.left_b4[0] + 3 + s4x4*4 + s4x4*left_index_table->mv[1]] ); + CP32( h->mb.cache.topright_mv[l][2], mv[h->mb.left_b4[0] + 3 + s4x4*4 + s4x4*left_index_table->mv[2]] ); + } + } + + if( h->param.b_cabac ) + { + uint8_t (*mvd)[8][2] = h->mb.mvd[l]; + if( h->mb.i_neighbour & MB_TOP ) + CP64( h->mb.cache.mvd[l][x264_scan8[0] - 8], mvd[top][0] ); + else + M64( h->mb.cache.mvd[l][x264_scan8[0] - 8] ) = 0; + + if( h->mb.i_neighbour & MB_LEFT && (!b_mbaff || h->mb.cache.ref[l][x264_scan8[0]-1] >= 0) ) + { + CP16( h->mb.cache.mvd[l][x264_scan8[0 ] - 1], mvd[left[LTOP]][left_index_table->intra[0]] ); + CP16( h->mb.cache.mvd[l][x264_scan8[2 ] - 1], mvd[left[LTOP]][left_index_table->intra[1]] ); + } + else + { + M16( h->mb.cache.mvd[l][x264_scan8[0]-1+0*8] ) = 0; + M16( h->mb.cache.mvd[l][x264_scan8[0]-1+1*8] ) = 0; + } + if( h->mb.i_neighbour & MB_LEFT && (!b_mbaff || h->mb.cache.ref[l][x264_scan8[0]-1+2*8] >= 0) ) + { + CP16( h->mb.cache.mvd[l][x264_scan8[8 ] - 1], mvd[left[LBOT]][left_index_table->intra[2]] ); + CP16( h->mb.cache.mvd[l][x264_scan8[10] - 1], mvd[left[LBOT]][left_index_table->intra[3]] ); + } + else + { + M16( h->mb.cache.mvd[l][x264_scan8[0]-1+2*8] ) = 0; + M16( h->mb.cache.mvd[l][x264_scan8[0]-1+3*8] ) = 0; + } + } + + /* If motion vectors are cached from frame macroblocks but this + * macroblock is a field macroblock then the motion vector must be + * halved. Similarly, motion vectors from field macroblocks are doubled. */ + if( b_mbaff ) + { +#define MAP_MVS\ + if( FIELD_DIFFERENT(h->mb.i_mb_topleft_xy) )\ + MAP_F2F(mv, ref, x264_scan8[0] - 1 - 1*8)\ + if( FIELD_DIFFERENT(top) )\ + {\ + MAP_F2F(mv, ref, x264_scan8[0] + 0 - 1*8)\ + MAP_F2F(mv, ref, x264_scan8[0] + 1 - 1*8)\ + MAP_F2F(mv, ref, x264_scan8[0] + 2 - 1*8)\ + MAP_F2F(mv, ref, x264_scan8[0] + 3 - 1*8)\ + }\ + if( FIELD_DIFFERENT(h->mb.i_mb_topright_xy) )\ + MAP_F2F(mv, ref, x264_scan8[0] + 4 - 1*8)\ + if( FIELD_DIFFERENT(left[0]) )\ + {\ + MAP_F2F(mv, ref, x264_scan8[0] - 1 + 0*8)\ + MAP_F2F(mv, ref, x264_scan8[0] - 1 + 1*8)\ + MAP_F2F(mv, ref, x264_scan8[0] - 1 + 2*8)\ + MAP_F2F(mv, ref, x264_scan8[0] - 1 + 3*8)\ + MAP_F2F(topright_mv, topright_ref, 0)\ + MAP_F2F(topright_mv, topright_ref, 1)\ + MAP_F2F(topright_mv, topright_ref, 2)\ + } + + if( MB_INTERLACED ) + { +#define FIELD_DIFFERENT(macroblock) (macroblock >= 0 && !h->mb.field[macroblock]) +#define MAP_F2F(varmv, varref, index)\ + if( h->mb.cache.varref[l][index] >= 0 )\ + {\ + h->mb.cache.varref[l][index] <<= 1;\ + h->mb.cache.varmv[l][index][1] /= 2;\ + h->mb.cache.mvd[l][index][1] >>= 1;\ + } + MAP_MVS +#undef MAP_F2F +#undef FIELD_DIFFERENT + } + else + { +#define FIELD_DIFFERENT(macroblock) (macroblock >= 0 && h->mb.field[macroblock]) +#define MAP_F2F(varmv, varref, index)\ + if( h->mb.cache.varref[l][index] >= 0 )\ + {\ + h->mb.cache.varref[l][index] >>= 1;\ + h->mb.cache.varmv[l][index][1] <<= 1;\ + h->mb.cache.mvd[l][index][1] <<= 1;\ + } + MAP_MVS +#undef MAP_F2F +#undef FIELD_DIFFERENT + } + } + } + + if( b_mbaff && mb_x == 0 && !(mb_y&1) ) + { + if( h->mb.i_mb_top_xy >= h->sh.i_first_mb ) + h->mb.field_decoding_flag = h->mb.field[h->mb.i_mb_top_xy]; + else + h->mb.field_decoding_flag = 0; + } + + /* Check whether skip here would cause decoder to predict interlace mode incorrectly. + * FIXME: It might be better to change the interlace type rather than forcing a skip to be non-skip. */ + h->mb.b_allow_skip = 1; + if( b_mbaff ) + { + if( MB_INTERLACED != h->mb.field_decoding_flag && + (mb_y&1) && IS_SKIP(h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride]) ) + h->mb.b_allow_skip = 0; + } + + if( h->param.b_cabac ) + { + if( b_mbaff ) + { + int left_xy, top_xy; + /* Neighbours here are calculated based on field_decoding_flag */ + int mb_xy = mb_x + (mb_y&~1)*h->mb.i_mb_stride; + left_xy = mb_xy - 1; + if( (mb_y&1) && mb_x > 0 && h->mb.field_decoding_flag == h->mb.field[left_xy] ) + left_xy += h->mb.i_mb_stride; + if( h->mb.field_decoding_flag ) + { + top_xy = mb_xy - h->mb.i_mb_stride; + if( !(mb_y&1) && top_xy >= 0 && h->mb.slice_table[top_xy] == h->sh.i_first_mb && h->mb.field[top_xy] ) + top_xy -= h->mb.i_mb_stride; + } + else + top_xy = mb_x + (mb_y-1)*h->mb.i_mb_stride; + + h->mb.cache.i_neighbour_skip = (mb_x > 0 && h->mb.slice_table[left_xy] == h->sh.i_first_mb && !IS_SKIP( h->mb.type[left_xy] )) + + (top_xy >= 0 && h->mb.slice_table[top_xy] == h->sh.i_first_mb && !IS_SKIP( h->mb.type[top_xy] )); + } + else + { + h->mb.cache.i_neighbour_skip = ((h->mb.i_neighbour & MB_LEFT) && !IS_SKIP( h->mb.i_mb_type_left[0] )) + + ((h->mb.i_neighbour & MB_TOP) && !IS_SKIP( h->mb.i_mb_type_top )); + } + } + + /* load skip */ + if( h->sh.i_type == SLICE_TYPE_B ) + { + h->mb.bipred_weight = h->mb.bipred_weight_buf[MB_INTERLACED][MB_INTERLACED&(mb_y&1)]; + h->mb.dist_scale_factor = h->mb.dist_scale_factor_buf[MB_INTERLACED][MB_INTERLACED&(mb_y&1)]; + if( h->param.b_cabac ) + { + uint8_t skipbp; + x264_macroblock_cache_skip( h, 0, 0, 4, 4, 0 ); + if( b_mbaff ) + { + skipbp = (h->mb.i_neighbour & MB_LEFT) ? h->mb.skipbp[left[LTOP]] : 0; + h->mb.cache.skip[x264_scan8[0] - 1] = (skipbp >> (1+(left_index_table->mv[0]&~1))) & 1; + skipbp = (h->mb.i_neighbour & MB_LEFT) ? h->mb.skipbp[left[LBOT]] : 0; + h->mb.cache.skip[x264_scan8[8] - 1] = (skipbp >> (1+(left_index_table->mv[2]&~1))) & 1; + } + else + { + skipbp = (h->mb.i_neighbour & MB_LEFT) ? h->mb.skipbp[left[0]] : 0; + h->mb.cache.skip[x264_scan8[0] - 1] = skipbp & 0x2; + h->mb.cache.skip[x264_scan8[8] - 1] = skipbp & 0x8; + } + skipbp = (h->mb.i_neighbour & MB_TOP) ? h->mb.skipbp[top] : 0; + h->mb.cache.skip[x264_scan8[0] - 8] = skipbp & 0x4; + h->mb.cache.skip[x264_scan8[4] - 8] = skipbp & 0x8; + } + } + + if( h->sh.i_type == SLICE_TYPE_P ) + x264_mb_predict_mv_pskip( h, h->mb.cache.pskip_mv ); + + h->mb.i_neighbour4[0] = + h->mb.i_neighbour8[0] = (h->mb.i_neighbour_intra & (MB_TOP|MB_LEFT|MB_TOPLEFT)) + | ((h->mb.i_neighbour_intra & MB_TOP) ? MB_TOPRIGHT : 0); + h->mb.i_neighbour4[4] = + h->mb.i_neighbour4[1] = MB_LEFT | ((h->mb.i_neighbour_intra & MB_TOP) ? (MB_TOP|MB_TOPLEFT|MB_TOPRIGHT) : 0); + h->mb.i_neighbour4[2] = + h->mb.i_neighbour4[8] = + h->mb.i_neighbour4[10] = + h->mb.i_neighbour8[2] = MB_TOP|MB_TOPRIGHT | ((h->mb.i_neighbour_intra & MB_LEFT) ? (MB_LEFT|MB_TOPLEFT) : 0); + h->mb.i_neighbour4[5] = + h->mb.i_neighbour8[1] = MB_LEFT | (h->mb.i_neighbour_intra & MB_TOPRIGHT) + | ((h->mb.i_neighbour_intra & MB_TOP) ? MB_TOP|MB_TOPLEFT : 0); +} + +void x264_macroblock_cache_load_progressive( x264_t *h, int mb_x, int mb_y ) +{ + x264_macroblock_cache_load( h, mb_x, mb_y, 0 ); +} + +void x264_macroblock_cache_load_interlaced( x264_t *h, int mb_x, int mb_y ) +{ + x264_macroblock_cache_load( h, mb_x, mb_y, 1 ); +} + +static void x264_macroblock_deblock_strength_mbaff( x264_t *h, uint8_t (*bs)[8][4] ) +{ + if( (h->mb.i_neighbour & MB_LEFT) && h->mb.field[h->mb.i_mb_left_xy[0]] != MB_INTERLACED ) + { + static const uint8_t offset[2][2][8] = + { { { 0, 0, 0, 0, 1, 1, 1, 1 }, + { 2, 2, 2, 2, 3, 3, 3, 3 }, }, + { { 0, 1, 2, 3, 0, 1, 2, 3 }, + { 0, 1, 2, 3, 0, 1, 2, 3 }, } + }; + ALIGNED_ARRAY_8( uint8_t, tmpbs, [8] ); + + const uint8_t *off = offset[MB_INTERLACED][h->mb.i_mb_y&1]; + uint8_t (*nnz)[48] = h->mb.non_zero_count; + + for( int i = 0; i < 8; i++ ) + { + int left = h->mb.i_mb_left_xy[MB_INTERLACED ? i>>2 : i&1]; + int nnz_this = h->mb.cache.non_zero_count[x264_scan8[0]+8*(i>>1)]; + int nnz_left = nnz[left][3 + 4*off[i]]; + if( !h->param.b_cabac && h->pps->b_transform_8x8_mode ) + { + int j = off[i]&~1; + if( h->mb.mb_transform_size[left] ) + nnz_left = !!(M16( &nnz[left][2+4*j] ) | M16( &nnz[left][2+4*(1+j)] )); + } + tmpbs[i] = (nnz_left || nnz_this) ? 2 : 1; + } + + if( MB_INTERLACED ) + { + CP32( bs[0][0], &tmpbs[0] ); + CP32( bs[0][4], &tmpbs[4] ); + } + else + { + for( int i = 0; i < 4; i++ ) bs[0][0][i] = tmpbs[2*i]; + for( int i = 0; i < 4; i++ ) bs[0][4][i] = tmpbs[1+2*i]; + } + } + + if( (h->mb.i_neighbour & MB_TOP) && MB_INTERLACED != h->mb.field[h->mb.i_mb_top_xy] ) + { + if( !(h->mb.i_mb_y&1) && !MB_INTERLACED ) + { + /* Need to filter both fields (even for frame macroblocks). + * Filter top two rows using the top macroblock of the above + * pair and then the bottom one. */ + int mbn_xy = h->mb.i_mb_xy - 2 * h->mb.i_mb_stride; + uint8_t *nnz_cur = &h->mb.cache.non_zero_count[x264_scan8[0]]; + + for( int j = 0; j < 2; j++, mbn_xy += h->mb.i_mb_stride ) + { + uint8_t (*nnz)[48] = h->mb.non_zero_count; + + ALIGNED_4( uint8_t nnz_top[4] ); + CP32( nnz_top, &nnz[mbn_xy][3*4] ); + + if( !h->param.b_cabac && h->pps->b_transform_8x8_mode && h->mb.mb_transform_size[mbn_xy] ) + { + nnz_top[0] = nnz_top[1] = M16( &nnz[mbn_xy][ 8] ) || M16( &nnz[mbn_xy][12] ); + nnz_top[2] = nnz_top[3] = M16( &nnz[mbn_xy][10] ) || M16( &nnz[mbn_xy][14] ); + } + + for( int i = 0; i < 4; i++ ) + bs[1][4*j][i] = (nnz_cur[i] || nnz_top[i]) ? 2 : 1; + } + } + else + for( int i = 0; i < 4; i++ ) + bs[1][0][i] = X264_MAX( bs[1][0][i], 1 ); + } +} + +void x264_macroblock_deblock_strength( x264_t *h ) +{ + uint8_t (*bs)[8][4] = h->mb.cache.deblock_strength; + if( IS_INTRA( h->mb.i_type ) ) + { + M32( bs[0][1] ) = 0x03030303; + M64( bs[0][2] ) = 0x0303030303030303ULL; + M32( bs[1][1] ) = 0x03030303; + M64( bs[1][2] ) = 0x0303030303030303ULL; + return; + } + + /* Early termination: in this case, nnz guarantees all edges use strength 2.*/ + if( h->mb.b_transform_8x8 && !CHROMA444 ) + { + int cbp_mask = 0xf >> CHROMA_V_SHIFT; + if( (h->mb.i_cbp_luma&cbp_mask) == cbp_mask ) + { + M32( bs[0][0] ) = 0x02020202; + M32( bs[0][2] ) = 0x02020202; + M32( bs[0][4] ) = 0x02020202; + M64( bs[1][0] ) = 0x0202020202020202ULL; /* [1][1] and [1][3] has to be set for 4:2:2 */ + M64( bs[1][2] ) = 0x0202020202020202ULL; + M32( bs[1][4] ) = 0x02020202; + return; + } + } + + int neighbour_changed = 0; + if( h->sh.i_disable_deblocking_filter_idc != 2 ) + { + neighbour_changed = h->mb.i_neighbour_frame&~h->mb.i_neighbour; + h->mb.i_neighbour = h->mb.i_neighbour_frame; + } + + /* MBAFF deblock uses different left neighbors from encoding */ + if( SLICE_MBAFF && (h->mb.i_neighbour & MB_LEFT) && (h->mb.field[h->mb.i_mb_xy - 1] != MB_INTERLACED) ) + { + h->mb.i_mb_left_xy[1] = + h->mb.i_mb_left_xy[0] = h->mb.i_mb_xy - 1; + if( h->mb.i_mb_y&1 ) + h->mb.i_mb_left_xy[0] -= h->mb.i_mb_stride; + else + h->mb.i_mb_left_xy[1] += h->mb.i_mb_stride; + } + + /* If we have multiple slices and we're deblocking on slice edges, we + * have to reload neighbour data. */ + if( neighbour_changed ) + { + int top_y = h->mb.i_mb_top_y; + int top_8x8 = (2*top_y+1) * h->mb.i_b8_stride + 2*h->mb.i_mb_x; + int top_4x4 = (4*top_y+3) * h->mb.i_b4_stride + 4*h->mb.i_mb_x; + int s8x8 = h->mb.i_b8_stride; + int s4x4 = h->mb.i_b4_stride; + + uint8_t (*nnz)[48] = h->mb.non_zero_count; + const x264_left_table_t *left_index_table = SLICE_MBAFF ? h->mb.left_index_table : &left_indices[3]; + + if( neighbour_changed & MB_TOP ) + CP32( &h->mb.cache.non_zero_count[x264_scan8[0] - 8], &nnz[h->mb.i_mb_top_xy][12] ); + + if( neighbour_changed & MB_LEFT ) + { + int *left = h->mb.i_mb_left_xy; + h->mb.cache.non_zero_count[x264_scan8[0 ] - 1] = nnz[left[0]][left_index_table->nnz[0]]; + h->mb.cache.non_zero_count[x264_scan8[2 ] - 1] = nnz[left[0]][left_index_table->nnz[1]]; + h->mb.cache.non_zero_count[x264_scan8[8 ] - 1] = nnz[left[1]][left_index_table->nnz[2]]; + h->mb.cache.non_zero_count[x264_scan8[10] - 1] = nnz[left[1]][left_index_table->nnz[3]]; + } + + for( int l = 0; l <= (h->sh.i_type == SLICE_TYPE_B); l++ ) + { + int16_t (*mv)[2] = h->mb.mv[l]; + int8_t *ref = h->mb.ref[l]; + + int i8 = x264_scan8[0] - 8; + if( neighbour_changed & MB_TOP ) + { + h->mb.cache.ref[l][i8+0] = + h->mb.cache.ref[l][i8+1] = ref[top_8x8 + 0]; + h->mb.cache.ref[l][i8+2] = + h->mb.cache.ref[l][i8+3] = ref[top_8x8 + 1]; + CP128( h->mb.cache.mv[l][i8], mv[top_4x4] ); + } + + i8 = x264_scan8[0] - 1; + if( neighbour_changed & MB_LEFT ) + { + h->mb.cache.ref[l][i8+0*8] = + h->mb.cache.ref[l][i8+1*8] = ref[h->mb.left_b8[0] + 1 + s8x8*left_index_table->ref[0]]; + h->mb.cache.ref[l][i8+2*8] = + h->mb.cache.ref[l][i8+3*8] = ref[h->mb.left_b8[1] + 1 + s8x8*left_index_table->ref[2]]; + + CP32( h->mb.cache.mv[l][i8+0*8], mv[h->mb.left_b4[0] + 3 + s4x4*left_index_table->mv[0]] ); + CP32( h->mb.cache.mv[l][i8+1*8], mv[h->mb.left_b4[0] + 3 + s4x4*left_index_table->mv[1]] ); + CP32( h->mb.cache.mv[l][i8+2*8], mv[h->mb.left_b4[1] + 3 + s4x4*left_index_table->mv[2]] ); + CP32( h->mb.cache.mv[l][i8+3*8], mv[h->mb.left_b4[1] + 3 + s4x4*left_index_table->mv[3]] ); + } + } + } + + if( h->param.analyse.i_weighted_pred == X264_WEIGHTP_SMART && h->sh.i_type == SLICE_TYPE_P ) + { + /* Handle reference frame duplicates */ + int i8 = x264_scan8[0] - 8; + h->mb.cache.ref[0][i8+0] = + h->mb.cache.ref[0][i8+1] = deblock_ref_table(h->mb.cache.ref[0][i8+0]); + h->mb.cache.ref[0][i8+2] = + h->mb.cache.ref[0][i8+3] = deblock_ref_table(h->mb.cache.ref[0][i8+2]); + + i8 = x264_scan8[0] - 1; + h->mb.cache.ref[0][i8+0*8] = + h->mb.cache.ref[0][i8+1*8] = deblock_ref_table(h->mb.cache.ref[0][i8+0*8]); + h->mb.cache.ref[0][i8+2*8] = + h->mb.cache.ref[0][i8+3*8] = deblock_ref_table(h->mb.cache.ref[0][i8+2*8]); + + int ref0 = deblock_ref_table(h->mb.cache.ref[0][x264_scan8[ 0]]); + int ref1 = deblock_ref_table(h->mb.cache.ref[0][x264_scan8[ 4]]); + int ref2 = deblock_ref_table(h->mb.cache.ref[0][x264_scan8[ 8]]); + int ref3 = deblock_ref_table(h->mb.cache.ref[0][x264_scan8[12]]); + uint32_t reftop = pack16to32( (uint8_t)ref0, (uint8_t)ref1 ) * 0x0101; + uint32_t refbot = pack16to32( (uint8_t)ref2, (uint8_t)ref3 ) * 0x0101; + + M32( &h->mb.cache.ref[0][x264_scan8[0]+8*0] ) = reftop; + M32( &h->mb.cache.ref[0][x264_scan8[0]+8*1] ) = reftop; + M32( &h->mb.cache.ref[0][x264_scan8[0]+8*2] ) = refbot; + M32( &h->mb.cache.ref[0][x264_scan8[0]+8*3] ) = refbot; + } + + /* Munge NNZ for cavlc + 8x8dct */ + if( !h->param.b_cabac && h->pps->b_transform_8x8_mode ) + { + uint8_t (*nnz)[48] = h->mb.non_zero_count; + int top = h->mb.i_mb_top_xy; + int *left = h->mb.i_mb_left_xy; + + if( (h->mb.i_neighbour & MB_TOP) && h->mb.mb_transform_size[top] ) + { + int i8 = x264_scan8[0] - 8; + int nnz_top0 = M16( &nnz[top][8] ) | M16( &nnz[top][12] ); + int nnz_top1 = M16( &nnz[top][10] ) | M16( &nnz[top][14] ); + M16( &h->mb.cache.non_zero_count[i8+0] ) = nnz_top0 ? 0x0101 : 0; + M16( &h->mb.cache.non_zero_count[i8+2] ) = nnz_top1 ? 0x0101 : 0; + } + + if( h->mb.i_neighbour & MB_LEFT ) + { + int i8 = x264_scan8[0] - 1; + if( h->mb.mb_transform_size[left[0]] ) + { + int nnz_left0 = M16( &nnz[left[0]][2] ) | M16( &nnz[left[0]][6] ); + h->mb.cache.non_zero_count[i8+8*0] = !!nnz_left0; + h->mb.cache.non_zero_count[i8+8*1] = !!nnz_left0; + } + if( h->mb.mb_transform_size[left[1]] ) + { + int nnz_left1 = M16( &nnz[left[1]][10] ) | M16( &nnz[left[1]][14] ); + h->mb.cache.non_zero_count[i8+8*2] = !!nnz_left1; + h->mb.cache.non_zero_count[i8+8*3] = !!nnz_left1; + } + } + + if( h->mb.b_transform_8x8 ) + { + int nnz0 = M16( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ) | M16( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ); + int nnz1 = M16( &h->mb.cache.non_zero_count[x264_scan8[ 4]] ) | M16( &h->mb.cache.non_zero_count[x264_scan8[ 6]] ); + int nnz2 = M16( &h->mb.cache.non_zero_count[x264_scan8[ 8]] ) | M16( &h->mb.cache.non_zero_count[x264_scan8[10]] ); + int nnz3 = M16( &h->mb.cache.non_zero_count[x264_scan8[12]] ) | M16( &h->mb.cache.non_zero_count[x264_scan8[14]] ); + uint32_t nnztop = pack16to32( !!nnz0, !!nnz1 ) * 0x0101; + uint32_t nnzbot = pack16to32( !!nnz2, !!nnz3 ) * 0x0101; + + M32( &h->mb.cache.non_zero_count[x264_scan8[0]+8*0] ) = nnztop; + M32( &h->mb.cache.non_zero_count[x264_scan8[0]+8*1] ) = nnztop; + M32( &h->mb.cache.non_zero_count[x264_scan8[0]+8*2] ) = nnzbot; + M32( &h->mb.cache.non_zero_count[x264_scan8[0]+8*3] ) = nnzbot; + } + } + + h->loopf.deblock_strength( h->mb.cache.non_zero_count, h->mb.cache.ref, h->mb.cache.mv, + bs, 4 >> MB_INTERLACED, h->sh.i_type == SLICE_TYPE_B ); + + if( SLICE_MBAFF ) + x264_macroblock_deblock_strength_mbaff( h, bs ); +} + +static void ALWAYS_INLINE x264_macroblock_store_pic( x264_t *h, int mb_x, int mb_y, int i, int b_chroma, int b_mbaff ) +{ + int height = b_chroma ? 16>>CHROMA_V_SHIFT : 16; + int i_stride = h->fdec->i_stride[i]; + int i_stride2 = i_stride << (b_mbaff && MB_INTERLACED); + int i_pix_offset = (b_mbaff && MB_INTERLACED) + ? 16 * mb_x + height * (mb_y&~1) * i_stride + (mb_y&1) * i_stride + : 16 * mb_x + height * mb_y * i_stride; + if( b_chroma ) + h->mc.store_interleave_chroma( &h->fdec->plane[1][i_pix_offset], i_stride2, h->mb.pic.p_fdec[1], h->mb.pic.p_fdec[2], height ); + else + h->mc.copy[PIXEL_16x16]( &h->fdec->plane[i][i_pix_offset], i_stride2, h->mb.pic.p_fdec[i], FDEC_STRIDE, 16 ); +} + +static void ALWAYS_INLINE x264_macroblock_backup_intra( x264_t *h, int mb_x, int mb_y, int b_mbaff ) +{ + /* In MBAFF we store the last two rows in intra_border_backup[0] and [1]. + * For progressive mbs this is the bottom two rows, and for interlaced the + * bottom row of each field. We also store samples needed for the next + * mbpair in intra_border_backup[2]. */ + int backup_dst = !b_mbaff ? (mb_y&1) : (mb_y&1) ? 1 : MB_INTERLACED ? 0 : 2; + memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+FDEC_STRIDE*15, 16*sizeof(pixel) ); + if( CHROMA444 ) + { + memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+FDEC_STRIDE*15, 16*sizeof(pixel) ); + memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+FDEC_STRIDE*15, 16*sizeof(pixel) ); + } + else + { + int backup_src = (15>>CHROMA_V_SHIFT) * FDEC_STRIDE; + memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*sizeof(pixel) ); + memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*sizeof(pixel) ); + } + if( b_mbaff ) + { + if( mb_y&1 ) + { + int backup_src = (MB_INTERLACED ? 7 : 14) * FDEC_STRIDE; + backup_dst = MB_INTERLACED ? 2 : 0; + memcpy( &h->intra_border_backup[backup_dst][0][mb_x*16 ], h->mb.pic.p_fdec[0]+backup_src, 16*sizeof(pixel) ); + if( CHROMA444 ) + { + memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 16*sizeof(pixel) ); + memcpy( &h->intra_border_backup[backup_dst][2][mb_x*16 ], h->mb.pic.p_fdec[2]+backup_src, 16*sizeof(pixel) ); + } + else + { + if( CHROMA_FORMAT == CHROMA_420 ) + backup_src = (MB_INTERLACED ? 3 : 6) * FDEC_STRIDE; + memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16 ], h->mb.pic.p_fdec[1]+backup_src, 8*sizeof(pixel) ); + memcpy( &h->intra_border_backup[backup_dst][1][mb_x*16+8], h->mb.pic.p_fdec[2]+backup_src, 8*sizeof(pixel) ); + } + } + } +} + +void x264_macroblock_cache_save( x264_t *h ) +{ + const int i_mb_xy = h->mb.i_mb_xy; + const int i_mb_type = x264_mb_type_fix[h->mb.i_type]; + const int s8x8 = h->mb.i_b8_stride; + const int s4x4 = h->mb.i_b4_stride; + const int i_mb_4x4 = h->mb.i_b4_xy; + const int i_mb_8x8 = h->mb.i_b8_xy; + + /* GCC pessimizes direct stores to heap-allocated arrays due to aliasing. */ + /* By only dereferencing them once, we avoid this issue. */ + int8_t *i4x4 = h->mb.intra4x4_pred_mode[i_mb_xy]; + uint8_t *nnz = h->mb.non_zero_count[i_mb_xy]; + + if( SLICE_MBAFF ) + { + x264_macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 1 ); + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 1 ); + if( CHROMA444 ) + { + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 1 ); + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 1 ); + } + else + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 1 ); + } + else + { + x264_macroblock_backup_intra( h, h->mb.i_mb_x, h->mb.i_mb_y, 0 ); + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 0, 0, 0 ); + if( CHROMA444 ) + { + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 0, 0 ); + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 2, 0, 0 ); + } + else + x264_macroblock_store_pic( h, h->mb.i_mb_x, h->mb.i_mb_y, 1, 1, 0 ); + } + + x264_prefetch_fenc( h, h->fdec, h->mb.i_mb_x, h->mb.i_mb_y ); + + h->mb.type[i_mb_xy] = i_mb_type; + h->mb.slice_table[i_mb_xy] = h->sh.i_first_mb; + h->mb.partition[i_mb_xy] = IS_INTRA( i_mb_type ) ? D_16x16 : h->mb.i_partition; + h->mb.i_mb_prev_xy = i_mb_xy; + + /* save intra4x4 */ + if( i_mb_type == I_4x4 ) + { + CP32( &i4x4[0], &h->mb.cache.intra4x4_pred_mode[x264_scan8[10]] ); + M32( &i4x4[4] ) = pack8to32( h->mb.cache.intra4x4_pred_mode[x264_scan8[5] ], + h->mb.cache.intra4x4_pred_mode[x264_scan8[7] ], + h->mb.cache.intra4x4_pred_mode[x264_scan8[13] ], 0); + } + else if( !h->param.b_constrained_intra || IS_INTRA(i_mb_type) ) + M64( i4x4 ) = I_PRED_4x4_DC * 0x0101010101010101ULL; + else + M64( i4x4 ) = (uint8_t)(-1) * 0x0101010101010101ULL; + + + if( i_mb_type == I_PCM ) + { + h->mb.qp[i_mb_xy] = 0; + h->mb.i_last_dqp = 0; + h->mb.i_cbp_chroma = CHROMA444 ? 0 : 2; + h->mb.i_cbp_luma = 0xf; + h->mb.cbp[i_mb_xy] = (h->mb.i_cbp_chroma << 4) | h->mb.i_cbp_luma | 0x1700; + h->mb.b_transform_8x8 = 0; + for( int i = 0; i < 48; i++ ) + h->mb.cache.non_zero_count[x264_scan8[i]] = h->param.b_cabac ? 1 : 16; + } + else + { + if( h->mb.i_type != I_16x16 && h->mb.i_cbp_luma == 0 && h->mb.i_cbp_chroma == 0 ) + h->mb.i_qp = h->mb.i_last_qp; + h->mb.qp[i_mb_xy] = h->mb.i_qp; + h->mb.i_last_dqp = h->mb.i_qp - h->mb.i_last_qp; + h->mb.i_last_qp = h->mb.i_qp; + } + + /* save non zero count */ + CP32( &nnz[ 0+0*4], &h->mb.cache.non_zero_count[x264_scan8[ 0]] ); + CP32( &nnz[ 0+1*4], &h->mb.cache.non_zero_count[x264_scan8[ 2]] ); + CP32( &nnz[ 0+2*4], &h->mb.cache.non_zero_count[x264_scan8[ 8]] ); + CP32( &nnz[ 0+3*4], &h->mb.cache.non_zero_count[x264_scan8[10]] ); + CP32( &nnz[16+0*4], &h->mb.cache.non_zero_count[x264_scan8[16+0]] ); + CP32( &nnz[16+1*4], &h->mb.cache.non_zero_count[x264_scan8[16+2]] ); + CP32( &nnz[32+0*4], &h->mb.cache.non_zero_count[x264_scan8[32+0]] ); + CP32( &nnz[32+1*4], &h->mb.cache.non_zero_count[x264_scan8[32+2]] ); + if( CHROMA_FORMAT >= CHROMA_422 ) + { + CP32( &nnz[16+2*4], &h->mb.cache.non_zero_count[x264_scan8[16+ 8]] ); + CP32( &nnz[16+3*4], &h->mb.cache.non_zero_count[x264_scan8[16+10]] ); + CP32( &nnz[32+2*4], &h->mb.cache.non_zero_count[x264_scan8[32+ 8]] ); + CP32( &nnz[32+3*4], &h->mb.cache.non_zero_count[x264_scan8[32+10]] ); + } + + if( h->mb.i_cbp_luma == 0 && h->mb.i_type != I_8x8 ) + h->mb.b_transform_8x8 = 0; + h->mb.mb_transform_size[i_mb_xy] = h->mb.b_transform_8x8; + + if( h->sh.i_type != SLICE_TYPE_I ) + { + int16_t (*mv0)[2] = &h->mb.mv[0][i_mb_4x4]; + int16_t (*mv1)[2] = &h->mb.mv[1][i_mb_4x4]; + int8_t *ref0 = &h->mb.ref[0][i_mb_8x8]; + int8_t *ref1 = &h->mb.ref[1][i_mb_8x8]; + if( !IS_INTRA( i_mb_type ) ) + { + ref0[0+0*s8x8] = h->mb.cache.ref[0][x264_scan8[0]]; + ref0[1+0*s8x8] = h->mb.cache.ref[0][x264_scan8[4]]; + ref0[0+1*s8x8] = h->mb.cache.ref[0][x264_scan8[8]]; + ref0[1+1*s8x8] = h->mb.cache.ref[0][x264_scan8[12]]; + CP128( &mv0[0*s4x4], h->mb.cache.mv[0][x264_scan8[0]+8*0] ); + CP128( &mv0[1*s4x4], h->mb.cache.mv[0][x264_scan8[0]+8*1] ); + CP128( &mv0[2*s4x4], h->mb.cache.mv[0][x264_scan8[0]+8*2] ); + CP128( &mv0[3*s4x4], h->mb.cache.mv[0][x264_scan8[0]+8*3] ); + if( h->sh.i_type == SLICE_TYPE_B ) + { + ref1[0+0*s8x8] = h->mb.cache.ref[1][x264_scan8[0]]; + ref1[1+0*s8x8] = h->mb.cache.ref[1][x264_scan8[4]]; + ref1[0+1*s8x8] = h->mb.cache.ref[1][x264_scan8[8]]; + ref1[1+1*s8x8] = h->mb.cache.ref[1][x264_scan8[12]]; + CP128( &mv1[0*s4x4], h->mb.cache.mv[1][x264_scan8[0]+8*0] ); + CP128( &mv1[1*s4x4], h->mb.cache.mv[1][x264_scan8[0]+8*1] ); + CP128( &mv1[2*s4x4], h->mb.cache.mv[1][x264_scan8[0]+8*2] ); + CP128( &mv1[3*s4x4], h->mb.cache.mv[1][x264_scan8[0]+8*3] ); + } + } + else + { + M16( &ref0[0*s8x8] ) = (uint8_t)(-1) * 0x0101; + M16( &ref0[1*s8x8] ) = (uint8_t)(-1) * 0x0101; + M128( &mv0[0*s4x4] ) = M128_ZERO; + M128( &mv0[1*s4x4] ) = M128_ZERO; + M128( &mv0[2*s4x4] ) = M128_ZERO; + M128( &mv0[3*s4x4] ) = M128_ZERO; + if( h->sh.i_type == SLICE_TYPE_B ) + { + M16( &ref1[0*s8x8] ) = (uint8_t)(-1) * 0x0101; + M16( &ref1[1*s8x8] ) = (uint8_t)(-1) * 0x0101; + M128( &mv1[0*s4x4] ) = M128_ZERO; + M128( &mv1[1*s4x4] ) = M128_ZERO; + M128( &mv1[2*s4x4] ) = M128_ZERO; + M128( &mv1[3*s4x4] ) = M128_ZERO; + } + } + } + + if( h->param.b_cabac ) + { + uint8_t (*mvd0)[2] = h->mb.mvd[0][i_mb_xy]; + uint8_t (*mvd1)[2] = h->mb.mvd[1][i_mb_xy]; + if( IS_INTRA(i_mb_type) && i_mb_type != I_PCM ) + h->mb.chroma_pred_mode[i_mb_xy] = x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode]; + else + h->mb.chroma_pred_mode[i_mb_xy] = I_PRED_CHROMA_DC; + + if( (0x3FF30 >> i_mb_type) & 1 ) /* !INTRA && !SKIP && !DIRECT */ + { + CP64( mvd0[0], h->mb.cache.mvd[0][x264_scan8[10]] ); + CP16( mvd0[4], h->mb.cache.mvd[0][x264_scan8[5 ]] ); + CP16( mvd0[5], h->mb.cache.mvd[0][x264_scan8[7 ]] ); + CP16( mvd0[6], h->mb.cache.mvd[0][x264_scan8[13]] ); + if( h->sh.i_type == SLICE_TYPE_B ) + { + CP64( mvd1[0], h->mb.cache.mvd[1][x264_scan8[10]] ); + CP16( mvd1[4], h->mb.cache.mvd[1][x264_scan8[5 ]] ); + CP16( mvd1[5], h->mb.cache.mvd[1][x264_scan8[7 ]] ); + CP16( mvd1[6], h->mb.cache.mvd[1][x264_scan8[13]] ); + } + } + else + { + M128( mvd0[0] ) = M128_ZERO; + if( h->sh.i_type == SLICE_TYPE_B ) + M128( mvd1[0] ) = M128_ZERO; + } + + if( h->sh.i_type == SLICE_TYPE_B ) + { + if( i_mb_type == B_SKIP || i_mb_type == B_DIRECT ) + h->mb.skipbp[i_mb_xy] = 0xf; + else if( i_mb_type == B_8x8 ) + { + int skipbp = ( h->mb.i_sub_partition[0] == D_DIRECT_8x8 ) << 0; + skipbp |= ( h->mb.i_sub_partition[1] == D_DIRECT_8x8 ) << 1; + skipbp |= ( h->mb.i_sub_partition[2] == D_DIRECT_8x8 ) << 2; + skipbp |= ( h->mb.i_sub_partition[3] == D_DIRECT_8x8 ) << 3; + h->mb.skipbp[i_mb_xy] = skipbp; + } + else + h->mb.skipbp[i_mb_xy] = 0; + } + } +} + + +void x264_macroblock_bipred_init( x264_t *h ) +{ + for( int mbfield = 0; mbfield <= SLICE_MBAFF; mbfield++ ) + for( int field = 0; field <= SLICE_MBAFF; field++ ) + for( int i_ref0 = 0; i_ref0 < (h->i_ref[0]<fref[0][i_ref0>>mbfield]; + int poc0 = l0->i_poc + mbfield*l0->i_delta_poc[field^(i_ref0&1)]; + for( int i_ref1 = 0; i_ref1 < (h->i_ref[1]<fref[1][i_ref1>>mbfield]; + int cur_poc = h->fdec->i_poc + mbfield*h->fdec->i_delta_poc[field]; + int poc1 = l1->i_poc + mbfield*l1->i_delta_poc[field^(i_ref1&1)]; + int td = x264_clip3( poc1 - poc0, -128, 127 ); + if( td == 0 /* || pic0 is a long-term ref */ ) + dist_scale_factor = 256; + else + { + int tb = x264_clip3( cur_poc - poc0, -128, 127 ); + int tx = (16384 + (abs(td) >> 1)) / td; + dist_scale_factor = x264_clip3( (tb * tx + 32) >> 6, -1024, 1023 ); + } + + h->mb.dist_scale_factor_buf[mbfield][field][i_ref0][i_ref1] = dist_scale_factor; + + dist_scale_factor >>= 2; + if( h->param.analyse.b_weighted_bipred + && dist_scale_factor >= -64 + && dist_scale_factor <= 128 ) + { + h->mb.bipred_weight_buf[mbfield][field][i_ref0][i_ref1] = 64 - dist_scale_factor; + // ssse3 implementation of biweight doesn't support the extrema. + // if we ever generate them, we'll have to drop that optimization. + assert( dist_scale_factor >= -63 && dist_scale_factor <= 127 ); + } + else + h->mb.bipred_weight_buf[mbfield][field][i_ref0][i_ref1] = 32; + } + } +} + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.h new file mode 100644 index 00000000..f1dfb275 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/macroblock.h @@ -0,0 +1,444 @@ +/***************************************************************************** + * macroblock.h: macroblock common functions + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_MACROBLOCK_H +#define X264_MACROBLOCK_H + +enum macroblock_position_e +{ + MB_LEFT = 0x01, + MB_TOP = 0x02, + MB_TOPRIGHT = 0x04, + MB_TOPLEFT = 0x08, + + MB_PRIVATE = 0x10, + + ALL_NEIGHBORS = 0xf, +}; + +static const uint8_t x264_pred_i4x4_neighbors[12] = +{ + MB_TOP, // I_PRED_4x4_V + MB_LEFT, // I_PRED_4x4_H + MB_LEFT | MB_TOP, // I_PRED_4x4_DC + MB_TOP | MB_TOPRIGHT, // I_PRED_4x4_DDL + MB_LEFT | MB_TOPLEFT | MB_TOP, // I_PRED_4x4_DDR + MB_LEFT | MB_TOPLEFT | MB_TOP, // I_PRED_4x4_VR + MB_LEFT | MB_TOPLEFT | MB_TOP, // I_PRED_4x4_HD + MB_TOP | MB_TOPRIGHT, // I_PRED_4x4_VL + MB_LEFT, // I_PRED_4x4_HU + MB_LEFT, // I_PRED_4x4_DC_LEFT + MB_TOP, // I_PRED_4x4_DC_TOP + 0 // I_PRED_4x4_DC_128 +}; + + +/* XXX mb_type isn't the one written in the bitstream -> only internal usage */ +#define IS_INTRA(type) ( (type) == I_4x4 || (type) == I_8x8 || (type) == I_16x16 || (type) == I_PCM ) +#define IS_SKIP(type) ( (type) == P_SKIP || (type) == B_SKIP ) +#define IS_DIRECT(type) ( (type) == B_DIRECT ) +enum mb_class_e +{ + I_4x4 = 0, + I_8x8 = 1, + I_16x16 = 2, + I_PCM = 3, + + P_L0 = 4, + P_8x8 = 5, + P_SKIP = 6, + + B_DIRECT = 7, + B_L0_L0 = 8, + B_L0_L1 = 9, + B_L0_BI = 10, + B_L1_L0 = 11, + B_L1_L1 = 12, + B_L1_BI = 13, + B_BI_L0 = 14, + B_BI_L1 = 15, + B_BI_BI = 16, + B_8x8 = 17, + B_SKIP = 18, + + X264_MBTYPE_MAX = 19 +}; +static const uint8_t x264_mb_type_fix[X264_MBTYPE_MAX] = +{ + I_4x4, I_4x4, I_16x16, I_PCM, + P_L0, P_8x8, P_SKIP, + B_DIRECT, B_L0_L0, B_L0_L1, B_L0_BI, B_L1_L0, B_L1_L1, + B_L1_BI, B_BI_L0, B_BI_L1, B_BI_BI, B_8x8, B_SKIP +}; +static const uint8_t x264_mb_type_list_table[X264_MBTYPE_MAX][2][2] = +{ + {{0,0},{0,0}}, {{0,0},{0,0}}, {{0,0},{0,0}}, {{0,0},{0,0}}, /* INTRA */ + {{1,1},{0,0}}, /* P_L0 */ + {{0,0},{0,0}}, /* P_8x8 */ + {{1,1},{0,0}}, /* P_SKIP */ + {{0,0},{0,0}}, /* B_DIRECT */ + {{1,1},{0,0}}, {{1,0},{0,1}}, {{1,1},{0,1}}, /* B_L0_* */ + {{0,1},{1,0}}, {{0,0},{1,1}}, {{0,1},{1,1}}, /* B_L1_* */ + {{1,1},{1,0}}, {{1,0},{1,1}}, {{1,1},{1,1}}, /* B_BI_* */ + {{0,0},{0,0}}, /* B_8x8 */ + {{0,0},{0,0}} /* B_SKIP */ +}; + +#define IS_SUB4x4(type) ( (type == D_L0_4x4)||(type == D_L1_4x4)||(type == D_BI_4x4) ) +#define IS_SUB4x8(type) ( (type == D_L0_4x8)||(type == D_L1_4x8)||(type == D_BI_4x8) ) +#define IS_SUB8x4(type) ( (type == D_L0_8x4)||(type == D_L1_8x4)||(type == D_BI_8x4) ) +#define IS_SUB8x8(type) ( (type == D_L0_8x8)||(type == D_L1_8x8)||(type == D_BI_8x8)||(type == D_DIRECT_8x8) ) +enum mb_partition_e +{ + /* sub partition type for P_8x8 and B_8x8 */ + D_L0_4x4 = 0, + D_L0_8x4 = 1, + D_L0_4x8 = 2, + D_L0_8x8 = 3, + + /* sub partition type for B_8x8 only */ + D_L1_4x4 = 4, + D_L1_8x4 = 5, + D_L1_4x8 = 6, + D_L1_8x8 = 7, + + D_BI_4x4 = 8, + D_BI_8x4 = 9, + D_BI_4x8 = 10, + D_BI_8x8 = 11, + D_DIRECT_8x8 = 12, + + /* partition */ + D_8x8 = 13, + D_16x8 = 14, + D_8x16 = 15, + D_16x16 = 16, + X264_PARTTYPE_MAX = 17, +}; + +static const uint8_t x264_mb_partition_listX_table[2][17] = +{{ + 1, 1, 1, 1, /* D_L0_* */ + 0, 0, 0, 0, /* D_L1_* */ + 1, 1, 1, 1, /* D_BI_* */ + 0, /* D_DIRECT_8x8 */ + 0, 0, 0, 0 /* 8x8 .. 16x16 */ +}, +{ + 0, 0, 0, 0, /* D_L0_* */ + 1, 1, 1, 1, /* D_L1_* */ + 1, 1, 1, 1, /* D_BI_* */ + 0, /* D_DIRECT_8x8 */ + 0, 0, 0, 0 /* 8x8 .. 16x16 */ +}}; +static const uint8_t x264_mb_partition_count_table[17] = +{ + /* sub L0 */ + 4, 2, 2, 1, + /* sub L1 */ + 4, 2, 2, 1, + /* sub BI */ + 4, 2, 2, 1, + /* Direct */ + 1, + /* Partition */ + 4, 2, 2, 1 +}; +static const uint8_t x264_mb_partition_pixel_table[17] = +{ + PIXEL_4x4, PIXEL_8x4, PIXEL_4x8, PIXEL_8x8, /* D_L0_* */ + PIXEL_4x4, PIXEL_8x4, PIXEL_4x8, PIXEL_8x8, /* D_L1_* */ + PIXEL_4x4, PIXEL_8x4, PIXEL_4x8, PIXEL_8x8, /* D_BI_* */ + PIXEL_8x8, /* D_DIRECT_8x8 */ + PIXEL_8x8, PIXEL_16x8, PIXEL_8x16, PIXEL_16x16, /* 8x8 .. 16x16 */ +}; + +/* zigzags are transposed with respect to the tables in the standard */ +static const uint8_t x264_zigzag_scan4[2][16] = +{{ // frame + 0, 4, 1, 2, 5, 8, 12, 9, 6, 3, 7, 10, 13, 14, 11, 15 +}, +{ // field + 0, 1, 4, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +}}; +static const uint8_t x264_zigzag_scan8[2][64] = +{{ + 0, 8, 1, 2, 9, 16, 24, 17, 10, 3, 4, 11, 18, 25, 32, 40, + 33, 26, 19, 12, 5, 6, 13, 20, 27, 34, 41, 48, 56, 49, 42, 35, + 28, 21, 14, 7, 15, 22, 29, 36, 43, 50, 57, 58, 51, 44, 37, 30, + 23, 31, 38, 45, 52, 59, 60, 53, 46, 39, 47, 54, 61, 62, 55, 63 +}, +{ + 0, 1, 2, 8, 9, 3, 4, 10, 16, 11, 5, 6, 7, 12, 17, 24, + 18, 13, 14, 15, 19, 25, 32, 26, 20, 21, 22, 23, 27, 33, 40, 34, + 28, 29, 30, 31, 35, 41, 48, 42, 36, 37, 38, 39, 43, 49, 50, 44, + 45, 46, 47, 51, 56, 57, 52, 53, 54, 55, 58, 59, 60, 61, 62, 63 +}}; + +static const uint8_t block_idx_x[16] = +{ + 0, 1, 0, 1, 2, 3, 2, 3, 0, 1, 0, 1, 2, 3, 2, 3 +}; +static const uint8_t block_idx_y[16] = +{ + 0, 0, 1, 1, 0, 0, 1, 1, 2, 2, 3, 3, 2, 2, 3, 3 +}; +static const uint8_t block_idx_xy[4][4] = +{ + { 0, 2, 8, 10 }, + { 1, 3, 9, 11 }, + { 4, 6, 12, 14 }, + { 5, 7, 13, 15 } +}; +static const uint8_t block_idx_xy_1d[16] = +{ + 0, 1, 4, 5, 2, 3, 6, 7, 8, 9, 12, 13, 10, 11, 14, 15 +}; +static const uint8_t block_idx_yx_1d[16] = +{ + 0, 4, 1, 5, 8, 12, 9, 13, 2, 6, 3, 7, 10, 14, 11, 15 +}; +static const uint8_t block_idx_xy_fenc[16] = +{ + 0*4 + 0*4*FENC_STRIDE, 1*4 + 0*4*FENC_STRIDE, + 0*4 + 1*4*FENC_STRIDE, 1*4 + 1*4*FENC_STRIDE, + 2*4 + 0*4*FENC_STRIDE, 3*4 + 0*4*FENC_STRIDE, + 2*4 + 1*4*FENC_STRIDE, 3*4 + 1*4*FENC_STRIDE, + 0*4 + 2*4*FENC_STRIDE, 1*4 + 2*4*FENC_STRIDE, + 0*4 + 3*4*FENC_STRIDE, 1*4 + 3*4*FENC_STRIDE, + 2*4 + 2*4*FENC_STRIDE, 3*4 + 2*4*FENC_STRIDE, + 2*4 + 3*4*FENC_STRIDE, 3*4 + 3*4*FENC_STRIDE +}; +static const uint16_t block_idx_xy_fdec[16] = +{ + 0*4 + 0*4*FDEC_STRIDE, 1*4 + 0*4*FDEC_STRIDE, + 0*4 + 1*4*FDEC_STRIDE, 1*4 + 1*4*FDEC_STRIDE, + 2*4 + 0*4*FDEC_STRIDE, 3*4 + 0*4*FDEC_STRIDE, + 2*4 + 1*4*FDEC_STRIDE, 3*4 + 1*4*FDEC_STRIDE, + 0*4 + 2*4*FDEC_STRIDE, 1*4 + 2*4*FDEC_STRIDE, + 0*4 + 3*4*FDEC_STRIDE, 1*4 + 3*4*FDEC_STRIDE, + 2*4 + 2*4*FDEC_STRIDE, 3*4 + 2*4*FDEC_STRIDE, + 2*4 + 3*4*FDEC_STRIDE, 3*4 + 3*4*FDEC_STRIDE +}; + +#define QP(qP) ( (qP)+QP_BD_OFFSET ) +static const uint8_t i_chroma_qp_table[QP_MAX+1+12*2] = +{ + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, +#if BIT_DEPTH > 9 + QP(-12),QP(-11),QP(-10), QP(-9), QP(-8), QP(-7), +#endif +#if BIT_DEPTH > 8 + QP(-6), QP(-5), QP(-4), QP(-3), QP(-2), QP(-1), +#endif + QP(0), QP(1), QP(2), QP(3), QP(4), QP(5), + QP(6), QP(7), QP(8), QP(9), QP(10), QP(11), + QP(12), QP(13), QP(14), QP(15), QP(16), QP(17), + QP(18), QP(19), QP(20), QP(21), QP(22), QP(23), + QP(24), QP(25), QP(26), QP(27), QP(28), QP(29), + QP(29), QP(30), QP(31), QP(32), QP(32), QP(33), + QP(34), QP(34), QP(35), QP(35), QP(36), QP(36), + QP(37), QP(37), QP(37), QP(38), QP(38), QP(38), + QP(39), QP(39), QP(39), QP(39), + QP(39), QP(39), QP(39), QP(39), QP(39), QP(39), + QP(39), QP(39), QP(39), QP(39), QP(39), QP(39), +}; +#undef QP + +enum cabac_ctx_block_cat_e +{ + DCT_LUMA_DC = 0, + DCT_LUMA_AC = 1, + DCT_LUMA_4x4 = 2, + DCT_CHROMA_DC = 3, + DCT_CHROMA_AC = 4, + DCT_LUMA_8x8 = 5, + DCT_CHROMAU_DC = 6, + DCT_CHROMAU_AC = 7, + DCT_CHROMAU_4x4 = 8, + DCT_CHROMAU_8x8 = 9, + DCT_CHROMAV_DC = 10, + DCT_CHROMAV_AC = 11, + DCT_CHROMAV_4x4 = 12, + DCT_CHROMAV_8x8 = 13, +}; + +static const uint8_t ctx_cat_plane[6][3] = +{ + { DCT_LUMA_DC, DCT_CHROMAU_DC, DCT_CHROMAV_DC}, + { DCT_LUMA_AC, DCT_CHROMAU_AC, DCT_CHROMAV_AC}, + {DCT_LUMA_4x4, DCT_CHROMAU_4x4, DCT_CHROMAV_4x4}, + {0}, + {0}, + {DCT_LUMA_8x8, DCT_CHROMAU_8x8, DCT_CHROMAV_8x8} +}; + +/* Per-frame allocation: is allocated per-thread only in frame-threads mode. */ +int x264_macroblock_cache_allocate( x264_t *h ); +void x264_macroblock_cache_free( x264_t *h ); + +/* Per-thread allocation: is allocated per-thread even in sliced-threads mode. */ +int x264_macroblock_thread_allocate( x264_t *h, int b_lookahead ); +void x264_macroblock_thread_free( x264_t *h, int b_lookahead ); + +void x264_macroblock_slice_init( x264_t *h ); +void x264_macroblock_thread_init( x264_t *h ); +void x264_macroblock_cache_load_progressive( x264_t *h, int mb_x, int mb_y ); +void x264_macroblock_cache_load_interlaced( x264_t *h, int mb_x, int mb_y ); +void x264_macroblock_deblock_strength( x264_t *h ); +void x264_macroblock_cache_save( x264_t *h ); + +void x264_macroblock_bipred_init( x264_t *h ); + +void x264_prefetch_fenc( x264_t *h, x264_frame_t *fenc, int i_mb_x, int i_mb_y ); + +void x264_copy_column8( pixel *dst, pixel *src ); + +/* x264_mb_predict_mv_16x16: + * set mvp with predicted mv for D_16x16 block + * h->mb. need only valid values from other blocks */ +void x264_mb_predict_mv_16x16( x264_t *h, int i_list, int i_ref, int16_t mvp[2] ); +/* x264_mb_predict_mv_pskip: + * set mvp with predicted mv for P_SKIP + * h->mb. need only valid values from other blocks */ +void x264_mb_predict_mv_pskip( x264_t *h, int16_t mv[2] ); +/* x264_mb_predict_mv: + * set mvp with predicted mv for all blocks except SKIP and DIRECT + * h->mb. need valid ref/partition/sub of current block to be valid + * and valid mv/ref from other blocks. */ +void x264_mb_predict_mv( x264_t *h, int i_list, int idx, int i_width, int16_t mvp[2] ); +/* x264_mb_predict_mv_direct16x16: + * set h->mb.cache.mv and h->mb.cache.ref for B_SKIP or B_DIRECT + * h->mb. need only valid values from other blocks. + * return 1 on success, 0 on failure. + * if b_changed != NULL, set it to whether refs or mvs differ from + * before this functioncall. */ +int x264_mb_predict_mv_direct16x16( x264_t *h, int *b_changed ); +/* x264_mb_predict_mv_ref16x16: + * set mvc with D_16x16 prediction. + * uses all neighbors, even those that didn't end up using this ref. + * h->mb. need only valid values from other blocks */ +void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[8][2], int *i_mvc ); + +void x264_mb_mc( x264_t *h ); +void x264_mb_mc_8x8( x264_t *h, int i8 ); + +static ALWAYS_INLINE uint32_t pack16to32( uint32_t a, uint32_t b ) +{ +#if WORDS_BIGENDIAN + return b + (a<<16); +#else + return a + (b<<16); +#endif +} +static ALWAYS_INLINE uint32_t pack8to16( uint32_t a, uint32_t b ) +{ +#if WORDS_BIGENDIAN + return b + (a<<8); +#else + return a + (b<<8); +#endif +} +static ALWAYS_INLINE uint32_t pack8to32( uint32_t a, uint32_t b, uint32_t c, uint32_t d ) +{ +#if WORDS_BIGENDIAN + return d + (c<<8) + (b<<16) + (a<<24); +#else + return a + (b<<8) + (c<<16) + (d<<24); +#endif +} +static ALWAYS_INLINE uint32_t pack16to32_mask( int a, int b ) +{ +#if WORDS_BIGENDIAN + return (b&0xFFFF) + (a<<16); +#else + return (a&0xFFFF) + (b<<16); +#endif +} +static ALWAYS_INLINE uint64_t pack32to64( uint32_t a, uint32_t b ) +{ +#if WORDS_BIGENDIAN + return b + ((uint64_t)a<<32); +#else + return a + ((uint64_t)b<<32); +#endif +} + +#if HIGH_BIT_DEPTH +# define pack_pixel_1to2 pack16to32 +# define pack_pixel_2to4 pack32to64 +#else +# define pack_pixel_1to2 pack8to16 +# define pack_pixel_2to4 pack16to32 +#endif + +static ALWAYS_INLINE int x264_mb_predict_intra4x4_mode( x264_t *h, int idx ) +{ + const int ma = h->mb.cache.intra4x4_pred_mode[x264_scan8[idx] - 1]; + const int mb = h->mb.cache.intra4x4_pred_mode[x264_scan8[idx] - 8]; + const int m = X264_MIN( x264_mb_pred_mode4x4_fix(ma), + x264_mb_pred_mode4x4_fix(mb) ); + + if( m < 0 ) + return I_PRED_4x4_DC; + + return m; +} +static ALWAYS_INLINE int x264_mb_predict_non_zero_code( x264_t *h, int idx ) +{ + const int za = h->mb.cache.non_zero_count[x264_scan8[idx] - 1]; + const int zb = h->mb.cache.non_zero_count[x264_scan8[idx] - 8]; + + int i_ret = za + zb; + + if( i_ret < 0x80 ) + i_ret = ( i_ret + 1 ) >> 1; + return i_ret & 0x7f; +} + +/* intra and skip are disallowed, p8x8 is conditional. */ +static const uint8_t x264_transform_allowed[X264_MBTYPE_MAX] = +{ + 0,0,0,0,1,2,0,1,1,1,1,1,1,1,1,1,1,1,0 +}; + +/* x264_mb_transform_8x8_allowed: + * check whether any partition is smaller than 8x8 (or at least + * might be, according to just partition type.) + * doesn't check for cbp */ +static ALWAYS_INLINE int x264_mb_transform_8x8_allowed( x264_t *h ) +{ + if( !h->pps->b_transform_8x8_mode ) + return 0; + if( h->mb.i_type != P_8x8 ) + return x264_transform_allowed[h->mb.i_type]; + return M32( h->mb.i_sub_partition ) == D_L0_8x8*0x01010101; +} + +#endif + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.c new file mode 100644 index 00000000..65af5b9e --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.c @@ -0,0 +1,779 @@ +/***************************************************************************** + * mc.c: motion compensation + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#if HAVE_MMX +#include "x86/mc.h" +#endif +#if ARCH_PPC +#include "ppc/mc.h" +#endif +#if ARCH_ARM +#include "arm/mc.h" +#endif +#if ARCH_AARCH64 +#include "aarch64/mc.h" +#endif +#if ARCH_MIPS +#include "mips/mc.h" +#endif + + +static inline void pixel_avg( pixel *dst, intptr_t i_dst_stride, + pixel *src1, intptr_t i_src1_stride, + pixel *src2, intptr_t i_src2_stride, int i_width, int i_height ) +{ + for( int y = 0; y < i_height; y++ ) + { + for( int x = 0; x < i_width; x++ ) + dst[x] = ( src1[x] + src2[x] + 1 ) >> 1; + dst += i_dst_stride; + src1 += i_src1_stride; + src2 += i_src2_stride; + } +} + +static inline void pixel_avg_wxh( pixel *dst, intptr_t i_dst, + pixel *src1, intptr_t i_src1, + pixel *src2, intptr_t i_src2, int width, int height ) +{ + for( int y = 0; y < height; y++ ) + { + for( int x = 0; x < width; x++ ) + dst[x] = ( src1[x] + src2[x] + 1 ) >> 1; + src1 += i_src1; + src2 += i_src2; + dst += i_dst; + } +} + +/* Implicit weighted bipred only: + * assumes log2_denom = 5, offset = 0, weight1 + weight2 = 64 */ +static inline void pixel_avg_weight_wxh( pixel *dst, intptr_t i_dst, + pixel *src1, intptr_t i_src1, + pixel *src2, intptr_t i_src2, int width, int height, int i_weight1 ) +{ + int i_weight2 = 64 - i_weight1; + for( int y = 0; y> 6 ); +} +#undef op_scale2 + +#define PIXEL_AVG_C( name, width, height ) \ +static void name( pixel *pix1, intptr_t i_stride_pix1, \ + pixel *pix2, intptr_t i_stride_pix2, \ + pixel *pix3, intptr_t i_stride_pix3, int weight ) \ +{ \ + if( weight == 32 ) \ + pixel_avg_wxh( pix1, i_stride_pix1, pix2, i_stride_pix2, pix3, i_stride_pix3, width, height ); \ + else \ + pixel_avg_weight_wxh( pix1, i_stride_pix1, pix2, i_stride_pix2, pix3, i_stride_pix3, width, height, weight ); \ +} +PIXEL_AVG_C( pixel_avg_16x16, 16, 16 ) +PIXEL_AVG_C( pixel_avg_16x8, 16, 8 ) +PIXEL_AVG_C( pixel_avg_8x16, 8, 16 ) +PIXEL_AVG_C( pixel_avg_8x8, 8, 8 ) +PIXEL_AVG_C( pixel_avg_8x4, 8, 4 ) +PIXEL_AVG_C( pixel_avg_4x16, 4, 16 ) +PIXEL_AVG_C( pixel_avg_4x8, 4, 8 ) +PIXEL_AVG_C( pixel_avg_4x4, 4, 4 ) +PIXEL_AVG_C( pixel_avg_4x2, 4, 2 ) +PIXEL_AVG_C( pixel_avg_2x8, 2, 8 ) +PIXEL_AVG_C( pixel_avg_2x4, 2, 4 ) +PIXEL_AVG_C( pixel_avg_2x2, 2, 2 ) + +static void x264_weight_cache( x264_t *h, x264_weight_t *w ) +{ + w->weightfn = h->mc.weight; +} +#define opscale(x) dst[x] = x264_clip_pixel( ((src[x] * scale + (1<<(denom - 1))) >> denom) + offset ) +#define opscale_noden(x) dst[x] = x264_clip_pixel( src[x] * scale + offset ) +static void mc_weight( pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, + const x264_weight_t *weight, int i_width, int i_height ) +{ + int offset = weight->i_offset << (BIT_DEPTH-8); + int scale = weight->i_scale; + int denom = weight->i_denom; + if( denom >= 1 ) + { + for( int y = 0; y < i_height; y++, dst += i_dst_stride, src += i_src_stride ) + for( int x = 0; x < i_width; x++ ) + opscale( x ); + } + else + { + for( int y = 0; y < i_height; y++, dst += i_dst_stride, src += i_src_stride ) + for( int x = 0; x < i_width; x++ ) + opscale_noden( x ); + } +} + +#define MC_WEIGHT_C( name, width ) \ + static void name( pixel *dst, intptr_t i_dst_stride, pixel *src, intptr_t i_src_stride, const x264_weight_t *weight, int height ) \ +{ \ + mc_weight( dst, i_dst_stride, src, i_src_stride, weight, width, height );\ +} + +MC_WEIGHT_C( mc_weight_w20, 20 ) +MC_WEIGHT_C( mc_weight_w16, 16 ) +MC_WEIGHT_C( mc_weight_w12, 12 ) +MC_WEIGHT_C( mc_weight_w8, 8 ) +MC_WEIGHT_C( mc_weight_w4, 4 ) +MC_WEIGHT_C( mc_weight_w2, 2 ) + +static weight_fn_t x264_mc_weight_wtab[6] = +{ + mc_weight_w2, + mc_weight_w4, + mc_weight_w8, + mc_weight_w12, + mc_weight_w16, + mc_weight_w20, +}; +const x264_weight_t x264_weight_none[3] = { {{0}} }; +static void mc_copy( pixel *src, intptr_t i_src_stride, pixel *dst, intptr_t i_dst_stride, int i_width, int i_height ) +{ + for( int y = 0; y < i_height; y++ ) + { + memcpy( dst, src, i_width * sizeof(pixel) ); + + src += i_src_stride; + dst += i_dst_stride; + } +} + +#define TAPFILTER(pix, d) ((pix)[x-2*d] + (pix)[x+3*d] - 5*((pix)[x-d] + (pix)[x+2*d]) + 20*((pix)[x] + (pix)[x+d])) +static void hpel_filter( pixel *dsth, pixel *dstv, pixel *dstc, pixel *src, + intptr_t stride, int width, int height, int16_t *buf ) +{ + const int pad = (BIT_DEPTH > 9) ? (-10 * PIXEL_MAX) : 0; + for( int y = 0; y < height; y++ ) + { + for( int x = -2; x < width+3; x++ ) + { + int v = TAPFILTER(src,stride); + dstv[x] = x264_clip_pixel( (v + 16) >> 5 ); + /* transform v for storage in a 16-bit integer */ + buf[x+2] = v + pad; + } + for( int x = 0; x < width; x++ ) + dstc[x] = x264_clip_pixel( (TAPFILTER(buf+2,1) - 32*pad + 512) >> 10 ); + for( int x = 0; x < width; x++ ) + dsth[x] = x264_clip_pixel( (TAPFILTER(src,1) + 16) >> 5 ); + dsth += stride; + dstv += stride; + dstc += stride; + src += stride; + } +} + +const uint8_t x264_hpel_ref0[16] = {0,1,1,1,0,1,1,1,2,3,3,3,0,1,1,1}; +const uint8_t x264_hpel_ref1[16] = {0,0,1,0,2,2,3,2,2,2,3,2,2,2,3,2}; + +static void mc_luma( pixel *dst, intptr_t i_dst_stride, + pixel *src[4], intptr_t i_src_stride, + int mvx, int mvy, + int i_width, int i_height, const x264_weight_t *weight ) +{ + int qpel_idx = ((mvy&3)<<2) + (mvx&3); + int offset = (mvy>>2)*i_src_stride + (mvx>>2); + pixel *src1 = src[x264_hpel_ref0[qpel_idx]] + offset + ((mvy&3) == 3) * i_src_stride; + + if( qpel_idx & 5 ) /* qpel interpolation needed */ + { + pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3); + pixel_avg( dst, i_dst_stride, src1, i_src_stride, + src2, i_src_stride, i_width, i_height ); + if( weight->weightfn ) + mc_weight( dst, i_dst_stride, dst, i_dst_stride, weight, i_width, i_height ); + } + else if( weight->weightfn ) + mc_weight( dst, i_dst_stride, src1, i_src_stride, weight, i_width, i_height ); + else + mc_copy( src1, i_src_stride, dst, i_dst_stride, i_width, i_height ); +} + +static pixel *get_ref( pixel *dst, intptr_t *i_dst_stride, + pixel *src[4], intptr_t i_src_stride, + int mvx, int mvy, + int i_width, int i_height, const x264_weight_t *weight ) +{ + int qpel_idx = ((mvy&3)<<2) + (mvx&3); + int offset = (mvy>>2)*i_src_stride + (mvx>>2); + pixel *src1 = src[x264_hpel_ref0[qpel_idx]] + offset + ((mvy&3) == 3) * i_src_stride; + + if( qpel_idx & 5 ) /* qpel interpolation needed */ + { + pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3); + pixel_avg( dst, *i_dst_stride, src1, i_src_stride, + src2, i_src_stride, i_width, i_height ); + if( weight->weightfn ) + mc_weight( dst, *i_dst_stride, dst, *i_dst_stride, weight, i_width, i_height ); + return dst; + } + else if( weight->weightfn ) + { + mc_weight( dst, *i_dst_stride, src1, i_src_stride, weight, i_width, i_height ); + return dst; + } + else + { + *i_dst_stride = i_src_stride; + return src1; + } +} + +/* full chroma mc (ie until 1/8 pixel)*/ +static void mc_chroma( pixel *dstu, pixel *dstv, intptr_t i_dst_stride, + pixel *src, intptr_t i_src_stride, + int mvx, int mvy, + int i_width, int i_height ) +{ + pixel *srcp; + + int d8x = mvx&0x07; + int d8y = mvy&0x07; + int cA = (8-d8x)*(8-d8y); + int cB = d8x *(8-d8y); + int cC = (8-d8x)*d8y; + int cD = d8x *d8y; + + src += (mvy >> 3) * i_src_stride + (mvx >> 3)*2; + srcp = &src[i_src_stride]; + + for( int y = 0; y < i_height; y++ ) + { + for( int x = 0; x < i_width; x++ ) + { + dstu[x] = ( cA*src[2*x] + cB*src[2*x+2] + + cC*srcp[2*x] + cD*srcp[2*x+2] + 32 ) >> 6; + dstv[x] = ( cA*src[2*x+1] + cB*src[2*x+3] + + cC*srcp[2*x+1] + cD*srcp[2*x+3] + 32 ) >> 6; + } + dstu += i_dst_stride; + dstv += i_dst_stride; + src = srcp; + srcp += i_src_stride; + } +} + +#define MC_COPY(W) \ +static void mc_copy_w##W( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int i_height ) \ +{ \ + mc_copy( src, i_src, dst, i_dst, W, i_height ); \ +} +MC_COPY( 16 ) +MC_COPY( 8 ) +MC_COPY( 4 ) + +void x264_plane_copy_c( pixel *dst, intptr_t i_dst, + pixel *src, intptr_t i_src, int w, int h ) +{ + while( h-- ) + { + memcpy( dst, src, w * sizeof(pixel) ); + dst += i_dst; + src += i_src; + } +} + +void x264_plane_copy_swap_c( pixel *dst, intptr_t i_dst, + pixel *src, intptr_t i_src, int w, int h ) +{ + for( int y=0; y>8)&0xff00) + (x>>24); +} +#else +#define v210_endian_fix32(x) (x) +#endif + +static void x264_plane_copy_deinterleave_v210_c( pixel *dsty, intptr_t i_dsty, + pixel *dstc, intptr_t i_dstc, + uint32_t *src, intptr_t i_src, int w, int h ) +{ + for( int l = 0; l < h; l++ ) + { + pixel *dsty0 = dsty; + pixel *dstc0 = dstc; + uint32_t *src0 = src; + + for( int n = 0; n < w; n += 3 ) + { + uint32_t s = v210_endian_fix32( *src0++ ); + *dstc0++ = s & 0x03FF; + *dsty0++ = (s >> 10) & 0x03FF; + *dstc0++ = (s >> 20) & 0x03FF; + s = v210_endian_fix32( *src0++ ); + *dsty0++ = s & 0x03FF; + *dstc0++ = (s >> 10) & 0x03FF; + *dsty0++ = (s >> 20) & 0x03FF; + } + + dsty += i_dsty; + dstc += i_dstc; + src += i_src; + } +} + +static void store_interleave_chroma( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height ) +{ + for( int y=0; yplane[0]; + int i_stride = frame->i_stride[0]; + int i_height = frame->i_lines[0]; + int i_width = frame->i_width[0]; + + // duplicate last row and column so that their interpolation doesn't have to be special-cased + for( int y = 0; y < i_height; y++ ) + src[i_width+y*i_stride] = src[i_width-1+y*i_stride]; + memcpy( src+i_stride*i_height, src+i_stride*(i_height-1), (i_width+1) * sizeof(pixel) ); + h->mc.frame_init_lowres_core( src, frame->lowres[0], frame->lowres[1], frame->lowres[2], frame->lowres[3], + i_stride, frame->i_stride_lowres, frame->i_width_lowres, frame->i_lines_lowres ); + x264_frame_expand_border_lowres( frame ); + + memset( frame->i_cost_est, -1, sizeof(frame->i_cost_est) ); + + for( int y = 0; y < h->param.i_bframe + 2; y++ ) + for( int x = 0; x < h->param.i_bframe + 2; x++ ) + frame->i_row_satds[y][x][0] = -1; + + for( int y = 0; y <= !!h->param.i_bframe; y++ ) + for( int x = 0; x <= h->param.i_bframe; x++ ) + frame->lowres_mvs[y][x][0][0] = 0x7FFF; +} + +static void frame_init_lowres_core( pixel *src0, pixel *dst0, pixel *dsth, pixel *dstv, pixel *dstc, + intptr_t src_stride, intptr_t dst_stride, int width, int height ) +{ + for( int y = 0; y < height; y++ ) + { + pixel *src1 = src0+src_stride; + pixel *src2 = src1+src_stride; + for( int x = 0; x>1)+((c+d+1)>>1)+1)>>1) + dst0[x] = FILTER(src0[2*x ], src1[2*x ], src0[2*x+1], src1[2*x+1]); + dsth[x] = FILTER(src0[2*x+1], src1[2*x+1], src0[2*x+2], src1[2*x+2]); + dstv[x] = FILTER(src1[2*x ], src2[2*x ], src1[2*x+1], src2[2*x+1]); + dstc[x] = FILTER(src1[2*x+1], src2[2*x+1], src1[2*x+2], src2[2*x+2]); +#undef FILTER + } + src0 += src_stride*2; + dst0 += dst_stride; + dsth += dst_stride; + dstv += dst_stride; + dstc += dst_stride; + } +} + +/* Estimate the total amount of influence on future quality that could be had if we + * were to improve the reference samples used to inter predict any given macroblock. */ +static void mbtree_propagate_cost( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs, + uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len ) +{ + float fps = *fps_factor; + for( int i = 0; i < len; i++ ) + { + int intra_cost = intra_costs[i]; + int inter_cost = X264_MIN(intra_costs[i], inter_costs[i] & LOWRES_COST_MASK); + float propagate_intra = intra_cost * inv_qscales[i]; + float propagate_amount = propagate_in[i] + propagate_intra*fps; + float propagate_num = intra_cost - inter_cost; + float propagate_denom = intra_cost; + dst[i] = X264_MIN((int)(propagate_amount * propagate_num / propagate_denom + 0.5f), 32767); + } +} + +static void mbtree_propagate_list( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2], + int16_t *propagate_amount, uint16_t *lowres_costs, + int bipred_weight, int mb_y, int len, int list ) +{ + unsigned stride = h->mb.i_mb_stride; + unsigned width = h->mb.i_mb_width; + unsigned height = h->mb.i_mb_height; + + for( unsigned i = 0; i < len; i++ ) + { + int lists_used = lowres_costs[i]>>LOWRES_COST_SHIFT; + + if( !(lists_used & (1 << list)) ) + continue; + + int listamount = propagate_amount[i]; + /* Apply bipred weighting. */ + if( lists_used == 3 ) + listamount = (listamount * bipred_weight + 32) >> 6; + + /* Early termination for simple case of mv0. */ + if( !M32( mvs[i] ) ) + { + MC_CLIP_ADD( ref_costs[mb_y*stride + i], listamount ); + continue; + } + + int x = mvs[i][0]; + int y = mvs[i][1]; + unsigned mbx = (x>>5)+i; + unsigned mby = (y>>5)+mb_y; + unsigned idx0 = mbx + mby * stride; + unsigned idx2 = idx0 + stride; + x &= 31; + y &= 31; + int idx0weight = (32-y)*(32-x); + int idx1weight = (32-y)*x; + int idx2weight = y*(32-x); + int idx3weight = y*x; + idx0weight = (idx0weight * listamount + 512) >> 10; + idx1weight = (idx1weight * listamount + 512) >> 10; + idx2weight = (idx2weight * listamount + 512) >> 10; + idx3weight = (idx3weight * listamount + 512) >> 10; + + if( mbx < width-1 && mby < height-1 ) + { + MC_CLIP_ADD( ref_costs[idx0+0], idx0weight ); + MC_CLIP_ADD( ref_costs[idx0+1], idx1weight ); + MC_CLIP_ADD( ref_costs[idx2+0], idx2weight ); + MC_CLIP_ADD( ref_costs[idx2+1], idx3weight ); + } + else + { + /* Note: this takes advantage of unsigned representation to + * catch negative mbx/mby. */ + if( mby < height ) + { + if( mbx < width ) + MC_CLIP_ADD( ref_costs[idx0+0], idx0weight ); + if( mbx+1 < width ) + MC_CLIP_ADD( ref_costs[idx0+1], idx1weight ); + } + if( mby+1 < height ) + { + if( mbx < width ) + MC_CLIP_ADD( ref_costs[idx2+0], idx2weight ); + if( mbx+1 < width ) + MC_CLIP_ADD( ref_costs[idx2+1], idx3weight ); + } + } + } +} + +/* Conversion between float and Q8.8 fixed point (big-endian) for storage */ +static void mbtree_fix8_pack( uint16_t *dst, float *src, int count ) +{ + for( int i = 0; i < count; i++ ) + dst[i] = endian_fix16( (int16_t)(src[i] * 256.0f) ); +} + +static void mbtree_fix8_unpack( float *dst, uint16_t *src, int count ) +{ + for( int i = 0; i < count; i++ ) + dst[i] = (int16_t)endian_fix16( src[i] ) * (1.0f/256.0f); +} + +void x264_mc_init( int cpu, x264_mc_functions_t *pf, int cpu_independent ) +{ + pf->mc_luma = mc_luma; + pf->get_ref = get_ref; + + pf->mc_chroma = mc_chroma; + + pf->avg[PIXEL_16x16]= pixel_avg_16x16; + pf->avg[PIXEL_16x8] = pixel_avg_16x8; + pf->avg[PIXEL_8x16] = pixel_avg_8x16; + pf->avg[PIXEL_8x8] = pixel_avg_8x8; + pf->avg[PIXEL_8x4] = pixel_avg_8x4; + pf->avg[PIXEL_4x16] = pixel_avg_4x16; + pf->avg[PIXEL_4x8] = pixel_avg_4x8; + pf->avg[PIXEL_4x4] = pixel_avg_4x4; + pf->avg[PIXEL_4x2] = pixel_avg_4x2; + pf->avg[PIXEL_2x8] = pixel_avg_2x8; + pf->avg[PIXEL_2x4] = pixel_avg_2x4; + pf->avg[PIXEL_2x2] = pixel_avg_2x2; + + pf->weight = x264_mc_weight_wtab; + pf->offsetadd = x264_mc_weight_wtab; + pf->offsetsub = x264_mc_weight_wtab; + pf->weight_cache = x264_weight_cache; + + pf->copy_16x16_unaligned = mc_copy_w16; + pf->copy[PIXEL_16x16] = mc_copy_w16; + pf->copy[PIXEL_8x8] = mc_copy_w8; + pf->copy[PIXEL_4x4] = mc_copy_w4; + + pf->store_interleave_chroma = store_interleave_chroma; + pf->load_deinterleave_chroma_fenc = load_deinterleave_chroma_fenc; + pf->load_deinterleave_chroma_fdec = load_deinterleave_chroma_fdec; + + pf->plane_copy = x264_plane_copy_c; + pf->plane_copy_swap = x264_plane_copy_swap_c; + pf->plane_copy_interleave = x264_plane_copy_interleave_c; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_c; + pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_c; + pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_c; + pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_c; + + pf->hpel_filter = hpel_filter; + + pf->prefetch_fenc_420 = prefetch_fenc_null; + pf->prefetch_fenc_422 = prefetch_fenc_null; + pf->prefetch_ref = prefetch_ref_null; + pf->memcpy_aligned = memcpy; + pf->memzero_aligned = memzero_aligned; + pf->frame_init_lowres_core = frame_init_lowres_core; + + pf->integral_init4h = integral_init4h; + pf->integral_init8h = integral_init8h; + pf->integral_init4v = integral_init4v; + pf->integral_init8v = integral_init8v; + + pf->mbtree_propagate_cost = mbtree_propagate_cost; + pf->mbtree_propagate_list = mbtree_propagate_list; + pf->mbtree_fix8_pack = mbtree_fix8_pack; + pf->mbtree_fix8_unpack = mbtree_fix8_unpack; + +#if HAVE_MMX + x264_mc_init_mmx( cpu, pf ); +#endif +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + x264_mc_init_altivec( pf ); +#endif +#if HAVE_ARMV6 + x264_mc_init_arm( cpu, pf ); +#endif +#if ARCH_AARCH64 + x264_mc_init_aarch64( cpu, pf ); +#endif +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + x264_mc_init_mips( cpu, pf ); +#endif + + if( cpu_independent ) + { + pf->mbtree_propagate_cost = mbtree_propagate_cost; + pf->mbtree_propagate_list = mbtree_propagate_list; + } +} + +void x264_frame_filter( x264_t *h, x264_frame_t *frame, int mb_y, int b_end ) +{ + const int b_interlaced = PARAM_INTERLACED; + int start = mb_y*16 - 8; // buffer = 4 for deblock + 3 for 6tap, rounded to 8 + int height = (b_end ? frame->i_lines[0] + 16*PARAM_INTERLACED : (mb_y+b_interlaced)*16) + 8; + + if( mb_y & b_interlaced ) + return; + + for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ ) + { + int stride = frame->i_stride[p]; + const int width = frame->i_width[p]; + int offs = start*stride - 8; // buffer = 3 for 6tap, aligned to 8 for simd + + if( !b_interlaced || h->mb.b_adaptive_mbaff ) + h->mc.hpel_filter( + frame->filtered[p][1] + offs, + frame->filtered[p][2] + offs, + frame->filtered[p][3] + offs, + frame->plane[p] + offs, + stride, width + 16, height - start, + h->scratch_buffer ); + + if( b_interlaced ) + { + /* MC must happen between pixels in the same field. */ + stride = frame->i_stride[p] << 1; + start = (mb_y*16 >> 1) - 8; + int height_fld = ((b_end ? frame->i_lines[p] : mb_y*16) >> 1) + 8; + offs = start*stride - 8; + for( int i = 0; i < 2; i++, offs += frame->i_stride[p] ) + { + h->mc.hpel_filter( + frame->filtered_fld[p][1] + offs, + frame->filtered_fld[p][2] + offs, + frame->filtered_fld[p][3] + offs, + frame->plane_fld[p] + offs, + stride, width + 16, height_fld - start, + h->scratch_buffer ); + } + } + } + + /* generate integral image: + * frame->integral contains 2 planes. in the upper plane, each element is + * the sum of an 8x8 pixel region with top-left corner on that point. + * in the lower plane, 4x4 sums (needed only with --partitions p4x4). */ + + if( frame->integral ) + { + int stride = frame->i_stride[0]; + if( start < 0 ) + { + memset( frame->integral - PADV * stride - PADH, 0, stride * sizeof(uint16_t) ); + start = -PADV; + } + if( b_end ) + height += PADV-9; + for( int y = start; y < height; y++ ) + { + pixel *pix = frame->plane[0] + y * stride - PADH; + uint16_t *sum8 = frame->integral + (y+1) * stride - PADH; + uint16_t *sum4; + if( h->frames.b_have_sub8x8_esa ) + { + h->mc.integral_init4h( sum8, pix, stride ); + sum8 -= 8*stride; + sum4 = sum8 + stride * (frame->i_lines[0] + PADV*2); + if( y >= 8-PADV ) + h->mc.integral_init4v( sum8, sum4, stride ); + } + else + { + h->mc.integral_init8h( sum8, pix, stride ); + if( y >= 8-PADV ) + h->mc.integral_init8v( sum8-8*stride, stride ); + } + } + } +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.h new file mode 100644 index 00000000..f3e7079d --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mc.h @@ -0,0 +1,340 @@ +/***************************************************************************** + * mc.h: motion compensation + ***************************************************************************** + * Copyright (C) 2004-2017 x264 project + * + * Authors: Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_MC_H +#define X264_MC_H + +#define MC_CLIP_ADD(s,x) (s) = X264_MIN((s)+(x),(1<<15)-1) +#define MC_CLIP_ADD2(s,x)\ +do\ +{\ + MC_CLIP_ADD((s)[0], (x)[0]);\ + MC_CLIP_ADD((s)[1], (x)[1]);\ +} while( 0 ) + +#define PROPAGATE_LIST(cpu)\ +void x264_mbtree_propagate_list_internal_##cpu( int16_t (*mvs)[2], int16_t *propagate_amount,\ + uint16_t *lowres_costs, int16_t *output,\ + int bipred_weight, int mb_y, int len );\ +\ +static void x264_mbtree_propagate_list_##cpu( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2],\ + int16_t *propagate_amount, uint16_t *lowres_costs,\ + int bipred_weight, int mb_y, int len, int list )\ +{\ + int16_t *current = h->scratch_buffer2;\ +\ + x264_mbtree_propagate_list_internal_##cpu( mvs, propagate_amount, lowres_costs,\ + current, bipred_weight, mb_y, len );\ +\ + unsigned stride = h->mb.i_mb_stride;\ + unsigned width = h->mb.i_mb_width;\ + unsigned height = h->mb.i_mb_height;\ +\ + for( unsigned i = 0; i < len; current += 32 )\ + {\ + int end = X264_MIN( i+8, len );\ + for( ; i < end; i++, current += 2 )\ + {\ + if( !(lowres_costs[i] & (1 << (list+LOWRES_COST_SHIFT))) )\ + continue;\ +\ + unsigned mbx = current[0];\ + unsigned mby = current[1];\ + unsigned idx0 = mbx + mby * stride;\ + unsigned idx2 = idx0 + stride;\ +\ + /* Shortcut for the simple/common case of zero MV */\ + if( !M32( mvs[i] ) )\ + {\ + MC_CLIP_ADD( ref_costs[idx0], current[16] );\ + continue;\ + }\ +\ + if( mbx < width-1 && mby < height-1 )\ + {\ + MC_CLIP_ADD2( ref_costs+idx0, current+16 );\ + MC_CLIP_ADD2( ref_costs+idx2, current+32 );\ + }\ + else\ + {\ + /* Note: this takes advantage of unsigned representation to\ + * catch negative mbx/mby. */\ + if( mby < height )\ + {\ + if( mbx < width )\ + MC_CLIP_ADD( ref_costs[idx0+0], current[16] );\ + if( mbx+1 < width )\ + MC_CLIP_ADD( ref_costs[idx0+1], current[17] );\ + }\ + if( mby+1 < height )\ + {\ + if( mbx < width )\ + MC_CLIP_ADD( ref_costs[idx2+0], current[32] );\ + if( mbx+1 < width )\ + MC_CLIP_ADD( ref_costs[idx2+1], current[33] );\ + }\ + }\ + }\ + }\ +} + +void x264_plane_copy_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h ); + +#define PLANE_COPY(align, cpu)\ +static void x264_plane_copy_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\ +{\ + int c_w = (align) / sizeof(pixel) - 1;\ + if( w < 256 ) /* tiny resolutions don't want non-temporal hints. dunno the exact threshold. */\ + x264_plane_copy_c( dst, i_dst, src, i_src, w, h );\ + else if( !(w&c_w) )\ + x264_plane_copy_core_##cpu( dst, i_dst, src, i_src, w, h );\ + else\ + {\ + if( --h > 0 )\ + {\ + if( i_src > 0 )\ + {\ + x264_plane_copy_core_##cpu( dst, i_dst, src, i_src, (w+c_w)&~c_w, h );\ + dst += i_dst * h;\ + src += i_src * h;\ + }\ + else\ + x264_plane_copy_core_##cpu( dst+i_dst, i_dst, src+i_src, i_src, (w+c_w)&~c_w, h );\ + }\ + /* use plain memcpy on the last line (in memory order) to avoid overreading src. */\ + memcpy( dst, src, w*sizeof(pixel) );\ + }\ +} + +void x264_plane_copy_swap_c( pixel *, intptr_t, pixel *, intptr_t, int w, int h ); + +#define PLANE_COPY_SWAP(align, cpu)\ +static void x264_plane_copy_swap_##cpu( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h )\ +{\ + int c_w = (align>>1) / sizeof(pixel) - 1;\ + if( !(w&c_w) )\ + x264_plane_copy_swap_core_##cpu( dst, i_dst, src, i_src, w, h );\ + else if( w > c_w )\ + {\ + if( --h > 0 )\ + {\ + if( i_src > 0 )\ + {\ + x264_plane_copy_swap_core_##cpu( dst, i_dst, src, i_src, (w+c_w)&~c_w, h );\ + dst += i_dst * h;\ + src += i_src * h;\ + }\ + else\ + x264_plane_copy_swap_core_##cpu( dst+i_dst, i_dst, src+i_src, i_src, (w+c_w)&~c_w, h );\ + }\ + x264_plane_copy_swap_core_##cpu( dst, 0, src, 0, w&~c_w, 1 );\ + for( int x = 2*(w&~c_w); x < 2*w; x += 2 )\ + {\ + dst[x] = src[x+1];\ + dst[x+1] = src[x];\ + }\ + }\ + else\ + x264_plane_copy_swap_c( dst, i_dst, src, i_src, w, h );\ +} + +void x264_plane_copy_deinterleave_c( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb, + pixel *src, intptr_t i_src, int w, int h ); + +/* We can utilize existing plane_copy_deinterleave() functions for YUYV/UYUV + * input with the additional constraint that we cannot overread src. */ +#define PLANE_COPY_YUYV(align, cpu)\ +static void x264_plane_copy_deinterleave_yuyv_##cpu( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb,\ + pixel *src, intptr_t i_src, int w, int h )\ +{\ + int c_w = (align>>1) / sizeof(pixel) - 1;\ + if( !(w&c_w) )\ + x264_plane_copy_deinterleave_##cpu( dsta, i_dsta, dstb, i_dstb, src, i_src, w, h );\ + else if( w > c_w )\ + {\ + if( --h > 0 )\ + {\ + if( i_src > 0 )\ + {\ + x264_plane_copy_deinterleave_##cpu( dsta, i_dsta, dstb, i_dstb, src, i_src, w, h );\ + dsta += i_dsta * h;\ + dstb += i_dstb * h;\ + src += i_src * h;\ + }\ + else\ + x264_plane_copy_deinterleave_##cpu( dsta+i_dsta, i_dsta, dstb+i_dstb, i_dstb,\ + src+i_src, i_src, w, h );\ + }\ + x264_plane_copy_deinterleave_c( dsta, 0, dstb, 0, src, 0, w, 1 );\ + }\ + else\ + x264_plane_copy_deinterleave_c( dsta, i_dsta, dstb, i_dstb, src, i_src, w, h );\ +} + +void x264_plane_copy_interleave_c( pixel *dst, intptr_t i_dst, + pixel *srcu, intptr_t i_srcu, + pixel *srcv, intptr_t i_srcv, int w, int h ); + +#define PLANE_INTERLEAVE(cpu) \ +static void x264_plane_copy_interleave_##cpu( pixel *dst, intptr_t i_dst,\ + pixel *srcu, intptr_t i_srcu,\ + pixel *srcv, intptr_t i_srcv, int w, int h )\ +{\ + int c_w = 16 / sizeof(pixel) - 1;\ + if( !(w&c_w) )\ + x264_plane_copy_interleave_core_##cpu( dst, i_dst, srcu, i_srcu, srcv, i_srcv, w, h );\ + else if( w > c_w && (i_srcu ^ i_srcv) >= 0 ) /* only works correctly for strides with identical signs */\ + {\ + if( --h > 0 )\ + {\ + if( i_srcu > 0 )\ + {\ + x264_plane_copy_interleave_core_##cpu( dst, i_dst, srcu, i_srcu, srcv, i_srcv, (w+c_w)&~c_w, h );\ + dst += i_dst * h;\ + srcu += i_srcu * h;\ + srcv += i_srcv * h;\ + }\ + else\ + x264_plane_copy_interleave_core_##cpu( dst+i_dst, i_dst, srcu+i_srcu, i_srcu, srcv+i_srcv, i_srcv, (w+c_w)&~c_w, h );\ + }\ + x264_plane_copy_interleave_c( dst, 0, srcu, 0, srcv, 0, w, 1 );\ + }\ + else\ + x264_plane_copy_interleave_c( dst, i_dst, srcu, i_srcu, srcv, i_srcv, w, h );\ +} + +struct x264_weight_t; +typedef void (* weight_fn_t)( pixel *, intptr_t, pixel *,intptr_t, const struct x264_weight_t *, int ); +typedef struct x264_weight_t +{ + /* aligning the first member is a gcc hack to force the struct to be + * 16 byte aligned, as well as force sizeof(struct) to be a multiple of 16 */ + ALIGNED_16( int16_t cachea[8] ); + int16_t cacheb[8]; + int32_t i_denom; + int32_t i_scale; + int32_t i_offset; + weight_fn_t *weightfn; +} ALIGNED_16( x264_weight_t ); + +extern const x264_weight_t x264_weight_none[3]; +extern const uint8_t x264_hpel_ref0[16]; +extern const uint8_t x264_hpel_ref1[16]; + +#define SET_WEIGHT( w, b, s, d, o )\ +{\ + (w).i_scale = (s);\ + (w).i_denom = (d);\ + (w).i_offset = (o);\ + if( b )\ + h->mc.weight_cache( h, &w );\ + else\ + w.weightfn = NULL;\ +} + +/* Do the MC + * XXX: Only width = 4, 8 or 16 are valid + * width == 4 -> height == 4 or 8 + * width == 8 -> height == 4 or 8 or 16 + * width == 16-> height == 8 or 16 + * */ + +typedef struct +{ + void (*mc_luma)( pixel *dst, intptr_t i_dst, pixel **src, intptr_t i_src, + int mvx, int mvy, int i_width, int i_height, const x264_weight_t *weight ); + + /* may round up the dimensions if they're not a power of 2 */ + pixel* (*get_ref)( pixel *dst, intptr_t *i_dst, pixel **src, intptr_t i_src, + int mvx, int mvy, int i_width, int i_height, const x264_weight_t *weight ); + + /* mc_chroma may write up to 2 bytes of garbage to the right of dst, + * so it must be run from left to right. */ + void (*mc_chroma)( pixel *dstu, pixel *dstv, intptr_t i_dst, pixel *src, intptr_t i_src, + int mvx, int mvy, int i_width, int i_height ); + + void (*avg[12])( pixel *dst, intptr_t dst_stride, pixel *src1, intptr_t src1_stride, + pixel *src2, intptr_t src2_stride, int i_weight ); + + /* only 16x16, 8x8, and 4x4 defined */ + void (*copy[7])( pixel *dst, intptr_t dst_stride, pixel *src, intptr_t src_stride, int i_height ); + void (*copy_16x16_unaligned)( pixel *dst, intptr_t dst_stride, pixel *src, intptr_t src_stride, int i_height ); + + void (*store_interleave_chroma)( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height ); + void (*load_deinterleave_chroma_fenc)( pixel *dst, pixel *src, intptr_t i_src, int height ); + void (*load_deinterleave_chroma_fdec)( pixel *dst, pixel *src, intptr_t i_src, int height ); + + void (*plane_copy)( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h ); + void (*plane_copy_swap)( pixel *dst, intptr_t i_dst, pixel *src, intptr_t i_src, int w, int h ); + void (*plane_copy_interleave)( pixel *dst, intptr_t i_dst, pixel *srcu, intptr_t i_srcu, + pixel *srcv, intptr_t i_srcv, int w, int h ); + /* may write up to 15 pixels off the end of each plane */ + void (*plane_copy_deinterleave)( pixel *dstu, intptr_t i_dstu, pixel *dstv, intptr_t i_dstv, + pixel *src, intptr_t i_src, int w, int h ); + void (*plane_copy_deinterleave_yuyv)( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb, + pixel *src, intptr_t i_src, int w, int h ); + void (*plane_copy_deinterleave_rgb)( pixel *dsta, intptr_t i_dsta, pixel *dstb, intptr_t i_dstb, + pixel *dstc, intptr_t i_dstc, pixel *src, intptr_t i_src, int pw, int w, int h ); + void (*plane_copy_deinterleave_v210)( pixel *dsty, intptr_t i_dsty, + pixel *dstc, intptr_t i_dstc, + uint32_t *src, intptr_t i_src, int w, int h ); + void (*hpel_filter)( pixel *dsth, pixel *dstv, pixel *dstc, pixel *src, + intptr_t i_stride, int i_width, int i_height, int16_t *buf ); + + /* prefetch the next few macroblocks of fenc or fdec */ + void (*prefetch_fenc) ( pixel *pix_y, intptr_t stride_y, pixel *pix_uv, intptr_t stride_uv, int mb_x ); + void (*prefetch_fenc_420)( pixel *pix_y, intptr_t stride_y, pixel *pix_uv, intptr_t stride_uv, int mb_x ); + void (*prefetch_fenc_422)( pixel *pix_y, intptr_t stride_y, pixel *pix_uv, intptr_t stride_uv, int mb_x ); + /* prefetch the next few macroblocks of a hpel reference frame */ + void (*prefetch_ref)( pixel *pix, intptr_t stride, int parity ); + + void *(*memcpy_aligned)( void *dst, const void *src, size_t n ); + void (*memzero_aligned)( void *dst, size_t n ); + + /* successive elimination prefilter */ + void (*integral_init4h)( uint16_t *sum, pixel *pix, intptr_t stride ); + void (*integral_init8h)( uint16_t *sum, pixel *pix, intptr_t stride ); + void (*integral_init4v)( uint16_t *sum8, uint16_t *sum4, intptr_t stride ); + void (*integral_init8v)( uint16_t *sum8, intptr_t stride ); + + void (*frame_init_lowres_core)( pixel *src0, pixel *dst0, pixel *dsth, pixel *dstv, pixel *dstc, + intptr_t src_stride, intptr_t dst_stride, int width, int height ); + weight_fn_t *weight; + weight_fn_t *offsetadd; + weight_fn_t *offsetsub; + void (*weight_cache)( x264_t *, x264_weight_t * ); + + void (*mbtree_propagate_cost)( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs, + uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len ); + void (*mbtree_propagate_list)( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2], + int16_t *propagate_amount, uint16_t *lowres_costs, + int bipred_weight, int mb_y, int len, int list ); + void (*mbtree_fix8_pack)( uint16_t *dst, float *src, int count ); + void (*mbtree_fix8_unpack)( float *dst, uint16_t *src, int count ); +} x264_mc_functions_t; + +void x264_mc_init( int cpu, x264_mc_functions_t *pf, int cpu_independent ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mvpred.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mvpred.c new file mode 100644 index 00000000..a7e34487 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/mvpred.c @@ -0,0 +1,607 @@ +/***************************************************************************** + * mvpred.c: motion vector prediction + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Fiona Glaser + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +void x264_mb_predict_mv( x264_t *h, int i_list, int idx, int i_width, int16_t mvp[2] ) +{ + const int i8 = x264_scan8[idx]; + const int i_ref= h->mb.cache.ref[i_list][i8]; + int i_refa = h->mb.cache.ref[i_list][i8 - 1]; + int16_t *mv_a = h->mb.cache.mv[i_list][i8 - 1]; + int i_refb = h->mb.cache.ref[i_list][i8 - 8]; + int16_t *mv_b = h->mb.cache.mv[i_list][i8 - 8]; + int i_refc = h->mb.cache.ref[i_list][i8 - 8 + i_width]; + int16_t *mv_c = h->mb.cache.mv[i_list][i8 - 8 + i_width]; + + // Partitions not yet reached in scan order are unavailable. + if( (idx&3) >= 2 + (i_width&1) || i_refc == -2 ) + { + i_refc = h->mb.cache.ref[i_list][i8 - 8 - 1]; + mv_c = h->mb.cache.mv[i_list][i8 - 8 - 1]; + + if( SLICE_MBAFF + && h->mb.cache.ref[i_list][x264_scan8[0]-1] != -2 + && MB_INTERLACED != h->mb.field[h->mb.i_mb_left_xy[0]] ) + { + if( idx == 2 ) + { + mv_c = h->mb.cache.topright_mv[i_list][0]; + i_refc = h->mb.cache.topright_ref[i_list][0]; + } + else if( idx == 8 ) + { + mv_c = h->mb.cache.topright_mv[i_list][1]; + i_refc = h->mb.cache.topright_ref[i_list][1]; + } + else if( idx == 10 ) + { + mv_c = h->mb.cache.topright_mv[i_list][2]; + i_refc = h->mb.cache.topright_ref[i_list][2]; + } + } + } + if( h->mb.i_partition == D_16x8 ) + { + if( idx == 0 ) + { + if( i_refb == i_ref ) + { + CP32( mvp, mv_b ); + return; + } + } + else + { + if( i_refa == i_ref ) + { + CP32( mvp, mv_a ); + return; + } + } + } + else if( h->mb.i_partition == D_8x16 ) + { + if( idx == 0 ) + { + if( i_refa == i_ref ) + { + CP32( mvp, mv_a ); + return; + } + } + else + { + if( i_refc == i_ref ) + { + CP32( mvp, mv_c ); + return; + } + } + } + + int i_count = (i_refa == i_ref) + (i_refb == i_ref) + (i_refc == i_ref); + + if( i_count > 1 ) + { +median: + x264_median_mv( mvp, mv_a, mv_b, mv_c ); + } + else if( i_count == 1 ) + { + if( i_refa == i_ref ) + CP32( mvp, mv_a ); + else if( i_refb == i_ref ) + CP32( mvp, mv_b ); + else + CP32( mvp, mv_c ); + } + else if( i_refb == -2 && i_refc == -2 && i_refa != -2 ) + CP32( mvp, mv_a ); + else + goto median; +} + +void x264_mb_predict_mv_16x16( x264_t *h, int i_list, int i_ref, int16_t mvp[2] ) +{ + int i_refa = h->mb.cache.ref[i_list][X264_SCAN8_0 - 1]; + int16_t *mv_a = h->mb.cache.mv[i_list][X264_SCAN8_0 - 1]; + int i_refb = h->mb.cache.ref[i_list][X264_SCAN8_0 - 8]; + int16_t *mv_b = h->mb.cache.mv[i_list][X264_SCAN8_0 - 8]; + int i_refc = h->mb.cache.ref[i_list][X264_SCAN8_0 - 8 + 4]; + int16_t *mv_c = h->mb.cache.mv[i_list][X264_SCAN8_0 - 8 + 4]; + if( i_refc == -2 ) + { + i_refc = h->mb.cache.ref[i_list][X264_SCAN8_0 - 8 - 1]; + mv_c = h->mb.cache.mv[i_list][X264_SCAN8_0 - 8 - 1]; + } + + int i_count = (i_refa == i_ref) + (i_refb == i_ref) + (i_refc == i_ref); + + if( i_count > 1 ) + { +median: + x264_median_mv( mvp, mv_a, mv_b, mv_c ); + } + else if( i_count == 1 ) + { + if( i_refa == i_ref ) + CP32( mvp, mv_a ); + else if( i_refb == i_ref ) + CP32( mvp, mv_b ); + else + CP32( mvp, mv_c ); + } + else if( i_refb == -2 && i_refc == -2 && i_refa != -2 ) + CP32( mvp, mv_a ); + else + goto median; +} + + +void x264_mb_predict_mv_pskip( x264_t *h, int16_t mv[2] ) +{ + int i_refa = h->mb.cache.ref[0][X264_SCAN8_0 - 1]; + int i_refb = h->mb.cache.ref[0][X264_SCAN8_0 - 8]; + int16_t *mv_a = h->mb.cache.mv[0][X264_SCAN8_0 - 1]; + int16_t *mv_b = h->mb.cache.mv[0][X264_SCAN8_0 - 8]; + + if( i_refa == -2 || i_refb == -2 || + !( i_refa | M32( mv_a ) ) || + !( i_refb | M32( mv_b ) ) ) + { + M32( mv ) = 0; + } + else + x264_mb_predict_mv_16x16( h, 0, 0, mv ); +} + +static int x264_mb_predict_mv_direct16x16_temporal( x264_t *h ) +{ + int mb_x = h->mb.i_mb_x; + int mb_y = h->mb.i_mb_y; + int mb_xy = h->mb.i_mb_xy; + int type_col[2] = { h->fref[1][0]->mb_type[mb_xy], h->fref[1][0]->mb_type[mb_xy] }; + int partition_col[2] = { h->fref[1][0]->mb_partition[mb_xy], h->fref[1][0]->mb_partition[mb_xy] }; + int preshift = MB_INTERLACED; + int postshift = MB_INTERLACED; + int offset = 1; + int yshift = 1; + h->mb.i_partition = partition_col[0]; + if( PARAM_INTERLACED && h->fref[1][0]->field[mb_xy] != MB_INTERLACED ) + { + if( MB_INTERLACED ) + { + mb_y = h->mb.i_mb_y&~1; + mb_xy = mb_x + h->mb.i_mb_stride * mb_y; + type_col[0] = h->fref[1][0]->mb_type[mb_xy]; + type_col[1] = h->fref[1][0]->mb_type[mb_xy + h->mb.i_mb_stride]; + partition_col[0] = h->fref[1][0]->mb_partition[mb_xy]; + partition_col[1] = h->fref[1][0]->mb_partition[mb_xy + h->mb.i_mb_stride]; + preshift = 0; + yshift = 0; + + if( (IS_INTRA(type_col[0]) || partition_col[0] == D_16x16) && + (IS_INTRA(type_col[1]) || partition_col[1] == D_16x16) && + partition_col[0] != D_8x8 ) + h->mb.i_partition = D_16x8; + else + h->mb.i_partition = D_8x8; + } + else + { + int cur_poc = h->fdec->i_poc + h->fdec->i_delta_poc[MB_INTERLACED&h->mb.i_mb_y&1]; + int col_parity = abs(h->fref[1][0]->i_poc + h->fref[1][0]->i_delta_poc[0] - cur_poc) + >= abs(h->fref[1][0]->i_poc + h->fref[1][0]->i_delta_poc[1] - cur_poc); + mb_y = (h->mb.i_mb_y&~1) + col_parity; + mb_xy = mb_x + h->mb.i_mb_stride * mb_y; + type_col[0] = type_col[1] = h->fref[1][0]->mb_type[mb_xy]; + partition_col[0] = partition_col[1] = h->fref[1][0]->mb_partition[mb_xy]; + preshift = 1; + yshift = 2; + h->mb.i_partition = partition_col[0]; + } + offset = 0; + } + int i_mb_4x4 = 16 * h->mb.i_mb_stride * mb_y + 4 * mb_x; + int i_mb_8x8 = 4 * h->mb.i_mb_stride * mb_y + 2 * mb_x; + + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, 0 ); + + /* Don't do any checks other than the ones we have to, based + * on the size of the colocated partitions. + * Depends on the enum order: D_8x8, D_16x8, D_8x16, D_16x16 */ + int max_i8 = (D_16x16 - h->mb.i_partition) + 1; + int step = (h->mb.i_partition == D_16x8) + 1; + int width = 4 >> ((D_16x16 - h->mb.i_partition)&1); + int height = 4 >> ((D_16x16 - h->mb.i_partition)>>1); + for( int i8 = 0; i8 < max_i8; i8 += step ) + { + int x8 = i8&1; + int y8 = i8>>1; + int ypart = (SLICE_MBAFF && h->fref[1][0]->field[mb_xy] != MB_INTERLACED) ? + MB_INTERLACED ? y8*6 : 2*(h->mb.i_mb_y&1) + y8 : + 3*y8; + + if( IS_INTRA( type_col[y8] ) ) + { + x264_macroblock_cache_ref( h, 2*x8, 2*y8, width, height, 0, 0 ); + x264_macroblock_cache_mv( h, 2*x8, 2*y8, width, height, 0, 0 ); + x264_macroblock_cache_mv( h, 2*x8, 2*y8, width, height, 1, 0 ); + continue; + } + + int i_part_8x8 = i_mb_8x8 + x8 + (ypart>>1) * h->mb.i_b8_stride; + int i_ref1_ref = h->fref[1][0]->ref[0][i_part_8x8]; + int i_ref = (map_col_to_list0(i_ref1_ref>>preshift) << postshift) + (offset&i_ref1_ref&MB_INTERLACED); + + if( i_ref >= 0 ) + { + int dist_scale_factor = h->mb.dist_scale_factor[i_ref][0]; + int16_t *mv_col = h->fref[1][0]->mv[0][i_mb_4x4 + 3*x8 + ypart * h->mb.i_b4_stride]; + int16_t mv_y = (mv_col[1]<> 8; + int l0y = ( dist_scale_factor * mv_y + 128 ) >> 8; + if( h->param.i_threads > 1 && (l0y > h->mb.mv_max_spel[1] || l0y-mv_y > h->mb.mv_max_spel[1]) ) + return 0; + x264_macroblock_cache_ref( h, 2*x8, 2*y8, width, height, 0, i_ref ); + x264_macroblock_cache_mv( h, 2*x8, 2*y8, width, height, 0, pack16to32_mask(l0x, l0y) ); + x264_macroblock_cache_mv( h, 2*x8, 2*y8, width, height, 1, pack16to32_mask(l0x-mv_col[0], l0y-mv_y) ); + } + else + { + /* the collocated ref isn't in the current list0 */ + /* FIXME: we might still be able to use direct_8x8 on some partitions */ + /* FIXME: with B-pyramid + extensive ref list reordering + * (not currently used), we would also have to check + * l1mv1 like in spatial mode */ + return 0; + } + } + + return 1; +} + +static ALWAYS_INLINE int x264_mb_predict_mv_direct16x16_spatial( x264_t *h, int b_interlaced ) +{ + int8_t ref[2]; + ALIGNED_ARRAY_8( int16_t, mv,[2],[2] ); + for( int i_list = 0; i_list < 2; i_list++ ) + { + int i_refa = h->mb.cache.ref[i_list][X264_SCAN8_0 - 1]; + int16_t *mv_a = h->mb.cache.mv[i_list][X264_SCAN8_0 - 1]; + int i_refb = h->mb.cache.ref[i_list][X264_SCAN8_0 - 8]; + int16_t *mv_b = h->mb.cache.mv[i_list][X264_SCAN8_0 - 8]; + int i_refc = h->mb.cache.ref[i_list][X264_SCAN8_0 - 8 + 4]; + int16_t *mv_c = h->mb.cache.mv[i_list][X264_SCAN8_0 - 8 + 4]; + if( i_refc == -2 ) + { + i_refc = h->mb.cache.ref[i_list][X264_SCAN8_0 - 8 - 1]; + mv_c = h->mb.cache.mv[i_list][X264_SCAN8_0 - 8 - 1]; + } + + int i_ref = X264_MIN3( (unsigned)i_refa, (unsigned)i_refb, (unsigned)i_refc ); + if( i_ref < 0 ) + { + i_ref = -1; + M32( mv[i_list] ) = 0; + } + else + { + /* Same as x264_mb_predict_mv_16x16, but simplified to eliminate cases + * not relevant to spatial direct. */ + int i_count = (i_refa == i_ref) + (i_refb == i_ref) + (i_refc == i_ref); + + if( i_count > 1 ) + x264_median_mv( mv[i_list], mv_a, mv_b, mv_c ); + else + { + if( i_refa == i_ref ) + CP32( mv[i_list], mv_a ); + else if( i_refb == i_ref ) + CP32( mv[i_list], mv_b ); + else + CP32( mv[i_list], mv_c ); + } + } + + x264_macroblock_cache_ref( h, 0, 0, 4, 4, i_list, i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, i_list, mv[i_list] ); + ref[i_list] = i_ref; + } + + int mb_x = h->mb.i_mb_x; + int mb_y = h->mb.i_mb_y; + int mb_xy = h->mb.i_mb_xy; + int type_col[2] = { h->fref[1][0]->mb_type[mb_xy], h->fref[1][0]->mb_type[mb_xy] }; + int partition_col[2] = { h->fref[1][0]->mb_partition[mb_xy], h->fref[1][0]->mb_partition[mb_xy] }; + h->mb.i_partition = partition_col[0]; + if( b_interlaced && h->fref[1][0]->field[mb_xy] != MB_INTERLACED ) + { + if( MB_INTERLACED ) + { + mb_y = h->mb.i_mb_y&~1; + mb_xy = mb_x + h->mb.i_mb_stride * mb_y; + type_col[0] = h->fref[1][0]->mb_type[mb_xy]; + type_col[1] = h->fref[1][0]->mb_type[mb_xy + h->mb.i_mb_stride]; + partition_col[0] = h->fref[1][0]->mb_partition[mb_xy]; + partition_col[1] = h->fref[1][0]->mb_partition[mb_xy + h->mb.i_mb_stride]; + + if( (IS_INTRA(type_col[0]) || partition_col[0] == D_16x16) && + (IS_INTRA(type_col[1]) || partition_col[1] == D_16x16) && + partition_col[0] != D_8x8 ) + h->mb.i_partition = D_16x8; + else + h->mb.i_partition = D_8x8; + } + else + { + int cur_poc = h->fdec->i_poc + h->fdec->i_delta_poc[MB_INTERLACED&h->mb.i_mb_y&1]; + int col_parity = abs(h->fref[1][0]->i_poc + h->fref[1][0]->i_delta_poc[0] - cur_poc) + >= abs(h->fref[1][0]->i_poc + h->fref[1][0]->i_delta_poc[1] - cur_poc); + mb_y = (h->mb.i_mb_y&~1) + col_parity; + mb_xy = mb_x + h->mb.i_mb_stride * mb_y; + type_col[0] = type_col[1] = h->fref[1][0]->mb_type[mb_xy]; + partition_col[0] = partition_col[1] = h->fref[1][0]->mb_partition[mb_xy]; + h->mb.i_partition = partition_col[0]; + } + } + int i_mb_4x4 = b_interlaced ? 4 * (h->mb.i_b4_stride*mb_y + mb_x) : h->mb.i_b4_xy; + int i_mb_8x8 = b_interlaced ? 2 * (h->mb.i_b8_stride*mb_y + mb_x) : h->mb.i_b8_xy; + + int8_t *l1ref0 = &h->fref[1][0]->ref[0][i_mb_8x8]; + int8_t *l1ref1 = &h->fref[1][0]->ref[1][i_mb_8x8]; + int16_t (*l1mv[2])[2] = { (int16_t (*)[2]) &h->fref[1][0]->mv[0][i_mb_4x4], + (int16_t (*)[2]) &h->fref[1][0]->mv[1][i_mb_4x4] }; + + if( (M16( ref ) & 0x8080) == 0x8080 ) /* if( ref[0] < 0 && ref[1] < 0 ) */ + { + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, 0 ); + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, 0 ); + return 1; + } + + if( h->param.i_threads > 1 + && ( mv[0][1] > h->mb.mv_max_spel[1] + || mv[1][1] > h->mb.mv_max_spel[1] ) ) + { +#if 0 + fprintf(stderr, "direct_spatial: (%d,%d) (%d,%d) > %d \n", + mv[0][0], mv[0][1], mv[1][0], mv[1][1], + h->mb.mv_max_spel[1]); +#endif + return 0; + } + + if( !M64( mv ) || (!b_interlaced && IS_INTRA( type_col[0] )) || (ref[0]&&ref[1]) ) + return 1; + + /* Don't do any checks other than the ones we have to, based + * on the size of the colocated partitions. + * Depends on the enum order: D_8x8, D_16x8, D_8x16, D_16x16 */ + int max_i8 = (D_16x16 - h->mb.i_partition) + 1; + int step = (h->mb.i_partition == D_16x8) + 1; + int width = 4 >> ((D_16x16 - h->mb.i_partition)&1); + int height = 4 >> ((D_16x16 - h->mb.i_partition)>>1); + + /* col_zero_flag */ + for( int i8 = 0; i8 < max_i8; i8 += step ) + { + const int x8 = i8&1; + const int y8 = i8>>1; + int ypart = (b_interlaced && h->fref[1][0]->field[mb_xy] != MB_INTERLACED) ? + MB_INTERLACED ? y8*6 : 2*(h->mb.i_mb_y&1) + y8 : + 3*y8; + int o8 = x8 + (ypart>>1) * h->mb.i_b8_stride; + int o4 = 3*x8 + ypart * h->mb.i_b4_stride; + + if( b_interlaced && IS_INTRA( type_col[y8] ) ) + continue; + + int idx; + if( l1ref0[o8] == 0 ) + idx = 0; + else if( l1ref0[o8] < 0 && l1ref1[o8] == 0 ) + idx = 1; + else + continue; + + if( abs( l1mv[idx][o4][0] ) <= 1 && abs( l1mv[idx][o4][1] ) <= 1 ) + { + if( ref[0] == 0 ) x264_macroblock_cache_mv( h, 2*x8, 2*y8, width, height, 0, 0 ); + if( ref[1] == 0 ) x264_macroblock_cache_mv( h, 2*x8, 2*y8, width, height, 1, 0 ); + } + } + + return 1; +} + + +static int x264_mb_predict_mv_direct16x16_spatial_interlaced( x264_t *h ) +{ + return x264_mb_predict_mv_direct16x16_spatial( h, 1 ); +} + +static int x264_mb_predict_mv_direct16x16_spatial_progressive( x264_t *h ) +{ + return x264_mb_predict_mv_direct16x16_spatial( h, 0 ); +} + +int x264_mb_predict_mv_direct16x16( x264_t *h, int *b_changed ) +{ + int b_available; + if( h->param.analyse.i_direct_mv_pred == X264_DIRECT_PRED_NONE ) + return 0; + else if( h->sh.b_direct_spatial_mv_pred ) + { + if( SLICE_MBAFF ) + b_available = x264_mb_predict_mv_direct16x16_spatial_interlaced( h ); + else + b_available = x264_mb_predict_mv_direct16x16_spatial_progressive( h ); + } + else + b_available = x264_mb_predict_mv_direct16x16_temporal( h ); + + if( b_changed != NULL && b_available ) + { + int changed; + + changed = M32( h->mb.cache.direct_mv[0][0] ) ^ M32( h->mb.cache.mv[0][x264_scan8[0]] ); + changed |= M32( h->mb.cache.direct_mv[1][0] ) ^ M32( h->mb.cache.mv[1][x264_scan8[0]] ); + changed |= h->mb.cache.direct_ref[0][0] ^ h->mb.cache.ref[0][x264_scan8[0]]; + changed |= h->mb.cache.direct_ref[1][0] ^ h->mb.cache.ref[1][x264_scan8[0]]; + if( !changed && h->mb.i_partition != D_16x16 ) + { + changed |= M32( h->mb.cache.direct_mv[0][3] ) ^ M32( h->mb.cache.mv[0][x264_scan8[12]] ); + changed |= M32( h->mb.cache.direct_mv[1][3] ) ^ M32( h->mb.cache.mv[1][x264_scan8[12]] ); + changed |= h->mb.cache.direct_ref[0][3] ^ h->mb.cache.ref[0][x264_scan8[12]]; + changed |= h->mb.cache.direct_ref[1][3] ^ h->mb.cache.ref[1][x264_scan8[12]]; + } + if( !changed && h->mb.i_partition == D_8x8 ) + { + changed |= M32( h->mb.cache.direct_mv[0][1] ) ^ M32( h->mb.cache.mv[0][x264_scan8[4]] ); + changed |= M32( h->mb.cache.direct_mv[1][1] ) ^ M32( h->mb.cache.mv[1][x264_scan8[4]] ); + changed |= M32( h->mb.cache.direct_mv[0][2] ) ^ M32( h->mb.cache.mv[0][x264_scan8[8]] ); + changed |= M32( h->mb.cache.direct_mv[1][2] ) ^ M32( h->mb.cache.mv[1][x264_scan8[8]] ); + changed |= h->mb.cache.direct_ref[0][1] ^ h->mb.cache.ref[0][x264_scan8[4]]; + changed |= h->mb.cache.direct_ref[1][1] ^ h->mb.cache.ref[1][x264_scan8[4]]; + changed |= h->mb.cache.direct_ref[0][2] ^ h->mb.cache.ref[0][x264_scan8[8]]; + changed |= h->mb.cache.direct_ref[1][2] ^ h->mb.cache.ref[1][x264_scan8[8]]; + } + *b_changed = changed; + if( !changed ) + return b_available; + } + + /* cache ref & mv */ + if( b_available ) + for( int l = 0; l < 2; l++ ) + { + CP32( h->mb.cache.direct_mv[l][0], h->mb.cache.mv[l][x264_scan8[ 0]] ); + CP32( h->mb.cache.direct_mv[l][1], h->mb.cache.mv[l][x264_scan8[ 4]] ); + CP32( h->mb.cache.direct_mv[l][2], h->mb.cache.mv[l][x264_scan8[ 8]] ); + CP32( h->mb.cache.direct_mv[l][3], h->mb.cache.mv[l][x264_scan8[12]] ); + h->mb.cache.direct_ref[l][0] = h->mb.cache.ref[l][x264_scan8[ 0]]; + h->mb.cache.direct_ref[l][1] = h->mb.cache.ref[l][x264_scan8[ 4]]; + h->mb.cache.direct_ref[l][2] = h->mb.cache.ref[l][x264_scan8[ 8]]; + h->mb.cache.direct_ref[l][3] = h->mb.cache.ref[l][x264_scan8[12]]; + h->mb.cache.direct_partition = h->mb.i_partition; + } + + return b_available; +} + +/* This just improves encoder performance, it's not part of the spec */ +void x264_mb_predict_mv_ref16x16( x264_t *h, int i_list, int i_ref, int16_t mvc[9][2], int *i_mvc ) +{ + int16_t (*mvr)[2] = h->mb.mvr[i_list][i_ref]; + int i = 0; + +#define SET_MVP(mvp) \ + { \ + CP32( mvc[i], mvp ); \ + i++; \ + } + +#define SET_IMVP(xy) \ + if( xy >= 0 ) \ + { \ + int shift = 1 + MB_INTERLACED - h->mb.field[xy]; \ + int16_t *mvp = h->mb.mvr[i_list][i_ref<<1>>shift][xy]; \ + mvc[i][0] = mvp[0]; \ + mvc[i][1] = mvp[1]<<1>>shift; \ + i++; \ + } + + /* b_direct */ + if( h->sh.i_type == SLICE_TYPE_B + && h->mb.cache.ref[i_list][x264_scan8[12]] == i_ref ) + { + SET_MVP( h->mb.cache.mv[i_list][x264_scan8[12]] ); + } + + if( i_ref == 0 && h->frames.b_have_lowres ) + { + int idx = i_list ? h->fref[1][0]->i_frame-h->fenc->i_frame-1 + : h->fenc->i_frame-h->fref[0][0]->i_frame-1; + if( idx <= h->param.i_bframe ) + { + int16_t (*lowres_mv)[2] = h->fenc->lowres_mvs[i_list][idx]; + if( lowres_mv[0][0] != 0x7fff ) + { + M32( mvc[i] ) = (M32( lowres_mv[h->mb.i_mb_xy] )*2)&0xfffeffff; + i++; + } + } + } + + /* spatial predictors */ + if( SLICE_MBAFF ) + { + SET_IMVP( h->mb.i_mb_left_xy[0] ); + SET_IMVP( h->mb.i_mb_top_xy ); + SET_IMVP( h->mb.i_mb_topleft_xy ); + SET_IMVP( h->mb.i_mb_topright_xy ); + } + else + { + SET_MVP( mvr[h->mb.i_mb_left_xy[0]] ); + SET_MVP( mvr[h->mb.i_mb_top_xy] ); + SET_MVP( mvr[h->mb.i_mb_topleft_xy] ); + SET_MVP( mvr[h->mb.i_mb_topright_xy] ); + } +#undef SET_IMVP +#undef SET_MVP + + /* temporal predictors */ + if( h->fref[0][0]->i_ref[0] > 0 ) + { + x264_frame_t *l0 = h->fref[0][0]; + int field = h->mb.i_mb_y&1; + int curpoc = h->fdec->i_poc + h->fdec->i_delta_poc[field]; + int refpoc = h->fref[i_list][i_ref>>SLICE_MBAFF]->i_poc; + refpoc += l0->i_delta_poc[field^(i_ref&1)]; + +#define SET_TMVP( dx, dy ) \ + { \ + int mb_index = h->mb.i_mb_xy + dx + dy*h->mb.i_mb_stride; \ + int scale = (curpoc - refpoc) * l0->inv_ref_poc[MB_INTERLACED&field]; \ + mvc[i][0] = (l0->mv16x16[mb_index][0]*scale + 128) >> 8; \ + mvc[i][1] = (l0->mv16x16[mb_index][1]*scale + 128) >> 8; \ + i++; \ + } + + SET_TMVP(0,0); + if( h->mb.i_mb_x < h->mb.i_mb_width-1 ) + SET_TMVP(1,0); + if( h->mb.i_mb_y < h->mb.i_mb_height-1 ) + SET_TMVP(0,1); +#undef SET_TMVP + } + + *i_mvc = i; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.c new file mode 100644 index 00000000..7f26ed98 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.c @@ -0,0 +1,719 @@ +/***************************************************************************** + * opencl.c: OpenCL initialization and kernel compilation + ***************************************************************************** + * Copyright (C) 2012-2017 x264 project + * + * Authors: Steve Borho + * Anton Mitrofanov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#ifdef _WIN32 +#include +#define ocl_open LoadLibraryW( L"OpenCL" ) +#define ocl_close FreeLibrary +#define ocl_address GetProcAddress +#else +#include //dlopen, dlsym, dlclose +#if SYS_MACOSX +#define ocl_open dlopen( "/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW ) +#else +#define ocl_open dlopen( "libOpenCL.so", RTLD_NOW ) +#endif +#define ocl_close dlclose +#define ocl_address dlsym +#endif + +#define LOAD_OCL_FUNC(name, continue_on_fail)\ +{\ + ocl->name = (void*)ocl_address( ocl->library, #name );\ + if( !continue_on_fail && !ocl->name )\ + goto fail;\ +} + +/* load the library and functions we require from it */ +x264_opencl_function_t *x264_opencl_load_library( void ) +{ + x264_opencl_function_t *ocl; +#undef fail +#define fail fail0 + CHECKED_MALLOCZERO( ocl, sizeof(x264_opencl_function_t) ); +#undef fail +#define fail fail1 + ocl->library = ocl_open; + if( !ocl->library ) + goto fail; +#undef fail +#define fail fail2 + LOAD_OCL_FUNC( clBuildProgram, 0 ); + LOAD_OCL_FUNC( clCreateBuffer, 0 ); + LOAD_OCL_FUNC( clCreateCommandQueue, 0 ); + LOAD_OCL_FUNC( clCreateContext, 0 ); + LOAD_OCL_FUNC( clCreateImage2D, 0 ); + LOAD_OCL_FUNC( clCreateKernel, 0 ); + LOAD_OCL_FUNC( clCreateProgramWithBinary, 0 ); + LOAD_OCL_FUNC( clCreateProgramWithSource, 0 ); + LOAD_OCL_FUNC( clEnqueueCopyBuffer, 0 ); + LOAD_OCL_FUNC( clEnqueueMapBuffer, 0 ); + LOAD_OCL_FUNC( clEnqueueNDRangeKernel, 0 ); + LOAD_OCL_FUNC( clEnqueueReadBuffer, 0 ); + LOAD_OCL_FUNC( clEnqueueWriteBuffer, 0 ); + LOAD_OCL_FUNC( clFinish, 0 ); + LOAD_OCL_FUNC( clGetCommandQueueInfo, 0 ); + LOAD_OCL_FUNC( clGetDeviceIDs, 0 ); + LOAD_OCL_FUNC( clGetDeviceInfo, 0 ); + LOAD_OCL_FUNC( clGetKernelWorkGroupInfo, 0 ); + LOAD_OCL_FUNC( clGetPlatformIDs, 0 ); + LOAD_OCL_FUNC( clGetProgramBuildInfo, 0 ); + LOAD_OCL_FUNC( clGetProgramInfo, 0 ); + LOAD_OCL_FUNC( clGetSupportedImageFormats, 0 ); + LOAD_OCL_FUNC( clReleaseCommandQueue, 0 ); + LOAD_OCL_FUNC( clReleaseContext, 0 ); + LOAD_OCL_FUNC( clReleaseKernel, 0 ); + LOAD_OCL_FUNC( clReleaseMemObject, 0 ); + LOAD_OCL_FUNC( clReleaseProgram, 0 ); + LOAD_OCL_FUNC( clSetKernelArg, 0 ); + return ocl; +#undef fail +fail2: + ocl_close( ocl->library ); +fail1: + x264_free( ocl ); +fail0: + return NULL; +} + +void x264_opencl_close_library( x264_opencl_function_t *ocl ) +{ + if( !ocl ) + return; + ocl_close( ocl->library ); + x264_free( ocl ); +} + +/* define from recent cl_ext.h, copied here in case headers are old */ +#define CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD 0x4042 + +/* Requires full include path in case of out-of-tree builds */ +#include "common/oclobj.h" + +static int x264_detect_switchable_graphics( void ); + +/* Try to load the cached compiled program binary, verify the device context is + * still valid before reuse */ +static cl_program x264_opencl_cache_load( x264_t *h, const char *dev_name, const char *dev_vendor, const char *driver_version ) +{ + /* try to load cached program binary */ + FILE *fp = x264_fopen( h->param.psz_clbin_file, "rb" ); + if( !fp ) + return NULL; + + x264_opencl_function_t *ocl = h->opencl.ocl; + cl_program program = NULL; + uint8_t *binary = NULL; + + fseek( fp, 0, SEEK_END ); + size_t size = ftell( fp ); + rewind( fp ); + CHECKED_MALLOC( binary, size ); + + if( fread( binary, 1, size, fp ) != size ) + goto fail; + const uint8_t *ptr = (const uint8_t*)binary; + +#define CHECK_STRING( STR )\ + do {\ + size_t len = strlen( STR );\ + if( size <= len || strncmp( (char*)ptr, STR, len ) )\ + goto fail;\ + else {\ + size -= (len+1); ptr += (len+1);\ + }\ + } while( 0 ) + + CHECK_STRING( dev_name ); + CHECK_STRING( dev_vendor ); + CHECK_STRING( driver_version ); + CHECK_STRING( x264_opencl_source_hash ); +#undef CHECK_STRING + + cl_int status; + program = ocl->clCreateProgramWithBinary( h->opencl.context, 1, &h->opencl.device, &size, &ptr, NULL, &status ); + if( status != CL_SUCCESS ) + program = NULL; + +fail: + fclose( fp ); + x264_free( binary ); + return program; +} + +/* Save the compiled program binary to a file for later reuse. Device context + * is also saved in the cache file so we do not reuse stale binaries */ +static void x264_opencl_cache_save( x264_t *h, cl_program program, const char *dev_name, const char *dev_vendor, const char *driver_version ) +{ + FILE *fp = x264_fopen( h->param.psz_clbin_file, "wb" ); + if( !fp ) + { + x264_log( h, X264_LOG_INFO, "OpenCL: unable to open clbin file for write\n" ); + return; + } + + x264_opencl_function_t *ocl = h->opencl.ocl; + uint8_t *binary = NULL; + + size_t size = 0; + cl_int status = ocl->clGetProgramInfo( program, CL_PROGRAM_BINARY_SIZES, sizeof(size_t), &size, NULL ); + if( status != CL_SUCCESS || !size ) + { + x264_log( h, X264_LOG_INFO, "OpenCL: Unable to query program binary size, no cache file generated\n" ); + goto fail; + } + + CHECKED_MALLOC( binary, size ); + status = ocl->clGetProgramInfo( program, CL_PROGRAM_BINARIES, sizeof(uint8_t *), &binary, NULL ); + if( status != CL_SUCCESS ) + { + x264_log( h, X264_LOG_INFO, "OpenCL: Unable to query program binary, no cache file generated\n" ); + goto fail; + } + + fputs( dev_name, fp ); + fputc( '\n', fp ); + fputs( dev_vendor, fp ); + fputc( '\n', fp ); + fputs( driver_version, fp ); + fputc( '\n', fp ); + fputs( x264_opencl_source_hash, fp ); + fputc( '\n', fp ); + fwrite( binary, 1, size, fp ); + +fail: + fclose( fp ); + x264_free( binary ); + return; +} + +/* The OpenCL source under common/opencl will be merged into common/oclobj.h by + * the Makefile. It defines a x264_opencl_source byte array which we will pass + * to clCreateProgramWithSource(). We also attempt to use a cache file for the + * compiled binary, stored in the current working folder. */ +static cl_program x264_opencl_compile( x264_t *h ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + cl_program program = NULL; + char *build_log = NULL; + + char dev_name[64]; + char dev_vendor[64]; + char driver_version[64]; + cl_int status; + status = ocl->clGetDeviceInfo( h->opencl.device, CL_DEVICE_NAME, sizeof(dev_name), dev_name, NULL ); + status |= ocl->clGetDeviceInfo( h->opencl.device, CL_DEVICE_VENDOR, sizeof(dev_vendor), dev_vendor, NULL ); + status |= ocl->clGetDeviceInfo( h->opencl.device, CL_DRIVER_VERSION, sizeof(driver_version), driver_version, NULL ); + if( status != CL_SUCCESS ) + return NULL; + + // Most AMD GPUs have vector registers + int vectorize = !strcmp( dev_vendor, "Advanced Micro Devices, Inc." ); + h->opencl.b_device_AMD_SI = 0; + + if( vectorize ) + { + /* Disable OpenCL on Intel/AMD switchable graphics devices */ + if( x264_detect_switchable_graphics() ) + { + x264_log( h, X264_LOG_INFO, "OpenCL acceleration disabled, switchable graphics detected\n" ); + return NULL; + } + + /* Detect AMD SouthernIsland or newer device (single-width registers) */ + cl_uint simdwidth = 4; + status = ocl->clGetDeviceInfo( h->opencl.device, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, sizeof(cl_uint), &simdwidth, NULL ); + if( status == CL_SUCCESS && simdwidth == 1 ) + { + vectorize = 0; + h->opencl.b_device_AMD_SI = 1; + } + } + + x264_log( h, X264_LOG_INFO, "OpenCL acceleration enabled with %s %s %s\n", dev_vendor, dev_name, h->opencl.b_device_AMD_SI ? "(SI)" : "" ); + + program = x264_opencl_cache_load( h, dev_name, dev_vendor, driver_version ); + if( !program ) + { + /* clCreateProgramWithSource() requires a pointer variable, you cannot just use &x264_opencl_source */ + x264_log( h, X264_LOG_INFO, "Compiling OpenCL kernels...\n" ); + const char *strptr = (const char*)x264_opencl_source; + size_t size = sizeof(x264_opencl_source); + program = ocl->clCreateProgramWithSource( h->opencl.context, 1, &strptr, &size, &status ); + if( status != CL_SUCCESS || !program ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: unable to create program\n" ); + return NULL; + } + } + + /* Build the program binary for the OpenCL device */ + const char *buildopts = vectorize ? "-DVECTORIZE=1" : ""; + status = ocl->clBuildProgram( program, 1, &h->opencl.device, buildopts, NULL, NULL ); + if( status == CL_SUCCESS ) + { + x264_opencl_cache_save( h, program, dev_name, dev_vendor, driver_version ); + return program; + } + + /* Compile failure, should not happen with production code. */ + + size_t build_log_len = 0; + status = ocl->clGetProgramBuildInfo( program, h->opencl.device, CL_PROGRAM_BUILD_LOG, 0, NULL, &build_log_len ); + if( status != CL_SUCCESS || !build_log_len ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Compilation failed, unable to query build log\n" ); + goto fail; + } + + build_log = x264_malloc( build_log_len ); + if( !build_log ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Compilation failed, unable to alloc build log\n" ); + goto fail; + } + + status = ocl->clGetProgramBuildInfo( program, h->opencl.device, CL_PROGRAM_BUILD_LOG, build_log_len, build_log, NULL ); + if( status != CL_SUCCESS ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Compilation failed, unable to get build log\n" ); + goto fail; + } + + FILE *log_file = x264_fopen( "x264_kernel_build_log.txt", "w" ); + if( !log_file ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Compilation failed, unable to create file x264_kernel_build_log.txt\n" ); + goto fail; + } + fwrite( build_log, 1, build_log_len, log_file ); + fclose( log_file ); + x264_log( h, X264_LOG_WARNING, "OpenCL: kernel build errors written to x264_kernel_build_log.txt\n" ); + +fail: + x264_free( build_log ); + if( program ) + ocl->clReleaseProgram( program ); + return NULL; +} + +static int x264_opencl_lookahead_alloc( x264_t *h ) +{ + if( !h->param.rc.i_lookahead ) + return -1; + + static const char *kernelnames[] = { + "mb_intra_cost_satd_8x8", + "sum_intra_cost", + "downscale_hpel", + "downscale1", + "downscale2", + "memset_int16", + "weightp_scaled_images", + "weightp_hpel", + "hierarchical_motion", + "subpel_refine", + "mode_selection", + "sum_inter_cost" + }; + + cl_kernel *kernels[] = { + &h->opencl.intra_kernel, + &h->opencl.rowsum_intra_kernel, + &h->opencl.downscale_hpel_kernel, + &h->opencl.downscale_kernel1, + &h->opencl.downscale_kernel2, + &h->opencl.memset_kernel, + &h->opencl.weightp_scaled_images_kernel, + &h->opencl.weightp_hpel_kernel, + &h->opencl.hme_kernel, + &h->opencl.subpel_refine_kernel, + &h->opencl.mode_select_kernel, + &h->opencl.rowsum_inter_kernel + }; + + x264_opencl_function_t *ocl = h->opencl.ocl; + cl_int status; + + h->opencl.lookahead_program = x264_opencl_compile( h ); + if( !h->opencl.lookahead_program ) + goto fail; + + for( int i = 0; i < ARRAY_SIZE(kernelnames); i++ ) + { + *kernels[i] = ocl->clCreateKernel( h->opencl.lookahead_program, kernelnames[i], &status ); + if( status != CL_SUCCESS ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to compile kernel '%s' (%d)\n", kernelnames[i], status ); + goto fail; + } + } + + h->opencl.page_locked_buffer = ocl->clCreateBuffer( h->opencl.context, CL_MEM_WRITE_ONLY|CL_MEM_ALLOC_HOST_PTR, PAGE_LOCKED_BUF_SIZE, NULL, &status ); + if( status != CL_SUCCESS ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to allocate page-locked buffer, error '%d'\n", status ); + goto fail; + } + h->opencl.page_locked_ptr = ocl->clEnqueueMapBuffer( h->opencl.queue, h->opencl.page_locked_buffer, CL_TRUE, CL_MAP_READ | CL_MAP_WRITE, + 0, PAGE_LOCKED_BUF_SIZE, 0, NULL, NULL, &status ); + if( status != CL_SUCCESS ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to map page-locked buffer, error '%d'\n", status ); + goto fail; + } + + return 0; +fail: + x264_opencl_lookahead_delete( h ); + return -1; +} + +static void CL_CALLBACK x264_opencl_error_notify( const char *errinfo, const void *private_info, size_t cb, void *user_data ) +{ + /* Any error notification can be assumed to be fatal to the OpenCL context. + * We need to stop using it immediately to prevent further damage. */ + x264_t *h = (x264_t*)user_data; + h->param.b_opencl = 0; + h->opencl.b_fatal_error = 1; + x264_log( h, X264_LOG_ERROR, "OpenCL: %s\n", errinfo ); + x264_log( h, X264_LOG_ERROR, "OpenCL: fatal error, aborting encode\n" ); +} + +int x264_opencl_lookahead_init( x264_t *h ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + cl_platform_id *platforms = NULL; + cl_device_id *devices = NULL; + cl_image_format *imageType = NULL; + cl_context context = NULL; + int ret = -1; + + cl_uint numPlatforms = 0; + cl_int status = ocl->clGetPlatformIDs( 0, NULL, &numPlatforms ); + if( status != CL_SUCCESS || !numPlatforms ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to query installed platforms\n" ); + goto fail; + } + platforms = (cl_platform_id*)x264_malloc( sizeof(cl_platform_id) * numPlatforms ); + if( !platforms ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: malloc of installed platforms buffer failed\n" ); + goto fail; + } + status = ocl->clGetPlatformIDs( numPlatforms, platforms, NULL ); + if( status != CL_SUCCESS ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to query installed platforms\n" ); + goto fail; + } + + /* Select the first OpenCL platform with a GPU device that supports our + * required image (texture) formats */ + for( cl_uint i = 0; i < numPlatforms; i++ ) + { + cl_uint gpu_count = 0; + status = ocl->clGetDeviceIDs( platforms[i], CL_DEVICE_TYPE_GPU, 0, NULL, &gpu_count ); + if( status != CL_SUCCESS || !gpu_count ) + continue; + + x264_free( devices ); + devices = x264_malloc( sizeof(cl_device_id) * gpu_count ); + if( !devices ) + continue; + + status = ocl->clGetDeviceIDs( platforms[i], CL_DEVICE_TYPE_GPU, gpu_count, devices, NULL ); + if( status != CL_SUCCESS ) + continue; + + /* Find a GPU device that supports our image formats */ + for( cl_uint gpu = 0; gpu < gpu_count; gpu++ ) + { + h->opencl.device = devices[gpu]; + + /* if the user has specified an exact device ID, skip all other + * GPUs. If this device matches, allow it to continue through the + * checks for supported images, etc. */ + if( h->param.opencl_device_id && devices[gpu] != (cl_device_id)h->param.opencl_device_id ) + continue; + + cl_bool image_support = 0; + status = ocl->clGetDeviceInfo( h->opencl.device, CL_DEVICE_IMAGE_SUPPORT, sizeof(cl_bool), &image_support, NULL ); + if( status != CL_SUCCESS || !image_support ) + continue; + + if( context ) + ocl->clReleaseContext( context ); + context = ocl->clCreateContext( NULL, 1, &h->opencl.device, (void*)x264_opencl_error_notify, (void*)h, &status ); + if( status != CL_SUCCESS || !context ) + continue; + + cl_uint imagecount = 0; + status = ocl->clGetSupportedImageFormats( context, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, 0, NULL, &imagecount ); + if( status != CL_SUCCESS || !imagecount ) + continue; + + x264_free( imageType ); + imageType = x264_malloc( sizeof(cl_image_format) * imagecount ); + if( !imageType ) + continue; + + status = ocl->clGetSupportedImageFormats( context, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE2D, imagecount, imageType, NULL ); + if( status != CL_SUCCESS ) + continue; + + int b_has_r = 0; + int b_has_rgba = 0; + for( cl_uint j = 0; j < imagecount; j++ ) + { + if( imageType[j].image_channel_order == CL_R && + imageType[j].image_channel_data_type == CL_UNSIGNED_INT32 ) + b_has_r = 1; + else if( imageType[j].image_channel_order == CL_RGBA && + imageType[j].image_channel_data_type == CL_UNSIGNED_INT8 ) + b_has_rgba = 1; + } + if( !b_has_r || !b_has_rgba ) + { + char dev_name[64]; + status = ocl->clGetDeviceInfo( h->opencl.device, CL_DEVICE_NAME, sizeof(dev_name), dev_name, NULL ); + if( status == CL_SUCCESS ) + { + /* emit warning if we are discarding the user's explicit choice */ + int level = h->param.opencl_device_id ? X264_LOG_WARNING : X264_LOG_DEBUG; + x264_log( h, level, "OpenCL: %s does not support required image formats\n", dev_name ); + } + continue; + } + + /* user selection of GPU device, skip N first matches */ + if( h->param.i_opencl_device ) + { + h->param.i_opencl_device--; + continue; + } + + h->opencl.queue = ocl->clCreateCommandQueue( context, h->opencl.device, 0, &status ); + if( status != CL_SUCCESS || !h->opencl.queue ) + continue; + + h->opencl.context = context; + context = NULL; + + ret = 0; + break; + } + + if( !ret ) + break; + } + + if( !h->param.psz_clbin_file ) + h->param.psz_clbin_file = "x264_lookahead.clbin"; + + if( ret ) + x264_log( h, X264_LOG_WARNING, "OpenCL: Unable to find a compatible device\n" ); + else + ret = x264_opencl_lookahead_alloc( h ); + +fail: + if( context ) + ocl->clReleaseContext( context ); + x264_free( imageType ); + x264_free( devices ); + x264_free( platforms ); + return ret; +} + +static void x264_opencl_lookahead_free( x264_t *h ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + +#define RELEASE( a, f ) do { if( a ) { ocl->f( a ); a = NULL; } } while( 0 ) + RELEASE( h->opencl.downscale_hpel_kernel, clReleaseKernel ); + RELEASE( h->opencl.downscale_kernel1, clReleaseKernel ); + RELEASE( h->opencl.downscale_kernel2, clReleaseKernel ); + RELEASE( h->opencl.weightp_hpel_kernel, clReleaseKernel ); + RELEASE( h->opencl.weightp_scaled_images_kernel, clReleaseKernel ); + RELEASE( h->opencl.memset_kernel, clReleaseKernel ); + RELEASE( h->opencl.intra_kernel, clReleaseKernel ); + RELEASE( h->opencl.rowsum_intra_kernel, clReleaseKernel ); + RELEASE( h->opencl.hme_kernel, clReleaseKernel ); + RELEASE( h->opencl.subpel_refine_kernel, clReleaseKernel ); + RELEASE( h->opencl.mode_select_kernel, clReleaseKernel ); + RELEASE( h->opencl.rowsum_inter_kernel, clReleaseKernel ); + + RELEASE( h->opencl.lookahead_program, clReleaseProgram ); + + RELEASE( h->opencl.page_locked_buffer, clReleaseMemObject ); + RELEASE( h->opencl.luma_16x16_image[0], clReleaseMemObject ); + RELEASE( h->opencl.luma_16x16_image[1], clReleaseMemObject ); + for( int i = 0; i < NUM_IMAGE_SCALES; i++ ) + RELEASE( h->opencl.weighted_scaled_images[i], clReleaseMemObject ); + RELEASE( h->opencl.weighted_luma_hpel, clReleaseMemObject ); + RELEASE( h->opencl.row_satds[0], clReleaseMemObject ); + RELEASE( h->opencl.row_satds[1], clReleaseMemObject ); + RELEASE( h->opencl.mv_buffers[0], clReleaseMemObject ); + RELEASE( h->opencl.mv_buffers[1], clReleaseMemObject ); + RELEASE( h->opencl.lowres_mv_costs, clReleaseMemObject ); + RELEASE( h->opencl.mvp_buffer, clReleaseMemObject ); + RELEASE( h->opencl.lowres_costs[0], clReleaseMemObject ); + RELEASE( h->opencl.lowres_costs[1], clReleaseMemObject ); + RELEASE( h->opencl.frame_stats[0], clReleaseMemObject ); + RELEASE( h->opencl.frame_stats[1], clReleaseMemObject ); +#undef RELEASE +} + +void x264_opencl_lookahead_delete( x264_t *h ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + + if( !ocl ) + return; + + if( h->opencl.queue ) + ocl->clFinish( h->opencl.queue ); + + x264_opencl_lookahead_free( h ); + + if( h->opencl.queue ) + { + ocl->clReleaseCommandQueue( h->opencl.queue ); + h->opencl.queue = NULL; + } + if( h->opencl.context ) + { + ocl->clReleaseContext( h->opencl.context ); + h->opencl.context = NULL; + } +} + +void x264_opencl_frame_delete( x264_frame_t *frame ) +{ + x264_opencl_function_t *ocl = frame->opencl.ocl; + + if( !ocl ) + return; + +#define RELEASEBUF(mem) do { if( mem ) { ocl->clReleaseMemObject( mem ); mem = NULL; } } while( 0 ) + for( int j = 0; j < NUM_IMAGE_SCALES; j++ ) + RELEASEBUF( frame->opencl.scaled_image2Ds[j] ); + RELEASEBUF( frame->opencl.luma_hpel ); + RELEASEBUF( frame->opencl.inv_qscale_factor ); + RELEASEBUF( frame->opencl.intra_cost ); + RELEASEBUF( frame->opencl.lowres_mvs0 ); + RELEASEBUF( frame->opencl.lowres_mvs1 ); + RELEASEBUF( frame->opencl.lowres_mv_costs0 ); + RELEASEBUF( frame->opencl.lowres_mv_costs1 ); +#undef RELEASEBUF +} + +/* OpenCL misbehaves on hybrid laptops with Intel iGPU and AMD dGPU, so + * we consult AMD's ADL interface to detect this situation and disable + * OpenCL on these machines (Linux and Windows) */ +#ifdef _WIN32 +#define ADL_API_CALL +#define ADL_CALLBACK __stdcall +#define adl_close FreeLibrary +#define adl_address GetProcAddress +#else +#define ADL_API_CALL +#define ADL_CALLBACK +#define adl_close dlclose +#define adl_address dlsym +#endif + +typedef void* ( ADL_CALLBACK *ADL_MAIN_MALLOC_CALLBACK )( int ); +typedef int ( ADL_API_CALL *ADL_MAIN_CONTROL_CREATE )( ADL_MAIN_MALLOC_CALLBACK, int ); +typedef int ( ADL_API_CALL *ADL_ADAPTER_NUMBEROFADAPTERS_GET )( int * ); +typedef int ( ADL_API_CALL *ADL_POWERXPRESS_SCHEME_GET )( int, int *, int *, int * ); +typedef int ( ADL_API_CALL *ADL_MAIN_CONTROL_DESTROY )( void ); + +#define ADL_OK 0 +#define ADL_PX_SCHEME_DYNAMIC 2 + +static void* ADL_CALLBACK adl_malloc_wrapper( int iSize ) +{ + return x264_malloc( iSize ); +} + +static int x264_detect_switchable_graphics( void ) +{ + void *hDLL; + ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create; + ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get; + ADL_POWERXPRESS_SCHEME_GET ADL_PowerXpress_Scheme_Get; + ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy; + int ret = 0; + +#ifdef _WIN32 + hDLL = LoadLibraryW( L"atiadlxx.dll" ); + if( !hDLL ) + hDLL = LoadLibraryW( L"atiadlxy.dll" ); +#else + hDLL = dlopen( "libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL ); +#endif + if( !hDLL ) + goto fail0; + + ADL_Main_Control_Create = (ADL_MAIN_CONTROL_CREATE)adl_address(hDLL, "ADL_Main_Control_Create"); + ADL_Main_Control_Destroy = (ADL_MAIN_CONTROL_DESTROY)adl_address(hDLL, "ADL_Main_Control_Destroy"); + ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET)adl_address(hDLL, "ADL_Adapter_NumberOfAdapters_Get"); + ADL_PowerXpress_Scheme_Get = (ADL_POWERXPRESS_SCHEME_GET)adl_address(hDLL, "ADL_PowerXpress_Scheme_Get"); + if( !ADL_Main_Control_Create || !ADL_Main_Control_Destroy || !ADL_Adapter_NumberOfAdapters_Get || + !ADL_PowerXpress_Scheme_Get ) + goto fail1; + + if( ADL_OK != ADL_Main_Control_Create( adl_malloc_wrapper, 1 ) ) + goto fail1; + + int numAdapters = 0; + if( ADL_OK != ADL_Adapter_NumberOfAdapters_Get( &numAdapters ) ) + goto fail2; + + for( int i = 0; i < numAdapters; i++ ) + { + int PXSchemeRange, PXSchemeCurrentState, PXSchemeDefaultState; + if( ADL_OK != ADL_PowerXpress_Scheme_Get( i, &PXSchemeRange, &PXSchemeCurrentState, &PXSchemeDefaultState) ) + break; + + if( PXSchemeRange >= ADL_PX_SCHEME_DYNAMIC ) + { + ret = 1; + break; + } + } + +fail2: + ADL_Main_Control_Destroy(); +fail1: + adl_close( hDLL ); +fail0: + return ret; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.h new file mode 100644 index 00000000..9b0da8b7 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/opencl.h @@ -0,0 +1,804 @@ +/***************************************************************************** + * opencl.h: OpenCL structures and defines + ***************************************************************************** + * Copyright (C) 2012-2017 x264 project + * + * Authors: Steve Borho + * Anton Mitrofanov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_OPENCL_H +#define X264_OPENCL_H + +#define CL_USE_DEPRECATED_OPENCL_1_1_APIS +#include "extras/cl.h" + +#define OCL_API(ret, attr, name) typedef ret (attr *name##_func) + +/* Platform API */ +OCL_API(cl_int, CL_API_CALL, clGetPlatformIDs) +( cl_uint /* num_entries */, + cl_platform_id * /* platforms */, + cl_uint * /* num_platforms */); + +OCL_API(cl_int, CL_API_CALL, clGetPlatformInfo) +( cl_platform_id /* platform */, + cl_platform_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +/* Device APIs */ +OCL_API(cl_int, CL_API_CALL, clGetDeviceIDs) +( cl_platform_id /* platform */, + cl_device_type /* device_type */, + cl_uint /* num_entries */, + cl_device_id * /* devices */, + cl_uint * /* num_devices */); + +OCL_API(cl_int, CL_API_CALL, clGetDeviceInfo) +( cl_device_id /* device */, + cl_device_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +OCL_API(cl_int, CL_API_CALL, clCreateSubDevices) +( cl_device_id /* in_device */, + const cl_device_partition_property * /* properties */, + cl_uint /* num_devices */, + cl_device_id * /* out_devices */, + cl_uint * /* num_devices_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainDevice) +( cl_device_id /* device */); + +OCL_API(cl_int, CL_API_CALL, clReleaseDevice) +( cl_device_id /* device */); + +/* Context APIs */ +OCL_API(cl_context, CL_API_CALL, clCreateContext) +( const cl_context_properties * /* properties */, + cl_uint /* num_devices */, + const cl_device_id * /* devices */, + void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *), + void * /* user_data */, + cl_int * /* errcode_ret */); + +OCL_API(cl_context, CL_API_CALL, clCreateContextFromType) +( const cl_context_properties * /* properties */, + cl_device_type /* device_type */, + void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *), + void * /* user_data */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainContext) +( cl_context /* context */); + +OCL_API(cl_int, CL_API_CALL, clReleaseContext) +( cl_context /* context */); + +OCL_API(cl_int, CL_API_CALL, clGetContextInfo) +( cl_context /* context */, + cl_context_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +/* Command Queue APIs */ +OCL_API(cl_command_queue, CL_API_CALL, clCreateCommandQueue) +( cl_context /* context */, + cl_device_id /* device */, + cl_command_queue_properties /* properties */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainCommandQueue) +( cl_command_queue /* command_queue */); + +OCL_API(cl_int, CL_API_CALL, clReleaseCommandQueue) +( cl_command_queue /* command_queue */); + +OCL_API(cl_int, CL_API_CALL, clGetCommandQueueInfo) +( cl_command_queue /* command_queue */, + cl_command_queue_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +/* Memory Object APIs */ +OCL_API(cl_mem, CL_API_CALL, clCreateBuffer) +( cl_context /* context */, + cl_mem_flags /* flags */, + size_t /* size */, + void * /* host_ptr */, + cl_int * /* errcode_ret */); + +OCL_API(cl_mem, CL_API_CALL, clCreateSubBuffer) +( cl_mem /* buffer */, + cl_mem_flags /* flags */, + cl_buffer_create_type /* buffer_create_type */, + const void * /* buffer_create_info */, + cl_int * /* errcode_ret */); + +OCL_API(cl_mem, CL_API_CALL, clCreateImage) +( cl_context /* context */, + cl_mem_flags /* flags */, + const cl_image_format * /* image_format */, + const cl_image_desc * /* image_desc */, + void * /* host_ptr */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainMemObject) +( cl_mem /* memobj */); + +OCL_API(cl_int, CL_API_CALL, clReleaseMemObject) +( cl_mem /* memobj */); + +OCL_API(cl_int, CL_API_CALL, clGetSupportedImageFormats) +( cl_context /* context */, + cl_mem_flags /* flags */, + cl_mem_object_type /* image_type */, + cl_uint /* num_entries */, + cl_image_format * /* image_formats */, + cl_uint * /* num_image_formats */); + +OCL_API(cl_int, CL_API_CALL, clGetMemObjectInfo) +( cl_mem /* memobj */, + cl_mem_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +OCL_API(cl_int, CL_API_CALL, clGetImageInfo) +( cl_mem /* image */, + cl_image_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +OCL_API(cl_int, CL_API_CALL, clSetMemObjectDestructorCallback) +( cl_mem /* memobj */, + void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), + void * /*user_data */ ); + +/* Sampler APIs */ +OCL_API(cl_sampler, CL_API_CALL, clCreateSampler) +( cl_context /* context */, + cl_bool /* normalized_coords */, + cl_addressing_mode /* addressing_mode */, + cl_filter_mode /* filter_mode */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainSampler) +( cl_sampler /* sampler */); + +OCL_API(cl_int, CL_API_CALL, clReleaseSampler) +( cl_sampler /* sampler */); + +OCL_API(cl_int, CL_API_CALL, clGetSamplerInfo) +( cl_sampler /* sampler */, + cl_sampler_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +/* Program Object APIs */ +OCL_API(cl_program, CL_API_CALL, clCreateProgramWithSource) +( cl_context /* context */, + cl_uint /* count */, + const char ** /* strings */, + const size_t * /* lengths */, + cl_int * /* errcode_ret */); + +OCL_API(cl_program, CL_API_CALL, clCreateProgramWithBinary) +( cl_context /* context */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const size_t * /* lengths */, + const unsigned char ** /* binaries */, + cl_int * /* binary_status */, + cl_int * /* errcode_ret */); + +OCL_API(cl_program, CL_API_CALL, clCreateProgramWithBuiltInKernels) +( cl_context /* context */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const char * /* kernel_names */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainProgram) +( cl_program /* program */); + +OCL_API(cl_int, CL_API_CALL, clReleaseProgram) +( cl_program /* program */); + +OCL_API(cl_int, CL_API_CALL, clBuildProgram) +( cl_program /* program */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const char * /* options */, + void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), + void * /* user_data */); + +OCL_API(cl_int, CL_API_CALL, clCompileProgram) +( cl_program /* program */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const char * /* options */, + cl_uint /* num_input_headers */, + const cl_program * /* input_headers */, + const char ** /* header_include_names */, + void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), + void * /* user_data */); + +OCL_API(cl_program, CL_API_CALL, clLinkProgram) +( cl_context /* context */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const char * /* options */, + cl_uint /* num_input_programs */, + const cl_program * /* input_programs */, + void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), + void * /* user_data */, + cl_int * /* errcode_ret */ ); + + +OCL_API(cl_int, CL_API_CALL, clUnloadPlatformCompiler) +( cl_platform_id /* platform */); + +OCL_API(cl_int, CL_API_CALL, clGetProgramInfo) +( cl_program /* program */, + cl_program_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +OCL_API(cl_int, CL_API_CALL, clGetProgramBuildInfo) +( cl_program /* program */, + cl_device_id /* device */, + cl_program_build_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +/* Kernel Object APIs */ +OCL_API(cl_kernel, CL_API_CALL, clCreateKernel) +( cl_program /* program */, + const char * /* kernel_name */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clCreateKernelsInProgram) +( cl_program /* program */, + cl_uint /* num_kernels */, + cl_kernel * /* kernels */, + cl_uint * /* num_kernels_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainKernel) +( cl_kernel /* kernel */); + +OCL_API(cl_int, CL_API_CALL, clReleaseKernel) +( cl_kernel /* kernel */); + +OCL_API(cl_int, CL_API_CALL, clSetKernelArg) +( cl_kernel /* kernel */, + cl_uint /* arg_index */, + size_t /* arg_size */, + const void * /* arg_value */); + +OCL_API(cl_int, CL_API_CALL, clGetKernelInfo) +( cl_kernel /* kernel */, + cl_kernel_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +OCL_API(cl_int, CL_API_CALL, clGetKernelArgInfo) +( cl_kernel /* kernel */, + cl_uint /* arg_indx */, + cl_kernel_arg_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +OCL_API(cl_int, CL_API_CALL, clGetKernelWorkGroupInfo) +( cl_kernel /* kernel */, + cl_device_id /* device */, + cl_kernel_work_group_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +/* Event Object APIs */ +OCL_API(cl_int, CL_API_CALL, clWaitForEvents) +( cl_uint /* num_events */, + const cl_event * /* event_list */); + +OCL_API(cl_int, CL_API_CALL, clGetEventInfo) +( cl_event /* event */, + cl_event_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +OCL_API(cl_event, CL_API_CALL, clCreateUserEvent) +( cl_context /* context */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clRetainEvent) +( cl_event /* event */); + +OCL_API(cl_int, CL_API_CALL, clReleaseEvent) +( cl_event /* event */); + +OCL_API(cl_int, CL_API_CALL, clSetUserEventStatus) +( cl_event /* event */, + cl_int /* execution_status */); + +OCL_API(cl_int, CL_API_CALL, clSetEventCallback) +( cl_event /* event */, + cl_int /* command_exec_callback_type */, + void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *), + void * /* user_data */); + +/* Profiling APIs */ +OCL_API(cl_int, CL_API_CALL, clGetEventProfilingInfo) +( cl_event /* event */, + cl_profiling_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */); + +/* Flush and Finish APIs */ +OCL_API(cl_int, CL_API_CALL, clFlush) +( cl_command_queue /* command_queue */); + +OCL_API(cl_int, CL_API_CALL, clFinish) +( cl_command_queue /* command_queue */); + +/* Enqueued Commands APIs */ +OCL_API(cl_int, CL_API_CALL, clEnqueueReadBuffer) +( cl_command_queue /* command_queue */, + cl_mem /* buffer */, + cl_bool /* blocking_read */, + size_t /* offset */, + size_t /* size */, + void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueReadBufferRect) +( cl_command_queue /* command_queue */, + cl_mem /* buffer */, + cl_bool /* blocking_read */, + const size_t * /* buffer_offset */, + const size_t * /* host_offset */, + const size_t * /* region */, + size_t /* buffer_row_pitch */, + size_t /* buffer_slice_pitch */, + size_t /* host_row_pitch */, + size_t /* host_slice_pitch */, + void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueWriteBuffer) +( cl_command_queue /* command_queue */, + cl_mem /* buffer */, + cl_bool /* blocking_write */, + size_t /* offset */, + size_t /* size */, + const void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueWriteBufferRect) +( cl_command_queue /* command_queue */, + cl_mem /* buffer */, + cl_bool /* blocking_write */, + const size_t * /* buffer_offset */, + const size_t * /* host_offset */, + const size_t * /* region */, + size_t /* buffer_row_pitch */, + size_t /* buffer_slice_pitch */, + size_t /* host_row_pitch */, + size_t /* host_slice_pitch */, + const void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueFillBuffer) +( cl_command_queue /* command_queue */, + cl_mem /* buffer */, + const void * /* pattern */, + size_t /* pattern_size */, + size_t /* offset */, + size_t /* size */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueCopyBuffer) +( cl_command_queue /* command_queue */, + cl_mem /* src_buffer */, + cl_mem /* dst_buffer */, + size_t /* src_offset */, + size_t /* dst_offset */, + size_t /* size */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueCopyBufferRect) +( cl_command_queue /* command_queue */, + cl_mem /* src_buffer */, + cl_mem /* dst_buffer */, + const size_t * /* src_origin */, + const size_t * /* dst_origin */, + const size_t * /* region */, + size_t /* src_row_pitch */, + size_t /* src_slice_pitch */, + size_t /* dst_row_pitch */, + size_t /* dst_slice_pitch */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueReadImage) +( cl_command_queue /* command_queue */, + cl_mem /* image */, + cl_bool /* blocking_read */, + const size_t * /* origin[3] */, + const size_t * /* region[3] */, + size_t /* row_pitch */, + size_t /* slice_pitch */, + void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueWriteImage) +( cl_command_queue /* command_queue */, + cl_mem /* image */, + cl_bool /* blocking_write */, + const size_t * /* origin[3] */, + const size_t * /* region[3] */, + size_t /* input_row_pitch */, + size_t /* input_slice_pitch */, + const void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueFillImage) +( cl_command_queue /* command_queue */, + cl_mem /* image */, + const void * /* fill_color */, + const size_t * /* origin[3] */, + const size_t * /* region[3] */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueCopyImage) +( cl_command_queue /* command_queue */, + cl_mem /* src_image */, + cl_mem /* dst_image */, + const size_t * /* src_origin[3] */, + const size_t * /* dst_origin[3] */, + const size_t * /* region[3] */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueCopyImageToBuffer) +( cl_command_queue /* command_queue */, + cl_mem /* src_image */, + cl_mem /* dst_buffer */, + const size_t * /* src_origin[3] */, + const size_t * /* region[3] */, + size_t /* dst_offset */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueCopyBufferToImage) +( cl_command_queue /* command_queue */, + cl_mem /* src_buffer */, + cl_mem /* dst_image */, + size_t /* src_offset */, + const size_t * /* dst_origin[3] */, + const size_t * /* region[3] */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(void *, CL_API_CALL, clEnqueueMapBuffer) +( cl_command_queue /* command_queue */, + cl_mem /* buffer */, + cl_bool /* blocking_map */, + cl_map_flags /* map_flags */, + size_t /* offset */, + size_t /* size */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */, + cl_int * /* errcode_ret */); + +OCL_API(void *, CL_API_CALL, clEnqueueMapImage) +( cl_command_queue /* command_queue */, + cl_mem /* image */, + cl_bool /* blocking_map */, + cl_map_flags /* map_flags */, + const size_t * /* origin[3] */, + const size_t * /* region[3] */, + size_t * /* image_row_pitch */, + size_t * /* image_slice_pitch */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueUnmapMemObject) +( cl_command_queue /* command_queue */, + cl_mem /* memobj */, + void * /* mapped_ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueMigrateMemObjects) +( cl_command_queue /* command_queue */, + cl_uint /* num_mem_objects */, + const cl_mem * /* mem_objects */, + cl_mem_migration_flags /* flags */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueNDRangeKernel) +( cl_command_queue /* command_queue */, + cl_kernel /* kernel */, + cl_uint /* work_dim */, + const size_t * /* global_work_offset */, + const size_t * /* global_work_size */, + const size_t * /* local_work_size */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueTask) +( cl_command_queue /* command_queue */, + cl_kernel /* kernel */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueNativeKernel) +( cl_command_queue /* command_queue */, + void (CL_CALLBACK * /*user_func*/)(void *), + void * /* args */, + size_t /* cb_args */, + cl_uint /* num_mem_objects */, + const cl_mem * /* mem_list */, + const void ** /* args_mem_loc */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueMarkerWithWaitList) +( cl_command_queue /* command_queue */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueBarrierWithWaitList) +( cl_command_queue /* command_queue */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */); + + +/* Extension function access +* +* Returns the extension function address for the given function name, +* or NULL if a valid function can not be found. The client must +* check to make sure the address is not NULL, before using or +* calling the returned function address. +*/ +OCL_API(void *, CL_API_CALL, clGetExtensionFunctionAddressForPlatform) +( cl_platform_id /* platform */, + const char * /* func_name */); + + +// Deprecated OpenCL 1.1 APIs +OCL_API(cl_mem, CL_API_CALL, clCreateImage2D) +( cl_context /* context */, + cl_mem_flags /* flags */, + const cl_image_format * /* image_format */, + size_t /* image_width */, + size_t /* image_height */, + size_t /* image_row_pitch */, + void * /* host_ptr */, + cl_int * /* errcode_ret */); + +OCL_API(cl_mem, CL_API_CALL, clCreateImage3D) +( cl_context /* context */, + cl_mem_flags /* flags */, + const cl_image_format * /* image_format */, + size_t /* image_width */, + size_t /* image_height */, + size_t /* image_depth */, + size_t /* image_row_pitch */, + size_t /* image_slice_pitch */, + void * /* host_ptr */, + cl_int * /* errcode_ret */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueMarker) +( cl_command_queue /* command_queue */, + cl_event * /* event */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueWaitForEvents) +( cl_command_queue /* command_queue */, + cl_uint /* num_events */, + const cl_event * /* event_list */); + +OCL_API(cl_int, CL_API_CALL, clEnqueueBarrier) +( cl_command_queue /* command_queue */); + +OCL_API(cl_int, CL_API_CALL, clUnloadCompiler) +( void); + +OCL_API(void *, CL_API_CALL, clGetExtensionFunctionAddress) +( const char * /* func_name */); + +#define OCL_DECLARE_FUNC(name) name##_func name + +typedef struct +{ + void *library; + + OCL_DECLARE_FUNC( clBuildProgram ); + OCL_DECLARE_FUNC( clCreateBuffer ); + OCL_DECLARE_FUNC( clCreateCommandQueue ); + OCL_DECLARE_FUNC( clCreateContext ); + OCL_DECLARE_FUNC( clCreateImage2D ); + OCL_DECLARE_FUNC( clCreateKernel ); + OCL_DECLARE_FUNC( clCreateProgramWithBinary ); + OCL_DECLARE_FUNC( clCreateProgramWithSource ); + OCL_DECLARE_FUNC( clEnqueueCopyBuffer ); + OCL_DECLARE_FUNC( clEnqueueMapBuffer ); + OCL_DECLARE_FUNC( clEnqueueNDRangeKernel ); + OCL_DECLARE_FUNC( clEnqueueReadBuffer ); + OCL_DECLARE_FUNC( clEnqueueWriteBuffer ); + OCL_DECLARE_FUNC( clFinish ); + OCL_DECLARE_FUNC( clGetCommandQueueInfo ); + OCL_DECLARE_FUNC( clGetDeviceIDs ); + OCL_DECLARE_FUNC( clGetDeviceInfo ); + OCL_DECLARE_FUNC( clGetKernelWorkGroupInfo ); + OCL_DECLARE_FUNC( clGetPlatformIDs ); + OCL_DECLARE_FUNC( clGetProgramBuildInfo ); + OCL_DECLARE_FUNC( clGetProgramInfo ); + OCL_DECLARE_FUNC( clGetSupportedImageFormats ); + OCL_DECLARE_FUNC( clReleaseCommandQueue ); + OCL_DECLARE_FUNC( clReleaseContext ); + OCL_DECLARE_FUNC( clReleaseKernel ); + OCL_DECLARE_FUNC( clReleaseMemObject ); + OCL_DECLARE_FUNC( clReleaseProgram ); + OCL_DECLARE_FUNC( clSetKernelArg ); +} x264_opencl_function_t; + +/* Number of downscale resolutions to use for motion search */ +#define NUM_IMAGE_SCALES 4 + +/* Number of PCIe copies that can be queued before requiring a flush */ +#define MAX_FINISH_COPIES 1024 + +/* Size (in bytes) of the page-locked buffer used for PCIe xfers */ +#define PAGE_LOCKED_BUF_SIZE 32 * 1024 * 1024 + +typedef struct +{ + x264_opencl_function_t *ocl; + + cl_context context; + cl_device_id device; + cl_command_queue queue; + + cl_program lookahead_program; + cl_int last_buf; + + cl_mem page_locked_buffer; + char *page_locked_ptr; + int pl_occupancy; + + struct + { + void *src; + void *dest; + int bytes; + } copies[MAX_FINISH_COPIES]; + int num_copies; + + int b_device_AMD_SI; + int b_fatal_error; + int lookahead_thread_pri; + int opencl_thread_pri; + + /* downscale lowres luma */ + cl_kernel downscale_hpel_kernel; + cl_kernel downscale_kernel1; + cl_kernel downscale_kernel2; + cl_mem luma_16x16_image[2]; + + /* weightp filtering */ + cl_kernel weightp_hpel_kernel; + cl_kernel weightp_scaled_images_kernel; + cl_mem weighted_scaled_images[NUM_IMAGE_SCALES]; + cl_mem weighted_luma_hpel; + + /* intra */ + cl_kernel memset_kernel; + cl_kernel intra_kernel; + cl_kernel rowsum_intra_kernel; + cl_mem row_satds[2]; + + /* hierarchical motion estimation */ + cl_kernel hme_kernel; + cl_kernel subpel_refine_kernel; + cl_mem mv_buffers[2]; + cl_mem lowres_mv_costs; + cl_mem mvp_buffer; + + /* bidir */ + cl_kernel mode_select_kernel; + cl_kernel rowsum_inter_kernel; + cl_mem lowres_costs[2]; + cl_mem frame_stats[2]; /* cost_est, cost_est_aq, intra_mbs */ +} x264_opencl_t; + +typedef struct +{ + x264_opencl_function_t *ocl; + + cl_mem scaled_image2Ds[NUM_IMAGE_SCALES]; + cl_mem luma_hpel; + cl_mem inv_qscale_factor; + cl_mem intra_cost; + cl_mem lowres_mvs0; + cl_mem lowres_mvs1; + cl_mem lowres_mv_costs0; + cl_mem lowres_mv_costs1; +} x264_frame_opencl_t; + +typedef struct x264_frame x264_frame; + +x264_opencl_function_t *x264_opencl_load_library( void ); +void x264_opencl_close_library( x264_opencl_function_t *ocl ); + +int x264_opencl_lookahead_init( x264_t *h ); +void x264_opencl_lookahead_delete( x264_t *h ); + +void x264_opencl_frame_delete( x264_frame *frame ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.c new file mode 100644 index 00000000..9bc926a1 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.c @@ -0,0 +1,206 @@ +/***************************************************************************** + * osdep.c: platform-specific code + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Steven Walters + * Laurent Aimar + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#ifdef _WIN32 +#include +#include +#endif + +#if SYS_WINDOWS +#include +#include +#else +#include +#endif +#include + +#if PTW32_STATIC_LIB +/* this is a global in pthread-win32 to indicate if it has been initialized or not */ +extern int ptw32_processInitialized; +#endif + +int64_t x264_mdate( void ) +{ +#if SYS_WINDOWS + struct timeb tb; + ftime( &tb ); + return ((int64_t)tb.time * 1000 + (int64_t)tb.millitm) * 1000; +#else + struct timeval tv_date; + gettimeofday( &tv_date, NULL ); + return (int64_t)tv_date.tv_sec * 1000000 + (int64_t)tv_date.tv_usec; +#endif +} + +#if HAVE_WIN32THREAD || PTW32_STATIC_LIB +/* state of the threading library being initialized */ +static volatile LONG x264_threading_is_init = 0; + +static void x264_threading_destroy( void ) +{ +#if PTW32_STATIC_LIB + pthread_win32_thread_detach_np(); + pthread_win32_process_detach_np(); +#else + x264_win32_threading_destroy(); +#endif +} + +int x264_threading_init( void ) +{ + /* if already init, then do nothing */ + if( InterlockedCompareExchange( &x264_threading_is_init, 1, 0 ) ) + return 0; +#if PTW32_STATIC_LIB + /* if static pthread-win32 is already initialized, then do nothing */ + if( ptw32_processInitialized ) + return 0; + if( !pthread_win32_process_attach_np() ) + return -1; +#else + if( x264_win32_threading_init() ) + return -1; +#endif + /* register cleanup to run at process termination */ + atexit( x264_threading_destroy ); + + return 0; +} +#endif + +#ifdef _WIN32 +/* Functions for dealing with Unicode on Windows. */ +FILE *x264_fopen( const char *filename, const char *mode ) +{ + wchar_t filename_utf16[MAX_PATH]; + wchar_t mode_utf16[16]; + if( utf8_to_utf16( filename, filename_utf16 ) && utf8_to_utf16( mode, mode_utf16 ) ) + return _wfopen( filename_utf16, mode_utf16 ); + return NULL; +} + +int x264_rename( const char *oldname, const char *newname ) +{ + wchar_t oldname_utf16[MAX_PATH]; + wchar_t newname_utf16[MAX_PATH]; + if( utf8_to_utf16( oldname, oldname_utf16 ) && utf8_to_utf16( newname, newname_utf16 ) ) + { + /* POSIX says that rename() removes the destination, but Win32 doesn't. */ + _wunlink( newname_utf16 ); + return _wrename( oldname_utf16, newname_utf16 ); + } + return -1; +} + +int x264_stat( const char *path, x264_struct_stat *buf ) +{ + wchar_t path_utf16[MAX_PATH]; + if( utf8_to_utf16( path, path_utf16 ) ) + return _wstati64( path_utf16, buf ); + return -1; +} + +#if !HAVE_WINRT +int x264_vfprintf( FILE *stream, const char *format, va_list arg ) +{ + HANDLE console = NULL; + DWORD mode; + + if( stream == stdout ) + console = GetStdHandle( STD_OUTPUT_HANDLE ); + else if( stream == stderr ) + console = GetStdHandle( STD_ERROR_HANDLE ); + + /* Only attempt to convert to UTF-16 when writing to a non-redirected console screen buffer. */ + if( GetConsoleMode( console, &mode ) ) + { + char buf[4096]; + wchar_t buf_utf16[4096]; + va_list arg2; + + va_copy( arg2, arg ); + int length = vsnprintf( buf, sizeof(buf), format, arg2 ); + va_end( arg2 ); + + if( length > 0 && length < sizeof(buf) ) + { + /* WriteConsoleW is the most reliable way to output Unicode to a console. */ + int length_utf16 = MultiByteToWideChar( CP_UTF8, 0, buf, length, buf_utf16, sizeof(buf_utf16)/sizeof(wchar_t) ); + DWORD written; + WriteConsoleW( console, buf_utf16, length_utf16, &written, NULL ); + return length; + } + } + return vfprintf( stream, format, arg ); +} + +int x264_is_pipe( const char *path ) +{ + wchar_t path_utf16[MAX_PATH]; + if( utf8_to_utf16( path, path_utf16 ) ) + return WaitNamedPipeW( path_utf16, 0 ); + return 0; +} +#endif + +#if defined(_MSC_VER) && _MSC_VER < 1900 +/* MSVC pre-VS2015 has broken snprintf/vsnprintf implementations which are incompatible with C99. */ +int x264_snprintf( char *s, size_t n, const char *fmt, ... ) +{ + va_list arg; + va_start( arg, fmt ); + int length = x264_vsnprintf( s, n, fmt, arg ); + va_end( arg ); + return length; +} + +int x264_vsnprintf( char *s, size_t n, const char *fmt, va_list arg ) +{ + int length = -1; + + if( n ) + { + va_list arg2; + va_copy( arg2, arg ); + length = _vsnprintf( s, n, fmt, arg2 ); + va_end( arg2 ); + + /* _(v)snprintf adds a null-terminator only if the length is less than the buffer size. */ + if( length < 0 || length >= n ) + s[n-1] = '\0'; + } + + /* _(v)snprintf returns a negative number if the length is greater than the buffer size. */ + if( length < 0 ) + return _vscprintf( fmt, arg ); + + return length; +} +#endif +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.h new file mode 100644 index 00000000..7b5de6e4 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/osdep.h @@ -0,0 +1,414 @@ +/***************************************************************************** + * osdep.h: platform-specific code + ***************************************************************************** + * Copyright (C) 2007-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_OSDEP_H +#define X264_OSDEP_H + +#define _LARGEFILE_SOURCE 1 +#define _FILE_OFFSET_BITS 64 +#include +#include +#include +#include + +//#include "config.h" + +#ifdef __INTEL_COMPILER +#include +#else +#include +#endif + +#if !HAVE_LOG2F +#define log2f(x) (logf(x)/0.693147180559945f) +#define log2(x) (log(x)/0.693147180559945) +#endif + +#ifdef _MSC_VER +#define inline __inline +#define strcasecmp _stricmp +#define strncasecmp _strnicmp +#define strtok_r strtok_s +#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) +#if _MSC_VER < 1900 +int x264_snprintf( char *s, size_t n, const char *fmt, ... ); +int x264_vsnprintf( char *s, size_t n, const char *fmt, va_list arg ); +#define snprintf x264_snprintf +#define vsnprintf x264_vsnprintf +#endif +#else +#include +#endif + +#if !defined(va_copy) && defined(__INTEL_COMPILER) +#define va_copy(dst, src) ((dst) = (src)) +#endif + +#if !defined(isfinite) && (SYS_OPENBSD || SYS_SunOS) +#define isfinite finite +#endif + +#ifdef _WIN32 +#ifndef strtok_r +#define strtok_r(str,delim,save) strtok(str,delim) +#endif + +#define utf8_to_utf16( utf8, utf16 )\ + MultiByteToWideChar( CP_UTF8, MB_ERR_INVALID_CHARS, utf8, -1, utf16, sizeof(utf16)/sizeof(wchar_t) ) +FILE *x264_fopen( const char *filename, const char *mode ); +int x264_rename( const char *oldname, const char *newname ); +#define x264_struct_stat struct _stati64 +#define x264_fstat _fstati64 +int x264_stat( const char *path, x264_struct_stat *buf ); +#else +#define x264_fopen fopen +#define x264_rename rename +#define x264_struct_stat struct stat +#define x264_fstat fstat +#define x264_stat stat +#endif + +/* mdate: return the current date in microsecond */ +int64_t x264_mdate( void ); + +#if defined(_WIN32) && !HAVE_WINRT +int x264_vfprintf( FILE *stream, const char *format, va_list arg ); +int x264_is_pipe( const char *path ); +#else +#define x264_vfprintf vfprintf +#define x264_is_pipe(x) 0 +#endif + +#ifdef _MSC_VER +#define DECLARE_ALIGNED( var, n ) __declspec(align(n)) var +#else +#define DECLARE_ALIGNED( var, n ) var __attribute__((aligned(n))) +#endif + +#define ALIGNED_4( var ) DECLARE_ALIGNED( var, 4 ) +#define ALIGNED_8( var ) DECLARE_ALIGNED( var, 8 ) +#define ALIGNED_16( var ) DECLARE_ALIGNED( var, 16 ) + +// ARM compiliers don't reliably align stack variables +// - EABI requires only 8 byte stack alignment to be maintained +// - gcc can't align stack variables to more even if the stack were to be correctly aligned outside the function +// - armcc can't either, but is nice enough to actually tell you so +// - Apple gcc only maintains 4 byte alignment +// - llvm can align the stack, but only in svn and (unrelated) it exposes bugs in all released GNU binutils... + +#define ALIGNED_ARRAY_EMU( mask, type, name, sub1, ... )\ + uint8_t name##_u [sizeof(type sub1 __VA_ARGS__) + mask]; \ + type (*name) __VA_ARGS__ = (void*)((intptr_t)(name##_u+mask) & ~mask) + +#if ARCH_ARM && SYS_MACOSX +#define ALIGNED_ARRAY_8( ... ) EXPAND( ALIGNED_ARRAY_EMU( 7, __VA_ARGS__ ) ) +#else +#define ALIGNED_ARRAY_8( type, name, sub1, ... ) ALIGNED_8( type name sub1 __VA_ARGS__ ) +#endif + +#if ARCH_ARM +#define ALIGNED_ARRAY_16( ... ) EXPAND( ALIGNED_ARRAY_EMU( 15, __VA_ARGS__ ) ) +#else +#define ALIGNED_ARRAY_16( type, name, sub1, ... ) ALIGNED_16( type name sub1 __VA_ARGS__ ) +#endif + +#define EXPAND(x) x + +#if ARCH_X86 || ARCH_X86_64 +#define NATIVE_ALIGN 64 +#define ALIGNED_32( var ) DECLARE_ALIGNED( var, 32 ) +#define ALIGNED_64( var ) DECLARE_ALIGNED( var, 64 ) +#if STACK_ALIGNMENT >= 32 +#define ALIGNED_ARRAY_32( type, name, sub1, ... ) ALIGNED_32( type name sub1 __VA_ARGS__ ) +#else +#define ALIGNED_ARRAY_32( ... ) EXPAND( ALIGNED_ARRAY_EMU( 31, __VA_ARGS__ ) ) +#endif +#if STACK_ALIGNMENT >= 64 +#define ALIGNED_ARRAY_64( type, name, sub1, ... ) ALIGNED_64( type name sub1 __VA_ARGS__ ) +#else +#define ALIGNED_ARRAY_64( ... ) EXPAND( ALIGNED_ARRAY_EMU( 63, __VA_ARGS__ ) ) +#endif +#else +#define NATIVE_ALIGN 16 +#define ALIGNED_32 ALIGNED_16 +#define ALIGNED_64 ALIGNED_16 +#define ALIGNED_ARRAY_32 ALIGNED_ARRAY_16 +#define ALIGNED_ARRAY_64 ALIGNED_ARRAY_16 +#endif + +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0) +#define UNUSED __attribute__((unused)) +#define ALWAYS_INLINE __attribute__((always_inline)) inline +#define NOINLINE __attribute__((noinline)) +#define MAY_ALIAS __attribute__((may_alias)) +#define x264_constant_p(x) __builtin_constant_p(x) +#define x264_nonconstant_p(x) (!__builtin_constant_p(x)) +#else +#ifdef _MSC_VER +#define ALWAYS_INLINE __forceinline +#define NOINLINE __declspec(noinline) +#else +#define ALWAYS_INLINE inline +#define NOINLINE +#endif +#define UNUSED +#define MAY_ALIAS +#define x264_constant_p(x) 0 +#define x264_nonconstant_p(x) 0 +#endif + +/* threads */ +#if HAVE_BEOSTHREAD +#include +#define x264_pthread_t thread_id +static inline int x264_pthread_create( x264_pthread_t *t, void *a, void *(*f)(void *), void *d ) +{ + *t = spawn_thread( f, "", 10, d ); + if( *t < B_NO_ERROR ) + return -1; + resume_thread( *t ); + return 0; +} +#define x264_pthread_join(t,s) { long tmp; \ + wait_for_thread(t,(s)?(long*)(s):&tmp); } + +#elif HAVE_POSIXTHREAD +#include +#define x264_pthread_t pthread_t +#define x264_pthread_create pthread_create +#define x264_pthread_join pthread_join +#define x264_pthread_mutex_t pthread_mutex_t +#define x264_pthread_mutex_init pthread_mutex_init +#define x264_pthread_mutex_destroy pthread_mutex_destroy +#define x264_pthread_mutex_lock pthread_mutex_lock +#define x264_pthread_mutex_unlock pthread_mutex_unlock +#define x264_pthread_cond_t pthread_cond_t +#define x264_pthread_cond_init pthread_cond_init +#define x264_pthread_cond_destroy pthread_cond_destroy +#define x264_pthread_cond_broadcast pthread_cond_broadcast +#define x264_pthread_cond_wait pthread_cond_wait +#define x264_pthread_attr_t pthread_attr_t +#define x264_pthread_attr_init pthread_attr_init +#define x264_pthread_attr_destroy pthread_attr_destroy +#define x264_pthread_num_processors_np pthread_num_processors_np +#define X264_PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER + +#elif HAVE_WIN32THREAD +#include "win32thread.h" + +#else +#define x264_pthread_t int +#define x264_pthread_create(t,u,f,d) 0 +#define x264_pthread_join(t,s) +#endif //HAVE_*THREAD + +#if !HAVE_POSIXTHREAD && !HAVE_WIN32THREAD +#define x264_pthread_mutex_t int +#define x264_pthread_mutex_init(m,f) 0 +#define x264_pthread_mutex_destroy(m) +#define x264_pthread_mutex_lock(m) +#define x264_pthread_mutex_unlock(m) +#define x264_pthread_cond_t int +#define x264_pthread_cond_init(c,f) 0 +#define x264_pthread_cond_destroy(c) +#define x264_pthread_cond_broadcast(c) +#define x264_pthread_cond_wait(c,m) +#define x264_pthread_attr_t int +#define x264_pthread_attr_init(a) 0 +#define x264_pthread_attr_destroy(a) +#define X264_PTHREAD_MUTEX_INITIALIZER 0 +#endif + +#if HAVE_WIN32THREAD || PTW32_STATIC_LIB +int x264_threading_init( void ); +#else +#define x264_threading_init() 0 +#endif + +static ALWAYS_INLINE int x264_pthread_fetch_and_add( int *val, int add, x264_pthread_mutex_t *mutex ) +{ +#if HAVE_THREAD +#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 0) && (ARCH_X86 || ARCH_X86_64) + return __sync_fetch_and_add( val, add ); +#else + x264_pthread_mutex_lock( mutex ); + int res = *val; + *val += add; + x264_pthread_mutex_unlock( mutex ); + return res; +#endif +#else + int res = *val; + *val += add; + return res; +#endif +} + +#define WORD_SIZE sizeof(void*) + +#define asm __asm__ + +#if WORDS_BIGENDIAN +#define endian_fix(x) (x) +#define endian_fix64(x) (x) +#define endian_fix32(x) (x) +#define endian_fix16(x) (x) +#else +#if HAVE_X86_INLINE_ASM && HAVE_MMX +static ALWAYS_INLINE uint32_t endian_fix32( uint32_t x ) +{ + asm("bswap %0":"+r"(x)); + return x; +} +#elif defined(__GNUC__) && HAVE_ARMV6 +static ALWAYS_INLINE uint32_t endian_fix32( uint32_t x ) +{ + asm("rev %0, %0":"+r"(x)); + return x; +} +#else +static ALWAYS_INLINE uint32_t endian_fix32( uint32_t x ) +{ + return (x<<24) + ((x<<8)&0xff0000) + ((x>>8)&0xff00) + (x>>24); +} +#endif +#if HAVE_X86_INLINE_ASM && ARCH_X86_64 +static ALWAYS_INLINE uint64_t endian_fix64( uint64_t x ) +{ + asm("bswap %0":"+r"(x)); + return x; +} +#else +static ALWAYS_INLINE uint64_t endian_fix64( uint64_t x ) +{ + return endian_fix32(x>>32) + ((uint64_t)endian_fix32(x)<<32); +} +#endif +static ALWAYS_INLINE intptr_t endian_fix( intptr_t x ) +{ + return WORD_SIZE == 8 ? endian_fix64(x) : endian_fix32(x); +} +static ALWAYS_INLINE uint16_t endian_fix16( uint16_t x ) +{ + return (x<<8)|(x>>8); +} +#endif + +/* For values with 4 bits or less. */ +static int ALWAYS_INLINE x264_ctz_4bit( uint32_t x ) +{ + static uint8_t lut[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0}; + return lut[x]; +} + +#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 3) +#define x264_clz(x) __builtin_clz(x) +#define x264_ctz(x) __builtin_ctz(x) +#else +static int ALWAYS_INLINE x264_clz( uint32_t x ) +{ + static uint8_t lut[16] = {4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0}; + int y, z = (((x >> 16) - 1) >> 27) & 16; + x >>= z^16; + z += y = ((x - 0x100) >> 28) & 8; + x >>= y^8; + z += y = ((x - 0x10) >> 29) & 4; + x >>= y^4; + return z + lut[x]; +} + +static int ALWAYS_INLINE x264_ctz( uint32_t x ) +{ + static uint8_t lut[16] = {4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0}; + int y, z = (((x & 0xffff) - 1) >> 27) & 16; + x >>= z; + z += y = (((x & 0xff) - 1) >> 28) & 8; + x >>= y; + z += y = (((x & 0xf) - 1) >> 29) & 4; + x >>= y; + return z + lut[x&0xf]; +} +#endif + +#if HAVE_X86_INLINE_ASM && HAVE_MMX +/* Don't use __builtin_prefetch; even as recent as 4.3.4, GCC seems incapable of + * using complex address modes properly unless we use inline asm. */ +static ALWAYS_INLINE void x264_prefetch( void *p ) +{ + asm volatile( "prefetcht0 %0"::"m"(*(uint8_t*)p) ); +} +/* We require that prefetch not fault on invalid reads, so we only enable it on + * known architectures. */ +#elif defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 1) &&\ + (ARCH_X86 || ARCH_X86_64 || ARCH_ARM || ARCH_PPC) +#define x264_prefetch(x) __builtin_prefetch(x) +#else +#define x264_prefetch(x) +#endif + +#if HAVE_POSIXTHREAD +#if SYS_WINDOWS +#define x264_lower_thread_priority(p)\ +{\ + x264_pthread_t handle = pthread_self();\ + struct sched_param sp;\ + int policy = SCHED_OTHER;\ + pthread_getschedparam( handle, &policy, &sp );\ + sp.sched_priority -= p;\ + pthread_setschedparam( handle, policy, &sp );\ +} +#elif SYS_HAIKU +#include +#define x264_lower_thread_priority(p)\ + { UNUSED status_t nice_ret = set_thread_priority( find_thread( NULL ), B_LOW_PRIORITY ); } +#else +#include +#define x264_lower_thread_priority(p) { UNUSED int nice_ret = nice(p); } +#endif /* SYS_WINDOWS */ +#elif HAVE_WIN32THREAD +#define x264_lower_thread_priority(p) SetThreadPriority( GetCurrentThread(), X264_MAX( -2, -p ) ) +#else +#define x264_lower_thread_priority(p) +#endif + +static inline int x264_is_regular_file( FILE *filehandle ) +{ + x264_struct_stat file_stat; + if( x264_fstat( fileno( filehandle ), &file_stat ) ) + return 1; + return S_ISREG( file_stat.st_mode ); +} + +static inline int x264_is_regular_file_path( const char *filename ) +{ + x264_struct_stat file_stat; + if( x264_stat( filename, &file_stat ) ) + return !x264_is_pipe( filename ); + return S_ISREG( file_stat.st_mode ); +} + +#endif /* X264_OSDEP_H */ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.c new file mode 100644 index 00000000..d668491b --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.c @@ -0,0 +1,1522 @@ +/***************************************************************************** + * pixel.c: pixel metrics + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#if HAVE_MMX +# include "x86/pixel.h" +# include "x86/predict.h" +#endif +#if ARCH_PPC +# include "ppc/pixel.h" +#endif +#if ARCH_ARM +# include "arm/pixel.h" +# include "arm/predict.h" +#endif +#if ARCH_AARCH64 +# include "aarch64/pixel.h" +# include "aarch64/predict.h" +#endif +#if ARCH_MIPS +# include "mips/pixel.h" +#endif + + +/**************************************************************************** + * pixel_sad_WxH + ****************************************************************************/ +#define PIXEL_SAD_C( name, lx, ly ) \ +static int name( pixel *pix1, intptr_t i_stride_pix1, \ + pixel *pix2, intptr_t i_stride_pix2 ) \ +{ \ + int i_sum = 0; \ + for( int y = 0; y < ly; y++ ) \ + { \ + for( int x = 0; x < lx; x++ ) \ + { \ + i_sum += abs( pix1[x] - pix2[x] ); \ + } \ + pix1 += i_stride_pix1; \ + pix2 += i_stride_pix2; \ + } \ + return i_sum; \ +} + + +PIXEL_SAD_C( x264_pixel_sad_16x16, 16, 16 ) +PIXEL_SAD_C( x264_pixel_sad_16x8, 16, 8 ) +PIXEL_SAD_C( x264_pixel_sad_8x16, 8, 16 ) +PIXEL_SAD_C( x264_pixel_sad_8x8, 8, 8 ) +PIXEL_SAD_C( x264_pixel_sad_8x4, 8, 4 ) +PIXEL_SAD_C( x264_pixel_sad_4x16, 4, 16 ) +PIXEL_SAD_C( x264_pixel_sad_4x8, 4, 8 ) +PIXEL_SAD_C( x264_pixel_sad_4x4, 4, 4 ) + +/**************************************************************************** + * pixel_ssd_WxH + ****************************************************************************/ +#define PIXEL_SSD_C( name, lx, ly ) \ +static int name( pixel *pix1, intptr_t i_stride_pix1, \ + pixel *pix2, intptr_t i_stride_pix2 ) \ +{ \ + int i_sum = 0; \ + for( int y = 0; y < ly; y++ ) \ + { \ + for( int x = 0; x < lx; x++ ) \ + { \ + int d = pix1[x] - pix2[x]; \ + i_sum += d*d; \ + } \ + pix1 += i_stride_pix1; \ + pix2 += i_stride_pix2; \ + } \ + return i_sum; \ +} + +PIXEL_SSD_C( x264_pixel_ssd_16x16, 16, 16 ) +PIXEL_SSD_C( x264_pixel_ssd_16x8, 16, 8 ) +PIXEL_SSD_C( x264_pixel_ssd_8x16, 8, 16 ) +PIXEL_SSD_C( x264_pixel_ssd_8x8, 8, 8 ) +PIXEL_SSD_C( x264_pixel_ssd_8x4, 8, 4 ) +PIXEL_SSD_C( x264_pixel_ssd_4x16, 4, 16 ) +PIXEL_SSD_C( x264_pixel_ssd_4x8, 4, 8 ) +PIXEL_SSD_C( x264_pixel_ssd_4x4, 4, 4 ) + +uint64_t x264_pixel_ssd_wxh( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, + pixel *pix2, intptr_t i_pix2, int i_width, int i_height ) +{ + uint64_t i_ssd = 0; + int y; + int align = !(((intptr_t)pix1 | (intptr_t)pix2 | i_pix1 | i_pix2) & 15); + +#define SSD(size) i_ssd += pf->ssd[size]( pix1 + y*i_pix1 + x, i_pix1, \ + pix2 + y*i_pix2 + x, i_pix2 ); + for( y = 0; y < i_height-15; y += 16 ) + { + int x = 0; + if( align ) + for( ; x < i_width-15; x += 16 ) + SSD(PIXEL_16x16); + for( ; x < i_width-7; x += 8 ) + SSD(PIXEL_8x16); + } + if( y < i_height-7 ) + for( int x = 0; x < i_width-7; x += 8 ) + SSD(PIXEL_8x8); +#undef SSD + +#define SSD1 { int d = pix1[y*i_pix1+x] - pix2[y*i_pix2+x]; i_ssd += d*d; } + if( i_width & 7 ) + { + for( y = 0; y < (i_height & ~7); y++ ) + for( int x = i_width & ~7; x < i_width; x++ ) + SSD1; + } + if( i_height & 7 ) + { + for( y = i_height & ~7; y < i_height; y++ ) + for( int x = 0; x < i_width; x++ ) + SSD1; + } +#undef SSD1 + + return i_ssd; +} + +static void pixel_ssd_nv12_core( pixel *pixuv1, intptr_t stride1, pixel *pixuv2, intptr_t stride2, + int width, int height, uint64_t *ssd_u, uint64_t *ssd_v ) +{ + *ssd_u = 0, *ssd_v = 0; + for( int y = 0; y < height; y++, pixuv1+=stride1, pixuv2+=stride2 ) + for( int x = 0; x < width; x++ ) + { + int du = pixuv1[2*x] - pixuv2[2*x]; + int dv = pixuv1[2*x+1] - pixuv2[2*x+1]; + *ssd_u += du*du; + *ssd_v += dv*dv; + } +} + +void x264_pixel_ssd_nv12( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2, + int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v ) +{ + pf->ssd_nv12_core( pix1, i_pix1, pix2, i_pix2, i_width&~7, i_height, ssd_u, ssd_v ); + if( i_width&7 ) + { + uint64_t tmp[2]; + pixel_ssd_nv12_core( pix1+(i_width&~7), i_pix1, pix2+(i_width&~7), i_pix2, i_width&7, i_height, &tmp[0], &tmp[1] ); + *ssd_u += tmp[0]; + *ssd_v += tmp[1]; + } +} + +/**************************************************************************** + * pixel_var_wxh + ****************************************************************************/ +#define PIXEL_VAR_C( name, w, h ) \ +static uint64_t name( pixel *pix, intptr_t i_stride ) \ +{ \ + uint32_t sum = 0, sqr = 0; \ + for( int y = 0; y < h; y++ ) \ + { \ + for( int x = 0; x < w; x++ ) \ + { \ + sum += pix[x]; \ + sqr += pix[x] * pix[x]; \ + } \ + pix += i_stride; \ + } \ + return sum + ((uint64_t)sqr << 32); \ +} + +PIXEL_VAR_C( x264_pixel_var_16x16, 16, 16 ) +PIXEL_VAR_C( x264_pixel_var_8x16, 8, 16 ) +PIXEL_VAR_C( x264_pixel_var_8x8, 8, 8 ) + +/**************************************************************************** + * pixel_var2_wxh + ****************************************************************************/ +#define PIXEL_VAR2_C( name, h, shift ) \ +static int name( pixel *fenc, pixel *fdec, int ssd[2] ) \ +{ \ + int sum_u = 0, sum_v = 0, sqr_u = 0, sqr_v = 0; \ + for( int y = 0; y < h; y++ ) \ + { \ + for( int x = 0; x < 8; x++ ) \ + { \ + int diff_u = fenc[x] - fdec[x]; \ + int diff_v = fenc[x+FENC_STRIDE/2] - fdec[x+FDEC_STRIDE/2]; \ + sum_u += diff_u; \ + sum_v += diff_v; \ + sqr_u += diff_u * diff_u; \ + sqr_v += diff_v * diff_v; \ + } \ + fenc += FENC_STRIDE; \ + fdec += FDEC_STRIDE; \ + } \ + ssd[0] = sqr_u; \ + ssd[1] = sqr_v; \ + return sqr_u - ((int64_t)sum_u * sum_u >> shift) + \ + sqr_v - ((int64_t)sum_v * sum_v >> shift); \ +} + +PIXEL_VAR2_C( x264_pixel_var2_8x16, 16, 7 ) +PIXEL_VAR2_C( x264_pixel_var2_8x8, 8, 6 ) + +#if BIT_DEPTH > 8 + typedef uint32_t sum_t; + typedef uint64_t sum2_t; +#else + typedef uint16_t sum_t; + typedef uint32_t sum2_t; +#endif +#define BITS_PER_SUM (8 * sizeof(sum_t)) + +#define HADAMARD4(d0, d1, d2, d3, s0, s1, s2, s3) {\ + sum2_t t0 = s0 + s1;\ + sum2_t t1 = s0 - s1;\ + sum2_t t2 = s2 + s3;\ + sum2_t t3 = s2 - s3;\ + d0 = t0 + t2;\ + d2 = t0 - t2;\ + d1 = t1 + t3;\ + d3 = t1 - t3;\ +} + +// in: a pseudo-simd number of the form x+(y<<16) +// return: abs(x)+(abs(y)<<16) +static ALWAYS_INLINE sum2_t abs2( sum2_t a ) +{ + sum2_t s = ((a>>(BITS_PER_SUM-1))&(((sum2_t)1<>BITS_PER_SUM); + } + return sum >> 1; +} + +static NOINLINE int x264_pixel_satd_8x4( pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2 ) +{ + sum2_t tmp[4][4]; + sum2_t a0, a1, a2, a3; + sum2_t sum = 0; + for( int i = 0; i < 4; i++, pix1 += i_pix1, pix2 += i_pix2 ) + { + a0 = (pix1[0] - pix2[0]) + ((sum2_t)(pix1[4] - pix2[4]) << BITS_PER_SUM); + a1 = (pix1[1] - pix2[1]) + ((sum2_t)(pix1[5] - pix2[5]) << BITS_PER_SUM); + a2 = (pix1[2] - pix2[2]) + ((sum2_t)(pix1[6] - pix2[6]) << BITS_PER_SUM); + a3 = (pix1[3] - pix2[3]) + ((sum2_t)(pix1[7] - pix2[7]) << BITS_PER_SUM); + HADAMARD4( tmp[i][0], tmp[i][1], tmp[i][2], tmp[i][3], a0,a1,a2,a3 ); + } + for( int i = 0; i < 4; i++ ) + { + HADAMARD4( a0, a1, a2, a3, tmp[0][i], tmp[1][i], tmp[2][i], tmp[3][i] ); + sum += abs2(a0) + abs2(a1) + abs2(a2) + abs2(a3); + } + return (((sum_t)sum) + (sum>>BITS_PER_SUM)) >> 1; +} + +#define PIXEL_SATD_C( w, h, sub )\ +static int x264_pixel_satd_##w##x##h( pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2 )\ +{\ + int sum = sub( pix1, i_pix1, pix2, i_pix2 )\ + + sub( pix1+4*i_pix1, i_pix1, pix2+4*i_pix2, i_pix2 );\ + if( w==16 )\ + sum+= sub( pix1+8, i_pix1, pix2+8, i_pix2 )\ + + sub( pix1+8+4*i_pix1, i_pix1, pix2+8+4*i_pix2, i_pix2 );\ + if( h==16 )\ + sum+= sub( pix1+8*i_pix1, i_pix1, pix2+8*i_pix2, i_pix2 )\ + + sub( pix1+12*i_pix1, i_pix1, pix2+12*i_pix2, i_pix2 );\ + if( w==16 && h==16 )\ + sum+= sub( pix1+8+8*i_pix1, i_pix1, pix2+8+8*i_pix2, i_pix2 )\ + + sub( pix1+8+12*i_pix1, i_pix1, pix2+8+12*i_pix2, i_pix2 );\ + return sum;\ +} +PIXEL_SATD_C( 16, 16, x264_pixel_satd_8x4 ) +PIXEL_SATD_C( 16, 8, x264_pixel_satd_8x4 ) +PIXEL_SATD_C( 8, 16, x264_pixel_satd_8x4 ) +PIXEL_SATD_C( 8, 8, x264_pixel_satd_8x4 ) +PIXEL_SATD_C( 4, 16, x264_pixel_satd_4x4 ) +PIXEL_SATD_C( 4, 8, x264_pixel_satd_4x4 ) + +static NOINLINE int sa8d_8x8( pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2 ) +{ + sum2_t tmp[8][4]; + sum2_t a0, a1, a2, a3, a4, a5, a6, a7, b0, b1, b2, b3; + sum2_t sum = 0; + for( int i = 0; i < 8; i++, pix1 += i_pix1, pix2 += i_pix2 ) + { + a0 = pix1[0] - pix2[0]; + a1 = pix1[1] - pix2[1]; + b0 = (a0+a1) + ((a0-a1)<>BITS_PER_SUM); + } + return sum; +} + +static int x264_pixel_sa8d_8x8( pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2 ) +{ + int sum = sa8d_8x8( pix1, i_pix1, pix2, i_pix2 ); + return (sum+2)>>2; +} + +static int x264_pixel_sa8d_16x16( pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2 ) +{ + int sum = sa8d_8x8( pix1, i_pix1, pix2, i_pix2 ) + + sa8d_8x8( pix1+8, i_pix1, pix2+8, i_pix2 ) + + sa8d_8x8( pix1+8*i_pix1, i_pix1, pix2+8*i_pix2, i_pix2 ) + + sa8d_8x8( pix1+8+8*i_pix1, i_pix1, pix2+8+8*i_pix2, i_pix2 ); + return (sum+2)>>2; +} + +static NOINLINE uint64_t pixel_hadamard_ac( pixel *pix, intptr_t stride ) +{ + sum2_t tmp[32]; + sum2_t a0, a1, a2, a3, dc; + sum2_t sum4 = 0, sum8 = 0; + for( int i = 0; i < 8; i++, pix+=stride ) + { + sum2_t *t = tmp + (i&3) + (i&4)*4; + a0 = (pix[0]+pix[1]) + ((sum2_t)(pix[0]-pix[1])<>BITS_PER_SUM) - dc; + sum8 = (sum_t)sum8 + (sum8>>BITS_PER_SUM) - dc; + return ((uint64_t)sum8<<32) + sum4; +} + +#define HADAMARD_AC(w,h) \ +static uint64_t x264_pixel_hadamard_ac_##w##x##h( pixel *pix, intptr_t stride )\ +{\ + uint64_t sum = pixel_hadamard_ac( pix, stride );\ + if( w==16 )\ + sum += pixel_hadamard_ac( pix+8, stride );\ + if( h==16 )\ + sum += pixel_hadamard_ac( pix+8*stride, stride );\ + if( w==16 && h==16 )\ + sum += pixel_hadamard_ac( pix+8*stride+8, stride );\ + return ((sum>>34)<<32) + ((uint32_t)sum>>1);\ +} +HADAMARD_AC( 16, 16 ) +HADAMARD_AC( 16, 8 ) +HADAMARD_AC( 8, 16 ) +HADAMARD_AC( 8, 8 ) + + +/**************************************************************************** + * pixel_sad_x4 + ****************************************************************************/ +#define SAD_X( size ) \ +static void x264_pixel_sad_x3_##size( pixel *fenc, pixel *pix0, pixel *pix1, pixel *pix2,\ + intptr_t i_stride, int scores[3] )\ +{\ + scores[0] = x264_pixel_sad_##size( fenc, FENC_STRIDE, pix0, i_stride );\ + scores[1] = x264_pixel_sad_##size( fenc, FENC_STRIDE, pix1, i_stride );\ + scores[2] = x264_pixel_sad_##size( fenc, FENC_STRIDE, pix2, i_stride );\ +}\ +static void x264_pixel_sad_x4_##size( pixel *fenc, pixel *pix0, pixel *pix1,pixel *pix2, pixel *pix3,\ + intptr_t i_stride, int scores[4] )\ +{\ + scores[0] = x264_pixel_sad_##size( fenc, FENC_STRIDE, pix0, i_stride );\ + scores[1] = x264_pixel_sad_##size( fenc, FENC_STRIDE, pix1, i_stride );\ + scores[2] = x264_pixel_sad_##size( fenc, FENC_STRIDE, pix2, i_stride );\ + scores[3] = x264_pixel_sad_##size( fenc, FENC_STRIDE, pix3, i_stride );\ +} + +SAD_X( 16x16 ) +SAD_X( 16x8 ) +SAD_X( 8x16 ) +SAD_X( 8x8 ) +SAD_X( 8x4 ) +SAD_X( 4x8 ) +SAD_X( 4x4 ) + +/**************************************************************************** + * pixel_satd_x4 + * no faster than single satd, but needed for satd to be a drop-in replacement for sad + ****************************************************************************/ + +#define SATD_X( size, cpu ) \ +static void x264_pixel_satd_x3_##size##cpu( pixel *fenc, pixel *pix0, pixel *pix1, pixel *pix2,\ + intptr_t i_stride, int scores[3] )\ +{\ + scores[0] = x264_pixel_satd_##size##cpu( fenc, FENC_STRIDE, pix0, i_stride );\ + scores[1] = x264_pixel_satd_##size##cpu( fenc, FENC_STRIDE, pix1, i_stride );\ + scores[2] = x264_pixel_satd_##size##cpu( fenc, FENC_STRIDE, pix2, i_stride );\ +}\ +static void x264_pixel_satd_x4_##size##cpu( pixel *fenc, pixel *pix0, pixel *pix1, pixel *pix2, pixel *pix3,\ + intptr_t i_stride, int scores[4] )\ +{\ + scores[0] = x264_pixel_satd_##size##cpu( fenc, FENC_STRIDE, pix0, i_stride );\ + scores[1] = x264_pixel_satd_##size##cpu( fenc, FENC_STRIDE, pix1, i_stride );\ + scores[2] = x264_pixel_satd_##size##cpu( fenc, FENC_STRIDE, pix2, i_stride );\ + scores[3] = x264_pixel_satd_##size##cpu( fenc, FENC_STRIDE, pix3, i_stride );\ +} +#define SATD_X_DECL6( cpu )\ +SATD_X( 16x16, cpu )\ +SATD_X( 16x8, cpu )\ +SATD_X( 8x16, cpu )\ +SATD_X( 8x8, cpu )\ +SATD_X( 8x4, cpu )\ +SATD_X( 4x8, cpu ) +#define SATD_X_DECL7( cpu )\ +SATD_X_DECL6( cpu )\ +SATD_X( 4x4, cpu ) + +SATD_X_DECL7() +#if HAVE_MMX +SATD_X_DECL7( _mmx2 ) +#if !HIGH_BIT_DEPTH +SATD_X_DECL6( _sse2 ) +SATD_X_DECL7( _ssse3 ) +SATD_X_DECL6( _ssse3_atom ) +SATD_X_DECL7( _sse4 ) +SATD_X_DECL7( _avx ) +SATD_X_DECL7( _xop ) +#endif // !HIGH_BIT_DEPTH +#endif + +#if !HIGH_BIT_DEPTH +#if HAVE_ARMV6 || ARCH_AARCH64 +SATD_X_DECL7( _neon ) +#endif +#endif // !HIGH_BIT_DEPTH + +#define INTRA_MBCMP_8x8( mbcmp, cpu, cpu2 )\ +void x264_intra_##mbcmp##_x3_8x8##cpu( pixel *fenc, pixel edge[36], int res[3] )\ +{\ + ALIGNED_ARRAY_16( pixel, pix, [8*FDEC_STRIDE] );\ + x264_predict_8x8_v##cpu2( pix, edge );\ + res[0] = x264_pixel_##mbcmp##_8x8##cpu( pix, FDEC_STRIDE, fenc, FENC_STRIDE );\ + x264_predict_8x8_h##cpu2( pix, edge );\ + res[1] = x264_pixel_##mbcmp##_8x8##cpu( pix, FDEC_STRIDE, fenc, FENC_STRIDE );\ + x264_predict_8x8_dc##cpu2( pix, edge );\ + res[2] = x264_pixel_##mbcmp##_8x8##cpu( pix, FDEC_STRIDE, fenc, FENC_STRIDE );\ +} + +INTRA_MBCMP_8x8( sad,, _c ) +INTRA_MBCMP_8x8(sa8d,, _c ) +#if HIGH_BIT_DEPTH && HAVE_MMX +#define x264_predict_8x8_v_sse2 x264_predict_8x8_v_sse +INTRA_MBCMP_8x8( sad, _mmx2, _c ) +INTRA_MBCMP_8x8(sa8d, _sse2, _sse2 ) +#endif +#if !HIGH_BIT_DEPTH && (HAVE_ARMV6 || ARCH_AARCH64) +INTRA_MBCMP_8x8( sad, _neon, _neon ) +INTRA_MBCMP_8x8(sa8d, _neon, _neon ) +#endif + +#define INTRA_MBCMP( mbcmp, size, pred1, pred2, pred3, chroma, cpu, cpu2 )\ +void x264_intra_##mbcmp##_x3_##size##chroma##cpu( pixel *fenc, pixel *fdec, int res[3] )\ +{\ + x264_predict_##size##chroma##_##pred1##cpu2( fdec );\ + res[0] = x264_pixel_##mbcmp##_##size##cpu( fdec, FDEC_STRIDE, fenc, FENC_STRIDE );\ + x264_predict_##size##chroma##_##pred2##cpu2( fdec );\ + res[1] = x264_pixel_##mbcmp##_##size##cpu( fdec, FDEC_STRIDE, fenc, FENC_STRIDE );\ + x264_predict_##size##chroma##_##pred3##cpu2( fdec );\ + res[2] = x264_pixel_##mbcmp##_##size##cpu( fdec, FDEC_STRIDE, fenc, FENC_STRIDE );\ +} + +INTRA_MBCMP( sad, 4x4, v, h, dc, ,, _c ) +INTRA_MBCMP(satd, 4x4, v, h, dc, ,, _c ) +INTRA_MBCMP( sad, 8x8, dc, h, v, c,, _c ) +INTRA_MBCMP(satd, 8x8, dc, h, v, c,, _c ) +INTRA_MBCMP( sad, 8x16, dc, h, v, c,, _c ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c,, _c ) +INTRA_MBCMP( sad, 16x16, v, h, dc, ,, _c ) +INTRA_MBCMP(satd, 16x16, v, h, dc, ,, _c ) + +#if HAVE_MMX +#if HIGH_BIT_DEPTH +#define x264_predict_8x8c_v_mmx2 x264_predict_8x8c_v_mmx +#define x264_predict_8x16c_v_mmx2 x264_predict_8x16c_v_c +#define x264_predict_16x16_dc_mmx2 x264_predict_16x16_dc_c +#define x264_predict_8x8c_v_sse2 x264_predict_8x8c_v_sse +#define x264_predict_8x16c_v_sse2 x264_predict_8x16c_v_sse +#define x264_predict_16x16_v_sse2 x264_predict_16x16_v_sse +INTRA_MBCMP( sad, 4x4, v, h, dc, , _mmx2, _c ) +INTRA_MBCMP( sad, 8x8, dc, h, v, c, _mmx2, _mmx2 ) +INTRA_MBCMP( sad, 8x16, dc, h, v, c, _mmx2, _mmx2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _mmx2, _mmx2 ) +INTRA_MBCMP( sad, 16x16, v, h, dc, , _mmx2, _mmx2 ) +INTRA_MBCMP( sad, 8x8, dc, h, v, c, _sse2, _sse2 ) +INTRA_MBCMP( sad, 8x16, dc, h, v, c, _sse2, _sse2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _sse2, _sse2 ) +INTRA_MBCMP( sad, 16x16, v, h, dc, , _sse2, _sse2 ) +INTRA_MBCMP( sad, 8x8, dc, h, v, c, _ssse3, _sse2 ) +INTRA_MBCMP( sad, 8x16, dc, h, v, c, _ssse3, _sse2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _ssse3, _sse2 ) +INTRA_MBCMP( sad, 16x16, v, h, dc, , _ssse3, _sse2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _sse4, _sse2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _avx, _sse2 ) +#else +#define x264_predict_8x16c_v_mmx2 x264_predict_8x16c_v_mmx +INTRA_MBCMP( sad, 8x16, dc, h, v, c, _mmx2, _mmx2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _mmx2, _mmx2 ) +INTRA_MBCMP( sad, 8x16, dc, h, v, c, _sse2, _mmx2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _sse2, _mmx2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _ssse3, _mmx2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _sse4, _mmx2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _avx, _mmx2 ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _xop, _mmx2 ) +#endif +#endif +#if !HIGH_BIT_DEPTH && HAVE_ARMV6 +INTRA_MBCMP( sad, 4x4, v, h, dc, , _neon, _armv6 ) +INTRA_MBCMP(satd, 4x4, v, h, dc, , _neon, _armv6 ) +INTRA_MBCMP( sad, 8x8, dc, h, v, c, _neon, _neon ) +INTRA_MBCMP(satd, 8x8, dc, h, v, c, _neon, _neon ) +INTRA_MBCMP( sad, 8x16, dc, h, v, c, _neon, _c ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _neon, _c ) +INTRA_MBCMP( sad, 16x16, v, h, dc, , _neon, _neon ) +INTRA_MBCMP(satd, 16x16, v, h, dc, , _neon, _neon ) +#endif +#if !HIGH_BIT_DEPTH && ARCH_AARCH64 +INTRA_MBCMP( sad, 4x4, v, h, dc, , _neon, _neon ) +INTRA_MBCMP(satd, 4x4, v, h, dc, , _neon, _neon ) +INTRA_MBCMP( sad, 8x8, dc, h, v, c, _neon, _neon ) +INTRA_MBCMP(satd, 8x8, dc, h, v, c, _neon, _neon ) +INTRA_MBCMP( sad, 8x16, dc, h, v, c, _neon, _neon ) +INTRA_MBCMP(satd, 8x16, dc, h, v, c, _neon, _neon ) +INTRA_MBCMP( sad, 16x16, v, h, dc, , _neon, _neon ) +INTRA_MBCMP(satd, 16x16, v, h, dc, , _neon, _neon ) +#endif + +// No C implementation of intra_satd_x9. See checkasm for its behavior, +// or see x264_mb_analyse_intra for the entirely different algorithm we +// use when lacking an asm implementation of it. + + + +/**************************************************************************** + * structural similarity metric + ****************************************************************************/ +static void ssim_4x4x2_core( const pixel *pix1, intptr_t stride1, + const pixel *pix2, intptr_t stride2, + int sums[2][4] ) +{ + for( int z = 0; z < 2; z++ ) + { + uint32_t s1 = 0, s2 = 0, ss = 0, s12 = 0; + for( int y = 0; y < 4; y++ ) + for( int x = 0; x < 4; x++ ) + { + int a = pix1[x+y*stride1]; + int b = pix2[x+y*stride2]; + s1 += a; + s2 += b; + ss += a*a; + ss += b*b; + s12 += a*b; + } + sums[z][0] = s1; + sums[z][1] = s2; + sums[z][2] = ss; + sums[z][3] = s12; + pix1 += 4; + pix2 += 4; + } +} + +static float ssim_end1( int s1, int s2, int ss, int s12 ) +{ +/* Maximum value for 10-bit is: ss*64 = (2^10-1)^2*16*4*64 = 4286582784, which will overflow in some cases. + * s1*s1, s2*s2, and s1*s2 also obtain this value for edge cases: ((2^10-1)*16*4)^2 = 4286582784. + * Maximum value for 9-bit is: ss*64 = (2^9-1)^2*16*4*64 = 1069551616, which will not overflow. */ +#if BIT_DEPTH > 9 +#define type float + static const float ssim_c1 = .01*.01*PIXEL_MAX*PIXEL_MAX*64; + static const float ssim_c2 = .03*.03*PIXEL_MAX*PIXEL_MAX*64*63; +#else +#define type int + static const int ssim_c1 = (int)(.01*.01*PIXEL_MAX*PIXEL_MAX*64 + .5); + static const int ssim_c2 = (int)(.03*.03*PIXEL_MAX*PIXEL_MAX*64*63 + .5); +#endif + type fs1 = s1; + type fs2 = s2; + type fss = ss; + type fs12 = s12; + type vars = fss*64 - fs1*fs1 - fs2*fs2; + type covar = fs12*64 - fs1*fs2; + return (float)(2*fs1*fs2 + ssim_c1) * (float)(2*covar + ssim_c2) + / ((float)(fs1*fs1 + fs2*fs2 + ssim_c1) * (float)(vars + ssim_c2)); +#undef type +} + +static float ssim_end4( int sum0[5][4], int sum1[5][4], int width ) +{ + float ssim = 0.0; + for( int i = 0; i < width; i++ ) + ssim += ssim_end1( sum0[i][0] + sum0[i+1][0] + sum1[i][0] + sum1[i+1][0], + sum0[i][1] + sum0[i+1][1] + sum1[i][1] + sum1[i+1][1], + sum0[i][2] + sum0[i+1][2] + sum1[i][2] + sum1[i+1][2], + sum0[i][3] + sum0[i+1][3] + sum1[i][3] + sum1[i+1][3] ); + return ssim; +} + +float x264_pixel_ssim_wxh( x264_pixel_function_t *pf, + pixel *pix1, intptr_t stride1, + pixel *pix2, intptr_t stride2, + int width, int height, void *buf, int *cnt ) +{ + int z = 0; + float ssim = 0.0; + int (*sum0)[4] = buf; + int (*sum1)[4] = sum0 + (width >> 2) + 3; + width >>= 2; + height >>= 2; + for( int y = 1; y < height; y++ ) + { + for( ; z <= y; z++ ) + { + XCHG( void*, sum0, sum1 ); + for( int x = 0; x < width; x+=2 ) + pf->ssim_4x4x2_core( &pix1[4*(x+z*stride1)], stride1, &pix2[4*(x+z*stride2)], stride2, &sum0[x] ); + } + for( int x = 0; x < width-1; x += 4 ) + ssim += pf->ssim_end4( sum0+x, sum1+x, X264_MIN(4,width-x-1) ); + } + *cnt = (height-1) * (width-1); + return ssim; +} + +static int pixel_vsad( pixel *src, intptr_t stride, int height ) +{ + int score = 0; + for( int i = 1; i < height; i++, src += stride ) + for( int j = 0; j < 16; j++ ) + score += abs(src[j] - src[j+stride]); + return score; +} + +int x264_field_vsad( x264_t *h, int mb_x, int mb_y ) +{ + int score_field, score_frame; + int stride = h->fenc->i_stride[0]; + int mb_stride = h->mb.i_mb_stride; + pixel *fenc = h->fenc->plane[0] + 16 * (mb_x + mb_y * stride); + int mb_xy = mb_x + mb_y*mb_stride; + + /* We don't want to analyze pixels outside the frame, as it gives inaccurate results. */ + int mbpair_height = X264_MIN( h->param.i_height - mb_y * 16, 32 ); + score_frame = h->pixf.vsad( fenc, stride, mbpair_height ); + score_field = h->pixf.vsad( fenc, stride*2, mbpair_height >> 1 ); + score_field += h->pixf.vsad( fenc+stride, stride*2, mbpair_height >> 1 ); + + if( mb_x > 0 ) + score_field += 512 - h->mb.field[mb_xy -1]*1024; + if( mb_y > 0 ) + score_field += 512 - h->mb.field[mb_xy-mb_stride]*1024; + + return (score_field < score_frame); +} + +static int pixel_asd8( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height ) +{ + int sum = 0; + for( int y = 0; y < height; y++, pix1 += stride1, pix2 += stride2 ) + for( int x = 0; x < 8; x++ ) + sum += pix1[x] - pix2[x]; + return abs( sum ); +} + +/**************************************************************************** + * successive elimination + ****************************************************************************/ +static int x264_pixel_ads4( int enc_dc[4], uint16_t *sums, int delta, + uint16_t *cost_mvx, int16_t *mvs, int width, int thresh ) +{ + int nmv = 0; + for( int i = 0; i < width; i++, sums++ ) + { + int ads = abs( enc_dc[0] - sums[0] ) + + abs( enc_dc[1] - sums[8] ) + + abs( enc_dc[2] - sums[delta] ) + + abs( enc_dc[3] - sums[delta+8] ) + + cost_mvx[i]; + if( ads < thresh ) + mvs[nmv++] = i; + } + return nmv; +} + +static int x264_pixel_ads2( int enc_dc[2], uint16_t *sums, int delta, + uint16_t *cost_mvx, int16_t *mvs, int width, int thresh ) +{ + int nmv = 0; + for( int i = 0; i < width; i++, sums++ ) + { + int ads = abs( enc_dc[0] - sums[0] ) + + abs( enc_dc[1] - sums[delta] ) + + cost_mvx[i]; + if( ads < thresh ) + mvs[nmv++] = i; + } + return nmv; +} + +static int x264_pixel_ads1( int enc_dc[1], uint16_t *sums, int delta, + uint16_t *cost_mvx, int16_t *mvs, int width, int thresh ) +{ + int nmv = 0; + for( int i = 0; iname1[PIXEL_16x16] = x264_pixel_##name2##_16x16##cpu;\ + pixf->name1[PIXEL_16x8] = x264_pixel_##name2##_16x8##cpu; +#define INIT4_NAME( name1, name2, cpu ) \ + INIT2_NAME( name1, name2, cpu ) \ + pixf->name1[PIXEL_8x16] = x264_pixel_##name2##_8x16##cpu;\ + pixf->name1[PIXEL_8x8] = x264_pixel_##name2##_8x8##cpu; +#define INIT5_NAME( name1, name2, cpu ) \ + INIT4_NAME( name1, name2, cpu ) \ + pixf->name1[PIXEL_8x4] = x264_pixel_##name2##_8x4##cpu; +#define INIT6_NAME( name1, name2, cpu ) \ + INIT5_NAME( name1, name2, cpu ) \ + pixf->name1[PIXEL_4x8] = x264_pixel_##name2##_4x8##cpu; +#define INIT7_NAME( name1, name2, cpu ) \ + INIT6_NAME( name1, name2, cpu ) \ + pixf->name1[PIXEL_4x4] = x264_pixel_##name2##_4x4##cpu; +#define INIT8_NAME( name1, name2, cpu ) \ + INIT7_NAME( name1, name2, cpu ) \ + pixf->name1[PIXEL_4x16] = x264_pixel_##name2##_4x16##cpu; +#define INIT2( name, cpu ) INIT2_NAME( name, name, cpu ) +#define INIT4( name, cpu ) INIT4_NAME( name, name, cpu ) +#define INIT5( name, cpu ) INIT5_NAME( name, name, cpu ) +#define INIT6( name, cpu ) INIT6_NAME( name, name, cpu ) +#define INIT7( name, cpu ) INIT7_NAME( name, name, cpu ) +#define INIT8( name, cpu ) INIT8_NAME( name, name, cpu ) + +#define INIT_ADS( cpu ) \ + pixf->ads[PIXEL_16x16] = x264_pixel_ads4##cpu;\ + pixf->ads[PIXEL_16x8] = x264_pixel_ads2##cpu;\ + pixf->ads[PIXEL_8x8] = x264_pixel_ads1##cpu; + + INIT8( sad, ); + INIT8_NAME( sad_aligned, sad, ); + INIT7( sad_x3, ); + INIT7( sad_x4, ); + INIT8( ssd, ); + INIT8( satd, ); + INIT7( satd_x3, ); + INIT7( satd_x4, ); + INIT4( hadamard_ac, ); + INIT_ADS( ); + + pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16; + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16; + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8; + + pixf->ssd_nv12_core = pixel_ssd_nv12_core; + pixf->ssim_4x4x2_core = ssim_4x4x2_core; + pixf->ssim_end4 = ssim_end4; + pixf->vsad = pixel_vsad; + pixf->asd8 = pixel_asd8; + + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4; + pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8; + pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c; + pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16; + pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16; + +#if HIGH_BIT_DEPTH +#if HAVE_MMX + if( cpu&X264_CPU_MMX2 ) + { + INIT7( sad, _mmx2 ); + INIT7_NAME( sad_aligned, sad, _mmx2 ); + INIT7( sad_x3, _mmx2 ); + INIT7( sad_x4, _mmx2 ); + INIT8( satd, _mmx2 ); + INIT7( satd_x3, _mmx2 ); + INIT7( satd_x4, _mmx2 ); + INIT4( hadamard_ac, _mmx2 ); + INIT8( ssd, _mmx2 ); + INIT_ADS( _mmx2 ); + + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_mmx2; + pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_mmx2; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_mmx2; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_mmx2; + pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_mmx2; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_mmx2; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_mmx2; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_mmx2; + pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_mmx2; + } + if( cpu&X264_CPU_SSE2 ) + { + INIT4_NAME( sad_aligned, sad, _sse2_aligned ); + INIT5( ssd, _sse2 ); + INIT6( satd, _sse2 ); + pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_sse2; + + pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_sse2; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse2; +#if ARCH_X86_64 + pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_sse2; + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse2; +#endif + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_sse2; + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_sse2; + pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_sse2; + pixf->ssim_end4 = x264_pixel_ssim_end4_sse2; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_sse2; + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_sse2; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_sse2; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_sse2; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2; + } + if( (cpu&X264_CPU_SSE2) && !(cpu&X264_CPU_SSE2_IS_SLOW) ) + { + INIT5( sad, _sse2 ); + INIT2( sad_x3, _sse2 ); + INIT2( sad_x4, _sse2 ); + INIT_ADS( _sse2 ); + + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + INIT4( hadamard_ac, _sse2 ); + } + pixf->vsad = x264_pixel_vsad_sse2; + pixf->asd8 = x264_pixel_asd8_sse2; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_sse2; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_sse2; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_sse2; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse2; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_sse2; + } + if( cpu&X264_CPU_SSE2_IS_FAST ) + { + pixf->sad[PIXEL_8x16] = x264_pixel_sad_8x16_sse2; + pixf->sad_x3[PIXEL_8x16] = x264_pixel_sad_x3_8x16_sse2; + pixf->sad_x3[PIXEL_8x8] = x264_pixel_sad_x3_8x8_sse2; + pixf->sad_x3[PIXEL_8x4] = x264_pixel_sad_x3_8x4_sse2; + pixf->sad_x4[PIXEL_8x16] = x264_pixel_sad_x4_8x16_sse2; + pixf->sad_x4[PIXEL_8x8] = x264_pixel_sad_x4_8x8_sse2; + pixf->sad_x4[PIXEL_8x4] = x264_pixel_sad_x4_8x4_sse2; + } + if( cpu&X264_CPU_SSSE3 ) + { + INIT4_NAME( sad_aligned, sad, _ssse3_aligned ); + pixf->sad_aligned[PIXEL_4x4] = x264_pixel_sad_4x4_ssse3; + pixf->sad_aligned[PIXEL_4x8] = x264_pixel_sad_4x8_ssse3; + INIT7( sad, _ssse3 ); + INIT7( sad_x3, _ssse3 ); + INIT7( sad_x4, _ssse3 ); +#if ARCH_X86 || !defined( __MACH__ ) + INIT_ADS( _ssse3 ); +#endif + INIT6( satd, _ssse3 ); + pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_ssse3; + + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + INIT4( hadamard_ac, _ssse3 ); + } + pixf->vsad = x264_pixel_vsad_ssse3; + pixf->asd8 = x264_pixel_asd8_ssse3; + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_ssse3; + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_ssse3; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_ssse3; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_ssse3; +#endif + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_ssse3; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_ssse3; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_ssse3; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_ssse3; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_ssse3; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_ssse3; + } + if( cpu&X264_CPU_SSE4 ) + { + INIT6( satd, _sse4 ); + pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_sse4; + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + INIT4( hadamard_ac, _sse4 ); + } + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_sse4; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse4; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse4; +#endif + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse4; + } + if( cpu&X264_CPU_AVX ) + { + INIT5_NAME( sad_aligned, sad, _ssse3 ); /* AVX-capable CPUs doesn't benefit from an aligned version */ +#if ARCH_X86 || !defined( __MACH__ ) + INIT_ADS( _avx ); +#endif + INIT6( satd, _avx ); + pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_avx; + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + INIT4( hadamard_ac, _avx ); + } + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_avx; + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_avx; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_avx; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx; + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_avx; + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_avx; + pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_avx; + pixf->ssim_end4 = x264_pixel_ssim_end4_avx; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_avx; +#endif + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_avx; + } + if( cpu&X264_CPU_XOP ) + { + INIT5( sad_x3, _xop ); + INIT5( sad_x4, _xop ); + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_xop; + pixf->vsad = x264_pixel_vsad_xop; + pixf->asd8 = x264_pixel_asd8_xop; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_xop; +#endif + } + if( cpu&X264_CPU_AVX2 ) + { + INIT2( ssd, _avx2 ); + INIT2( sad, _avx2 ); + INIT2_NAME( sad_aligned, sad, _avx2 ); + INIT2( sad_x3, _avx2 ); + INIT2( sad_x4, _avx2 ); + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx2; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_avx2; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_avx2; + pixf->vsad = x264_pixel_vsad_avx2; + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_avx2; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_avx2; + } + if( cpu&X264_CPU_AVX512 ) + { + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_avx512; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx512; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_avx512; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_avx512; + } +#endif // HAVE_MMX +#else // !HIGH_BIT_DEPTH +#if HAVE_MMX + if( cpu&X264_CPU_MMX ) + { + INIT8( ssd, _mmx ); + } + + if( cpu&X264_CPU_MMX2 ) + { + INIT8( sad, _mmx2 ); + INIT8_NAME( sad_aligned, sad, _mmx2 ); + INIT7( sad_x3, _mmx2 ); + INIT7( sad_x4, _mmx2 ); + INIT8( satd, _mmx2 ); + INIT7( satd_x3, _mmx2 ); + INIT7( satd_x4, _mmx2 ); + INIT4( hadamard_ac, _mmx2 ); + INIT_ADS( _mmx2 ); +#if ARCH_X86 + pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_mmx2; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_mmx2; + pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_mmx2; + pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_mmx2; + pixf->vsad = x264_pixel_vsad_mmx2; + + if( cpu&X264_CPU_CACHELINE_32 ) + { + INIT5( sad, _cache32_mmx2 ); + INIT4( sad_x3, _cache32_mmx2 ); + INIT4( sad_x4, _cache32_mmx2 ); + } + else if( cpu&X264_CPU_CACHELINE_64 && !(cpu&X264_CPU_SLOW_ATOM) ) + { + INIT5( sad, _cache64_mmx2 ); + INIT4( sad_x3, _cache64_mmx2 ); + INIT4( sad_x4, _cache64_mmx2 ); + } +#else + if( cpu&X264_CPU_CACHELINE_64 && !(cpu&X264_CPU_SLOW_ATOM) ) + { + pixf->sad[PIXEL_8x16] = x264_pixel_sad_8x16_cache64_mmx2; + pixf->sad[PIXEL_8x8] = x264_pixel_sad_8x8_cache64_mmx2; + pixf->sad[PIXEL_8x4] = x264_pixel_sad_8x4_cache64_mmx2; + pixf->sad_x3[PIXEL_8x16] = x264_pixel_sad_x3_8x16_cache64_mmx2; + pixf->sad_x3[PIXEL_8x8] = x264_pixel_sad_x3_8x8_cache64_mmx2; + pixf->sad_x4[PIXEL_8x16] = x264_pixel_sad_x4_8x16_cache64_mmx2; + pixf->sad_x4[PIXEL_8x8] = x264_pixel_sad_x4_8x8_cache64_mmx2; + } +#endif + pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_mmx2; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_mmx2; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_mmx2; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_mmx2; + pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_mmx2; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_mmx2; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_mmx2; + pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_mmx2; + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_mmx2; + } + + if( cpu&X264_CPU_SSE2 ) + { + INIT5( ssd, _sse2slow ); + INIT2_NAME( sad_aligned, sad, _sse2_aligned ); + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_sse2; + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_sse2; + pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_sse2; + pixf->ssim_end4 = x264_pixel_ssim_end4_sse2; + pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_sse2; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse2; +#if ARCH_X86_64 + pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_sse2; + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse2; +#endif + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_sse2; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_sse2; + pixf->vsad = x264_pixel_vsad_sse2; + pixf->asd8 = x264_pixel_asd8_sse2; + } + + if( (cpu&X264_CPU_SSE2) && !(cpu&X264_CPU_SSE2_IS_SLOW) ) + { + INIT2( sad, _sse2 ); + INIT2( sad_x3, _sse2 ); + INIT2( sad_x4, _sse2 ); + INIT6( satd, _sse2 ); + pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_sse2; + INIT6( satd_x3, _sse2 ); + INIT6( satd_x4, _sse2 ); + INIT4( hadamard_ac, _sse2 ); + INIT_ADS( _sse2 ); + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_sse2; + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_sse2; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_sse2; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse2; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_sse2; + if( cpu&X264_CPU_CACHELINE_64 ) + { + INIT2( ssd, _sse2); /* faster for width 16 on p4 */ +#if ARCH_X86 + INIT2( sad, _cache64_sse2 ); + INIT2( sad_x3, _cache64_sse2 ); + INIT2( sad_x4, _cache64_sse2 ); +#endif + if( cpu&X264_CPU_SSE2_IS_FAST ) + { + pixf->sad_x3[PIXEL_8x16] = x264_pixel_sad_x3_8x16_cache64_sse2; + pixf->sad_x4[PIXEL_8x16] = x264_pixel_sad_x4_8x16_cache64_sse2; + } + } + } + + if( cpu&X264_CPU_SSE2_IS_FAST && !(cpu&X264_CPU_CACHELINE_64) ) + { + pixf->sad_aligned[PIXEL_8x16] = x264_pixel_sad_8x16_sse2; + pixf->sad[PIXEL_8x16] = x264_pixel_sad_8x16_sse2; + pixf->sad_x3[PIXEL_8x16] = x264_pixel_sad_x3_8x16_sse2; + pixf->sad_x3[PIXEL_8x8] = x264_pixel_sad_x3_8x8_sse2; + pixf->sad_x3[PIXEL_8x4] = x264_pixel_sad_x3_8x4_sse2; + pixf->sad_x4[PIXEL_8x16] = x264_pixel_sad_x4_8x16_sse2; + pixf->sad_x4[PIXEL_8x8] = x264_pixel_sad_x4_8x8_sse2; + pixf->sad_x4[PIXEL_8x4] = x264_pixel_sad_x4_8x4_sse2; + } + + if( (cpu&X264_CPU_SSE3) && (cpu&X264_CPU_CACHELINE_64) ) + { + INIT2( sad, _sse3 ); + INIT2( sad_x3, _sse3 ); + INIT2( sad_x4, _sse3 ); + } + + if( cpu&X264_CPU_SSSE3 ) + { + INIT4( hadamard_ac, _ssse3 ); + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + pixf->intra_sad_x9_4x4 = x264_intra_sad_x9_4x4_ssse3; + pixf->intra_satd_x9_4x4 = x264_intra_satd_x9_4x4_ssse3; + pixf->intra_sad_x9_8x8 = x264_intra_sad_x9_8x8_ssse3; +#if ARCH_X86_64 + pixf->intra_sa8d_x9_8x8 = x264_intra_sa8d_x9_8x8_ssse3; +#endif + } +#if ARCH_X86 || !defined( __MACH__ ) + INIT_ADS( _ssse3 ); +#endif + if( cpu&X264_CPU_SLOW_ATOM ) + { + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_ssse3_atom; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_ssse3_atom; + INIT6( satd, _ssse3_atom ); + pixf->satd[PIXEL_4x16] = x264_pixel_satd_4x16_ssse3_atom; + INIT6( satd_x3, _ssse3_atom ); + INIT6( satd_x4, _ssse3_atom ); + INIT4( hadamard_ac, _ssse3_atom ); +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_ssse3_atom; +#endif + } + else + { + INIT8( ssd, _ssse3 ); + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_ssse3; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_ssse3; + INIT8( satd, _ssse3 ); + INIT7( satd_x3, _ssse3 ); + INIT7( satd_x4, _ssse3 ); +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_ssse3; +#endif + } + pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_ssse3; + if( !(cpu&X264_CPU_SLOW_PSHUFB) ) + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_ssse3; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_ssse3; + pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_ssse3; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_ssse3; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_ssse3; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_ssse3; + pixf->asd8 = x264_pixel_asd8_ssse3; + if( cpu&X264_CPU_CACHELINE_64 ) + { + INIT2( sad, _cache64_ssse3 ); + INIT2( sad_x3, _cache64_ssse3 ); + INIT2( sad_x4, _cache64_ssse3 ); + } + else + { + INIT2( sad_x3, _ssse3 ); + INIT5( sad_x4, _ssse3 ); + } + if( (cpu&X264_CPU_SLOW_ATOM) || (cpu&X264_CPU_SLOW_SHUFFLE) ) + { + INIT5( ssd, _sse2 ); /* on conroe, sse2 is faster for width8/16 */ + } + } + + if( cpu&X264_CPU_SSE4 ) + { + INIT8( satd, _sse4 ); + INIT7( satd_x3, _sse4 ); + INIT7( satd_x4, _sse4 ); + INIT4( hadamard_ac, _sse4 ); + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + pixf->intra_sad_x9_4x4 = x264_intra_sad_x9_4x4_sse4; + pixf->intra_satd_x9_4x4 = x264_intra_satd_x9_4x4_sse4; + pixf->intra_sad_x9_8x8 = x264_intra_sad_x9_8x8_sse4; +#if ARCH_X86_64 + pixf->intra_sa8d_x9_8x8 = x264_intra_sa8d_x9_8x8_sse4; +#endif + } + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_sse4; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_sse4; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_sse4; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_sse4; +#endif + } + + if( cpu&X264_CPU_AVX ) + { + INIT2_NAME( sad_aligned, sad, _sse2 ); /* AVX-capable CPUs doesn't benefit from an aligned version */ + INIT2( sad_x3, _avx ); + INIT2( sad_x4, _avx ); + INIT8( satd, _avx ); + INIT7( satd_x3, _avx ); + INIT7( satd_x4, _avx ); +#if ARCH_X86 || !defined( __MACH__ ) + INIT_ADS( _avx ); +#endif + INIT4( hadamard_ac, _avx ); + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + pixf->intra_sad_x9_4x4 = x264_intra_sad_x9_4x4_avx; + pixf->intra_satd_x9_4x4 = x264_intra_satd_x9_4x4_avx; + pixf->intra_sad_x9_8x8 = x264_intra_sad_x9_8x8_avx; +#if ARCH_X86_64 + pixf->intra_sa8d_x9_8x8 = x264_intra_sa8d_x9_8x8_avx; +#endif + } + INIT5( ssd, _avx ); + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_avx; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_avx; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_avx; + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_avx; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx; + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_avx; + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_avx; + pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_avx; + pixf->ssim_end4 = x264_pixel_ssim_end4_avx; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_avx; +#endif + } + + if( cpu&X264_CPU_XOP ) + { + INIT7( satd, _xop ); + INIT7( satd_x3, _xop ); + INIT7( satd_x4, _xop ); + INIT4( hadamard_ac, _xop ); + if( !(cpu&X264_CPU_STACK_MOD4) ) + { + pixf->intra_satd_x9_4x4 = x264_intra_satd_x9_4x4_xop; + } + INIT5( ssd, _xop ); + pixf->sa8d[PIXEL_16x16]= x264_pixel_sa8d_16x16_xop; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_xop; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_xop; + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_xop; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_xop; +#endif + } + + if( cpu&X264_CPU_AVX2 ) + { + INIT2( ssd, _avx2 ); + INIT2( sad_x3, _avx2 ); + INIT2( sad_x4, _avx2 ); + INIT4( satd, _avx2 ); + INIT2( hadamard_ac, _avx2 ); +#if ARCH_X86 || !defined( __MACH__ ) + INIT_ADS( _avx2 ); +#endif + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_avx2; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx2; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_avx2; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_avx2; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_avx2; + pixf->intra_sad_x9_8x8 = x264_intra_sad_x9_8x8_avx2; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_avx2; + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_avx2; +#if ARCH_X86_64 + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_avx2; +#endif + } + + if( cpu&X264_CPU_AVX512 ) + { + INIT8( sad, _avx512 ); + INIT8_NAME( sad_aligned, sad, _avx512 ); + INIT7( sad_x3, _avx512 ); + INIT7( sad_x4, _avx512 ); + INIT8( satd, _avx512 ); + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_avx512; + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_avx512; + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_avx512; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_avx512; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_avx512; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_avx512; + } +#endif //HAVE_MMX + +#if HAVE_ARMV6 + if( cpu&X264_CPU_ARMV6 ) + { + pixf->sad[PIXEL_4x8] = x264_pixel_sad_4x8_armv6; + pixf->sad[PIXEL_4x4] = x264_pixel_sad_4x4_armv6; + pixf->sad_aligned[PIXEL_4x8] = x264_pixel_sad_4x8_armv6; + pixf->sad_aligned[PIXEL_4x4] = x264_pixel_sad_4x4_armv6; + } + if( cpu&X264_CPU_NEON ) + { + INIT5( sad, _neon ); + INIT5( sad_aligned, _neon ); + INIT7( sad_x3, _neon ); + INIT7( sad_x4, _neon ); + INIT7( ssd, _neon ); + INIT7( satd, _neon ); + INIT7( satd_x3, _neon ); + INIT7( satd_x4, _neon ); + INIT4( hadamard_ac, _neon ); + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_neon; + pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_neon; + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_neon; + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_neon; + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_neon; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_neon; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_neon; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_neon; + pixf->vsad = x264_pixel_vsad_neon; + pixf->asd8 = x264_pixel_asd8_neon; + + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_neon; + pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_neon; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_neon; + pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_neon; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_neon; + pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_neon; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_neon; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_neon; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_neon; + pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_neon; + + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_neon; + pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_neon; + pixf->ssim_end4 = x264_pixel_ssim_end4_neon; + + if( cpu&X264_CPU_FAST_NEON_MRC ) + { + pixf->sad[PIXEL_4x8] = x264_pixel_sad_4x8_neon; + pixf->sad[PIXEL_4x4] = x264_pixel_sad_4x4_neon; + pixf->sad_aligned[PIXEL_4x8] = x264_pixel_sad_aligned_4x8_neon; + pixf->sad_aligned[PIXEL_4x4] = x264_pixel_sad_aligned_4x4_neon; + } + else // really just scheduled for dual issue / A8 + { + INIT5( sad_aligned, _neon_dual ); + } + } +#endif + +#if ARCH_AARCH64 + if( cpu&X264_CPU_NEON ) + { + INIT8( sad, _neon ); + // AArch64 has no distinct instructions for aligned load/store + INIT8_NAME( sad_aligned, sad, _neon ); + INIT7( sad_x3, _neon ); + INIT7( sad_x4, _neon ); + INIT8( ssd, _neon ); + INIT8( satd, _neon ); + INIT7( satd_x3, _neon ); + INIT7( satd_x4, _neon ); + INIT4( hadamard_ac, _neon ); + + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_neon; + pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_neon; + pixf->sa8d_satd[PIXEL_16x16] = x264_pixel_sa8d_satd_16x16_neon; + + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_neon; + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_neon; + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_neon; + pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_neon; + pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_neon; + pixf->vsad = x264_pixel_vsad_neon; + pixf->asd8 = x264_pixel_asd8_neon; + + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_neon; + pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_neon; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_neon; + pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_neon; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_neon; + pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_neon; + pixf->intra_sad_x3_8x16c = x264_intra_sad_x3_8x16c_neon; + pixf->intra_satd_x3_8x16c = x264_intra_satd_x3_8x16c_neon; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_neon; + pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_neon; + + pixf->ssd_nv12_core = x264_pixel_ssd_nv12_core_neon; + pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_neon; + pixf->ssim_end4 = x264_pixel_ssim_end4_neon; + } +#endif // ARCH_AARCH64 + +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + INIT8( sad, _msa ); + INIT8_NAME( sad_aligned, sad, _msa ); + INIT8( ssd, _msa ); + INIT7( sad_x3, _msa ); + INIT7( sad_x4, _msa ); + INIT8( satd, _msa ); + INIT4( hadamard_ac, _msa ); + + pixf->intra_sad_x3_4x4 = x264_intra_sad_x3_4x4_msa; + pixf->intra_sad_x3_8x8 = x264_intra_sad_x3_8x8_msa; + pixf->intra_sad_x3_8x8c = x264_intra_sad_x3_8x8c_msa; + pixf->intra_sad_x3_16x16 = x264_intra_sad_x3_16x16_msa; + pixf->intra_satd_x3_4x4 = x264_intra_satd_x3_4x4_msa; + pixf->intra_satd_x3_16x16 = x264_intra_satd_x3_16x16_msa; + pixf->intra_satd_x3_8x8c = x264_intra_satd_x3_8x8c_msa; + pixf->intra_sa8d_x3_8x8 = x264_intra_sa8d_x3_8x8_msa; + + pixf->ssim_4x4x2_core = x264_ssim_4x4x2_core_msa; + + pixf->var[PIXEL_16x16] = x264_pixel_var_16x16_msa; + pixf->var[PIXEL_8x16] = x264_pixel_var_8x16_msa; + pixf->var[PIXEL_8x8] = x264_pixel_var_8x8_msa; + //pixf->var2[PIXEL_8x16] = x264_pixel_var2_8x16_msa; + //pixf->var2[PIXEL_8x8] = x264_pixel_var2_8x8_msa; + pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_msa; + pixf->sa8d[PIXEL_8x8] = x264_pixel_sa8d_8x8_msa; + } +#endif // HAVE_MSA + +#endif // HIGH_BIT_DEPTH +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + { + x264_pixel_init_altivec( pixf ); + } +#endif + + pixf->ads[PIXEL_8x16] = + pixf->ads[PIXEL_8x4] = + pixf->ads[PIXEL_4x8] = pixf->ads[PIXEL_16x8]; + pixf->ads[PIXEL_4x4] = pixf->ads[PIXEL_8x8]; +} + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.h new file mode 100644 index 00000000..d4dbfaf2 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/pixel.h @@ -0,0 +1,155 @@ +/***************************************************************************** + * pixel.c: pixel metrics + ***************************************************************************** + * Copyright (C) 2004-2017 x264 project + * + * Authors: Loren Merritt + * Fiona Glaser + Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_PIXEL_H +#define X264_PIXEL_H + +// SSD assumes all args aligned +// other cmp functions assume first arg aligned +typedef int (*x264_pixel_cmp_t)( pixel *, intptr_t, pixel *, intptr_t ); +typedef void (*x264_pixel_cmp_x3_t)( pixel *, pixel *, pixel *, pixel *, intptr_t, int[3] ); +typedef void (*x264_pixel_cmp_x4_t)( pixel *, pixel *, pixel *, pixel *, pixel *, intptr_t, int[4] ); + +enum +{ + PIXEL_16x16 = 0, + PIXEL_16x8 = 1, + PIXEL_8x16 = 2, + PIXEL_8x8 = 3, + PIXEL_8x4 = 4, + PIXEL_4x8 = 5, + PIXEL_4x4 = 6, + + /* Subsampled chroma only */ + PIXEL_4x16 = 7, /* 4:2:2 */ + PIXEL_4x2 = 8, + PIXEL_2x8 = 9, /* 4:2:2 */ + PIXEL_2x4 = 10, + PIXEL_2x2 = 11, +}; + +static const struct { uint8_t w, h; } x264_pixel_size[12] = +{ + { 16, 16 }, { 16, 8 }, { 8, 16 }, { 8, 8 }, { 8, 4 }, { 4, 8 }, { 4, 4 }, + { 4, 16 }, { 4, 2 }, { 2, 8 }, { 2, 4 }, { 2, 2 }, +}; + +static const uint8_t x264_size2pixel[5][5] = +{ + { 0, }, + { 0, PIXEL_4x4, PIXEL_8x4, 0, 0 }, + { 0, PIXEL_4x8, PIXEL_8x8, 0, PIXEL_16x8 }, + { 0, }, + { 0, 0, PIXEL_8x16, 0, PIXEL_16x16 } +}; + +static const uint8_t x264_luma2chroma_pixel[4][7] = +{ + { 0 }, + { PIXEL_8x8, PIXEL_8x4, PIXEL_4x8, PIXEL_4x4, PIXEL_4x2, PIXEL_2x4, PIXEL_2x2 }, /* 4:2:0 */ + { PIXEL_8x16, PIXEL_8x8, PIXEL_4x16, PIXEL_4x8, PIXEL_4x4, PIXEL_2x8, PIXEL_2x4 }, /* 4:2:2 */ + { PIXEL_16x16, PIXEL_16x8, PIXEL_8x16, PIXEL_8x8, PIXEL_8x4, PIXEL_4x8, PIXEL_4x4 }, /* 4:4:4 */ +}; + +typedef struct +{ + x264_pixel_cmp_t sad[8]; + x264_pixel_cmp_t ssd[8]; + x264_pixel_cmp_t satd[8]; + x264_pixel_cmp_t ssim[7]; + x264_pixel_cmp_t sa8d[4]; + x264_pixel_cmp_t mbcmp[8]; /* either satd or sad for subpel refine and mode decision */ + x264_pixel_cmp_t mbcmp_unaligned[8]; /* unaligned mbcmp for subpel */ + x264_pixel_cmp_t fpelcmp[8]; /* either satd or sad for fullpel motion search */ + x264_pixel_cmp_x3_t fpelcmp_x3[7]; + x264_pixel_cmp_x4_t fpelcmp_x4[7]; + x264_pixel_cmp_t sad_aligned[8]; /* Aligned SAD for mbcmp */ + int (*vsad)( pixel *, intptr_t, int ); + int (*asd8)( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height ); + uint64_t (*sa8d_satd[1])( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); + + uint64_t (*var[4])( pixel *pix, intptr_t stride ); + int (*var2[4])( pixel *fenc, pixel *fdec, int ssd[2] ); + uint64_t (*hadamard_ac[4])( pixel *pix, intptr_t stride ); + + void (*ssd_nv12_core)( pixel *pixuv1, intptr_t stride1, + pixel *pixuv2, intptr_t stride2, int width, int height, + uint64_t *ssd_u, uint64_t *ssd_v ); + void (*ssim_4x4x2_core)( const pixel *pix1, intptr_t stride1, + const pixel *pix2, intptr_t stride2, int sums[2][4] ); + float (*ssim_end4)( int sum0[5][4], int sum1[5][4], int width ); + + /* multiple parallel calls to cmp. */ + x264_pixel_cmp_x3_t sad_x3[7]; + x264_pixel_cmp_x4_t sad_x4[7]; + x264_pixel_cmp_x3_t satd_x3[7]; + x264_pixel_cmp_x4_t satd_x4[7]; + + /* abs-diff-sum for successive elimination. + * may round width up to a multiple of 16. */ + int (*ads[7])( int enc_dc[4], uint16_t *sums, int delta, + uint16_t *cost_mvx, int16_t *mvs, int width, int thresh ); + + /* calculate satd or sad of V, H, and DC modes. */ + void (*intra_mbcmp_x3_16x16)( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_satd_x3_16x16) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_sad_x3_16x16) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_mbcmp_x3_4x4) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_satd_x3_4x4) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_sad_x3_4x4) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_mbcmp_x3_chroma)( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_satd_x3_chroma) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_sad_x3_chroma) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_mbcmp_x3_8x16c) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_satd_x3_8x16c) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_sad_x3_8x16c) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_mbcmp_x3_8x8c) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_satd_x3_8x8c) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_sad_x3_8x8c) ( pixel *fenc, pixel *fdec, int res[3] ); + void (*intra_mbcmp_x3_8x8) ( pixel *fenc, pixel edge[36], int res[3] ); + void (*intra_sa8d_x3_8x8) ( pixel *fenc, pixel edge[36], int res[3] ); + void (*intra_sad_x3_8x8) ( pixel *fenc, pixel edge[36], int res[3] ); + /* find minimum satd or sad of all modes, and set fdec. + * may be NULL, in which case just use pred+satd instead. */ + int (*intra_mbcmp_x9_4x4)( pixel *fenc, pixel *fdec, uint16_t *bitcosts ); + int (*intra_satd_x9_4x4) ( pixel *fenc, pixel *fdec, uint16_t *bitcosts ); + int (*intra_sad_x9_4x4) ( pixel *fenc, pixel *fdec, uint16_t *bitcosts ); + int (*intra_mbcmp_x9_8x8)( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds ); + int (*intra_sa8d_x9_8x8) ( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds ); + int (*intra_sad_x9_8x8) ( pixel *fenc, pixel *fdec, pixel edge[36], uint16_t *bitcosts, uint16_t *satds ); +} x264_pixel_function_t; + +void x264_pixel_init( int cpu, x264_pixel_function_t *pixf ); +void x264_pixel_ssd_nv12 ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2, + int i_width, int i_height, uint64_t *ssd_u, uint64_t *ssd_v ); +uint64_t x264_pixel_ssd_wxh( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2, + int i_width, int i_height ); +float x264_pixel_ssim_wxh ( x264_pixel_function_t *pf, pixel *pix1, intptr_t i_pix1, pixel *pix2, intptr_t i_pix2, + int i_width, int i_height, void *buf, int *cnt ); +int x264_field_vsad( x264_t *h, int mb_x, int mb_y ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.c new file mode 100644 index 00000000..8163f942 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.c @@ -0,0 +1,1054 @@ +/***************************************************************************** + * predict.c: intra prediction + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +/* predict4x4 are inspired from ffmpeg h264 decoder */ + + +#include "common.h" + +#if HAVE_MMX +# include "x86/predict.h" +#endif +#if ARCH_PPC +# include "ppc/predict.h" +#endif +#if ARCH_ARM +# include "arm/predict.h" +#endif +#if ARCH_AARCH64 +# include "aarch64/predict.h" +#endif +#if ARCH_MIPS +# include "mips/predict.h" +#endif + +/**************************************************************************** + * 16x16 prediction for intra luma block + ****************************************************************************/ + +#define PREDICT_16x16_DC(v)\ + for( int i = 0; i < 16; i++ )\ + {\ + MPIXEL_X4( src+ 0 ) = v;\ + MPIXEL_X4( src+ 4 ) = v;\ + MPIXEL_X4( src+ 8 ) = v;\ + MPIXEL_X4( src+12 ) = v;\ + src += FDEC_STRIDE;\ + } + +void x264_predict_16x16_dc_c( pixel *src ) +{ + int dc = 0; + + for( int i = 0; i < 16; i++ ) + { + dc += src[-1 + i * FDEC_STRIDE]; + dc += src[i - FDEC_STRIDE]; + } + pixel4 dcsplat = PIXEL_SPLAT_X4( ( dc + 16 ) >> 5 ); + + PREDICT_16x16_DC( dcsplat ); +} +static void x264_predict_16x16_dc_left_c( pixel *src ) +{ + int dc = 0; + + for( int i = 0; i < 16; i++ ) + dc += src[-1 + i * FDEC_STRIDE]; + pixel4 dcsplat = PIXEL_SPLAT_X4( ( dc + 8 ) >> 4 ); + + PREDICT_16x16_DC( dcsplat ); +} +static void x264_predict_16x16_dc_top_c( pixel *src ) +{ + int dc = 0; + + for( int i = 0; i < 16; i++ ) + dc += src[i - FDEC_STRIDE]; + pixel4 dcsplat = PIXEL_SPLAT_X4( ( dc + 8 ) >> 4 ); + + PREDICT_16x16_DC( dcsplat ); +} +static void x264_predict_16x16_dc_128_c( pixel *src ) +{ + PREDICT_16x16_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) ); +} +void x264_predict_16x16_h_c( pixel *src ) +{ + for( int i = 0; i < 16; i++ ) + { + const pixel4 v = PIXEL_SPLAT_X4( src[-1] ); + MPIXEL_X4( src+ 0 ) = v; + MPIXEL_X4( src+ 4 ) = v; + MPIXEL_X4( src+ 8 ) = v; + MPIXEL_X4( src+12 ) = v; + src += FDEC_STRIDE; + } +} +void x264_predict_16x16_v_c( pixel *src ) +{ + pixel4 v0 = MPIXEL_X4( &src[ 0-FDEC_STRIDE] ); + pixel4 v1 = MPIXEL_X4( &src[ 4-FDEC_STRIDE] ); + pixel4 v2 = MPIXEL_X4( &src[ 8-FDEC_STRIDE] ); + pixel4 v3 = MPIXEL_X4( &src[12-FDEC_STRIDE] ); + + for( int i = 0; i < 16; i++ ) + { + MPIXEL_X4( src+ 0 ) = v0; + MPIXEL_X4( src+ 4 ) = v1; + MPIXEL_X4( src+ 8 ) = v2; + MPIXEL_X4( src+12 ) = v3; + src += FDEC_STRIDE; + } +} +void x264_predict_16x16_p_c( pixel *src ) +{ + int H = 0, V = 0; + + /* calculate H and V */ + for( int i = 0; i <= 7; i++ ) + { + H += ( i + 1 ) * ( src[ 8 + i - FDEC_STRIDE ] - src[6 -i -FDEC_STRIDE] ); + V += ( i + 1 ) * ( src[-1 + (8+i)*FDEC_STRIDE] - src[-1 + (6-i)*FDEC_STRIDE] ); + } + + int a = 16 * ( src[-1 + 15*FDEC_STRIDE] + src[15 - FDEC_STRIDE] ); + int b = ( 5 * H + 32 ) >> 6; + int c = ( 5 * V + 32 ) >> 6; + + int i00 = a - b * 7 - c * 7 + 16; + + for( int y = 0; y < 16; y++ ) + { + int pix = i00; + for( int x = 0; x < 16; x++ ) + { + src[x] = x264_clip_pixel( pix>>5 ); + pix += b; + } + src += FDEC_STRIDE; + i00 += c; + } +} + + +/**************************************************************************** + * 8x8 prediction for intra chroma block (4:2:0) + ****************************************************************************/ + +static void x264_predict_8x8c_dc_128_c( pixel *src ) +{ + for( int y = 0; y < 8; y++ ) + { + MPIXEL_X4( src+0 ) = PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ); + MPIXEL_X4( src+4 ) = PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ); + src += FDEC_STRIDE; + } +} +static void x264_predict_8x8c_dc_left_c( pixel *src ) +{ + int dc0 = 0, dc1 = 0; + + for( int y = 0; y < 4; y++ ) + { + dc0 += src[y * FDEC_STRIDE - 1]; + dc1 += src[(y+4) * FDEC_STRIDE - 1]; + } + pixel4 dc0splat = PIXEL_SPLAT_X4( ( dc0 + 2 ) >> 2 ); + pixel4 dc1splat = PIXEL_SPLAT_X4( ( dc1 + 2 ) >> 2 ); + + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc0splat; + MPIXEL_X4( src+4 ) = dc0splat; + src += FDEC_STRIDE; + } + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc1splat; + MPIXEL_X4( src+4 ) = dc1splat; + src += FDEC_STRIDE; + } + +} +static void x264_predict_8x8c_dc_top_c( pixel *src ) +{ + int dc0 = 0, dc1 = 0; + + for( int x = 0; x < 4; x++ ) + { + dc0 += src[x - FDEC_STRIDE]; + dc1 += src[x + 4 - FDEC_STRIDE]; + } + pixel4 dc0splat = PIXEL_SPLAT_X4( ( dc0 + 2 ) >> 2 ); + pixel4 dc1splat = PIXEL_SPLAT_X4( ( dc1 + 2 ) >> 2 ); + + for( int y = 0; y < 8; y++ ) + { + MPIXEL_X4( src+0 ) = dc0splat; + MPIXEL_X4( src+4 ) = dc1splat; + src += FDEC_STRIDE; + } +} +void x264_predict_8x8c_dc_c( pixel *src ) +{ + int s0 = 0, s1 = 0, s2 = 0, s3 = 0; + + /* + s0 s1 + s2 + s3 + */ + for( int i = 0; i < 4; i++ ) + { + s0 += src[i - FDEC_STRIDE]; + s1 += src[i + 4 - FDEC_STRIDE]; + s2 += src[-1 + i * FDEC_STRIDE]; + s3 += src[-1 + (i+4)*FDEC_STRIDE]; + } + /* + dc0 dc1 + dc2 dc3 + */ + pixel4 dc0 = PIXEL_SPLAT_X4( ( s0 + s2 + 4 ) >> 3 ); + pixel4 dc1 = PIXEL_SPLAT_X4( ( s1 + 2 ) >> 2 ); + pixel4 dc2 = PIXEL_SPLAT_X4( ( s3 + 2 ) >> 2 ); + pixel4 dc3 = PIXEL_SPLAT_X4( ( s1 + s3 + 4 ) >> 3 ); + + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc0; + MPIXEL_X4( src+4 ) = dc1; + src += FDEC_STRIDE; + } + + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc2; + MPIXEL_X4( src+4 ) = dc3; + src += FDEC_STRIDE; + } +} +void x264_predict_8x8c_h_c( pixel *src ) +{ + for( int i = 0; i < 8; i++ ) + { + pixel4 v = PIXEL_SPLAT_X4( src[-1] ); + MPIXEL_X4( src+0 ) = v; + MPIXEL_X4( src+4 ) = v; + src += FDEC_STRIDE; + } +} +void x264_predict_8x8c_v_c( pixel *src ) +{ + pixel4 v0 = MPIXEL_X4( src+0-FDEC_STRIDE ); + pixel4 v1 = MPIXEL_X4( src+4-FDEC_STRIDE ); + + for( int i = 0; i < 8; i++ ) + { + MPIXEL_X4( src+0 ) = v0; + MPIXEL_X4( src+4 ) = v1; + src += FDEC_STRIDE; + } +} +void x264_predict_8x8c_p_c( pixel *src ) +{ + int H = 0, V = 0; + + for( int i = 0; i < 4; i++ ) + { + H += ( i + 1 ) * ( src[4+i - FDEC_STRIDE] - src[2 - i -FDEC_STRIDE] ); + V += ( i + 1 ) * ( src[-1 +(i+4)*FDEC_STRIDE] - src[-1+(2-i)*FDEC_STRIDE] ); + } + + int a = 16 * ( src[-1+7*FDEC_STRIDE] + src[7 - FDEC_STRIDE] ); + int b = ( 17 * H + 16 ) >> 5; + int c = ( 17 * V + 16 ) >> 5; + int i00 = a -3*b -3*c + 16; + + for( int y = 0; y < 8; y++ ) + { + int pix = i00; + for( int x = 0; x < 8; x++ ) + { + src[x] = x264_clip_pixel( pix>>5 ); + pix += b; + } + src += FDEC_STRIDE; + i00 += c; + } +} + +/**************************************************************************** + * 8x16 prediction for intra chroma block (4:2:2) + ****************************************************************************/ + +static void x264_predict_8x16c_dc_128_c( pixel *src ) +{ + for( int y = 0; y < 16; y++ ) + { + MPIXEL_X4( src+0 ) = PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ); + MPIXEL_X4( src+4 ) = PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ); + src += FDEC_STRIDE; + } +} +static void x264_predict_8x16c_dc_left_c( pixel *src ) +{ + for( int i = 0; i < 4; i++ ) + { + int dc = 0; + + for( int y = 0; y < 4; y++ ) + dc += src[y*FDEC_STRIDE - 1]; + + pixel4 dcsplat = PIXEL_SPLAT_X4( (dc + 2) >> 2 ); + + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dcsplat; + MPIXEL_X4( src+4 ) = dcsplat; + src += FDEC_STRIDE; + } + } +} +static void x264_predict_8x16c_dc_top_c( pixel *src ) +{ + int dc0 = 0, dc1 = 0; + + for( int x = 0; x < 4; x++ ) + { + dc0 += src[x - FDEC_STRIDE]; + dc1 += src[x + 4 - FDEC_STRIDE]; + } + pixel4 dc0splat = PIXEL_SPLAT_X4( ( dc0 + 2 ) >> 2 ); + pixel4 dc1splat = PIXEL_SPLAT_X4( ( dc1 + 2 ) >> 2 ); + + for( int y = 0; y < 16; y++ ) + { + MPIXEL_X4( src+0 ) = dc0splat; + MPIXEL_X4( src+4 ) = dc1splat; + src += FDEC_STRIDE; + } +} +void x264_predict_8x16c_dc_c( pixel *src ) +{ + int s0 = 0, s1 = 0, s2 = 0, s3 = 0, s4 = 0, s5 = 0; + + /* + s0 s1 + s2 + s3 + s4 + s5 + */ + for( int i = 0; i < 4; i++ ) + { + s0 += src[i+0 - FDEC_STRIDE]; + s1 += src[i+4 - FDEC_STRIDE]; + s2 += src[-1 + (i+0) * FDEC_STRIDE]; + s3 += src[-1 + (i+4) * FDEC_STRIDE]; + s4 += src[-1 + (i+8) * FDEC_STRIDE]; + s5 += src[-1 + (i+12) * FDEC_STRIDE]; + } + /* + dc0 dc1 + dc2 dc3 + dc4 dc5 + dc6 dc7 + */ + pixel4 dc0 = PIXEL_SPLAT_X4( ( s0 + s2 + 4 ) >> 3 ); + pixel4 dc1 = PIXEL_SPLAT_X4( ( s1 + 2 ) >> 2 ); + pixel4 dc2 = PIXEL_SPLAT_X4( ( s3 + 2 ) >> 2 ); + pixel4 dc3 = PIXEL_SPLAT_X4( ( s1 + s3 + 4 ) >> 3 ); + pixel4 dc4 = PIXEL_SPLAT_X4( ( s4 + 2 ) >> 2 ); + pixel4 dc5 = PIXEL_SPLAT_X4( ( s1 + s4 + 4 ) >> 3 ); + pixel4 dc6 = PIXEL_SPLAT_X4( ( s5 + 2 ) >> 2 ); + pixel4 dc7 = PIXEL_SPLAT_X4( ( s1 + s5 + 4 ) >> 3 ); + + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc0; + MPIXEL_X4( src+4 ) = dc1; + src += FDEC_STRIDE; + } + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc2; + MPIXEL_X4( src+4 ) = dc3; + src += FDEC_STRIDE; + } + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc4; + MPIXEL_X4( src+4 ) = dc5; + src += FDEC_STRIDE; + } + for( int y = 0; y < 4; y++ ) + { + MPIXEL_X4( src+0 ) = dc6; + MPIXEL_X4( src+4 ) = dc7; + src += FDEC_STRIDE; + } +} +void x264_predict_8x16c_h_c( pixel *src ) +{ + for( int i = 0; i < 16; i++ ) + { + pixel4 v = PIXEL_SPLAT_X4( src[-1] ); + MPIXEL_X4( src+0 ) = v; + MPIXEL_X4( src+4 ) = v; + src += FDEC_STRIDE; + } +} +void x264_predict_8x16c_v_c( pixel *src ) +{ + pixel4 v0 = MPIXEL_X4( src+0-FDEC_STRIDE ); + pixel4 v1 = MPIXEL_X4( src+4-FDEC_STRIDE ); + + for( int i = 0; i < 16; i++ ) + { + MPIXEL_X4( src+0 ) = v0; + MPIXEL_X4( src+4 ) = v1; + src += FDEC_STRIDE; + } +} +void x264_predict_8x16c_p_c( pixel *src ) +{ + int H = 0; + int V = 0; + + for( int i = 0; i < 4; i++ ) + H += ( i + 1 ) * ( src[4 + i - FDEC_STRIDE] - src[2 - i - FDEC_STRIDE] ); + for( int i = 0; i < 8; i++ ) + V += ( i + 1 ) * ( src[-1 + (i+8)*FDEC_STRIDE] - src[-1 + (6-i)*FDEC_STRIDE] ); + + int a = 16 * ( src[-1 + 15*FDEC_STRIDE] + src[7 - FDEC_STRIDE] ); + int b = ( 17 * H + 16 ) >> 5; + int c = ( 5 * V + 32 ) >> 6; + int i00 = a -3*b -7*c + 16; + + for( int y = 0; y < 16; y++ ) + { + int pix = i00; + for( int x = 0; x < 8; x++ ) + { + src[x] = x264_clip_pixel( pix>>5 ); + pix += b; + } + src += FDEC_STRIDE; + i00 += c; + } +} + +/**************************************************************************** + * 4x4 prediction for intra luma block + ****************************************************************************/ + +#define SRC(x,y) src[(x)+(y)*FDEC_STRIDE] +#define SRC_X4(x,y) MPIXEL_X4( &SRC(x,y) ) + +#define PREDICT_4x4_DC(v)\ + SRC_X4(0,0) = SRC_X4(0,1) = SRC_X4(0,2) = SRC_X4(0,3) = v; + +static void x264_predict_4x4_dc_128_c( pixel *src ) +{ + PREDICT_4x4_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) ); +} +static void x264_predict_4x4_dc_left_c( pixel *src ) +{ + pixel4 dc = PIXEL_SPLAT_X4( (SRC(-1,0) + SRC(-1,1) + SRC(-1,2) + SRC(-1,3) + 2) >> 2 ); + PREDICT_4x4_DC( dc ); +} +static void x264_predict_4x4_dc_top_c( pixel *src ) +{ + pixel4 dc = PIXEL_SPLAT_X4( (SRC(0,-1) + SRC(1,-1) + SRC(2,-1) + SRC(3,-1) + 2) >> 2 ); + PREDICT_4x4_DC( dc ); +} +void x264_predict_4x4_dc_c( pixel *src ) +{ + pixel4 dc = PIXEL_SPLAT_X4( (SRC(-1,0) + SRC(-1,1) + SRC(-1,2) + SRC(-1,3) + + SRC(0,-1) + SRC(1,-1) + SRC(2,-1) + SRC(3,-1) + 4) >> 3 ); + PREDICT_4x4_DC( dc ); +} +void x264_predict_4x4_h_c( pixel *src ) +{ + SRC_X4(0,0) = PIXEL_SPLAT_X4( SRC(-1,0) ); + SRC_X4(0,1) = PIXEL_SPLAT_X4( SRC(-1,1) ); + SRC_X4(0,2) = PIXEL_SPLAT_X4( SRC(-1,2) ); + SRC_X4(0,3) = PIXEL_SPLAT_X4( SRC(-1,3) ); +} +void x264_predict_4x4_v_c( pixel *src ) +{ + PREDICT_4x4_DC(SRC_X4(0,-1)); +} + +#define PREDICT_4x4_LOAD_LEFT\ + int l0 = SRC(-1,0);\ + int l1 = SRC(-1,1);\ + int l2 = SRC(-1,2);\ + UNUSED int l3 = SRC(-1,3); + +#define PREDICT_4x4_LOAD_TOP\ + int t0 = SRC(0,-1);\ + int t1 = SRC(1,-1);\ + int t2 = SRC(2,-1);\ + UNUSED int t3 = SRC(3,-1); + +#define PREDICT_4x4_LOAD_TOP_RIGHT\ + int t4 = SRC(4,-1);\ + int t5 = SRC(5,-1);\ + int t6 = SRC(6,-1);\ + UNUSED int t7 = SRC(7,-1); + +#define F1(a,b) (((a)+(b)+1)>>1) +#define F2(a,b,c) (((a)+2*(b)+(c)+2)>>2) + +static void x264_predict_4x4_ddl_c( pixel *src ) +{ + PREDICT_4x4_LOAD_TOP + PREDICT_4x4_LOAD_TOP_RIGHT + SRC(0,0)= F2(t0,t1,t2); + SRC(1,0)=SRC(0,1)= F2(t1,t2,t3); + SRC(2,0)=SRC(1,1)=SRC(0,2)= F2(t2,t3,t4); + SRC(3,0)=SRC(2,1)=SRC(1,2)=SRC(0,3)= F2(t3,t4,t5); + SRC(3,1)=SRC(2,2)=SRC(1,3)= F2(t4,t5,t6); + SRC(3,2)=SRC(2,3)= F2(t5,t6,t7); + SRC(3,3)= F2(t6,t7,t7); +} +static void x264_predict_4x4_ddr_c( pixel *src ) +{ + int lt = SRC(-1,-1); + PREDICT_4x4_LOAD_LEFT + PREDICT_4x4_LOAD_TOP + SRC(3,0)= F2(t3,t2,t1); + SRC(2,0)=SRC(3,1)= F2(t2,t1,t0); + SRC(1,0)=SRC(2,1)=SRC(3,2)= F2(t1,t0,lt); + SRC(0,0)=SRC(1,1)=SRC(2,2)=SRC(3,3)= F2(t0,lt,l0); + SRC(0,1)=SRC(1,2)=SRC(2,3)= F2(lt,l0,l1); + SRC(0,2)=SRC(1,3)= F2(l0,l1,l2); + SRC(0,3)= F2(l1,l2,l3); +} + +static void x264_predict_4x4_vr_c( pixel *src ) +{ + int lt = SRC(-1,-1); + PREDICT_4x4_LOAD_LEFT + PREDICT_4x4_LOAD_TOP + SRC(0,3)= F2(l2,l1,l0); + SRC(0,2)= F2(l1,l0,lt); + SRC(0,1)=SRC(1,3)= F2(l0,lt,t0); + SRC(0,0)=SRC(1,2)= F1(lt,t0); + SRC(1,1)=SRC(2,3)= F2(lt,t0,t1); + SRC(1,0)=SRC(2,2)= F1(t0,t1); + SRC(2,1)=SRC(3,3)= F2(t0,t1,t2); + SRC(2,0)=SRC(3,2)= F1(t1,t2); + SRC(3,1)= F2(t1,t2,t3); + SRC(3,0)= F1(t2,t3); +} + +static void x264_predict_4x4_hd_c( pixel *src ) +{ + int lt= SRC(-1,-1); + PREDICT_4x4_LOAD_LEFT + PREDICT_4x4_LOAD_TOP + SRC(0,3)= F1(l2,l3); + SRC(1,3)= F2(l1,l2,l3); + SRC(0,2)=SRC(2,3)= F1(l1,l2); + SRC(1,2)=SRC(3,3)= F2(l0,l1,l2); + SRC(0,1)=SRC(2,2)= F1(l0,l1); + SRC(1,1)=SRC(3,2)= F2(lt,l0,l1); + SRC(0,0)=SRC(2,1)= F1(lt,l0); + SRC(1,0)=SRC(3,1)= F2(t0,lt,l0); + SRC(2,0)= F2(t1,t0,lt); + SRC(3,0)= F2(t2,t1,t0); +} + +static void x264_predict_4x4_vl_c( pixel *src ) +{ + PREDICT_4x4_LOAD_TOP + PREDICT_4x4_LOAD_TOP_RIGHT + SRC(0,0)= F1(t0,t1); + SRC(0,1)= F2(t0,t1,t2); + SRC(1,0)=SRC(0,2)= F1(t1,t2); + SRC(1,1)=SRC(0,3)= F2(t1,t2,t3); + SRC(2,0)=SRC(1,2)= F1(t2,t3); + SRC(2,1)=SRC(1,3)= F2(t2,t3,t4); + SRC(3,0)=SRC(2,2)= F1(t3,t4); + SRC(3,1)=SRC(2,3)= F2(t3,t4,t5); + SRC(3,2)= F1(t4,t5); + SRC(3,3)= F2(t4,t5,t6); +} + +static void x264_predict_4x4_hu_c( pixel *src ) +{ + PREDICT_4x4_LOAD_LEFT + SRC(0,0)= F1(l0,l1); + SRC(1,0)= F2(l0,l1,l2); + SRC(2,0)=SRC(0,1)= F1(l1,l2); + SRC(3,0)=SRC(1,1)= F2(l1,l2,l3); + SRC(2,1)=SRC(0,2)= F1(l2,l3); + SRC(3,1)=SRC(1,2)= F2(l2,l3,l3); + SRC(3,2)=SRC(1,3)=SRC(0,3)= + SRC(2,2)=SRC(2,3)=SRC(3,3)= l3; +} + +/**************************************************************************** + * 8x8 prediction for intra luma block + ****************************************************************************/ + +#define PL(y) \ + edge[14-y] = F2(SRC(-1,y-1), SRC(-1,y), SRC(-1,y+1)); +#define PT(x) \ + edge[16+x] = F2(SRC(x-1,-1), SRC(x,-1), SRC(x+1,-1)); + +static void x264_predict_8x8_filter_c( pixel *src, pixel edge[36], int i_neighbor, int i_filters ) +{ + /* edge[7..14] = l7..l0 + * edge[15] = lt + * edge[16..31] = t0 .. t15 + * edge[32] = t15 */ + + int have_lt = i_neighbor & MB_TOPLEFT; + if( i_filters & MB_LEFT ) + { + edge[15] = (SRC(0,-1) + 2*SRC(-1,-1) + SRC(-1,0) + 2) >> 2; + edge[14] = ((have_lt ? SRC(-1,-1) : SRC(-1,0)) + + 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; + PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) + edge[6] = + edge[7] = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2; + } + + if( i_filters & MB_TOP ) + { + int have_tr = i_neighbor & MB_TOPRIGHT; + edge[16] = ((have_lt ? SRC(-1,-1) : SRC(0,-1)) + + 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; + PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) + edge[23] = (SRC(6,-1) + 2*SRC(7,-1) + + (have_tr ? SRC(8,-1) : SRC(7,-1)) + 2) >> 2; + + if( i_filters & MB_TOPRIGHT ) + { + if( have_tr ) + { + PT(8) PT(9) PT(10) PT(11) PT(12) PT(13) PT(14) + edge[31] = + edge[32] = (SRC(14,-1) + 3*SRC(15,-1) + 2) >> 2; + } + else + { + MPIXEL_X4( edge+24 ) = PIXEL_SPLAT_X4( SRC(7,-1) ); + MPIXEL_X4( edge+28 ) = PIXEL_SPLAT_X4( SRC(7,-1) ); + edge[32] = SRC(7,-1); + } + } + } +} + +#undef PL +#undef PT + +#define PL(y) \ + UNUSED int l##y = edge[14-y]; +#define PT(x) \ + UNUSED int t##x = edge[16+x]; +#define PREDICT_8x8_LOAD_TOPLEFT \ + int lt = edge[15]; +#define PREDICT_8x8_LOAD_LEFT \ + PL(0) PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) PL(7) +#define PREDICT_8x8_LOAD_TOP \ + PT(0) PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) PT(7) +#define PREDICT_8x8_LOAD_TOPRIGHT \ + PT(8) PT(9) PT(10) PT(11) PT(12) PT(13) PT(14) PT(15) + +#define PREDICT_8x8_DC(v) \ + for( int y = 0; y < 8; y++ ) { \ + MPIXEL_X4( src+0 ) = v; \ + MPIXEL_X4( src+4 ) = v; \ + src += FDEC_STRIDE; \ + } + +static void x264_predict_8x8_dc_128_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_DC( PIXEL_SPLAT_X4( 1 << (BIT_DEPTH-1) ) ); +} +static void x264_predict_8x8_dc_left_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_LEFT + pixel4 dc = PIXEL_SPLAT_X4( (l0+l1+l2+l3+l4+l5+l6+l7+4) >> 3 ); + PREDICT_8x8_DC( dc ); +} +static void x264_predict_8x8_dc_top_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_TOP + pixel4 dc = PIXEL_SPLAT_X4( (t0+t1+t2+t3+t4+t5+t6+t7+4) >> 3 ); + PREDICT_8x8_DC( dc ); +} +void x264_predict_8x8_dc_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_LEFT + PREDICT_8x8_LOAD_TOP + pixel4 dc = PIXEL_SPLAT_X4( (l0+l1+l2+l3+l4+l5+l6+l7+t0+t1+t2+t3+t4+t5+t6+t7+8) >> 4 ); + PREDICT_8x8_DC( dc ); +} +void x264_predict_8x8_h_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_LEFT +#define ROW(y) MPIXEL_X4( src+y*FDEC_STRIDE+0 ) =\ + MPIXEL_X4( src+y*FDEC_STRIDE+4 ) = PIXEL_SPLAT_X4( l##y ); + ROW(0); ROW(1); ROW(2); ROW(3); ROW(4); ROW(5); ROW(6); ROW(7); +#undef ROW +} +void x264_predict_8x8_v_c( pixel *src, pixel edge[36] ) +{ + pixel4 top[2] = { MPIXEL_X4( edge+16 ), + MPIXEL_X4( edge+20 ) }; + for( int y = 0; y < 8; y++ ) + { + MPIXEL_X4( src+y*FDEC_STRIDE+0 ) = top[0]; + MPIXEL_X4( src+y*FDEC_STRIDE+4 ) = top[1]; + } +} +static void x264_predict_8x8_ddl_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_TOP + PREDICT_8x8_LOAD_TOPRIGHT + SRC(0,0)= F2(t0,t1,t2); + SRC(0,1)=SRC(1,0)= F2(t1,t2,t3); + SRC(0,2)=SRC(1,1)=SRC(2,0)= F2(t2,t3,t4); + SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= F2(t3,t4,t5); + SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= F2(t4,t5,t6); + SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= F2(t5,t6,t7); + SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= F2(t6,t7,t8); + SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= F2(t7,t8,t9); + SRC(1,7)=SRC(2,6)=SRC(3,5)=SRC(4,4)=SRC(5,3)=SRC(6,2)=SRC(7,1)= F2(t8,t9,t10); + SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= F2(t9,t10,t11); + SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= F2(t10,t11,t12); + SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= F2(t11,t12,t13); + SRC(5,7)=SRC(6,6)=SRC(7,5)= F2(t12,t13,t14); + SRC(6,7)=SRC(7,6)= F2(t13,t14,t15); + SRC(7,7)= F2(t14,t15,t15); +} +static void x264_predict_8x8_ddr_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_TOP + PREDICT_8x8_LOAD_LEFT + PREDICT_8x8_LOAD_TOPLEFT + SRC(0,7)= F2(l7,l6,l5); + SRC(0,6)=SRC(1,7)= F2(l6,l5,l4); + SRC(0,5)=SRC(1,6)=SRC(2,7)= F2(l5,l4,l3); + SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= F2(l4,l3,l2); + SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= F2(l3,l2,l1); + SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= F2(l2,l1,l0); + SRC(0,1)=SRC(1,2)=SRC(2,3)=SRC(3,4)=SRC(4,5)=SRC(5,6)=SRC(6,7)= F2(l1,l0,lt); + SRC(0,0)=SRC(1,1)=SRC(2,2)=SRC(3,3)=SRC(4,4)=SRC(5,5)=SRC(6,6)=SRC(7,7)= F2(l0,lt,t0); + SRC(1,0)=SRC(2,1)=SRC(3,2)=SRC(4,3)=SRC(5,4)=SRC(6,5)=SRC(7,6)= F2(lt,t0,t1); + SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= F2(t0,t1,t2); + SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= F2(t1,t2,t3); + SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= F2(t2,t3,t4); + SRC(5,0)=SRC(6,1)=SRC(7,2)= F2(t3,t4,t5); + SRC(6,0)=SRC(7,1)= F2(t4,t5,t6); + SRC(7,0)= F2(t5,t6,t7); + +} +static void x264_predict_8x8_vr_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_TOP + PREDICT_8x8_LOAD_LEFT + PREDICT_8x8_LOAD_TOPLEFT + SRC(0,6)= F2(l5,l4,l3); + SRC(0,7)= F2(l6,l5,l4); + SRC(0,4)=SRC(1,6)= F2(l3,l2,l1); + SRC(0,5)=SRC(1,7)= F2(l4,l3,l2); + SRC(0,2)=SRC(1,4)=SRC(2,6)= F2(l1,l0,lt); + SRC(0,3)=SRC(1,5)=SRC(2,7)= F2(l2,l1,l0); + SRC(0,1)=SRC(1,3)=SRC(2,5)=SRC(3,7)= F2(l0,lt,t0); + SRC(0,0)=SRC(1,2)=SRC(2,4)=SRC(3,6)= F1(lt,t0); + SRC(1,1)=SRC(2,3)=SRC(3,5)=SRC(4,7)= F2(lt,t0,t1); + SRC(1,0)=SRC(2,2)=SRC(3,4)=SRC(4,6)= F1(t0,t1); + SRC(2,1)=SRC(3,3)=SRC(4,5)=SRC(5,7)= F2(t0,t1,t2); + SRC(2,0)=SRC(3,2)=SRC(4,4)=SRC(5,6)= F1(t1,t2); + SRC(3,1)=SRC(4,3)=SRC(5,5)=SRC(6,7)= F2(t1,t2,t3); + SRC(3,0)=SRC(4,2)=SRC(5,4)=SRC(6,6)= F1(t2,t3); + SRC(4,1)=SRC(5,3)=SRC(6,5)=SRC(7,7)= F2(t2,t3,t4); + SRC(4,0)=SRC(5,2)=SRC(6,4)=SRC(7,6)= F1(t3,t4); + SRC(5,1)=SRC(6,3)=SRC(7,5)= F2(t3,t4,t5); + SRC(5,0)=SRC(6,2)=SRC(7,4)= F1(t4,t5); + SRC(6,1)=SRC(7,3)= F2(t4,t5,t6); + SRC(6,0)=SRC(7,2)= F1(t5,t6); + SRC(7,1)= F2(t5,t6,t7); + SRC(7,0)= F1(t6,t7); +} +static void x264_predict_8x8_hd_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_TOP + PREDICT_8x8_LOAD_LEFT + PREDICT_8x8_LOAD_TOPLEFT + int p1 = pack_pixel_1to2(F1(l6,l7), F2(l5,l6,l7)); + int p2 = pack_pixel_1to2(F1(l5,l6), F2(l4,l5,l6)); + int p3 = pack_pixel_1to2(F1(l4,l5), F2(l3,l4,l5)); + int p4 = pack_pixel_1to2(F1(l3,l4), F2(l2,l3,l4)); + int p5 = pack_pixel_1to2(F1(l2,l3), F2(l1,l2,l3)); + int p6 = pack_pixel_1to2(F1(l1,l2), F2(l0,l1,l2)); + int p7 = pack_pixel_1to2(F1(l0,l1), F2(lt,l0,l1)); + int p8 = pack_pixel_1to2(F1(lt,l0), F2(l0,lt,t0)); + int p9 = pack_pixel_1to2(F2(t1,t0,lt), F2(t2,t1,t0)); + int p10 = pack_pixel_1to2(F2(t3,t2,t1), F2(t4,t3,t2)); + int p11 = pack_pixel_1to2(F2(t5,t4,t3), F2(t6,t5,t4)); + SRC_X4(0,7)= pack_pixel_2to4(p1,p2); + SRC_X4(0,6)= pack_pixel_2to4(p2,p3); + SRC_X4(4,7)=SRC_X4(0,5)= pack_pixel_2to4(p3,p4); + SRC_X4(4,6)=SRC_X4(0,4)= pack_pixel_2to4(p4,p5); + SRC_X4(4,5)=SRC_X4(0,3)= pack_pixel_2to4(p5,p6); + SRC_X4(4,4)=SRC_X4(0,2)= pack_pixel_2to4(p6,p7); + SRC_X4(4,3)=SRC_X4(0,1)= pack_pixel_2to4(p7,p8); + SRC_X4(4,2)=SRC_X4(0,0)= pack_pixel_2to4(p8,p9); + SRC_X4(4,1)= pack_pixel_2to4(p9,p10); + SRC_X4(4,0)= pack_pixel_2to4(p10,p11); +} +static void x264_predict_8x8_vl_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_TOP + PREDICT_8x8_LOAD_TOPRIGHT + SRC(0,0)= F1(t0,t1); + SRC(0,1)= F2(t0,t1,t2); + SRC(0,2)=SRC(1,0)= F1(t1,t2); + SRC(0,3)=SRC(1,1)= F2(t1,t2,t3); + SRC(0,4)=SRC(1,2)=SRC(2,0)= F1(t2,t3); + SRC(0,5)=SRC(1,3)=SRC(2,1)= F2(t2,t3,t4); + SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= F1(t3,t4); + SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= F2(t3,t4,t5); + SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= F1(t4,t5); + SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= F2(t4,t5,t6); + SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= F1(t5,t6); + SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= F2(t5,t6,t7); + SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= F1(t6,t7); + SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= F2(t6,t7,t8); + SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= F1(t7,t8); + SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= F2(t7,t8,t9); + SRC(5,6)=SRC(6,4)=SRC(7,2)= F1(t8,t9); + SRC(5,7)=SRC(6,5)=SRC(7,3)= F2(t8,t9,t10); + SRC(6,6)=SRC(7,4)= F1(t9,t10); + SRC(6,7)=SRC(7,5)= F2(t9,t10,t11); + SRC(7,6)= F1(t10,t11); + SRC(7,7)= F2(t10,t11,t12); +} +static void x264_predict_8x8_hu_c( pixel *src, pixel edge[36] ) +{ + PREDICT_8x8_LOAD_LEFT + int p1 = pack_pixel_1to2(F1(l0,l1), F2(l0,l1,l2)); + int p2 = pack_pixel_1to2(F1(l1,l2), F2(l1,l2,l3)); + int p3 = pack_pixel_1to2(F1(l2,l3), F2(l2,l3,l4)); + int p4 = pack_pixel_1to2(F1(l3,l4), F2(l3,l4,l5)); + int p5 = pack_pixel_1to2(F1(l4,l5), F2(l4,l5,l6)); + int p6 = pack_pixel_1to2(F1(l5,l6), F2(l5,l6,l7)); + int p7 = pack_pixel_1to2(F1(l6,l7), F2(l6,l7,l7)); + int p8 = pack_pixel_1to2(l7,l7); + SRC_X4(0,0)= pack_pixel_2to4(p1,p2); + SRC_X4(0,1)= pack_pixel_2to4(p2,p3); + SRC_X4(4,0)=SRC_X4(0,2)= pack_pixel_2to4(p3,p4); + SRC_X4(4,1)=SRC_X4(0,3)= pack_pixel_2to4(p4,p5); + SRC_X4(4,2)=SRC_X4(0,4)= pack_pixel_2to4(p5,p6); + SRC_X4(4,3)=SRC_X4(0,5)= pack_pixel_2to4(p6,p7); + SRC_X4(4,4)=SRC_X4(0,6)= pack_pixel_2to4(p7,p8); + SRC_X4(4,5)=SRC_X4(4,6)= SRC_X4(0,7) = SRC_X4(4,7) = pack_pixel_2to4(p8,p8); +} + +/**************************************************************************** + * Exported functions: + ****************************************************************************/ +void x264_predict_16x16_init( int cpu, x264_predict_t pf[7] ) +{ + pf[I_PRED_16x16_V ] = x264_predict_16x16_v_c; + pf[I_PRED_16x16_H ] = x264_predict_16x16_h_c; + pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_c; + pf[I_PRED_16x16_P ] = x264_predict_16x16_p_c; + pf[I_PRED_16x16_DC_LEFT]= x264_predict_16x16_dc_left_c; + pf[I_PRED_16x16_DC_TOP ]= x264_predict_16x16_dc_top_c; + pf[I_PRED_16x16_DC_128 ]= x264_predict_16x16_dc_128_c; + +#if HAVE_MMX + x264_predict_16x16_init_mmx( cpu, pf ); +#endif + +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + x264_predict_16x16_init_altivec( pf ); +#endif + +#if HAVE_ARMV6 + x264_predict_16x16_init_arm( cpu, pf ); +#endif + +#if ARCH_AARCH64 + x264_predict_16x16_init_aarch64( cpu, pf ); +#endif + +#if !HIGH_BIT_DEPTH +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + pf[I_PRED_16x16_V ] = x264_intra_predict_vert_16x16_msa; + pf[I_PRED_16x16_H ] = x264_intra_predict_hor_16x16_msa; + pf[I_PRED_16x16_DC] = x264_intra_predict_dc_16x16_msa; + pf[I_PRED_16x16_P ] = x264_intra_predict_plane_16x16_msa; + pf[I_PRED_16x16_DC_LEFT]= x264_intra_predict_dc_left_16x16_msa; + pf[I_PRED_16x16_DC_TOP ]= x264_intra_predict_dc_top_16x16_msa; + pf[I_PRED_16x16_DC_128 ]= x264_intra_predict_dc_128_16x16_msa; + } +#endif +#endif +} + +void x264_predict_8x8c_init( int cpu, x264_predict_t pf[7] ) +{ + pf[I_PRED_CHROMA_V ] = x264_predict_8x8c_v_c; + pf[I_PRED_CHROMA_H ] = x264_predict_8x8c_h_c; + pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_c; + pf[I_PRED_CHROMA_P ] = x264_predict_8x8c_p_c; + pf[I_PRED_CHROMA_DC_LEFT]= x264_predict_8x8c_dc_left_c; + pf[I_PRED_CHROMA_DC_TOP ]= x264_predict_8x8c_dc_top_c; + pf[I_PRED_CHROMA_DC_128 ]= x264_predict_8x8c_dc_128_c; + +#if HAVE_MMX + x264_predict_8x8c_init_mmx( cpu, pf ); +#endif + +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + x264_predict_8x8c_init_altivec( pf ); +#endif + +#if HAVE_ARMV6 + x264_predict_8x8c_init_arm( cpu, pf ); +#endif + +#if ARCH_AARCH64 + x264_predict_8x8c_init_aarch64( cpu, pf ); +#endif + +#if !HIGH_BIT_DEPTH +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + pf[I_PRED_CHROMA_P ] = x264_intra_predict_plane_8x8_msa; + } +#endif +#endif +} + +void x264_predict_8x16c_init( int cpu, x264_predict_t pf[7] ) +{ + pf[I_PRED_CHROMA_V ] = x264_predict_8x16c_v_c; + pf[I_PRED_CHROMA_H ] = x264_predict_8x16c_h_c; + pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_c; + pf[I_PRED_CHROMA_P ] = x264_predict_8x16c_p_c; + pf[I_PRED_CHROMA_DC_LEFT]= x264_predict_8x16c_dc_left_c; + pf[I_PRED_CHROMA_DC_TOP ]= x264_predict_8x16c_dc_top_c; + pf[I_PRED_CHROMA_DC_128 ]= x264_predict_8x16c_dc_128_c; + +#if HAVE_MMX + x264_predict_8x16c_init_mmx( cpu, pf ); +#endif + +#if HAVE_ARMV6 + x264_predict_8x16c_init_arm( cpu, pf ); +#endif + +#if ARCH_AARCH64 + x264_predict_8x16c_init_aarch64( cpu, pf ); +#endif +} + +void x264_predict_8x8_init( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter ) +{ + pf[I_PRED_8x8_V] = x264_predict_8x8_v_c; + pf[I_PRED_8x8_H] = x264_predict_8x8_h_c; + pf[I_PRED_8x8_DC] = x264_predict_8x8_dc_c; + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_c; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_c; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_c; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_c; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_c; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_c; + pf[I_PRED_8x8_DC_LEFT]= x264_predict_8x8_dc_left_c; + pf[I_PRED_8x8_DC_TOP] = x264_predict_8x8_dc_top_c; + pf[I_PRED_8x8_DC_128] = x264_predict_8x8_dc_128_c; + *predict_filter = x264_predict_8x8_filter_c; + +#if HAVE_MMX + x264_predict_8x8_init_mmx( cpu, pf, predict_filter ); +#endif + +#if HAVE_ARMV6 + x264_predict_8x8_init_arm( cpu, pf, predict_filter ); +#endif + +#if ARCH_AARCH64 + x264_predict_8x8_init_aarch64( cpu, pf, predict_filter ); +#endif + +#if !HIGH_BIT_DEPTH +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + pf[I_PRED_8x8_DDL] = x264_intra_predict_ddl_8x8_msa; + } +#endif +#endif +} + +void x264_predict_4x4_init( int cpu, x264_predict_t pf[12] ) +{ + pf[I_PRED_4x4_V] = x264_predict_4x4_v_c; + pf[I_PRED_4x4_H] = x264_predict_4x4_h_c; + pf[I_PRED_4x4_DC] = x264_predict_4x4_dc_c; + pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_c; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_c; + pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_c; + pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_c; + pf[I_PRED_4x4_VL] = x264_predict_4x4_vl_c; + pf[I_PRED_4x4_HU] = x264_predict_4x4_hu_c; + pf[I_PRED_4x4_DC_LEFT]= x264_predict_4x4_dc_left_c; + pf[I_PRED_4x4_DC_TOP] = x264_predict_4x4_dc_top_c; + pf[I_PRED_4x4_DC_128] = x264_predict_4x4_dc_128_c; + +#if HAVE_MMX + x264_predict_4x4_init_mmx( cpu, pf ); +#endif + +#if HAVE_ARMV6 + x264_predict_4x4_init_arm( cpu, pf ); +#endif + +#if ARCH_AARCH64 + x264_predict_4x4_init_aarch64( cpu, pf ); +#endif +} + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.h new file mode 100644 index 00000000..9ec94763 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/predict.h @@ -0,0 +1,138 @@ +/***************************************************************************** + * predict.h: intra prediction + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_PREDICT_H +#define X264_PREDICT_H + +typedef void (*x264_predict_t)( pixel *src ); +typedef void (*x264_predict8x8_t)( pixel *src, pixel edge[36] ); +typedef void (*x264_predict_8x8_filter_t)( pixel *src, pixel edge[36], int i_neighbor, int i_filters ); + +enum intra_chroma_pred_e +{ + I_PRED_CHROMA_DC = 0, + I_PRED_CHROMA_H = 1, + I_PRED_CHROMA_V = 2, + I_PRED_CHROMA_P = 3, + + I_PRED_CHROMA_DC_LEFT = 4, + I_PRED_CHROMA_DC_TOP = 5, + I_PRED_CHROMA_DC_128 = 6 +}; +static const uint8_t x264_mb_chroma_pred_mode_fix[7] = +{ + I_PRED_CHROMA_DC, I_PRED_CHROMA_H, I_PRED_CHROMA_V, I_PRED_CHROMA_P, + I_PRED_CHROMA_DC, I_PRED_CHROMA_DC,I_PRED_CHROMA_DC +}; + +enum intra16x16_pred_e +{ + I_PRED_16x16_V = 0, + I_PRED_16x16_H = 1, + I_PRED_16x16_DC = 2, + I_PRED_16x16_P = 3, + + I_PRED_16x16_DC_LEFT = 4, + I_PRED_16x16_DC_TOP = 5, + I_PRED_16x16_DC_128 = 6, +}; +static const uint8_t x264_mb_pred_mode16x16_fix[7] = +{ + I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, I_PRED_16x16_P, + I_PRED_16x16_DC,I_PRED_16x16_DC,I_PRED_16x16_DC +}; + +enum intra4x4_pred_e +{ + I_PRED_4x4_V = 0, + I_PRED_4x4_H = 1, + I_PRED_4x4_DC = 2, + I_PRED_4x4_DDL= 3, + I_PRED_4x4_DDR= 4, + I_PRED_4x4_VR = 5, + I_PRED_4x4_HD = 6, + I_PRED_4x4_VL = 7, + I_PRED_4x4_HU = 8, + + I_PRED_4x4_DC_LEFT = 9, + I_PRED_4x4_DC_TOP = 10, + I_PRED_4x4_DC_128 = 11, +}; +static const int8_t x264_mb_pred_mode4x4_fix[13] = +{ + -1, + I_PRED_4x4_V, I_PRED_4x4_H, I_PRED_4x4_DC, + I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR, + I_PRED_4x4_HD, I_PRED_4x4_VL, I_PRED_4x4_HU, + I_PRED_4x4_DC, I_PRED_4x4_DC, I_PRED_4x4_DC +}; +#define x264_mb_pred_mode4x4_fix(t) x264_mb_pred_mode4x4_fix[(t)+1] + +/* must use the same numbering as intra4x4_pred_e */ +enum intra8x8_pred_e +{ + I_PRED_8x8_V = 0, + I_PRED_8x8_H = 1, + I_PRED_8x8_DC = 2, + I_PRED_8x8_DDL= 3, + I_PRED_8x8_DDR= 4, + I_PRED_8x8_VR = 5, + I_PRED_8x8_HD = 6, + I_PRED_8x8_VL = 7, + I_PRED_8x8_HU = 8, + + I_PRED_8x8_DC_LEFT = 9, + I_PRED_8x8_DC_TOP = 10, + I_PRED_8x8_DC_128 = 11, +}; + +void x264_predict_8x8_dc_c ( pixel *src, pixel edge[36] ); +void x264_predict_8x8_h_c ( pixel *src, pixel edge[36] ); +void x264_predict_8x8_v_c ( pixel *src, pixel edge[36] ); +void x264_predict_4x4_dc_c ( pixel *src ); +void x264_predict_4x4_h_c ( pixel *src ); +void x264_predict_4x4_v_c ( pixel *src ); +void x264_predict_16x16_dc_c( pixel *src ); +void x264_predict_16x16_h_c ( pixel *src ); +void x264_predict_16x16_v_c ( pixel *src ); +void x264_predict_16x16_p_c ( pixel *src ); +void x264_predict_8x8c_dc_c ( pixel *src ); +void x264_predict_8x8c_h_c ( pixel *src ); +void x264_predict_8x8c_v_c ( pixel *src ); +void x264_predict_8x8c_p_c ( pixel *src ); +void x264_predict_8x16c_dc_c( pixel *src ); +void x264_predict_8x16c_h_c ( pixel *src ); +void x264_predict_8x16c_v_c ( pixel *src ); +void x264_predict_8x16c_p_c ( pixel *src ); + +void x264_predict_16x16_init ( int cpu, x264_predict_t pf[7] ); +void x264_predict_8x8c_init ( int cpu, x264_predict_t pf[7] ); +void x264_predict_8x16c_init ( int cpu, x264_predict_t pf[7] ); +void x264_predict_4x4_init ( int cpu, x264_predict_t pf[12] ); +void x264_predict_8x8_init ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter ); + + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.c new file mode 100644 index 00000000..ae962226 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.c @@ -0,0 +1,830 @@ +/***************************************************************************** + * quant.c: quantization and level-run + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Loren Merritt + * Fiona Glaser + * Christian Heine + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#if HAVE_MMX +#include "x86/quant.h" +#endif +#if ARCH_PPC +# include "ppc/quant.h" +#endif +#if ARCH_ARM +# include "arm/quant.h" +#endif +#if ARCH_AARCH64 +# include "aarch64/quant.h" +#endif +#if ARCH_MIPS +# include "mips/quant.h" +#endif + +#define QUANT_ONE( coef, mf, f ) \ +{ \ + if( (coef) > 0 ) \ + (coef) = (f + (coef)) * (mf) >> 16; \ + else \ + (coef) = - ((f - (coef)) * (mf) >> 16); \ + nz |= (coef); \ +} + +static int quant_8x8( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] ) +{ + int nz = 0; + for( int i = 0; i < 64; i++ ) + QUANT_ONE( dct[i], mf[i], bias[i] ); + return !!nz; +} + +static int quant_4x4( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] ) +{ + int nz = 0; + for( int i = 0; i < 16; i++ ) + QUANT_ONE( dct[i], mf[i], bias[i] ); + return !!nz; +} + +static int quant_4x4x4( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] ) +{ + int nza = 0; + for( int j = 0; j < 4; j++ ) + { + int nz = 0; + for( int i = 0; i < 16; i++ ) + QUANT_ONE( dct[j][i], mf[i], bias[i] ); + nza |= (!!nz)<> (-i_qbits) + +static void dequant_4x4( dctcoef dct[16], int dequant_mf[6][16], int i_qp ) +{ + const int i_mf = i_qp%6; + const int i_qbits = i_qp/6 - 4; + + if( i_qbits >= 0 ) + { + for( int i = 0; i < 16; i++ ) + DEQUANT_SHL( i ); + } + else + { + const int f = 1 << (-i_qbits-1); + for( int i = 0; i < 16; i++ ) + DEQUANT_SHR( i ); + } +} + +static void dequant_8x8( dctcoef dct[64], int dequant_mf[6][64], int i_qp ) +{ + const int i_mf = i_qp%6; + const int i_qbits = i_qp/6 - 6; + + if( i_qbits >= 0 ) + { + for( int i = 0; i < 64; i++ ) + DEQUANT_SHL( i ); + } + else + { + const int f = 1 << (-i_qbits-1); + for( int i = 0; i < 64; i++ ) + DEQUANT_SHR( i ); + } +} + +static void dequant_4x4_dc( dctcoef dct[16], int dequant_mf[6][16], int i_qp ) +{ + const int i_qbits = i_qp/6 - 6; + + if( i_qbits >= 0 ) + { + const int i_dmf = dequant_mf[i_qp%6][0] << i_qbits; + for( int i = 0; i < 16; i++ ) + dct[i] *= i_dmf; + } + else + { + const int i_dmf = dequant_mf[i_qp%6][0]; + const int f = 1 << (-i_qbits-1); + for( int i = 0; i < 16; i++ ) + dct[i] = ( dct[i] * i_dmf + f ) >> (-i_qbits); + } +} + +#define IDCT_DEQUANT_2X4_START \ + int a0 = dct[0] + dct[1]; \ + int a1 = dct[2] + dct[3]; \ + int a2 = dct[4] + dct[5]; \ + int a3 = dct[6] + dct[7]; \ + int a4 = dct[0] - dct[1]; \ + int a5 = dct[2] - dct[3]; \ + int a6 = dct[4] - dct[5]; \ + int a7 = dct[6] - dct[7]; \ + int b0 = a0 + a1; \ + int b1 = a2 + a3; \ + int b2 = a4 + a5; \ + int b3 = a6 + a7; \ + int b4 = a0 - a1; \ + int b5 = a2 - a3; \ + int b6 = a4 - a5; \ + int b7 = a6 - a7; + +static void idct_dequant_2x4_dc( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp ) +{ + IDCT_DEQUANT_2X4_START + int dmf = dequant_mf[i_qp%6][0] << i_qp/6; + dct4x4[0][0] = ((b0 + b1) * dmf + 32) >> 6; + dct4x4[1][0] = ((b2 + b3) * dmf + 32) >> 6; + dct4x4[2][0] = ((b0 - b1) * dmf + 32) >> 6; + dct4x4[3][0] = ((b2 - b3) * dmf + 32) >> 6; + dct4x4[4][0] = ((b4 - b5) * dmf + 32) >> 6; + dct4x4[5][0] = ((b6 - b7) * dmf + 32) >> 6; + dct4x4[6][0] = ((b4 + b5) * dmf + 32) >> 6; + dct4x4[7][0] = ((b6 + b7) * dmf + 32) >> 6; +} + +static void idct_dequant_2x4_dconly( dctcoef dct[8], int dequant_mf[6][16], int i_qp ) +{ + IDCT_DEQUANT_2X4_START + int dmf = dequant_mf[i_qp%6][0] << i_qp/6; + dct[0] = ((b0 + b1) * dmf + 32) >> 6; + dct[1] = ((b2 + b3) * dmf + 32) >> 6; + dct[2] = ((b0 - b1) * dmf + 32) >> 6; + dct[3] = ((b2 - b3) * dmf + 32) >> 6; + dct[4] = ((b4 - b5) * dmf + 32) >> 6; + dct[5] = ((b6 - b7) * dmf + 32) >> 6; + dct[6] = ((b4 + b5) * dmf + 32) >> 6; + dct[7] = ((b6 + b7) * dmf + 32) >> 6; +} + +static ALWAYS_INLINE void optimize_chroma_idct_dequant_2x4( dctcoef out[8], dctcoef dct[8], int dmf ) +{ + IDCT_DEQUANT_2X4_START + out[0] = ((b0 + b1) * dmf + 2080) >> 6; /* 2080 = 32 + (32<<6) */ + out[1] = ((b2 + b3) * dmf + 2080) >> 6; + out[2] = ((b0 - b1) * dmf + 2080) >> 6; + out[3] = ((b2 - b3) * dmf + 2080) >> 6; + out[4] = ((b4 - b5) * dmf + 2080) >> 6; + out[5] = ((b6 - b7) * dmf + 2080) >> 6; + out[6] = ((b4 + b5) * dmf + 2080) >> 6; + out[7] = ((b6 + b7) * dmf + 2080) >> 6; +} +#undef IDCT_DEQUANT_2X4_START + +static ALWAYS_INLINE void optimize_chroma_idct_dequant_2x2( dctcoef out[4], dctcoef dct[4], int dmf ) +{ + int d0 = dct[0] + dct[1]; + int d1 = dct[2] + dct[3]; + int d2 = dct[0] - dct[1]; + int d3 = dct[2] - dct[3]; + out[0] = ((d0 + d1) * dmf >> 5) + 32; + out[1] = ((d0 - d1) * dmf >> 5) + 32; + out[2] = ((d2 + d3) * dmf >> 5) + 32; + out[3] = ((d2 - d3) * dmf >> 5) + 32; +} + +static ALWAYS_INLINE int optimize_chroma_round( dctcoef *ref, dctcoef *dct, int dequant_mf, int chroma422 ) +{ + dctcoef out[8]; + + if( chroma422 ) + optimize_chroma_idct_dequant_2x4( out, dct, dequant_mf ); + else + optimize_chroma_idct_dequant_2x2( out, dct, dequant_mf ); + + int sum = 0; + for( int i = 0; i < (chroma422?8:4); i++ ) + sum |= ref[i] ^ out[i]; + return sum >> 6; +} + +static ALWAYS_INLINE int optimize_chroma_dc_internal( dctcoef *dct, int dequant_mf, int chroma422 ) +{ + /* dequant_mf = h->dequant4_mf[CQM_4IC + b_inter][i_qp%6][0] << i_qp/6, max 32*64 */ + dctcoef dct_orig[8]; + int coeff, nz; + + if( chroma422 ) + optimize_chroma_idct_dequant_2x4( dct_orig, dct, dequant_mf ); + else + optimize_chroma_idct_dequant_2x2( dct_orig, dct, dequant_mf ); + + /* If the DC coefficients already round to zero, terminate early. */ + int sum = 0; + for( int i = 0; i < (chroma422?8:4); i++ ) + sum |= dct_orig[i]; + if( !(sum >> 6) ) + return 0; + + /* Start with the highest frequency coefficient... is this the best option? */ + for( nz = 0, coeff = (chroma422?7:3); coeff >= 0; coeff-- ) + { + int level = dct[coeff]; + int sign = level>>31 | 1; /* dct[coeff] < 0 ? -1 : 1 */ + + while( level ) + { + dct[coeff] = level - sign; + if( optimize_chroma_round( dct_orig, dct, dequant_mf, chroma422 ) ) + { + nz = 1; + dct[coeff] = level; + break; + } + level -= sign; + } + } + + return nz; +} + +static int optimize_chroma_2x2_dc( dctcoef dct[4], int dequant_mf ) +{ + return optimize_chroma_dc_internal( dct, dequant_mf, 0 ); +} + +static int optimize_chroma_2x4_dc( dctcoef dct[8], int dequant_mf ) +{ + return optimize_chroma_dc_internal( dct, dequant_mf, 1 ); +} + +static void x264_denoise_dct( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size ) +{ + for( int i = 0; i < size; i++ ) + { + int level = dct[i]; + int sign = level>>31; + level = (level+sign)^sign; + sum[i] += level; + level -= offset[i]; + dct[i] = level<0 ? 0 : (level^sign)-sign; + } +} + +/* (ref: JVT-B118) + * x264_mb_decimate_score: given dct coeffs it returns a score to see if we could empty this dct coeffs + * to 0 (low score means set it to null) + * Used in inter macroblock (luma and chroma) + * luma: for a 8x8 block: if score < 4 -> null + * for the complete mb: if score < 6 -> null + * chroma: for the complete mb: if score < 7 -> null + */ + +const uint8_t x264_decimate_table4[16] = +{ + 3,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0 +}; +const uint8_t x264_decimate_table8[64] = +{ + 3,3,3,3,2,2,2,2,2,2,2,2,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 +}; + +static int ALWAYS_INLINE x264_decimate_score_internal( dctcoef *dct, int i_max ) +{ + const uint8_t *ds_table = (i_max == 64) ? x264_decimate_table8 : x264_decimate_table4; + int i_score = 0; + int idx = i_max - 1; + + while( idx >= 0 && dct[idx] == 0 ) + idx--; + while( idx >= 0 ) + { + int i_run; + + if( (unsigned)(dct[idx--] + 1) > 2 ) + return 9; + + i_run = 0; + while( idx >= 0 && dct[idx] == 0 ) + { + idx--; + i_run++; + } + i_score += ds_table[i_run]; + } + + return i_score; +} + +static int x264_decimate_score15( dctcoef *dct ) +{ + return x264_decimate_score_internal( dct+1, 15 ); +} +static int x264_decimate_score16( dctcoef *dct ) +{ + return x264_decimate_score_internal( dct, 16 ); +} +static int x264_decimate_score64( dctcoef *dct ) +{ + return x264_decimate_score_internal( dct, 64 ); +} + +#define last(num)\ +static int x264_coeff_last##num( dctcoef *l )\ +{\ + int i_last = num-1;\ + while( i_last >= 0 && l[i_last] == 0 )\ + i_last--;\ + return i_last;\ +} + +last(4) +last(8) +last(15) +last(16) +last(64) + +#define level_run(num)\ +static int x264_coeff_level_run##num( dctcoef *dct, x264_run_level_t *runlevel )\ +{\ + int i_last = runlevel->last = x264_coeff_last##num(dct);\ + int i_total = 0;\ + int mask = 0;\ + do\ + {\ + runlevel->level[i_total++] = dct[i_last];\ + mask |= 1 << (i_last);\ + while( --i_last >= 0 && dct[i_last] == 0 );\ + } while( i_last >= 0 );\ + runlevel->mask = mask;\ + return i_total;\ +} + +level_run(4) +level_run(8) +level_run(15) +level_run(16) + +#if ARCH_X86_64 +#define INIT_TRELLIS(cpu)\ + pf->trellis_cabac_4x4 = x264_trellis_cabac_4x4_##cpu;\ + pf->trellis_cabac_8x8 = x264_trellis_cabac_8x8_##cpu;\ + pf->trellis_cabac_4x4_psy = x264_trellis_cabac_4x4_psy_##cpu;\ + pf->trellis_cabac_8x8_psy = x264_trellis_cabac_8x8_psy_##cpu;\ + pf->trellis_cabac_dc = x264_trellis_cabac_dc_##cpu;\ + pf->trellis_cabac_chroma_422_dc = x264_trellis_cabac_chroma_422_dc_##cpu; +#else +#define INIT_TRELLIS(...) +#endif + +void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf ) +{ + pf->quant_8x8 = quant_8x8; + pf->quant_4x4 = quant_4x4; + pf->quant_4x4x4 = quant_4x4x4; + pf->quant_4x4_dc = quant_4x4_dc; + pf->quant_2x2_dc = quant_2x2_dc; + + pf->dequant_4x4 = dequant_4x4; + pf->dequant_4x4_dc = dequant_4x4_dc; + pf->dequant_8x8 = dequant_8x8; + + pf->idct_dequant_2x4_dc = idct_dequant_2x4_dc; + pf->idct_dequant_2x4_dconly = idct_dequant_2x4_dconly; + + pf->optimize_chroma_2x2_dc = optimize_chroma_2x2_dc; + pf->optimize_chroma_2x4_dc = optimize_chroma_2x4_dc; + + pf->denoise_dct = x264_denoise_dct; + pf->decimate_score15 = x264_decimate_score15; + pf->decimate_score16 = x264_decimate_score16; + pf->decimate_score64 = x264_decimate_score64; + + pf->coeff_last4 = x264_coeff_last4; + pf->coeff_last8 = x264_coeff_last8; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15; + pf->coeff_last[ DCT_LUMA_4x4] = x264_coeff_last16; + pf->coeff_last[ DCT_LUMA_8x8] = x264_coeff_last64; + pf->coeff_level_run4 = x264_coeff_level_run4; + pf->coeff_level_run8 = x264_coeff_level_run8; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15; + pf->coeff_level_run[ DCT_LUMA_4x4] = x264_coeff_level_run16; + +#if HIGH_BIT_DEPTH +#if HAVE_MMX + INIT_TRELLIS( sse2 ); + if( cpu&X264_CPU_MMX2 ) + { +#if ARCH_X86 + pf->denoise_dct = x264_denoise_dct_mmx; + pf->coeff_last8 = x264_coeff_last8_mmx2; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_mmx2; + pf->coeff_last[ DCT_LUMA_4x4] = x264_coeff_last16_mmx2; + pf->coeff_last[ DCT_LUMA_8x8] = x264_coeff_last64_mmx2; + pf->coeff_level_run8 = x264_coeff_level_run8_mmx2; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_mmx2; + pf->coeff_level_run[ DCT_LUMA_4x4] = x264_coeff_level_run16_mmx2; +#endif + pf->coeff_last4 = x264_coeff_last4_mmx2; + pf->coeff_level_run4 = x264_coeff_level_run4_mmx2; + } + if( cpu&X264_CPU_SSE2 ) + { + pf->quant_4x4 = x264_quant_4x4_sse2; + pf->quant_4x4x4 = x264_quant_4x4x4_sse2; + pf->quant_8x8 = x264_quant_8x8_sse2; + pf->quant_2x2_dc = x264_quant_2x2_dc_sse2; + pf->quant_4x4_dc = x264_quant_4x4_dc_sse2; + pf->dequant_4x4 = x264_dequant_4x4_sse2; + pf->dequant_8x8 = x264_dequant_8x8_sse2; + pf->dequant_4x4_dc = x264_dequant_4x4dc_sse2; + pf->idct_dequant_2x4_dc = x264_idct_dequant_2x4_dc_sse2; + pf->idct_dequant_2x4_dconly = x264_idct_dequant_2x4_dconly_sse2; + pf->denoise_dct = x264_denoise_dct_sse2; + pf->decimate_score15 = x264_decimate_score15_sse2; + pf->decimate_score16 = x264_decimate_score16_sse2; + pf->decimate_score64 = x264_decimate_score64_sse2; + pf->coeff_last8 = x264_coeff_last8_sse2; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_sse2; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_sse2; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_sse2; + pf->coeff_level_run8 = x264_coeff_level_run8_sse2; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_sse2; + pf->coeff_level_run[DCT_LUMA_4x4] = x264_coeff_level_run16_sse2; + } + if( cpu&X264_CPU_LZCNT ) + { + pf->coeff_last4 = x264_coeff_last4_lzcnt; + pf->coeff_last8 = x264_coeff_last8_lzcnt; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_lzcnt; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_lzcnt; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_lzcnt; + pf->coeff_level_run4 = x264_coeff_level_run4_lzcnt; + pf->coeff_level_run8 = x264_coeff_level_run8_lzcnt; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_lzcnt; + pf->coeff_level_run[DCT_LUMA_4x4] = x264_coeff_level_run16_lzcnt; + } + if( cpu&X264_CPU_SSSE3 ) + { + pf->quant_4x4 = x264_quant_4x4_ssse3; + pf->quant_4x4x4 = x264_quant_4x4x4_ssse3; + pf->quant_8x8 = x264_quant_8x8_ssse3; + pf->quant_2x2_dc = x264_quant_2x2_dc_ssse3; + pf->quant_4x4_dc = x264_quant_4x4_dc_ssse3; + pf->denoise_dct = x264_denoise_dct_ssse3; + pf->decimate_score15 = x264_decimate_score15_ssse3; + pf->decimate_score16 = x264_decimate_score16_ssse3; + pf->decimate_score64 = x264_decimate_score64_ssse3; + INIT_TRELLIS( ssse3 ); + } + if( cpu&X264_CPU_SSE4 ) + { + pf->quant_2x2_dc = x264_quant_2x2_dc_sse4; + pf->quant_4x4_dc = x264_quant_4x4_dc_sse4; + pf->quant_4x4 = x264_quant_4x4_sse4; + pf->quant_4x4x4 = x264_quant_4x4x4_sse4; + pf->quant_8x8 = x264_quant_8x8_sse4; + } + if( cpu&X264_CPU_AVX ) + { + pf->idct_dequant_2x4_dc = x264_idct_dequant_2x4_dc_avx; + pf->idct_dequant_2x4_dconly = x264_idct_dequant_2x4_dconly_avx; + pf->denoise_dct = x264_denoise_dct_avx; + } + if( cpu&X264_CPU_XOP ) + { + pf->dequant_4x4_dc = x264_dequant_4x4dc_xop; + if( h->param.i_cqm_preset != X264_CQM_FLAT ) + { + pf->dequant_4x4 = x264_dequant_4x4_xop; + pf->dequant_8x8 = x264_dequant_8x8_xop; + } + } + if( cpu&X264_CPU_AVX2 ) + { + pf->quant_4x4 = x264_quant_4x4_avx2; + pf->quant_4x4_dc = x264_quant_4x4_dc_avx2; + pf->quant_8x8 = x264_quant_8x8_avx2; + pf->quant_4x4x4 = x264_quant_4x4x4_avx2; + pf->dequant_4x4 = x264_dequant_4x4_avx2; + pf->dequant_8x8 = x264_dequant_8x8_avx2; + pf->dequant_4x4_dc = x264_dequant_4x4dc_avx2; + pf->denoise_dct = x264_denoise_dct_avx2; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_avx2; + } + if( cpu&X264_CPU_AVX512 ) + { + pf->dequant_4x4 = x264_dequant_4x4_avx512; + pf->dequant_8x8 = x264_dequant_8x8_avx512; + pf->decimate_score15 = x264_decimate_score15_avx512; + pf->decimate_score16 = x264_decimate_score16_avx512; + pf->decimate_score64 = x264_decimate_score64_avx512; + pf->coeff_last4 = x264_coeff_last4_avx512; + pf->coeff_last8 = x264_coeff_last8_avx512; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_avx512; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_avx512; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_avx512; + } +#endif // HAVE_MMX +#else // !HIGH_BIT_DEPTH +#if HAVE_MMX + INIT_TRELLIS( sse2 ); + if( cpu&X264_CPU_MMX ) + { +#if ARCH_X86 + pf->dequant_4x4 = x264_dequant_4x4_mmx; + pf->dequant_4x4_dc = x264_dequant_4x4dc_mmx2; + pf->dequant_8x8 = x264_dequant_8x8_mmx; + if( h->param.i_cqm_preset == X264_CQM_FLAT ) + { + pf->dequant_4x4 = x264_dequant_4x4_flat16_mmx; + pf->dequant_8x8 = x264_dequant_8x8_flat16_mmx; + } + pf->denoise_dct = x264_denoise_dct_mmx; +#endif + } + + if( cpu&X264_CPU_MMX2 ) + { + pf->quant_2x2_dc = x264_quant_2x2_dc_mmx2; +#if ARCH_X86 + pf->quant_4x4 = x264_quant_4x4_mmx2; + pf->quant_8x8 = x264_quant_8x8_mmx2; + pf->quant_4x4_dc = x264_quant_4x4_dc_mmx2; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_mmx2; + pf->coeff_last[ DCT_LUMA_4x4] = x264_coeff_last16_mmx2; + pf->coeff_last[ DCT_LUMA_8x8] = x264_coeff_last64_mmx2; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_mmx2; + pf->coeff_level_run[ DCT_LUMA_4x4] = x264_coeff_level_run16_mmx2; +#endif + pf->coeff_last4 = x264_coeff_last4_mmx2; + pf->coeff_last8 = x264_coeff_last8_mmx2; + pf->coeff_level_run4 = x264_coeff_level_run4_mmx2; + pf->coeff_level_run8 = x264_coeff_level_run8_mmx2; + } + + if( cpu&X264_CPU_SSE2 ) + { + pf->quant_4x4_dc = x264_quant_4x4_dc_sse2; + pf->quant_4x4 = x264_quant_4x4_sse2; + pf->quant_4x4x4 = x264_quant_4x4x4_sse2; + pf->quant_8x8 = x264_quant_8x8_sse2; + pf->dequant_4x4 = x264_dequant_4x4_sse2; + pf->dequant_4x4_dc = x264_dequant_4x4dc_sse2; + pf->dequant_8x8 = x264_dequant_8x8_sse2; + if( h->param.i_cqm_preset == X264_CQM_FLAT ) + { + pf->dequant_4x4 = x264_dequant_4x4_flat16_sse2; + pf->dequant_8x8 = x264_dequant_8x8_flat16_sse2; + } + pf->idct_dequant_2x4_dc = x264_idct_dequant_2x4_dc_sse2; + pf->idct_dequant_2x4_dconly = x264_idct_dequant_2x4_dconly_sse2; + pf->optimize_chroma_2x2_dc = x264_optimize_chroma_2x2_dc_sse2; + pf->denoise_dct = x264_denoise_dct_sse2; + pf->decimate_score15 = x264_decimate_score15_sse2; + pf->decimate_score16 = x264_decimate_score16_sse2; + pf->decimate_score64 = x264_decimate_score64_sse2; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_sse2; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_sse2; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_sse2; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_sse2; + pf->coeff_level_run[DCT_LUMA_4x4] = x264_coeff_level_run16_sse2; + } + + if( cpu&X264_CPU_LZCNT ) + { + pf->coeff_last4 = x264_coeff_last4_lzcnt; + pf->coeff_last8 = x264_coeff_last8_lzcnt; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_lzcnt; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_lzcnt; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_lzcnt; + pf->coeff_level_run4 = x264_coeff_level_run4_lzcnt; + pf->coeff_level_run8 = x264_coeff_level_run8_lzcnt; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_lzcnt; + pf->coeff_level_run[DCT_LUMA_4x4] = x264_coeff_level_run16_lzcnt; + } + + if( cpu&X264_CPU_SSSE3 ) + { + pf->quant_2x2_dc = x264_quant_2x2_dc_ssse3; + pf->quant_4x4_dc = x264_quant_4x4_dc_ssse3; + pf->quant_4x4 = x264_quant_4x4_ssse3; + pf->quant_4x4x4 = x264_quant_4x4x4_ssse3; + pf->quant_8x8 = x264_quant_8x8_ssse3; + pf->optimize_chroma_2x2_dc = x264_optimize_chroma_2x2_dc_ssse3; + pf->denoise_dct = x264_denoise_dct_ssse3; + pf->decimate_score15 = x264_decimate_score15_ssse3; + pf->decimate_score16 = x264_decimate_score16_ssse3; + pf->decimate_score64 = x264_decimate_score64_ssse3; + INIT_TRELLIS( ssse3 ); +#if ARCH_X86 || !defined( __MACH__ ) + pf->coeff_level_run4 = x264_coeff_level_run4_ssse3; + pf->coeff_level_run8 = x264_coeff_level_run8_ssse3; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_ssse3; + pf->coeff_level_run[DCT_LUMA_4x4] = x264_coeff_level_run16_ssse3; + if( cpu&X264_CPU_LZCNT ) + { + pf->coeff_level_run4 = x264_coeff_level_run4_ssse3_lzcnt; + pf->coeff_level_run8 = x264_coeff_level_run8_ssse3_lzcnt; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_ssse3_lzcnt; + pf->coeff_level_run[DCT_LUMA_4x4] = x264_coeff_level_run16_ssse3_lzcnt; + } +#endif + } + + if( cpu&X264_CPU_SSE4 ) + { + pf->quant_4x4_dc = x264_quant_4x4_dc_sse4; + pf->quant_4x4 = x264_quant_4x4_sse4; + pf->quant_8x8 = x264_quant_8x8_sse4; + pf->optimize_chroma_2x2_dc = x264_optimize_chroma_2x2_dc_sse4; + } + + if( cpu&X264_CPU_AVX ) + { + pf->dequant_4x4_dc = x264_dequant_4x4dc_avx; + if( h->param.i_cqm_preset != X264_CQM_FLAT ) + { + pf->dequant_4x4 = x264_dequant_4x4_avx; + pf->dequant_8x8 = x264_dequant_8x8_avx; + } + pf->idct_dequant_2x4_dc = x264_idct_dequant_2x4_dc_avx; + pf->idct_dequant_2x4_dconly = x264_idct_dequant_2x4_dconly_avx; + pf->optimize_chroma_2x2_dc = x264_optimize_chroma_2x2_dc_avx; + pf->denoise_dct = x264_denoise_dct_avx; + } + + if( cpu&X264_CPU_XOP ) + { + if( h->param.i_cqm_preset != X264_CQM_FLAT ) + { + pf->dequant_4x4 = x264_dequant_4x4_xop; + pf->dequant_8x8 = x264_dequant_8x8_xop; + } + } + + if( cpu&X264_CPU_AVX2 ) + { + pf->quant_4x4 = x264_quant_4x4_avx2; + pf->quant_4x4_dc = x264_quant_4x4_dc_avx2; + pf->quant_8x8 = x264_quant_8x8_avx2; + pf->quant_4x4x4 = x264_quant_4x4x4_avx2; + pf->dequant_4x4 = x264_dequant_4x4_avx2; + pf->dequant_8x8 = x264_dequant_8x8_avx2; + pf->dequant_4x4_dc = x264_dequant_4x4dc_avx2; + if( h->param.i_cqm_preset == X264_CQM_FLAT ) + { + pf->dequant_4x4 = x264_dequant_4x4_flat16_avx2; + pf->dequant_8x8 = x264_dequant_8x8_flat16_avx2; + } + pf->decimate_score64 = x264_decimate_score64_avx2; + pf->denoise_dct = x264_denoise_dct_avx2; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_avx2; +#if ARCH_X86 || !defined( __MACH__ ) + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_avx2; + pf->coeff_level_run[DCT_LUMA_4x4] = x264_coeff_level_run16_avx2; +#endif + } + if( cpu&X264_CPU_AVX512 ) + { + if( h->param.i_cqm_preset == X264_CQM_FLAT ) + pf->dequant_8x8 = x264_dequant_8x8_flat16_avx512; + else + { + pf->dequant_4x4 = x264_dequant_4x4_avx512; + pf->dequant_8x8 = x264_dequant_8x8_avx512; + } + pf->decimate_score15 = x264_decimate_score15_avx512; + pf->decimate_score16 = x264_decimate_score16_avx512; + pf->decimate_score64 = x264_decimate_score64_avx512; + pf->coeff_last8 = x264_coeff_last8_avx512; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_avx512; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_avx512; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_avx512; + } +#endif // HAVE_MMX + +#if HAVE_ALTIVEC + if( cpu&X264_CPU_ALTIVEC ) + { + pf->quant_2x2_dc = x264_quant_2x2_dc_altivec; + pf->quant_4x4_dc = x264_quant_4x4_dc_altivec; + pf->quant_4x4 = x264_quant_4x4_altivec; + pf->quant_8x8 = x264_quant_8x8_altivec; + + pf->dequant_4x4 = x264_dequant_4x4_altivec; + pf->dequant_8x8 = x264_dequant_8x8_altivec; + } +#endif + +#if HAVE_ARMV6 + if( cpu&X264_CPU_ARMV6 ) + { + pf->coeff_last4 = x264_coeff_last4_arm; + pf->coeff_last8 = x264_coeff_last8_arm; + } +#endif +#if HAVE_ARMV6 || ARCH_AARCH64 + if( cpu&X264_CPU_NEON ) + { + pf->quant_2x2_dc = x264_quant_2x2_dc_neon; + pf->quant_4x4 = x264_quant_4x4_neon; + pf->quant_4x4_dc = x264_quant_4x4_dc_neon; + pf->quant_4x4x4 = x264_quant_4x4x4_neon; + pf->quant_8x8 = x264_quant_8x8_neon; + pf->dequant_4x4 = x264_dequant_4x4_neon; + pf->dequant_4x4_dc = x264_dequant_4x4_dc_neon; + pf->dequant_8x8 = x264_dequant_8x8_neon; + pf->coeff_last[ DCT_LUMA_AC] = x264_coeff_last15_neon; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_neon; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_neon; + pf->denoise_dct = x264_denoise_dct_neon; + pf->decimate_score15 = x264_decimate_score15_neon; + pf->decimate_score16 = x264_decimate_score16_neon; + pf->decimate_score64 = x264_decimate_score64_neon; + } +#endif +#if ARCH_AARCH64 + if( cpu&X264_CPU_ARMV8 ) + { + pf->coeff_last4 = x264_coeff_last4_aarch64; + pf->coeff_last8 = x264_coeff_last8_aarch64; + pf->coeff_level_run4 = x264_coeff_level_run4_aarch64; + } + if( cpu&X264_CPU_NEON ) + { + pf->coeff_level_run8 = x264_coeff_level_run8_neon; + pf->coeff_level_run[ DCT_LUMA_AC] = x264_coeff_level_run15_neon; + pf->coeff_level_run[ DCT_LUMA_4x4] = x264_coeff_level_run16_neon; + } +#endif + +#if HAVE_MSA + if( cpu&X264_CPU_MSA ) + { + pf->quant_4x4 = x264_quant_4x4_msa; + pf->quant_4x4_dc = x264_quant_4x4_dc_msa; + pf->quant_4x4x4 = x264_quant_4x4x4_msa; + pf->quant_8x8 = x264_quant_8x8_msa; + pf->dequant_4x4 = x264_dequant_4x4_msa; + pf->dequant_4x4_dc = x264_dequant_4x4_dc_msa; + pf->dequant_8x8 = x264_dequant_8x8_msa; + pf->coeff_last[DCT_LUMA_4x4] = x264_coeff_last16_msa; + pf->coeff_last[DCT_LUMA_8x8] = x264_coeff_last64_msa; + } +#endif +#endif // HIGH_BIT_DEPTH + pf->coeff_last[DCT_LUMA_DC] = pf->coeff_last[DCT_CHROMAU_DC] = pf->coeff_last[DCT_CHROMAV_DC] = + pf->coeff_last[DCT_CHROMAU_4x4] = pf->coeff_last[DCT_CHROMAV_4x4] = pf->coeff_last[DCT_LUMA_4x4]; + pf->coeff_last[DCT_CHROMA_AC] = pf->coeff_last[DCT_CHROMAU_AC] = + pf->coeff_last[DCT_CHROMAV_AC] = pf->coeff_last[DCT_LUMA_AC]; + pf->coeff_last[DCT_CHROMAU_8x8] = pf->coeff_last[DCT_CHROMAV_8x8] = pf->coeff_last[DCT_LUMA_8x8]; + + pf->coeff_level_run[DCT_LUMA_DC] = pf->coeff_level_run[DCT_CHROMAU_DC] = pf->coeff_level_run[DCT_CHROMAV_DC] = + pf->coeff_level_run[DCT_CHROMAU_4x4] = pf->coeff_level_run[DCT_CHROMAV_4x4] = pf->coeff_level_run[DCT_LUMA_4x4]; + pf->coeff_level_run[DCT_CHROMA_AC] = pf->coeff_level_run[DCT_CHROMAU_AC] = + pf->coeff_level_run[DCT_CHROMAV_AC] = pf->coeff_level_run[DCT_LUMA_AC]; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.h new file mode 100644 index 00000000..0bd0c21c --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/quant.h @@ -0,0 +1,74 @@ +/***************************************************************************** + * quant.h: quantization and level-run + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_QUANT_H +#define X264_QUANT_H + +typedef struct +{ + int (*quant_8x8) ( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] ); + int (*quant_4x4) ( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] ); + int (*quant_4x4x4)( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] ); + int (*quant_4x4_dc)( dctcoef dct[16], int mf, int bias ); + int (*quant_2x2_dc)( dctcoef dct[4], int mf, int bias ); + + void (*dequant_8x8)( dctcoef dct[64], int dequant_mf[6][64], int i_qp ); + void (*dequant_4x4)( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); + void (*dequant_4x4_dc)( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); + + void (*idct_dequant_2x4_dc)( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp ); + void (*idct_dequant_2x4_dconly)( dctcoef dct[8], int dequant_mf[6][16], int i_qp ); + + int (*optimize_chroma_2x2_dc)( dctcoef dct[4], int dequant_mf ); + int (*optimize_chroma_2x4_dc)( dctcoef dct[8], int dequant_mf ); + + void (*denoise_dct)( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size ); + + int (*decimate_score15)( dctcoef *dct ); + int (*decimate_score16)( dctcoef *dct ); + int (*decimate_score64)( dctcoef *dct ); + int (*coeff_last[14])( dctcoef *dct ); + int (*coeff_last4)( dctcoef *dct ); + int (*coeff_last8)( dctcoef *dct ); + int (*coeff_level_run[13])( dctcoef *dct, x264_run_level_t *runlevel ); + int (*coeff_level_run4)( dctcoef *dct, x264_run_level_t *runlevel ); + int (*coeff_level_run8)( dctcoef *dct, x264_run_level_t *runlevel ); + +#define TRELLIS_PARAMS const int *unquant_mf, const uint8_t *zigzag, int lambda2,\ + int last_nnz, dctcoef *coefs, dctcoef *quant_coefs, dctcoef *dct,\ + uint8_t *cabac_state_sig, uint8_t *cabac_state_last,\ + uint64_t level_state0, uint16_t level_state1 + int (*trellis_cabac_4x4)( TRELLIS_PARAMS, int b_ac ); + int (*trellis_cabac_8x8)( TRELLIS_PARAMS, int b_interlaced ); + int (*trellis_cabac_4x4_psy)( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int psy_trellis ); + int (*trellis_cabac_8x8_psy)( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int psy_trellis ); + int (*trellis_cabac_dc)( TRELLIS_PARAMS, int num_coefs ); + int (*trellis_cabac_chroma_422_dc)( TRELLIS_PARAMS ); +} x264_quant_function_t; + +void x264_quant_init( x264_t *h, int cpu, x264_quant_function_t *pf ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.c new file mode 100644 index 00000000..4057b683 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.c @@ -0,0 +1,58 @@ +/***************************************************************************** + * rectangle.c: rectangle filling + ***************************************************************************** + * Copyright (C) 2010-2017 x264 project + * + * Authors: Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#define CACHE_FUNC(name,size,width,height)\ +static void x264_macroblock_cache_##name##_##width##_##height( void *target, uint32_t val )\ +{\ + x264_macroblock_cache_rect( target, width*size, height, size, val );\ +} + +#define CACHE_FUNCS(name,size)\ +CACHE_FUNC(name,size,4,4)\ +CACHE_FUNC(name,size,2,4)\ +CACHE_FUNC(name,size,4,2)\ +CACHE_FUNC(name,size,2,2)\ +CACHE_FUNC(name,size,2,1)\ +CACHE_FUNC(name,size,1,2)\ +CACHE_FUNC(name,size,1,1)\ +void (*x264_cache_##name##_func_table[10])(void *, uint32_t) =\ +{\ + x264_macroblock_cache_##name##_1_1,\ + x264_macroblock_cache_##name##_2_1,\ + x264_macroblock_cache_##name##_1_2,\ + x264_macroblock_cache_##name##_2_2,\ + NULL,\ + x264_macroblock_cache_##name##_4_2,\ + NULL,\ + x264_macroblock_cache_##name##_2_4,\ + NULL,\ + x264_macroblock_cache_##name##_4_4\ +};\ + +CACHE_FUNCS(mv, 4) +CACHE_FUNCS(mvd, 2) +CACHE_FUNCS(ref, 1) diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.h new file mode 100644 index 00000000..2bd20281 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/rectangle.h @@ -0,0 +1,157 @@ +/***************************************************************************** + * rectangle.h: rectangle filling + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Fiona Glaser + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +/* This function should only be called with constant w / h / s arguments! */ +static ALWAYS_INLINE void x264_macroblock_cache_rect( void *dst, int w, int h, int s, uint32_t v ) +{ + uint8_t *d = dst; + uint16_t v2 = s == 2 ? v : v * 0x101; + uint32_t v4 = s == 4 ? v : s == 2 ? v * 0x10001 : v * 0x1010101; + uint64_t v8 = v4 + ((uint64_t)v4 << 32); + s *= 8; + + if( w == 2 ) + { + M16( d+s*0 ) = v2; + if( h == 1 ) return; + M16( d+s*1 ) = v2; + if( h == 2 ) return; + M16( d+s*2 ) = v2; + M16( d+s*3 ) = v2; + } + else if( w == 4 ) + { + M32( d+s*0 ) = v4; + if( h == 1 ) return; + M32( d+s*1 ) = v4; + if( h == 2 ) return; + M32( d+s*2 ) = v4; + M32( d+s*3 ) = v4; + } + else if( w == 8 ) + { + if( WORD_SIZE == 8 ) + { + M64( d+s*0 ) = v8; + if( h == 1 ) return; + M64( d+s*1 ) = v8; + if( h == 2 ) return; + M64( d+s*2 ) = v8; + M64( d+s*3 ) = v8; + } + else + { + M32( d+s*0+0 ) = v4; + M32( d+s*0+4 ) = v4; + if( h == 1 ) return; + M32( d+s*1+0 ) = v4; + M32( d+s*1+4 ) = v4; + if( h == 2 ) return; + M32( d+s*2+0 ) = v4; + M32( d+s*2+4 ) = v4; + M32( d+s*3+0 ) = v4; + M32( d+s*3+4 ) = v4; + } + } + else if( w == 16 ) + { + /* height 1, width 16 doesn't occur */ + assert( h != 1 ); +#if HAVE_VECTOREXT && defined(__SSE__) + v4si v16 = {v,v,v,v}; + + M128( d+s*0+0 ) = (__m128)v16; + M128( d+s*1+0 ) = (__m128)v16; + if( h == 2 ) return; + M128( d+s*2+0 ) = (__m128)v16; + M128( d+s*3+0 ) = (__m128)v16; +#else + if( WORD_SIZE == 8 ) + { + do + { + M64( d+s*0+0 ) = v8; + M64( d+s*0+8 ) = v8; + M64( d+s*1+0 ) = v8; + M64( d+s*1+8 ) = v8; + h -= 2; + d += s*2; + } while( h ); + } + else + { + do + { + M32( d+ 0 ) = v4; + M32( d+ 4 ) = v4; + M32( d+ 8 ) = v4; + M32( d+12 ) = v4; + d += s; + } while( --h ); + } +#endif + } + else + assert(0); +} + +extern void (*x264_cache_mv_func_table[10])(void *, uint32_t);\ +extern void (*x264_cache_mvd_func_table[10])(void *, uint32_t);\ +extern void (*x264_cache_ref_func_table[10])(void *, uint32_t);\ + +#define x264_macroblock_cache_mv_ptr( a, x, y, w, h, l, mv ) x264_macroblock_cache_mv( a, x, y, w, h, l, M32( mv ) ) +static ALWAYS_INLINE void x264_macroblock_cache_mv( x264_t *h, int x, int y, int width, int height, int i_list, uint32_t mv ) +{ + void *mv_cache = &h->mb.cache.mv[i_list][X264_SCAN8_0+x+8*y]; + if( x264_nonconstant_p( width ) || x264_nonconstant_p( height ) ) + x264_cache_mv_func_table[width + (height<<1)-3]( mv_cache, mv ); + else + x264_macroblock_cache_rect( mv_cache, width*4, height, 4, mv ); +} +static ALWAYS_INLINE void x264_macroblock_cache_mvd( x264_t *h, int x, int y, int width, int height, int i_list, uint16_t mvd ) +{ + void *mvd_cache = &h->mb.cache.mvd[i_list][X264_SCAN8_0+x+8*y]; + if( x264_nonconstant_p( width ) || x264_nonconstant_p( height ) ) + x264_cache_mvd_func_table[width + (height<<1)-3]( mvd_cache, mvd ); + else + x264_macroblock_cache_rect( mvd_cache, width*2, height, 2, mvd ); +} +static ALWAYS_INLINE void x264_macroblock_cache_ref( x264_t *h, int x, int y, int width, int height, int i_list, uint8_t ref ) +{ + void *ref_cache = &h->mb.cache.ref[i_list][X264_SCAN8_0+x+8*y]; + if( x264_nonconstant_p( width ) || x264_nonconstant_p( height ) ) + x264_cache_ref_func_table[width + (height<<1)-3]( ref_cache, ref ); + else + x264_macroblock_cache_rect( ref_cache, width, height, 1, ref ); +} +static ALWAYS_INLINE void x264_macroblock_cache_skip( x264_t *h, int x, int y, int width, int height, int b_skip ) +{ + x264_macroblock_cache_rect( &h->mb.cache.skip[X264_SCAN8_0+x+8*y], width, height, 1, b_skip ); +} +static ALWAYS_INLINE void x264_macroblock_cache_intra8x8_pred( x264_t *h, int x, int y, int i_mode ) +{ + x264_macroblock_cache_rect( &h->mb.cache.intra4x4_pred_mode[X264_SCAN8_0+x+8*y], 2, 2, 1, i_mode ); +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.c new file mode 100644 index 00000000..b9d94fd8 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.c @@ -0,0 +1,379 @@ +/***************************************************************************** + * set.c: quantization init + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +#define SHIFT(x,s) ((s)<=0 ? (x)<<-(s) : ((x)+(1<<((s)-1)))>>(s)) +#define DIV(n,d) (((n) + ((d)>>1)) / (d)) + +static const uint8_t dequant4_scale[6][3] = +{ + { 10, 13, 16 }, + { 11, 14, 18 }, + { 13, 16, 20 }, + { 14, 18, 23 }, + { 16, 20, 25 }, + { 18, 23, 29 } +}; +static const uint16_t quant4_scale[6][3] = +{ + { 13107, 8066, 5243 }, + { 11916, 7490, 4660 }, + { 10082, 6554, 4194 }, + { 9362, 5825, 3647 }, + { 8192, 5243, 3355 }, + { 7282, 4559, 2893 }, +}; + +static const uint8_t quant8_scan[16] = +{ + 0,3,4,3, 3,1,5,1, 4,5,2,5, 3,1,5,1 +}; +static const uint8_t dequant8_scale[6][6] = +{ + { 20, 18, 32, 19, 25, 24 }, + { 22, 19, 35, 21, 28, 26 }, + { 26, 23, 42, 24, 33, 31 }, + { 28, 25, 45, 26, 35, 33 }, + { 32, 28, 51, 30, 40, 38 }, + { 36, 32, 58, 34, 46, 43 }, +}; +static const uint16_t quant8_scale[6][6] = +{ + { 13107, 11428, 20972, 12222, 16777, 15481 }, + { 11916, 10826, 19174, 11058, 14980, 14290 }, + { 10082, 8943, 15978, 9675, 12710, 11985 }, + { 9362, 8228, 14913, 8931, 11984, 11259 }, + { 8192, 7346, 13159, 7740, 10486, 9777 }, + { 7282, 6428, 11570, 6830, 9118, 8640 } +}; + +int x264_cqm_init( x264_t *h ) +{ + int def_quant4[6][16]; + int def_quant8[6][64]; + int def_dequant4[6][16]; + int def_dequant8[6][64]; + int quant4_mf[4][6][16]; + int quant8_mf[4][6][64]; + int deadzone[4] = { 32 - h->param.analyse.i_luma_deadzone[1], + 32 - h->param.analyse.i_luma_deadzone[0], + 32 - 11, 32 - 21 }; + int max_qp_err = -1; + int max_chroma_qp_err = -1; + int min_qp_err = QP_MAX+1; + int num_8x8_lists = h->sps->i_chroma_format_idc == CHROMA_444 ? 4 + : h->param.analyse.b_transform_8x8 ? 2 : 0; /* Checkasm may segfault if optimized out by --chroma-format */ + +#define CQM_ALLOC( w, count )\ + for( int i = 0; i < count; i++ )\ + {\ + int size = w*w;\ + int start = w == 8 ? 4 : 0;\ + int j;\ + for( j = 0; j < i; j++ )\ + if( !memcmp( h->pps->scaling_list[i+start], h->pps->scaling_list[j+start], size*sizeof(uint8_t) ) )\ + break;\ + if( j < i )\ + {\ + h-> quant##w##_mf[i] = h-> quant##w##_mf[j];\ + h->dequant##w##_mf[i] = h->dequant##w##_mf[j];\ + h->unquant##w##_mf[i] = h->unquant##w##_mf[j];\ + }\ + else\ + {\ + CHECKED_MALLOC( h-> quant##w##_mf[i], (QP_MAX_SPEC+1)*size*sizeof(udctcoef) );\ + CHECKED_MALLOC( h->dequant##w##_mf[i], 6*size*sizeof(int) );\ + CHECKED_MALLOC( h->unquant##w##_mf[i], (QP_MAX_SPEC+1)*size*sizeof(int) );\ + }\ + for( j = 0; j < i; j++ )\ + if( deadzone[j] == deadzone[i] &&\ + !memcmp( h->pps->scaling_list[i+start], h->pps->scaling_list[j+start], size*sizeof(uint8_t) ) )\ + break;\ + if( j < i )\ + {\ + h->quant##w##_bias[i] = h->quant##w##_bias[j];\ + h->quant##w##_bias0[i] = h->quant##w##_bias0[j];\ + }\ + else\ + {\ + CHECKED_MALLOC( h->quant##w##_bias[i], (QP_MAX_SPEC+1)*size*sizeof(udctcoef) );\ + CHECKED_MALLOC( h->quant##w##_bias0[i], (QP_MAX_SPEC+1)*size*sizeof(udctcoef) );\ + }\ + } + + CQM_ALLOC( 4, 4 ) + CQM_ALLOC( 8, num_8x8_lists ) + + for( int q = 0; q < 6; q++ ) + { + for( int i = 0; i < 16; i++ ) + { + int j = (i&1) + ((i>>2)&1); + def_dequant4[q][i] = dequant4_scale[q][j]; + def_quant4[q][i] = quant4_scale[q][j]; + } + for( int i = 0; i < 64; i++ ) + { + int j = quant8_scan[((i>>1)&12) | (i&3)]; + def_dequant8[q][i] = dequant8_scale[q][j]; + def_quant8[q][i] = quant8_scale[q][j]; + } + } + + for( int q = 0; q < 6; q++ ) + { + for( int i_list = 0; i_list < 4; i_list++ ) + for( int i = 0; i < 16; i++ ) + { + h->dequant4_mf[i_list][q][i] = def_dequant4[q][i] * h->pps->scaling_list[i_list][i]; + quant4_mf[i_list][q][i] = DIV(def_quant4[q][i] * 16, h->pps->scaling_list[i_list][i]); + } + for( int i_list = 0; i_list < num_8x8_lists; i_list++ ) + for( int i = 0; i < 64; i++ ) + { + h->dequant8_mf[i_list][q][i] = def_dequant8[q][i] * h->pps->scaling_list[4+i_list][i]; + quant8_mf[i_list][q][i] = DIV(def_quant8[q][i] * 16, h->pps->scaling_list[4+i_list][i]); + } + } + for( int q = 0; q <= QP_MAX_SPEC; q++ ) + { + int j; + for( int i_list = 0; i_list < 4; i_list++ ) + for( int i = 0; i < 16; i++ ) + { + h->unquant4_mf[i_list][q][i] = (1ULL << (q/6 + 15 + 8)) / quant4_mf[i_list][q%6][i]; + h->quant4_mf[i_list][q][i] = j = SHIFT(quant4_mf[i_list][q%6][i], q/6 - 1); + if( !j ) + { + min_qp_err = X264_MIN( min_qp_err, q ); + continue; + } + // round to nearest, unless that would cause the deadzone to be negative + h->quant4_bias[i_list][q][i] = X264_MIN( DIV(deadzone[i_list]<<10, j), (1<<15)/j ); + h->quant4_bias0[i_list][q][i] = (1<<15)/j; + if( j > 0xffff && q > max_qp_err && (i_list == CQM_4IY || i_list == CQM_4PY) ) + max_qp_err = q; + if( j > 0xffff && q > max_chroma_qp_err && (i_list == CQM_4IC || i_list == CQM_4PC) ) + max_chroma_qp_err = q; + } + if( h->param.analyse.b_transform_8x8 ) + for( int i_list = 0; i_list < num_8x8_lists; i_list++ ) + for( int i = 0; i < 64; i++ ) + { + h->unquant8_mf[i_list][q][i] = (1ULL << (q/6 + 16 + 8)) / quant8_mf[i_list][q%6][i]; + j = SHIFT(quant8_mf[i_list][q%6][i], q/6); + h->quant8_mf[i_list][q][i] = (uint16_t)j; + + if( !j ) + { + min_qp_err = X264_MIN( min_qp_err, q ); + continue; + } + h->quant8_bias[i_list][q][i] = X264_MIN( DIV(deadzone[i_list]<<10, j), (1<<15)/j ); + h->quant8_bias0[i_list][q][i] = (1<<15)/j; + if( j > 0xffff && q > max_qp_err && (i_list == CQM_8IY || i_list == CQM_8PY) ) + max_qp_err = q; + if( j > 0xffff && q > max_chroma_qp_err && (i_list == CQM_8IC || i_list == CQM_8PC) ) + max_chroma_qp_err = q; + } + } + + /* Emergency mode denoising. */ + x264_emms(); + CHECKED_MALLOC( h->nr_offset_emergency, sizeof(*h->nr_offset_emergency)*(QP_MAX-QP_MAX_SPEC) ); + for( int q = 0; q < QP_MAX - QP_MAX_SPEC; q++ ) + for( int cat = 0; cat < 3 + CHROMA444; cat++ ) + { + int dct8x8 = cat&1; + if( !h->param.analyse.b_transform_8x8 && dct8x8 ) + continue; + + int size = dct8x8 ? 64 : 16; + udctcoef *nr_offset = h->nr_offset_emergency[q][cat]; + /* Denoise chroma first (due to h264's chroma QP offset), then luma, then DC. */ + int dc_threshold = (QP_MAX-QP_MAX_SPEC)*2/3; + int luma_threshold = (QP_MAX-QP_MAX_SPEC)*2/3; + int chroma_threshold = 0; + + for( int i = 0; i < size; i++ ) + { + int max = (1 << (7 + BIT_DEPTH)) - 1; + /* True "emergency mode": remove all DCT coefficients */ + if( q == QP_MAX - QP_MAX_SPEC - 1 ) + { + nr_offset[i] = max; + continue; + } + + int thresh = i == 0 ? dc_threshold : cat >= 2 ? chroma_threshold : luma_threshold; + if( q < thresh ) + { + nr_offset[i] = 0; + continue; + } + double pos = (double)(q-thresh+1) / (QP_MAX - QP_MAX_SPEC - thresh); + + /* XXX: this math is largely tuned for /dev/random input. */ + double start = dct8x8 ? h->unquant8_mf[CQM_8PY][QP_MAX_SPEC][i] + : h->unquant4_mf[CQM_4PY][QP_MAX_SPEC][i]; + /* Formula chosen as an exponential scale to vaguely mimic the effects + * of a higher quantizer. */ + double bias = (pow( 2, pos*(QP_MAX - QP_MAX_SPEC)/10. )*0.003-0.003) * start; + nr_offset[i] = X264_MIN( bias + 0.5, max ); + } + } + + if( !h->mb.b_lossless ) + { + while( h->chroma_qp_table[SPEC_QP(h->param.rc.i_qp_min)] <= max_chroma_qp_err ) + h->param.rc.i_qp_min++; + if( min_qp_err <= h->param.rc.i_qp_max ) + h->param.rc.i_qp_max = min_qp_err-1; + if( max_qp_err >= h->param.rc.i_qp_min ) + h->param.rc.i_qp_min = max_qp_err+1; + /* If long level-codes aren't allowed, we need to allow QP high enough to avoid them. */ + if( !h->param.b_cabac && h->sps->i_profile_idc < PROFILE_HIGH ) + while( h->chroma_qp_table[SPEC_QP(h->param.rc.i_qp_max)] <= 12 || h->param.rc.i_qp_max <= 12 ) + h->param.rc.i_qp_max++; + if( h->param.rc.i_qp_min > h->param.rc.i_qp_max ) + { + x264_log( h, X264_LOG_ERROR, "Impossible QP constraints for CQM (min=%d, max=%d)\n", h->param.rc.i_qp_min, h->param.rc.i_qp_max ); + return -1; + } + } + return 0; +fail: + x264_cqm_delete( h ); + return -1; +} + +#define CQM_DELETE( n, max )\ + for( int i = 0; i < (max); i++ )\ + {\ + int j;\ + for( j = 0; j < i; j++ )\ + if( h->quant##n##_mf[i] == h->quant##n##_mf[j] )\ + break;\ + if( j == i )\ + {\ + x264_free( h-> quant##n##_mf[i] );\ + x264_free( h->dequant##n##_mf[i] );\ + x264_free( h->unquant##n##_mf[i] );\ + }\ + for( j = 0; j < i; j++ )\ + if( h->quant##n##_bias[i] == h->quant##n##_bias[j] )\ + break;\ + if( j == i )\ + {\ + x264_free( h->quant##n##_bias[i] );\ + x264_free( h->quant##n##_bias0[i] );\ + }\ + } + +void x264_cqm_delete( x264_t *h ) +{ + CQM_DELETE( 4, 4 ); + CQM_DELETE( 8, CHROMA444 ? 4 : 2 ); + x264_free( h->nr_offset_emergency ); +} + +static int x264_cqm_parse_jmlist( x264_t *h, const char *buf, const char *name, + uint8_t *cqm, const uint8_t *jvt, int length ) +{ + int i; + + char *p = strstr( buf, name ); + if( !p ) + { + memset( cqm, 16, length ); + return 0; + } + + p += strlen( name ); + if( *p == 'U' || *p == 'V' ) + p++; + + char *nextvar = strstr( p, "INT" ); + + for( i = 0; i < length && (p = strpbrk( p, " \t\n," )) && (p = strpbrk( p, "0123456789" )); i++ ) + { + int coef = -1; + sscanf( p, "%d", &coef ); + if( i == 0 && coef == 0 ) + { + memcpy( cqm, jvt, length ); + return 0; + } + if( coef < 1 || coef > 255 ) + { + x264_log( h, X264_LOG_ERROR, "bad coefficient in list '%s'\n", name ); + return -1; + } + cqm[i] = coef; + } + + if( (nextvar && p > nextvar) || i != length ) + { + x264_log( h, X264_LOG_ERROR, "not enough coefficients in list '%s'\n", name ); + return -1; + } + + return 0; +} + +int x264_cqm_parse_file( x264_t *h, const char *filename ) +{ + char *p; + int b_error = 0; + + h->param.i_cqm_preset = X264_CQM_CUSTOM; + + char *buf = x264_slurp_file( filename ); + if( !buf ) + { + x264_log( h, X264_LOG_ERROR, "can't open file '%s'\n", filename ); + return -1; + } + + while( (p = strchr( buf, '#' )) != NULL ) + memset( p, ' ', strcspn( p, "\n" ) ); + + b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA4X4_LUMA", h->param.cqm_4iy, x264_cqm_jvt4i, 16 ); + b_error |= x264_cqm_parse_jmlist( h, buf, "INTER4X4_LUMA", h->param.cqm_4py, x264_cqm_jvt4p, 16 ); + b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA4X4_CHROMA", h->param.cqm_4ic, x264_cqm_jvt4i, 16 ); + b_error |= x264_cqm_parse_jmlist( h, buf, "INTER4X4_CHROMA", h->param.cqm_4pc, x264_cqm_jvt4p, 16 ); + b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA8X8_LUMA", h->param.cqm_8iy, x264_cqm_jvt8i, 64 ); + b_error |= x264_cqm_parse_jmlist( h, buf, "INTER8X8_LUMA", h->param.cqm_8py, x264_cqm_jvt8p, 64 ); + if( CHROMA444 ) + { + b_error |= x264_cqm_parse_jmlist( h, buf, "INTRA8X8_CHROMA", h->param.cqm_8ic, x264_cqm_jvt8i, 64 ); + b_error |= x264_cqm_parse_jmlist( h, buf, "INTER8X8_CHROMA", h->param.cqm_8pc, x264_cqm_jvt8p, 64 ); + } + + x264_free( buf ); + return b_error; +} + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.h new file mode 100644 index 00000000..5760f33c --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/set.h @@ -0,0 +1,347 @@ +/***************************************************************************** + * set.h: quantization init + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_SET_H +#define X264_SET_H + +enum profile_e +{ + PROFILE_BASELINE = 66, + PROFILE_MAIN = 77, + PROFILE_HIGH = 100, + PROFILE_HIGH10 = 110, + PROFILE_HIGH422 = 122, + PROFILE_HIGH444_PREDICTIVE = 244, +}; + +enum chroma_format_e +{ + CHROMA_400 = 0, + CHROMA_420 = 1, + CHROMA_422 = 2, + CHROMA_444 = 3, +}; + +enum cqm4_e +{ + CQM_4IY = 0, + CQM_4PY = 1, + CQM_4IC = 2, + CQM_4PC = 3 +}; +enum cqm8_e +{ + CQM_8IY = 0, + CQM_8PY = 1, + CQM_8IC = 2, + CQM_8PC = 3, +}; + +typedef struct +{ + int i_id; + + int i_profile_idc; + int i_level_idc; + + int b_constraint_set0; + int b_constraint_set1; + int b_constraint_set2; + int b_constraint_set3; + + int i_log2_max_frame_num; + + int i_poc_type; + /* poc 0 */ + int i_log2_max_poc_lsb; + + int i_num_ref_frames; + int b_gaps_in_frame_num_value_allowed; + int i_mb_width; + int i_mb_height; + int b_frame_mbs_only; + int b_mb_adaptive_frame_field; + int b_direct8x8_inference; + + int b_crop; + struct + { + int i_left; + int i_right; + int i_top; + int i_bottom; + } crop; + + int b_vui; + struct + { + int b_aspect_ratio_info_present; + int i_sar_width; + int i_sar_height; + + int b_overscan_info_present; + int b_overscan_info; + + int b_signal_type_present; + int i_vidformat; + int b_fullrange; + int b_color_description_present; + int i_colorprim; + int i_transfer; + int i_colmatrix; + + int b_chroma_loc_info_present; + int i_chroma_loc_top; + int i_chroma_loc_bottom; + + int b_timing_info_present; + uint32_t i_num_units_in_tick; + uint32_t i_time_scale; + int b_fixed_frame_rate; + + int b_nal_hrd_parameters_present; + int b_vcl_hrd_parameters_present; + + struct + { + int i_cpb_cnt; + int i_bit_rate_scale; + int i_cpb_size_scale; + int i_bit_rate_value; + int i_cpb_size_value; + int i_bit_rate_unscaled; + int i_cpb_size_unscaled; + int b_cbr_hrd; + + int i_initial_cpb_removal_delay_length; + int i_cpb_removal_delay_length; + int i_dpb_output_delay_length; + int i_time_offset_length; + } hrd; + + int b_pic_struct_present; + int b_bitstream_restriction; + int b_motion_vectors_over_pic_boundaries; + int i_max_bytes_per_pic_denom; + int i_max_bits_per_mb_denom; + int i_log2_max_mv_length_horizontal; + int i_log2_max_mv_length_vertical; + int i_num_reorder_frames; + int i_max_dec_frame_buffering; + + /* FIXME to complete */ + } vui; + + int b_qpprime_y_zero_transform_bypass; + int i_chroma_format_idc; + +} x264_sps_t; + +typedef struct +{ + int i_id; + int i_sps_id; + + int b_cabac; + + int b_pic_order; + int i_num_slice_groups; + + int i_num_ref_idx_l0_default_active; + int i_num_ref_idx_l1_default_active; + + int b_weighted_pred; + int b_weighted_bipred; + + int i_pic_init_qp; + int i_pic_init_qs; + + int i_chroma_qp_index_offset; + + int b_deblocking_filter_control; + int b_constrained_intra_pred; + int b_redundant_pic_cnt; + + int b_transform_8x8_mode; + + int i_cqm_preset; + const uint8_t *scaling_list[8]; /* could be 12, but we don't allow separate Cb/Cr lists */ + +} x264_pps_t; + +/* default quant matrices */ +static const uint8_t x264_cqm_jvt4i[16] = +{ + 6,13,20,28, + 13,20,28,32, + 20,28,32,37, + 28,32,37,42 +}; +static const uint8_t x264_cqm_jvt4p[16] = +{ + 10,14,20,24, + 14,20,24,27, + 20,24,27,30, + 24,27,30,34 +}; +static const uint8_t x264_cqm_jvt8i[64] = +{ + 6,10,13,16,18,23,25,27, + 10,11,16,18,23,25,27,29, + 13,16,18,23,25,27,29,31, + 16,18,23,25,27,29,31,33, + 18,23,25,27,29,31,33,36, + 23,25,27,29,31,33,36,38, + 25,27,29,31,33,36,38,40, + 27,29,31,33,36,38,40,42 +}; +static const uint8_t x264_cqm_jvt8p[64] = +{ + 9,13,15,17,19,21,22,24, + 13,13,17,19,21,22,24,25, + 15,17,19,21,22,24,25,27, + 17,19,21,22,24,25,27,28, + 19,21,22,24,25,27,28,30, + 21,22,24,25,27,28,30,32, + 22,24,25,27,28,30,32,33, + 24,25,27,28,30,32,33,35 +}; +static const uint8_t x264_cqm_flat16[64] = +{ + 16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16, + 16,16,16,16,16,16,16,16 +}; +static const uint8_t * const x264_cqm_jvt[8] = +{ + x264_cqm_jvt4i, x264_cqm_jvt4p, + x264_cqm_jvt4i, x264_cqm_jvt4p, + x264_cqm_jvt8i, x264_cqm_jvt8p, + x264_cqm_jvt8i, x264_cqm_jvt8p +}; + +// 1080i25_avci50, 1080p25_avci50 +static const uint8_t x264_cqm_avci50_4ic[16] = +{ + 16,22,28,40, + 22,28,40,44, + 28,40,44,48, + 40,44,48,60 +}; + +// 1080i25_avci50, +static const uint8_t x264_cqm_avci50_1080i_8iy[64] = +{ + 16,18,19,21,27,33,81,87, + 18,19,21,24,30,33,81,87, + 19,21,24,27,30,78,84,90, + 21,24,27,30,33,78,84,90, + 24,27,30,33,78,81,84,90, + 24,27,30,33,78,81,84,93, + 27,30,33,78,78,81,87,93, + 30,33,33,78,81,84,87,96 +}; + +// 1080p25_avci50, 720p25_avci50, 720p50_avci50 +static const uint8_t x264_cqm_avci50_p_8iy[64] = +{ + 16,18,19,21,24,27,30,33, + 18,19,21,24,27,30,33,78, + 19,21,24,27,30,33,78,81, + 21,24,27,30,33,78,81,84, + 24,27,30,33,78,81,84,87, + 27,30,33,78,81,84,87,90, + 30,33,78,81,84,87,90,93, + 33,78,81,84,87,90,93,96 +}; + +// 1080i25_avci100, 1080p25_avci100 +static const uint8_t x264_cqm_avci100_1080_4ic[16] = +{ + 16,20,26,32, + 20,26,32,38, + 26,32,38,44, + 32,38,44,50 +}; + +// 720p25_avci100, 720p50_avci100 +static const uint8_t x264_cqm_avci100_720p_4ic[16] = +{ + 16,21,27,34, + 21,27,34,41, + 27,34,41,46, + 34,41,46,54 +}; + +// 1080i25_avci100, +static const uint8_t x264_cqm_avci100_1080i_8iy[64] = +{ + 16,19,20,23,24,26,32,42, + 18,19,22,24,26,32,36,42, + 18,20,23,24,26,32,36,63, + 19,20,23,26,32,36,42,63, + 20,22,24,26,32,36,59,63, + 22,23,24,26,32,36,59,68, + 22,23,24,26,32,42,59,68, + 22,23,24,26,36,42,59,72 +}; + +// 1080p25_avci100, +static const uint8_t x264_cqm_avci100_1080p_8iy[64] = +{ + 16,18,19,20,22,23,24,26, + 18,19,20,22,23,24,26,32, + 19,20,22,23,24,26,32,36, + 20,22,23,24,26,32,36,42, + 22,23,24,26,32,36,42,59, + 23,24,26,32,36,42,59,63, + 24,26,32,36,42,59,63,68, + 26,32,36,42,59,63,68,72 +}; + +// 720p25_avci100, 720p50_avci100 +static const uint8_t x264_cqm_avci100_720p_8iy[64] = +{ + 16,18,19,21,22,24,26,32, + 18,19,19,21,22,24,26,32, + 19,19,21,22,22,24,26,32, + 21,21,22,22,23,24,26,34, + 22,22,22,23,24,25,26,34, + 24,24,24,24,25,26,34,36, + 26,26,26,26,26,34,36,38, + 32,32,32,34,34,36,38,42 +}; + +int x264_cqm_init( x264_t *h ); +void x264_cqm_delete( x264_t *h ); +int x264_cqm_parse_file( x264_t *h, const char *filename ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.c new file mode 100644 index 00000000..72eb86d0 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.c @@ -0,0 +1,164 @@ +/***************************************************************************** + * threadpool.c: thread pooling + ***************************************************************************** + * Copyright (C) 2010-2017 x264 project + * + * Authors: Steven Walters + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +typedef struct +{ + void *(*func)(void *); + void *arg; + void *ret; +} x264_threadpool_job_t; + +struct x264_threadpool_t +{ + int exit; + int threads; + x264_pthread_t *thread_handle; + void (*init_func)(void *); + void *init_arg; + + /* requires a synchronized list structure and associated methods, + so use what is already implemented for frames */ + x264_sync_frame_list_t uninit; /* list of jobs that are awaiting use */ + x264_sync_frame_list_t run; /* list of jobs that are queued for processing by the pool */ + x264_sync_frame_list_t done; /* list of jobs that have finished processing */ +}; + +static void *x264_threadpool_thread( x264_threadpool_t *pool ) +{ + if( pool->init_func ) + pool->init_func( pool->init_arg ); + + while( !pool->exit ) + { + x264_threadpool_job_t *job = NULL; + x264_pthread_mutex_lock( &pool->run.mutex ); + while( !pool->exit && !pool->run.i_size ) + x264_pthread_cond_wait( &pool->run.cv_fill, &pool->run.mutex ); + if( pool->run.i_size ) + { + job = (void*)x264_frame_shift( pool->run.list ); + pool->run.i_size--; + } + x264_pthread_mutex_unlock( &pool->run.mutex ); + if( !job ) + continue; + job->ret = (void*)x264_stack_align( job->func, job->arg ); /* execute the function */ + x264_sync_frame_list_push( &pool->done, (void*)job ); + } + return NULL; +} + +int x264_threadpool_init( x264_threadpool_t **p_pool, int threads, + void (*init_func)(void *), void *init_arg ) +{ + if( threads <= 0 ) + return -1; + + x264_threadpool_t *pool; + CHECKED_MALLOCZERO( pool, sizeof(x264_threadpool_t) ); + *p_pool = pool; + + pool->init_func = init_func; + pool->init_arg = init_arg; + pool->threads = threads; + + CHECKED_MALLOC( pool->thread_handle, pool->threads * sizeof(x264_pthread_t) ); + + if( x264_sync_frame_list_init( &pool->uninit, pool->threads ) || + x264_sync_frame_list_init( &pool->run, pool->threads ) || + x264_sync_frame_list_init( &pool->done, pool->threads ) ) + goto fail; + + for( int i = 0; i < pool->threads; i++ ) + { + x264_threadpool_job_t *job; + CHECKED_MALLOC( job, sizeof(x264_threadpool_job_t) ); + x264_sync_frame_list_push( &pool->uninit, (void*)job ); + } + for( int i = 0; i < pool->threads; i++ ) + if( x264_pthread_create( pool->thread_handle+i, NULL, (void*)x264_threadpool_thread, pool ) ) + goto fail; + + return 0; +fail: + return -1; +} + +void x264_threadpool_run( x264_threadpool_t *pool, void *(*func)(void *), void *arg ) +{ + x264_threadpool_job_t *job = (void*)x264_sync_frame_list_pop( &pool->uninit ); + job->func = func; + job->arg = arg; + x264_sync_frame_list_push( &pool->run, (void*)job ); +} + +void *x264_threadpool_wait( x264_threadpool_t *pool, void *arg ) +{ + x264_pthread_mutex_lock( &pool->done.mutex ); + while( 1 ) + { + for( int i = 0; i < pool->done.i_size; i++ ) + if( ((x264_threadpool_job_t*)pool->done.list[i])->arg == arg ) + { + x264_threadpool_job_t *job = (void*)x264_frame_shift( pool->done.list+i ); + pool->done.i_size--; + x264_pthread_mutex_unlock( &pool->done.mutex ); + + void *ret = job->ret; + x264_sync_frame_list_push( &pool->uninit, (void*)job ); + return ret; + } + + x264_pthread_cond_wait( &pool->done.cv_fill, &pool->done.mutex ); + } +} + +static void x264_threadpool_list_delete( x264_sync_frame_list_t *slist ) +{ + for( int i = 0; slist->list[i]; i++ ) + { + x264_free( slist->list[i] ); + slist->list[i] = NULL; + } + x264_sync_frame_list_delete( slist ); +} + +void x264_threadpool_delete( x264_threadpool_t *pool ) +{ + x264_pthread_mutex_lock( &pool->run.mutex ); + pool->exit = 1; + x264_pthread_cond_broadcast( &pool->run.cv_fill ); + x264_pthread_mutex_unlock( &pool->run.mutex ); + for( int i = 0; i < pool->threads; i++ ) + x264_pthread_join( pool->thread_handle[i], NULL ); + + x264_threadpool_list_delete( &pool->uninit ); + x264_threadpool_list_delete( &pool->run ); + x264_threadpool_list_delete( &pool->done ); + x264_free( pool->thread_handle ); + x264_free( pool ); +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.h new file mode 100644 index 00000000..639cad42 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/threadpool.h @@ -0,0 +1,44 @@ +/***************************************************************************** + * threadpool.h: thread pooling + ***************************************************************************** + * Copyright (C) 2010-2017 x264 project + * + * Authors: Steven Walters + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_THREADPOOL_H +#define X264_THREADPOOL_H + +typedef struct x264_threadpool_t x264_threadpool_t; + +#if HAVE_THREAD +int x264_threadpool_init( x264_threadpool_t **p_pool, int threads, + void (*init_func)(void *), void *init_arg ); +void x264_threadpool_run( x264_threadpool_t *pool, void *(*func)(void *), void *arg ); +void *x264_threadpool_wait( x264_threadpool_t *pool, void *arg ); +void x264_threadpool_delete( x264_threadpool_t *pool ); +#else +#define x264_threadpool_init(p,t,f,a) -1 +#define x264_threadpool_run(p,f,a) +#define x264_threadpool_wait(p,a) NULL +#define x264_threadpool_delete(p) +#endif + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/vlc.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/vlc.c new file mode 100644 index 00000000..a55d4b90 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/vlc.c @@ -0,0 +1,869 @@ +/***************************************************************************** + * vlc.c : vlc tables + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Fiona Glaser + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common.h" + +/* [nC] */ +const vlc_t x264_coeff0_token[6] = +{ + { 0x1, 1 }, /* str=1 */ + { 0x3, 2 }, /* str=11 */ + { 0xf, 4 }, /* str=1111 */ + { 0x3, 6 }, /* str=000011 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 1 }, /* str=1 */ +}; + +/* [nC][i_total_coeff-1][i_trailing] */ +const vlc_t x264_coeff_token[6][16][4] = +{ + { /* table 0 */ + { /* i_total 1 */ + { 0x5, 6 }, /* str=000101 */ + { 0x1, 2 }, /* str=01 */ + }, + { /* i_total 2 */ + { 0x7, 8 }, /* str=00000111 */ + { 0x4, 6 }, /* str=000100 */ + { 0x1, 3 }, /* str=001 */ + }, + { /* i_total 3 */ + { 0x7, 9 }, /* str=000000111 */ + { 0x6, 8 }, /* str=00000110 */ + { 0x5, 7 }, /* str=0000101 */ + { 0x3, 5 }, /* str=00011 */ + }, + { /* i_total 4 */ + { 0x7, 10 }, /* str=0000000111 */ + { 0x6, 9 }, /* str=000000110 */ + { 0x5, 8 }, /* str=00000101 */ + { 0x3, 6 }, /* str=000011 */ + }, + { /* i_total 5 */ + { 0x7, 11 }, /* str=00000000111 */ + { 0x6, 10 }, /* str=0000000110 */ + { 0x5, 9 }, /* str=000000101 */ + { 0x4, 7 }, /* str=0000100 */ + }, + { /* i_total 6 */ + { 0xf, 13 }, /* str=0000000001111 */ + { 0x6, 11 }, /* str=00000000110 */ + { 0x5, 10 }, /* str=0000000101 */ + { 0x4, 8 }, /* str=00000100 */ + }, + { /* i_total 7 */ + { 0xb, 13 }, /* str=0000000001011 */ + { 0xe, 13 }, /* str=0000000001110 */ + { 0x5, 11 }, /* str=00000000101 */ + { 0x4, 9 }, /* str=000000100 */ + }, + { /* i_total 8 */ + { 0x8, 13 }, /* str=0000000001000 */ + { 0xa, 13 }, /* str=0000000001010 */ + { 0xd, 13 }, /* str=0000000001101 */ + { 0x4, 10 }, /* str=0000000100 */ + }, + { /* i_total 9 */ + { 0xf, 14 }, /* str=00000000001111 */ + { 0xe, 14 }, /* str=00000000001110 */ + { 0x9, 13 }, /* str=0000000001001 */ + { 0x4, 11 }, /* str=00000000100 */ + }, + { /* i_total 10 */ + { 0xb, 14 }, /* str=00000000001011 */ + { 0xa, 14 }, /* str=00000000001010 */ + { 0xd, 14 }, /* str=00000000001101 */ + { 0xc, 13 }, /* str=0000000001100 */ + }, + { /* i_total 14 */ + { 0xf, 15 }, /* str=000000000001111 */ + { 0xe, 15 }, /* str=000000000001110 */ + { 0x9, 14 }, /* str=00000000001001 */ + { 0xc, 14 }, /* str=00000000001100 */ + }, + { /* i_total 12 */ + { 0xb, 15 }, /* str=000000000001011 */ + { 0xa, 15 }, /* str=000000000001010 */ + { 0xd, 15 }, /* str=000000000001101 */ + { 0x8, 14 }, /* str=00000000001000 */ + }, + { /* i_total 13 */ + { 0xf, 16 }, /* str=0000000000001111 */ + { 0x1, 15 }, /* str=000000000000001 */ + { 0x9, 15 }, /* str=000000000001001 */ + { 0xc, 15 }, /* str=000000000001100 */ + }, + { /* i_total 14 */ + { 0xb, 16 }, /* str=0000000000001011 */ + { 0xe, 16 }, /* str=0000000000001110 */ + { 0xd, 16 }, /* str=0000000000001101 */ + { 0x8, 15 }, /* str=000000000001000 */ + }, + { /* i_total 15 */ + { 0x7, 16 }, /* str=0000000000000111 */ + { 0xa, 16 }, /* str=0000000000001010 */ + { 0x9, 16 }, /* str=0000000000001001 */ + { 0xc, 16 }, /* str=0000000000001100 */ + }, + { /* i_total 16 */ + { 0x4, 16 }, /* str=0000000000000100 */ + { 0x6, 16 }, /* str=0000000000000110 */ + { 0x5, 16 }, /* str=0000000000000101 */ + { 0x8, 16 }, /* str=0000000000001000 */ + }, + }, + { /* table 1 */ + { /* i_total 1 */ + { 0xb, 6 }, /* str=001011 */ + { 0x2, 2 }, /* str=10 */ + }, + { /* i_total 2 */ + { 0x7, 6 }, /* str=000111 */ + { 0x7, 5 }, /* str=00111 */ + { 0x3, 3 }, /* str=011 */ + }, + { /* i_total 3 */ + { 0x7, 7 }, /* str=0000111 */ + { 0xa, 6 }, /* str=001010 */ + { 0x9, 6 }, /* str=001001 */ + { 0x5, 4 }, /* str=0101 */ + }, + { /* i_total 4 */ + { 0x7, 8 }, /* str=00000111 */ + { 0x6, 6 }, /* str=000110 */ + { 0x5, 6 }, /* str=000101 */ + { 0x4, 4 }, /* str=0100 */ + }, + { /* i_total 5 */ + { 0x4, 8 }, /* str=00000100 */ + { 0x6, 7 }, /* str=0000110 */ + { 0x5, 7 }, /* str=0000101 */ + { 0x6, 5 }, /* str=00110 */ + }, + { /* i_total 6 */ + { 0x7, 9 }, /* str=000000111 */ + { 0x6, 8 }, /* str=00000110 */ + { 0x5, 8 }, /* str=00000101 */ + { 0x8, 6 }, /* str=001000 */ + }, + { /* i_total 7 */ + { 0xf, 11 }, /* str=00000001111 */ + { 0x6, 9 }, /* str=000000110 */ + { 0x5, 9 }, /* str=000000101 */ + { 0x4, 6 }, /* str=000100 */ + }, + { /* i_total 8 */ + { 0xb, 11 }, /* str=00000001011 */ + { 0xe, 11 }, /* str=00000001110 */ + { 0xd, 11 }, /* str=00000001101 */ + { 0x4, 7 }, /* str=0000100 */ + }, + { /* i_total 9 */ + { 0xf, 12 }, /* str=000000001111 */ + { 0xa, 11 }, /* str=00000001010 */ + { 0x9, 11 }, /* str=00000001001 */ + { 0x4, 9 }, /* str=000000100 */ + }, + { /* i_total 10 */ + { 0xb, 12 }, /* str=000000001011 */ + { 0xe, 12 }, /* str=000000001110 */ + { 0xd, 12 }, /* str=000000001101 */ + { 0xc, 11 }, /* str=00000001100 */ + }, + { /* i_total 11 */ + { 0x8, 12 }, /* str=000000001000 */ + { 0xa, 12 }, /* str=000000001010 */ + { 0x9, 12 }, /* str=000000001001 */ + { 0x8, 11 }, /* str=00000001000 */ + }, + { /* i_total 12 */ + { 0xf, 13 }, /* str=0000000001111 */ + { 0xe, 13 }, /* str=0000000001110 */ + { 0xd, 13 }, /* str=0000000001101 */ + { 0xc, 12 }, /* str=000000001100 */ + }, + { /* i_total 13 */ + { 0xb, 13 }, /* str=0000000001011 */ + { 0xa, 13 }, /* str=0000000001010 */ + { 0x9, 13 }, /* str=0000000001001 */ + { 0xc, 13 }, /* str=0000000001100 */ + }, + { /* i_total 14 */ + { 0x7, 13 }, /* str=0000000000111 */ + { 0xb, 14 }, /* str=00000000001011 */ + { 0x6, 13 }, /* str=0000000000110 */ + { 0x8, 13 }, /* str=0000000001000 */ + }, + { /* i_total 15 */ + { 0x9, 14 }, /* str=00000000001001 */ + { 0x8, 14 }, /* str=00000000001000 */ + { 0xa, 14 }, /* str=00000000001010 */ + { 0x1, 13 }, /* str=0000000000001 */ + }, + { /* i_total 16 */ + { 0x7, 14 }, /* str=00000000000111 */ + { 0x6, 14 }, /* str=00000000000110 */ + { 0x5, 14 }, /* str=00000000000101 */ + { 0x4, 14 }, /* str=00000000000100 */ + }, + }, + { /* table 2 */ + { /* i_total 1 */ + { 0xf, 6 }, /* str=001111 */ + { 0xe, 4 }, /* str=1110 */ + }, + { /* i_total 2 */ + { 0xb, 6 }, /* str=001011 */ + { 0xf, 5 }, /* str=01111 */ + { 0xd, 4 }, /* str=1101 */ + }, + { /* i_total 3 */ + { 0x8, 6 }, /* str=001000 */ + { 0xc, 5 }, /* str=01100 */ + { 0xe, 5 }, /* str=01110 */ + { 0xc, 4 }, /* str=1100 */ + }, + { /* i_total 4 */ + { 0xf, 7 }, /* str=0001111 */ + { 0xa, 5 }, /* str=01010 */ + { 0xb, 5 }, /* str=01011 */ + { 0xb, 4 }, /* str=1011 */ + }, + { /* i_total 5 */ + { 0xb, 7 }, /* str=0001011 */ + { 0x8, 5 }, /* str=01000 */ + { 0x9, 5 }, /* str=01001 */ + { 0xa, 4 }, /* str=1010 */ + }, + { /* i_total 6 */ + { 0x9, 7 }, /* str=0001001 */ + { 0xe, 6 }, /* str=001110 */ + { 0xd, 6 }, /* str=001101 */ + { 0x9, 4 }, /* str=1001 */ + }, + { /* i_total 7 */ + { 0x8, 7 }, /* str=0001000 */ + { 0xa, 6 }, /* str=001010 */ + { 0x9, 6 }, /* str=001001 */ + { 0x8, 4 }, /* str=1000 */ + }, + { /* i_total 8 */ + { 0xf, 8 }, /* str=00001111 */ + { 0xe, 7 }, /* str=0001110 */ + { 0xd, 7 }, /* str=0001101 */ + { 0xd, 5 }, /* str=01101 */ + }, + { /* i_total 9 */ + { 0xb, 8 }, /* str=00001011 */ + { 0xe, 8 }, /* str=00001110 */ + { 0xa, 7 }, /* str=0001010 */ + { 0xc, 6 }, /* str=001100 */ + }, + { /* i_total 10 */ + { 0xf, 9 }, /* str=000001111 */ + { 0xa, 8 }, /* str=00001010 */ + { 0xd, 8 }, /* str=00001101 */ + { 0xc, 7 }, /* str=0001100 */ + }, + { /* i_total 11 */ + { 0xb, 9 }, /* str=000001011 */ + { 0xe, 9 }, /* str=000001110 */ + { 0x9, 8 }, /* str=00001001 */ + { 0xc, 8 }, /* str=00001100 */ + }, + { /* i_total 12 */ + { 0x8, 9 }, /* str=000001000 */ + { 0xa, 9 }, /* str=000001010 */ + { 0xd, 9 }, /* str=000001101 */ + { 0x8, 8 }, /* str=00001000 */ + }, + { /* i_total 13 */ + { 0xd, 10 }, /* str=0000001101 */ + { 0x7, 9 }, /* str=000000111 */ + { 0x9, 9 }, /* str=000001001 */ + { 0xc, 9 }, /* str=000001100 */ + }, + { /* i_total 14 */ + { 0x9, 10 }, /* str=0000001001 */ + { 0xc, 10 }, /* str=0000001100 */ + { 0xb, 10 }, /* str=0000001011 */ + { 0xa, 10 }, /* str=0000001010 */ + }, + { /* i_total 15 */ + { 0x5, 10 }, /* str=0000000101 */ + { 0x8, 10 }, /* str=0000001000 */ + { 0x7, 10 }, /* str=0000000111 */ + { 0x6, 10 }, /* str=0000000110 */ + }, + { /* i_total 16 */ + { 0x1, 10 }, /* str=0000000001 */ + { 0x4, 10 }, /* str=0000000100 */ + { 0x3, 10 }, /* str=0000000011 */ + { 0x2, 10 }, /* str=0000000010 */ + }, + }, + { /* table 3 */ + { /* i_total 1 */ + { 0x0, 6 }, /* str=000000 */ + { 0x1, 6 }, /* str=000001 */ + }, + { /* i_total 2 */ + { 0x4, 6 }, /* str=000100 */ + { 0x5, 6 }, /* str=000101 */ + { 0x6, 6 }, /* str=000110 */ + }, + { /* i_total 3 */ + { 0x8, 6 }, /* str=001000 */ + { 0x9, 6 }, /* str=001001 */ + { 0xa, 6 }, /* str=001010 */ + { 0xb, 6 }, /* str=001011 */ + }, + { /* i_total 4 */ + { 0xc, 6 }, /* str=001100 */ + { 0xd, 6 }, /* str=001101 */ + { 0xe, 6 }, /* str=001110 */ + { 0xf, 6 }, /* str=001111 */ + }, + { /* i_total 5 */ + { 0x10, 6 }, /* str=010000 */ + { 0x11, 6 }, /* str=010001 */ + { 0x12, 6 }, /* str=010010 */ + { 0x13, 6 }, /* str=010011 */ + }, + { /* i_total 6 */ + { 0x14, 6 }, /* str=010100 */ + { 0x15, 6 }, /* str=010101 */ + { 0x16, 6 }, /* str=010110 */ + { 0x17, 6 }, /* str=010111 */ + }, + { /* i_total 7 */ + { 0x18, 6 }, /* str=011000 */ + { 0x19, 6 }, /* str=011001 */ + { 0x1a, 6 }, /* str=011010 */ + { 0x1b, 6 }, /* str=011011 */ + }, + { /* i_total 8 */ + { 0x1c, 6 }, /* str=011100 */ + { 0x1d, 6 }, /* str=011101 */ + { 0x1e, 6 }, /* str=011110 */ + { 0x1f, 6 }, /* str=011111 */ + }, + { /* i_total 9 */ + { 0x20, 6 }, /* str=100000 */ + { 0x21, 6 }, /* str=100001 */ + { 0x22, 6 }, /* str=100010 */ + { 0x23, 6 }, /* str=100011 */ + }, + { /* i_total 10 */ + { 0x24, 6 }, /* str=100100 */ + { 0x25, 6 }, /* str=100101 */ + { 0x26, 6 }, /* str=100110 */ + { 0x27, 6 }, /* str=100111 */ + }, + { /* i_total 11 */ + { 0x28, 6 }, /* str=101000 */ + { 0x29, 6 }, /* str=101001 */ + { 0x2a, 6 }, /* str=101010 */ + { 0x2b, 6 }, /* str=101011 */ + }, + { /* i_total 12 */ + { 0x2c, 6 }, /* str=101100 */ + { 0x2d, 6 }, /* str=101101 */ + { 0x2e, 6 }, /* str=101110 */ + { 0x2f, 6 }, /* str=101111 */ + }, + { /* i_total 13 */ + { 0x30, 6 }, /* str=110000 */ + { 0x31, 6 }, /* str=110001 */ + { 0x32, 6 }, /* str=110010 */ + { 0x33, 6 }, /* str=110011 */ + }, + { /* i_total 14 */ + { 0x34, 6 }, /* str=110100 */ + { 0x35, 6 }, /* str=110101 */ + { 0x36, 6 }, /* str=110110 */ + { 0x37, 6 }, /* str=110111 */ + }, + { /* i_total 15 */ + { 0x38, 6 }, /* str=111000 */ + { 0x39, 6 }, /* str=111001 */ + { 0x3a, 6 }, /* str=111010 */ + { 0x3b, 6 }, /* str=111011 */ + }, + { /* i_total 16 */ + { 0x3c, 6 }, /* str=111100 */ + { 0x3d, 6 }, /* str=111101 */ + { 0x3e, 6 }, /* str=111110 */ + { 0x3f, 6 }, /* str=111111 */ + }, + }, + { /* table 4 */ + { /* i_total 1 */ + { 0x7, 6 }, /* str=000111 */ + { 0x1, 1 }, /* str=1 */ + }, + { /* i_total 2 */ + { 0x4, 6 }, /* str=000100 */ + { 0x6, 6 }, /* str=000110 */ + { 0x1, 3 }, /* str=001 */ + }, + { /* i_total 3 */ + { 0x3, 6 }, /* str=000011 */ + { 0x3, 7 }, /* str=0000011 */ + { 0x2, 7 }, /* str=0000010 */ + { 0x5, 6 }, /* str=000101 */ + }, + { /* i_total 4 */ + { 0x2, 6 }, /* str=000010 */ + { 0x3, 8 }, /* str=00000011 */ + { 0x2, 8 }, /* str=00000010 */ + { 0x0, 7 }, /* str=0000000 */ + }, + }, + { /* table 5 */ + { /* i_total 1 */ + { 0xf, 7 }, /* str=0001111 */ + { 0x1, 2 }, /* str=01 */ + }, + { /* i_total 2 */ + { 0xe, 7 }, /* str=0001110 */ + { 0xd, 7 }, /* str=0001101 */ + { 0x1, 3 }, /* str=001 */ + }, + { /* i_total 3 */ + { 0x7, 9 }, /* str=000000111 */ + { 0xc, 7 }, /* str=0001100 */ + { 0xb, 7 }, /* str=0001011 */ + { 0x1, 5 }, /* str=00001 */ + }, + { /* i_total 4 */ + { 0x6, 9 }, /* str=000000110 */ + { 0x5, 9 }, /* str=000000101 */ + { 0xa, 7 }, /* str=0001010 */ + { 0x1, 6 }, /* str=000001 */ + }, + { /* i_total 5 */ + { 0x7, 10 }, /* str=0000000111 */ + { 0x6, 10 }, /* str=0000000110 */ + { 0x4, 9 }, /* str=000000100 */ + { 0x9, 7 }, /* str=0001001 */ + }, + { /* i_total 6 */ + { 0x7, 11 }, /* str=00000000111 */ + { 0x6, 11 }, /* str=00000000110 */ + { 0x5, 10 }, /* str=0000000101 */ + { 0x8, 7 }, /* str=0001000 */ + }, + { /* i_total 7 */ + { 0x7, 12 }, /* str=000000000111 */ + { 0x6, 12 }, /* str=000000000110 */ + { 0x5, 11 }, /* str=00000000101 */ + { 0x4, 10 }, /* str=0000000100 */ + }, + { /* i_total 8 */ + { 0x7, 13 }, /* str=0000000000111 */ + { 0x5, 12 }, /* str=000000000101 */ + { 0x4, 12 }, /* str=000000000100 */ + { 0x4, 11 }, /* str=00000000100 */ + }, + }, +}; + +/* [i_total_coeff-1][i_total_zeros] */ +const vlc_t x264_total_zeros[15][16] = +{ + { /* i_total 1 */ + { 0x1, 1 }, /* str=1 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 3 }, /* str=010 */ + { 0x3, 4 }, /* str=0011 */ + { 0x2, 4 }, /* str=0010 */ + { 0x3, 5 }, /* str=00011 */ + { 0x2, 5 }, /* str=00010 */ + { 0x3, 6 }, /* str=000011 */ + { 0x2, 6 }, /* str=000010 */ + { 0x3, 7 }, /* str=0000011 */ + { 0x2, 7 }, /* str=0000010 */ + { 0x3, 8 }, /* str=00000011 */ + { 0x2, 8 }, /* str=00000010 */ + { 0x3, 9 }, /* str=000000011 */ + { 0x2, 9 }, /* str=000000010 */ + { 0x1, 9 }, /* str=000000001 */ + }, + { /* i_total 2 */ + { 0x7, 3 }, /* str=111 */ + { 0x6, 3 }, /* str=110 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 3 }, /* str=100 */ + { 0x3, 3 }, /* str=011 */ + { 0x5, 4 }, /* str=0101 */ + { 0x4, 4 }, /* str=0100 */ + { 0x3, 4 }, /* str=0011 */ + { 0x2, 4 }, /* str=0010 */ + { 0x3, 5 }, /* str=00011 */ + { 0x2, 5 }, /* str=00010 */ + { 0x3, 6 }, /* str=000011 */ + { 0x2, 6 }, /* str=000010 */ + { 0x1, 6 }, /* str=000001 */ + { 0x0, 6 }, /* str=000000 */ + }, + { /* i_total 3 */ + { 0x5, 4 }, /* str=0101 */ + { 0x7, 3 }, /* str=111 */ + { 0x6, 3 }, /* str=110 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 4 }, /* str=0100 */ + { 0x3, 4 }, /* str=0011 */ + { 0x4, 3 }, /* str=100 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 4 }, /* str=0010 */ + { 0x3, 5 }, /* str=00011 */ + { 0x2, 5 }, /* str=00010 */ + { 0x1, 6 }, /* str=000001 */ + { 0x1, 5 }, /* str=00001 */ + { 0x0, 6 }, /* str=000000 */ + }, + { /* i_total 4 */ + { 0x3, 5 }, /* str=00011 */ + { 0x7, 3 }, /* str=111 */ + { 0x5, 4 }, /* str=0101 */ + { 0x4, 4 }, /* str=0100 */ + { 0x6, 3 }, /* str=110 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 3 }, /* str=100 */ + { 0x3, 4 }, /* str=0011 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 4 }, /* str=0010 */ + { 0x2, 5 }, /* str=00010 */ + { 0x1, 5 }, /* str=00001 */ + { 0x0, 5 }, /* str=00000 */ + }, + { /* i_total 5 */ + { 0x5, 4 }, /* str=0101 */ + { 0x4, 4 }, /* str=0100 */ + { 0x3, 4 }, /* str=0011 */ + { 0x7, 3 }, /* str=111 */ + { 0x6, 3 }, /* str=110 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 3 }, /* str=100 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 4 }, /* str=0010 */ + { 0x1, 5 }, /* str=00001 */ + { 0x1, 4 }, /* str=0001 */ + { 0x0, 5 }, /* str=00000 */ + }, + { /* i_total 6 */ + { 0x1, 6 }, /* str=000001 */ + { 0x1, 5 }, /* str=00001 */ + { 0x7, 3 }, /* str=111 */ + { 0x6, 3 }, /* str=110 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 3 }, /* str=100 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 3 }, /* str=010 */ + { 0x1, 4 }, /* str=0001 */ + { 0x1, 3 }, /* str=001 */ + { 0x0, 6 }, /* str=000000 */ + }, + { /* i_total 7 */ + { 0x1, 6 }, /* str=000001 */ + { 0x1, 5 }, /* str=00001 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 3 }, /* str=100 */ + { 0x3, 3 }, /* str=011 */ + { 0x3, 2 }, /* str=11 */ + { 0x2, 3 }, /* str=010 */ + { 0x1, 4 }, /* str=0001 */ + { 0x1, 3 }, /* str=001 */ + { 0x0, 6 }, /* str=000000 */ + }, + { /* i_total 8 */ + { 0x1, 6 }, /* str=000001 */ + { 0x1, 4 }, /* str=0001 */ + { 0x1, 5 }, /* str=00001 */ + { 0x3, 3 }, /* str=011 */ + { 0x3, 2 }, /* str=11 */ + { 0x2, 2 }, /* str=10 */ + { 0x2, 3 }, /* str=010 */ + { 0x1, 3 }, /* str=001 */ + { 0x0, 6 }, /* str=000000 */ + }, + { /* i_total 9 */ + { 0x1, 6 }, /* str=000001 */ + { 0x0, 6 }, /* str=000000 */ + { 0x1, 4 }, /* str=0001 */ + { 0x3, 2 }, /* str=11 */ + { 0x2, 2 }, /* str=10 */ + { 0x1, 3 }, /* str=001 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 5 }, /* str=00001 */ + }, + { /* i_total 10 */ + { 0x1, 5 }, /* str=00001 */ + { 0x0, 5 }, /* str=00000 */ + { 0x1, 3 }, /* str=001 */ + { 0x3, 2 }, /* str=11 */ + { 0x2, 2 }, /* str=10 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 4 }, /* str=0001 */ + }, + { /* i_total 11 */ + { 0x0, 4 }, /* str=0000 */ + { 0x1, 4 }, /* str=0001 */ + { 0x1, 3 }, /* str=001 */ + { 0x2, 3 }, /* str=010 */ + { 0x1, 1 }, /* str=1 */ + { 0x3, 3 }, /* str=011 */ + }, + { /* i_total 12 */ + { 0x0, 4 }, /* str=0000 */ + { 0x1, 4 }, /* str=0001 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 1 }, /* str=1 */ + { 0x1, 3 }, /* str=001 */ + }, + { /* i_total 13 */ + { 0x0, 3 }, /* str=000 */ + { 0x1, 3 }, /* str=001 */ + { 0x1, 1 }, /* str=1 */ + { 0x1, 2 }, /* str=01 */ + }, + { /* i_total 14 */ + { 0x0, 2 }, /* str=00 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 1 }, /* str=1 */ + }, + { /* i_total 15 */ + { 0x0, 1 }, /* str=0 */ + { 0x1, 1 }, /* str=1 */ + }, +}; + +/* [i_total_coeff-1][i_total_zeros] */ +const vlc_t x264_total_zeros_2x2_dc[3][4] = +{ + { /* i_total 1 */ + { 0x1, 1 }, /* str=1 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 3 }, /* str=001 */ + { 0x0, 3 } /* str=000 */ + }, + { /* i_total 2 */ + { 0x1, 1 }, /* str=1 */ + { 0x1, 2 }, /* str=01 */ + { 0x0, 2 }, /* str=00 */ + }, + { /* i_total 3 */ + { 0x1, 1 }, /* str=1 */ + { 0x0, 1 }, /* str=0 */ + }, +}; + +/* [i_total_coeff-1][i_total_zeros] */ +const vlc_t x264_total_zeros_2x4_dc[7][8] = +{ + { /* i_total 1 */ + { 0x1, 1 }, /* str=1 */ + { 0x2, 3 }, /* str=010 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 4 }, /* str=0010 */ + { 0x3, 4 }, /* str=0011 */ + { 0x1, 4 }, /* str=0001 */ + { 0x1, 5 }, /* str=00001 */ + { 0x0, 5 }, /* str=00000 */ + }, + { /* i_total 2 */ + { 0x0, 3 }, /* str=000 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 3 }, /* str=001 */ + { 0x4, 3 }, /* str=100 */ + { 0x5, 3 }, /* str=101 */ + { 0x6, 3 }, /* str=110 */ + { 0x7, 3 }, /* str=111 */ + }, + { /* i_total 3 */ + { 0x0, 3 }, /* str=000 */ + { 0x1, 3 }, /* str=001 */ + { 0x1, 2 }, /* str=01 */ + { 0x2, 2 }, /* str=10 */ + { 0x6, 3 }, /* str=110 */ + { 0x7, 3 }, /* str=111 */ + }, + { /* i_total 4 */ + { 0x6, 3 }, /* str=110 */ + { 0x0, 2 }, /* str=00 */ + { 0x1, 2 }, /* str=01 */ + { 0x2, 2 }, /* str=10 */ + { 0x7, 3 }, /* str=111 */ + }, + { /* i_total 5 */ + { 0x0, 2 }, /* str=00 */ + { 0x1, 2 }, /* str=01 */ + { 0x2, 2 }, /* str=10 */ + { 0x3, 2 }, /* str=11 */ + }, + { /* i_total 6 */ + { 0x0, 2 }, /* str=00 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 1 }, /* str=1 */ + }, + { /* i_total 7 */ + { 0x0, 1 }, /* str=0 */ + { 0x1, 1 }, /* str=1 */ + } +}; + +/* [MIN( i_zero_left-1, 6 )][run_before] */ +static const vlc_t run_before[7][16] = +{ + { /* i_zero_left 1 */ + { 0x1, 1 }, /* str=1 */ + { 0x0, 1 }, /* str=0 */ + }, + { /* i_zero_left 2 */ + { 0x1, 1 }, /* str=1 */ + { 0x1, 2 }, /* str=01 */ + { 0x0, 2 }, /* str=00 */ + }, + { /* i_zero_left 3 */ + { 0x3, 2 }, /* str=11 */ + { 0x2, 2 }, /* str=10 */ + { 0x1, 2 }, /* str=01 */ + { 0x0, 2 }, /* str=00 */ + }, + { /* i_zero_left 4 */ + { 0x3, 2 }, /* str=11 */ + { 0x2, 2 }, /* str=10 */ + { 0x1, 2 }, /* str=01 */ + { 0x1, 3 }, /* str=001 */ + { 0x0, 3 }, /* str=000 */ + }, + { /* i_zero_left 5 */ + { 0x3, 2 }, /* str=11 */ + { 0x2, 2 }, /* str=10 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 3 }, /* str=010 */ + { 0x1, 3 }, /* str=001 */ + { 0x0, 3 }, /* str=000 */ + }, + { /* i_zero_left 6 */ + { 0x3, 2 }, /* str=11 */ + { 0x0, 3 }, /* str=000 */ + { 0x1, 3 }, /* str=001 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 3 }, /* str=010 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 3 }, /* str=100 */ + }, + { /* i_zero_left >6 */ + { 0x7, 3 }, /* str=111 */ + { 0x6, 3 }, /* str=110 */ + { 0x5, 3 }, /* str=101 */ + { 0x4, 3 }, /* str=100 */ + { 0x3, 3 }, /* str=011 */ + { 0x2, 3 }, /* str=010 */ + { 0x1, 3 }, /* str=001 */ + { 0x1, 4 }, /* str=0001 */ + { 0x1, 5 }, /* str=00001 */ + { 0x1, 6 }, /* str=000001 */ + { 0x1, 7 }, /* str=0000001 */ + { 0x1, 8 }, /* str=00000001 */ + { 0x1, 9 }, /* str=000000001 */ + { 0x1, 10 }, /* str=0000000001 */ + { 0x1, 11 }, /* str=00000000001 */ + }, +}; + +vlc_large_t x264_level_token[7][LEVEL_TABLE_SIZE]; +uint32_t x264_run_before[1<<16]; + +void x264_cavlc_init( x264_t *h ) +{ + for( int i_suffix = 0; i_suffix < 7; i_suffix++ ) + for( int16_t level = -LEVEL_TABLE_SIZE/2; level < LEVEL_TABLE_SIZE/2; level++ ) + { + int mask = level >> 15; + int abs_level = (level^mask)-mask; + int i_level_code = abs_level*2-mask-2; + int i_next = i_suffix; + vlc_large_t *vlc = &x264_level_token[i_suffix][level+LEVEL_TABLE_SIZE/2]; + + if( ( i_level_code >> i_suffix ) < 14 ) + { + vlc->i_size = (i_level_code >> i_suffix) + 1 + i_suffix; + vlc->i_bits = (1<i_size = 19; + vlc->i_bits = (1<<4) + (i_level_code - 14); + } + else if( i_suffix > 0 && ( i_level_code >> i_suffix ) == 14 ) + { + vlc->i_size = 15 + i_suffix; + vlc->i_bits = (1<i_size = 28; + vlc->i_bits = (1<<12) + i_level_code; + } + if( i_next == 0 ) + i_next++; + if( abs_level > (3 << (i_next-1)) && i_next < 6 ) + i_next++; + vlc->i_next = i_next; + } + + for( int i = 1; i < (1<<16); i++ ) + { + x264_run_level_t runlevel; + ALIGNED_ARRAY_16( dctcoef, dct, [16] ); + int size = 0; + int bits = 0; + for( int j = 0; j < 16; j++ ) + dct[j] = i&(1<quantf.coeff_level_run[DCT_LUMA_4x4]( dct, &runlevel ); + int zeros = runlevel.last + 1 - total; + uint32_t mask = i << (x264_clz( i ) + 1); + for( int j = 0; j < total-1 && zeros > 0; j++ ) + { + int idx = X264_MIN(zeros, 7) - 1; + int run = x264_clz( mask ); + int len = run_before[idx][run].i_size; + size += len; + bits <<= len; + bits |= run_before[idx][run].i_bits; + zeros -= run; + mask <<= run + 1; + } + x264_run_before[i] = (bits << 5) + size; + } +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.c new file mode 100644 index 00000000..94e9d898 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.c @@ -0,0 +1,357 @@ +/***************************************************************************** + * win32thread.c: windows threading + ***************************************************************************** + * Copyright (C) 2010-2017 x264 project + * + * Authors: Steven Walters + * Pegasys Inc. + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +/* Microsoft's way of supporting systems with >64 logical cpus can be found at + * http://www.microsoft.com/whdc/system/Sysinternals/MoreThan64proc.mspx */ + +/* Based on the agreed standing that x264 does not need to utilize >64 logical cpus, + * this API does not detect nor utilize more than 64 cpus for systems that have them. */ + +#include "common.h" + +#if HAVE_WINRT +/* _beginthreadex() is technically the correct option, but it's only available for Desktop applications. + * Using CreateThread() as an alternative works on Windows Store and Windows Phone 8.1+ as long as we're + * using a dynamically linked MSVCRT which happens to be a requirement for WinRT applications anyway */ +#define _beginthreadex CreateThread +#define InitializeCriticalSectionAndSpinCount(a, b) InitializeCriticalSectionEx(a, b, CRITICAL_SECTION_NO_DEBUG_INFO) +#define WaitForSingleObject(a, b) WaitForSingleObjectEx(a, b, FALSE) +#else +#include +#endif + +/* number of times to spin a thread about to block on a locked mutex before retrying and sleeping if still locked */ +#define X264_SPIN_COUNT 0 + +/* global mutex for replacing MUTEX_INITIALIZER instances */ +static x264_pthread_mutex_t static_mutex; + +/* _beginthreadex requires that the start routine is __stdcall */ +static unsigned __stdcall x264_win32thread_worker( void *arg ) +{ + x264_pthread_t *h = arg; + *h->p_ret = h->func( h->arg ); + return 0; +} + +int x264_pthread_create( x264_pthread_t *thread, const x264_pthread_attr_t *attr, + void *(*start_routine)( void* ), void *arg ) +{ + thread->func = start_routine; + thread->arg = arg; + thread->p_ret = &thread->ret; + thread->ret = NULL; + thread->handle = (void*)_beginthreadex( NULL, 0, x264_win32thread_worker, thread, 0, NULL ); + return !thread->handle; +} + +int x264_pthread_join( x264_pthread_t thread, void **value_ptr ) +{ + DWORD ret = WaitForSingleObject( thread.handle, INFINITE ); + if( ret != WAIT_OBJECT_0 ) + return -1; + if( value_ptr ) + *value_ptr = *thread.p_ret; + CloseHandle( thread.handle ); + return 0; +} + +int x264_pthread_mutex_init( x264_pthread_mutex_t *mutex, const x264_pthread_mutexattr_t *attr ) +{ + return !InitializeCriticalSectionAndSpinCount( mutex, X264_SPIN_COUNT ); +} + +int x264_pthread_mutex_destroy( x264_pthread_mutex_t *mutex ) +{ + DeleteCriticalSection( mutex ); + return 0; +} + +int x264_pthread_mutex_lock( x264_pthread_mutex_t *mutex ) +{ + static const x264_pthread_mutex_t init = X264_PTHREAD_MUTEX_INITIALIZER; + if( !memcmp( mutex, &init, sizeof(x264_pthread_mutex_t) ) ) + *mutex = static_mutex; + EnterCriticalSection( mutex ); + return 0; +} + +int x264_pthread_mutex_unlock( x264_pthread_mutex_t *mutex ) +{ + LeaveCriticalSection( mutex ); + return 0; +} + +void x264_win32_threading_destroy( void ) +{ + x264_pthread_mutex_destroy( &static_mutex ); + memset( &static_mutex, 0, sizeof(static_mutex) ); +} + +#if HAVE_WINRT +int x264_pthread_cond_init( x264_pthread_cond_t *cond, const x264_pthread_condattr_t *attr ) +{ + InitializeConditionVariable( cond ); + return 0; +} + +int x264_pthread_cond_destroy( x264_pthread_cond_t *cond ) +{ + return 0; +} + +int x264_pthread_cond_broadcast( x264_pthread_cond_t *cond ) +{ + WakeAllConditionVariable( cond ); + return 0; +} + +int x264_pthread_cond_signal( x264_pthread_cond_t *cond ) +{ + WakeConditionVariable( cond ); + return 0; +} + +int x264_pthread_cond_wait( x264_pthread_cond_t *cond, x264_pthread_mutex_t *mutex ) +{ + return !SleepConditionVariableCS( cond, mutex, INFINITE ); +} + +int x264_win32_threading_init( void ) +{ + return x264_pthread_mutex_init( &static_mutex, NULL ); +} + +int x264_pthread_num_processors_np( void ) +{ + SYSTEM_INFO si; + GetNativeSystemInfo(&si); + return si.dwNumberOfProcessors; +} + +#else + +static struct +{ + /* function pointers to conditional variable API on windows 6.0+ kernels */ + void (WINAPI *cond_broadcast)( x264_pthread_cond_t *cond ); + void (WINAPI *cond_init)( x264_pthread_cond_t *cond ); + void (WINAPI *cond_signal)( x264_pthread_cond_t *cond ); + BOOL (WINAPI *cond_wait)( x264_pthread_cond_t *cond, x264_pthread_mutex_t *mutex, DWORD milliseconds ); +} thread_control; + +/* for pre-Windows 6.0 platforms we need to define and use our own condition variable and api */ +typedef struct +{ + x264_pthread_mutex_t mtx_broadcast; + x264_pthread_mutex_t mtx_waiter_count; + volatile int waiter_count; + HANDLE semaphore; + HANDLE waiters_done; + volatile int is_broadcast; +} x264_win32_cond_t; + +int x264_pthread_cond_init( x264_pthread_cond_t *cond, const x264_pthread_condattr_t *attr ) +{ + if( thread_control.cond_init ) + { + thread_control.cond_init( cond ); + return 0; + } + + /* non native condition variables */ + x264_win32_cond_t *win32_cond = calloc( 1, sizeof(x264_win32_cond_t) ); + if( !win32_cond ) + return -1; + cond->Ptr = win32_cond; + win32_cond->semaphore = CreateSemaphoreW( NULL, 0, 0x7fffffff, NULL ); + if( !win32_cond->semaphore ) + return -1; + + if( x264_pthread_mutex_init( &win32_cond->mtx_waiter_count, NULL ) ) + return -1; + if( x264_pthread_mutex_init( &win32_cond->mtx_broadcast, NULL ) ) + return -1; + + win32_cond->waiters_done = CreateEventW( NULL, FALSE, FALSE, NULL ); + if( !win32_cond->waiters_done ) + return -1; + + return 0; +} + +int x264_pthread_cond_destroy( x264_pthread_cond_t *cond ) +{ + /* native condition variables do not destroy */ + if( thread_control.cond_init ) + return 0; + + /* non native condition variables */ + x264_win32_cond_t *win32_cond = cond->Ptr; + CloseHandle( win32_cond->semaphore ); + CloseHandle( win32_cond->waiters_done ); + x264_pthread_mutex_destroy( &win32_cond->mtx_broadcast ); + x264_pthread_mutex_destroy( &win32_cond->mtx_waiter_count ); + free( win32_cond ); + + return 0; +} + +int x264_pthread_cond_broadcast( x264_pthread_cond_t *cond ) +{ + if( thread_control.cond_broadcast ) + { + thread_control.cond_broadcast( cond ); + return 0; + } + + /* non native condition variables */ + x264_win32_cond_t *win32_cond = cond->Ptr; + x264_pthread_mutex_lock( &win32_cond->mtx_broadcast ); + x264_pthread_mutex_lock( &win32_cond->mtx_waiter_count ); + int have_waiter = 0; + + if( win32_cond->waiter_count ) + { + win32_cond->is_broadcast = 1; + have_waiter = 1; + } + + if( have_waiter ) + { + ReleaseSemaphore( win32_cond->semaphore, win32_cond->waiter_count, NULL ); + x264_pthread_mutex_unlock( &win32_cond->mtx_waiter_count ); + WaitForSingleObject( win32_cond->waiters_done, INFINITE ); + win32_cond->is_broadcast = 0; + } + else + x264_pthread_mutex_unlock( &win32_cond->mtx_waiter_count ); + return x264_pthread_mutex_unlock( &win32_cond->mtx_broadcast ); +} + +int x264_pthread_cond_signal( x264_pthread_cond_t *cond ) +{ + if( thread_control.cond_signal ) + { + thread_control.cond_signal( cond ); + return 0; + } + + /* non-native condition variables */ + x264_win32_cond_t *win32_cond = cond->Ptr; + + x264_pthread_mutex_lock( &win32_cond->mtx_broadcast ); + x264_pthread_mutex_lock( &win32_cond->mtx_waiter_count ); + int have_waiter = win32_cond->waiter_count; + x264_pthread_mutex_unlock( &win32_cond->mtx_waiter_count ); + + if( have_waiter ) + { + ReleaseSemaphore( win32_cond->semaphore, 1, NULL ); + WaitForSingleObject( win32_cond->waiters_done, INFINITE ); + } + + return x264_pthread_mutex_unlock( &win32_cond->mtx_broadcast ); +} + +int x264_pthread_cond_wait( x264_pthread_cond_t *cond, x264_pthread_mutex_t *mutex ) +{ + if( thread_control.cond_wait ) + return !thread_control.cond_wait( cond, mutex, INFINITE ); + + /* non native condition variables */ + x264_win32_cond_t *win32_cond = cond->Ptr; + + x264_pthread_mutex_lock( &win32_cond->mtx_broadcast ); + x264_pthread_mutex_lock( &win32_cond->mtx_waiter_count ); + win32_cond->waiter_count++; + x264_pthread_mutex_unlock( &win32_cond->mtx_waiter_count ); + x264_pthread_mutex_unlock( &win32_cond->mtx_broadcast ); + + // unlock the external mutex + x264_pthread_mutex_unlock( mutex ); + WaitForSingleObject( win32_cond->semaphore, INFINITE ); + + x264_pthread_mutex_lock( &win32_cond->mtx_waiter_count ); + win32_cond->waiter_count--; + int last_waiter = !win32_cond->waiter_count || !win32_cond->is_broadcast; + x264_pthread_mutex_unlock( &win32_cond->mtx_waiter_count ); + + if( last_waiter ) + SetEvent( win32_cond->waiters_done ); + + // lock the external mutex + return x264_pthread_mutex_lock( mutex ); +} + +int x264_win32_threading_init( void ) +{ + /* find function pointers to API functions, if they exist */ + HANDLE kernel_dll = GetModuleHandleW( L"kernel32.dll" ); + thread_control.cond_init = (void*)GetProcAddress( kernel_dll, "InitializeConditionVariable" ); + if( thread_control.cond_init ) + { + /* we're on a windows 6.0+ kernel, acquire the rest of the functions */ + thread_control.cond_broadcast = (void*)GetProcAddress( kernel_dll, "WakeAllConditionVariable" ); + thread_control.cond_signal = (void*)GetProcAddress( kernel_dll, "WakeConditionVariable" ); + thread_control.cond_wait = (void*)GetProcAddress( kernel_dll, "SleepConditionVariableCS" ); + } + return x264_pthread_mutex_init( &static_mutex, NULL ); +} + +int x264_pthread_num_processors_np( void ) +{ + DWORD_PTR system_cpus, process_cpus = 0; + int cpus = 0; + + /* GetProcessAffinityMask returns affinities of 0 when the process has threads in multiple processor groups. + * On platforms that support processor grouping, use GetThreadGroupAffinity to get the current thread's affinity instead. */ +#if ARCH_X86_64 + /* find function pointers to API functions specific to x86_64 platforms, if they exist */ + HANDLE kernel_dll = GetModuleHandleW( L"kernel32.dll" ); + BOOL (*get_thread_affinity)( HANDLE thread, void *group_affinity ) = (void*)GetProcAddress( kernel_dll, "GetThreadGroupAffinity" ); + if( get_thread_affinity ) + { + /* running on a platform that supports >64 logical cpus */ + struct /* GROUP_AFFINITY */ + { + ULONG_PTR mask; // KAFFINITY = ULONG_PTR + USHORT group; + USHORT reserved[3]; + } thread_affinity; + if( get_thread_affinity( GetCurrentThread(), &thread_affinity ) ) + process_cpus = thread_affinity.mask; + } +#endif + if( !process_cpus ) + GetProcessAffinityMask( GetCurrentProcess(), &process_cpus, &system_cpus ); + for( DWORD_PTR bit = 1; bit; bit <<= 1 ) + cpus += !!(process_cpus & bit); + + return cpus ? cpus : 1; +} +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.h new file mode 100644 index 00000000..44a7241b --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/win32thread.h @@ -0,0 +1,81 @@ +/***************************************************************************** + * win32thread.h: windows threading + ***************************************************************************** + * Copyright (C) 2010-2017 x264 project + * + * Authors: Steven Walters + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_WIN32THREAD_H +#define X264_WIN32THREAD_H + +#include +/* the following macro is used within x264 */ +#undef ERROR + +typedef struct +{ + void *handle; + void *(*func)( void* arg ); + void *arg; + void **p_ret; + void *ret; +} x264_pthread_t; +#define x264_pthread_attr_t int + +/* the conditional variable api for windows 6.0+ uses critical sections and not mutexes */ +typedef CRITICAL_SECTION x264_pthread_mutex_t; +#define X264_PTHREAD_MUTEX_INITIALIZER {0} +#define x264_pthread_mutexattr_t int + +#if HAVE_WINRT +typedef CONDITION_VARIABLE x264_pthread_cond_t; +#else +typedef struct +{ + void *Ptr; +} x264_pthread_cond_t; +#endif +#define x264_pthread_condattr_t int + +int x264_pthread_create( x264_pthread_t *thread, const x264_pthread_attr_t *attr, + void *(*start_routine)( void* ), void *arg ); +int x264_pthread_join( x264_pthread_t thread, void **value_ptr ); + +int x264_pthread_mutex_init( x264_pthread_mutex_t *mutex, const x264_pthread_mutexattr_t *attr ); +int x264_pthread_mutex_destroy( x264_pthread_mutex_t *mutex ); +int x264_pthread_mutex_lock( x264_pthread_mutex_t *mutex ); +int x264_pthread_mutex_unlock( x264_pthread_mutex_t *mutex ); + +int x264_pthread_cond_init( x264_pthread_cond_t *cond, const x264_pthread_condattr_t *attr ); +int x264_pthread_cond_destroy( x264_pthread_cond_t *cond ); +int x264_pthread_cond_broadcast( x264_pthread_cond_t *cond ); +int x264_pthread_cond_wait( x264_pthread_cond_t *cond, x264_pthread_mutex_t *mutex ); +int x264_pthread_cond_signal( x264_pthread_cond_t *cond ); + +#define x264_pthread_attr_init(a) 0 +#define x264_pthread_attr_destroy(a) 0 + +int x264_win32_threading_init( void ); +void x264_win32_threading_destroy( void ); + +int x264_pthread_num_processors_np( void ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/dct.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/dct.h new file mode 100644 index 00000000..20a65c53 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/dct.h @@ -0,0 +1,144 @@ +/***************************************************************************** + * dct.h: x86 transform and zigzag + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_I386_DCT_H +#define X264_I386_DCT_H + +void x264_sub4x4_dct_mmx ( dctcoef dct [16], pixel *pix1, pixel *pix2 ); +void x264_sub8x8_dct_mmx ( dctcoef dct[ 4][16], pixel *pix1, pixel *pix2 ); +void x264_sub16x16_dct_mmx ( dctcoef dct[16][16], pixel *pix1, pixel *pix2 ); +void x264_sub8x8_dct_sse2 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_sse2 ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub4x4_dct_ssse3 ( int16_t dct [16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub4x4_dct_avx512 ( int16_t dct [16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_ssse3 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_ssse3( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_avx ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_avx ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_xop ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_xop ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_avx2 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_avx512 ( int16_t dct[ 4][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_avx2 ( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct_avx512( int16_t dct[16][16], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_dc_mmx2 ( int16_t dct [ 4], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct_dc_sse2 ( dctcoef dct [ 4], pixel *pix1, pixel *pix2 ); +void x264_sub8x8_dct_dc_avx512 ( int16_t dct [ 4], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x16_dct_dc_sse2 ( dctcoef dct [ 8], pixel *pix1, pixel *pix2 ); +void x264_sub8x16_dct_dc_ssse3 ( int16_t dct [ 8], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x16_dct_dc_avx ( dctcoef dct [ 8], pixel *pix1, pixel *pix2 ); +void x264_sub8x16_dct_dc_avx512( int16_t dct [ 8], uint8_t *pix1, uint8_t *pix2 ); + +void x264_add4x4_idct_mmx ( uint8_t *p_dst, int16_t dct [16] ); +void x264_add4x4_idct_sse2 ( uint16_t *p_dst, int32_t dct [16] ); +void x264_add4x4_idct_sse4 ( uint8_t *p_dst, int16_t dct [16] ); +void x264_add4x4_idct_avx ( pixel *p_dst, dctcoef dct [16] ); +void x264_add8x8_idct_mmx ( uint8_t *p_dst, int16_t dct[ 4][16] ); +void x264_add8x8_idct_dc_mmx2 ( uint8_t *p_dst, int16_t dct [ 4] ); +void x264_add16x16_idct_mmx ( uint8_t *p_dst, int16_t dct[16][16] ); +void x264_add16x16_idct_dc_mmx2 ( uint8_t *p_dst, int16_t dct [16] ); +void x264_add8x8_idct_sse2 ( pixel *p_dst, dctcoef dct[ 4][16] ); +void x264_add8x8_idct_avx ( pixel *p_dst, dctcoef dct[ 4][16] ); +void x264_add8x8_idct_avx2 ( pixel *p_dst, dctcoef dct[ 4][16] ); +void x264_add8x8_idct_avx512 ( uint8_t *p_dst, int16_t dct[ 4][16] ); +void x264_add16x16_idct_sse2 ( pixel *p_dst, dctcoef dct[16][16] ); +void x264_add16x16_idct_avx ( pixel *p_dst, dctcoef dct[16][16] ); +void x264_add16x16_idct_avx2 ( pixel *p_dst, dctcoef dct[16][16] ); +void x264_add8x8_idct_dc_sse2 ( pixel *p_dst, dctcoef dct [ 4] ); +void x264_add16x16_idct_dc_sse2 ( pixel *p_dst, dctcoef dct [16] ); +void x264_add8x8_idct_dc_ssse3 ( uint8_t *p_dst, int16_t dct [ 4] ); +void x264_add16x16_idct_dc_ssse3( uint8_t *p_dst, int16_t dct [16] ); +void x264_add8x8_idct_dc_avx ( pixel *p_dst, dctcoef dct [ 4] ); +void x264_add16x16_idct_dc_avx ( pixel *p_dst, dctcoef dct [16] ); +void x264_add16x16_idct_dc_avx2 ( uint8_t *p_dst, int16_t dct [16] ); + +void x264_dct4x4dc_mmx2 ( int16_t d[16] ); +void x264_dct4x4dc_sse2 ( int32_t d[16] ); +void x264_dct4x4dc_avx ( int32_t d[16] ); +void x264_idct4x4dc_mmx ( int16_t d[16] ); +void x264_idct4x4dc_sse2 ( int32_t d[16] ); +void x264_idct4x4dc_avx ( int32_t d[16] ); + +void x264_dct2x4dc_mmx2( dctcoef dct[8], dctcoef dct4x4[8][16] ); +void x264_dct2x4dc_sse2( dctcoef dct[8], dctcoef dct4x4[8][16] ); +void x264_dct2x4dc_avx ( dctcoef dct[8], dctcoef dct4x4[8][16] ); + +void x264_sub8x8_dct8_mmx ( int16_t dct [64], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct8_mmx ( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct8_sse2 ( dctcoef dct [64], pixel *pix1, pixel *pix2 ); +void x264_sub16x16_dct8_sse2 ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 ); +void x264_sub8x8_dct8_ssse3 ( int16_t dct [64], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub16x16_dct8_ssse3( int16_t dct[4][64], uint8_t *pix1, uint8_t *pix2 ); +void x264_sub8x8_dct8_sse4 ( int32_t dct [64], uint16_t *pix1, uint16_t *pix2 ); +void x264_sub16x16_dct8_sse4 ( int32_t dct[4][64], uint16_t *pix1, uint16_t *pix2 ); +void x264_sub8x8_dct8_avx ( dctcoef dct [64], pixel *pix1, pixel *pix2 ); +void x264_sub16x16_dct8_avx ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 ); +void x264_sub16x16_dct8_avx2 ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 ); + + +void x264_add8x8_idct8_mmx ( uint8_t *dst, int16_t dct [64] ); +void x264_add16x16_idct8_mmx ( uint8_t *dst, int16_t dct[4][64] ); +void x264_add8x8_idct8_sse2 ( pixel *dst, dctcoef dct [64] ); +void x264_add16x16_idct8_sse2( pixel *dst, dctcoef dct[4][64] ); +void x264_add8x8_idct8_avx ( pixel *dst, dctcoef dct [64] ); +void x264_add16x16_idct8_avx ( pixel *dst, dctcoef dct[4][64] ); + +void x264_zigzag_scan_8x8_frame_mmx2 ( int16_t level[64], int16_t dct[64] ); +void x264_zigzag_scan_8x8_frame_sse2 ( dctcoef level[64], dctcoef dct[64] ); +void x264_zigzag_scan_8x8_frame_ssse3 ( int16_t level[64], int16_t dct[64] ); +void x264_zigzag_scan_8x8_frame_avx ( dctcoef level[64], dctcoef dct[64] ); +void x264_zigzag_scan_8x8_frame_xop ( int16_t level[64], int16_t dct[64] ); +void x264_zigzag_scan_8x8_frame_avx512( dctcoef level[64], dctcoef dct[64] ); +void x264_zigzag_scan_4x4_frame_mmx ( int16_t level[16], int16_t dct[16] ); +void x264_zigzag_scan_4x4_frame_sse2 ( int32_t level[16], int32_t dct[16] ); +void x264_zigzag_scan_4x4_frame_ssse3 ( int16_t level[16], int16_t dct[16] ); +void x264_zigzag_scan_4x4_frame_avx ( dctcoef level[16], dctcoef dct[16] ); +void x264_zigzag_scan_4x4_frame_xop ( dctcoef level[16], dctcoef dct[16] ); +void x264_zigzag_scan_4x4_frame_avx512( dctcoef level[16], dctcoef dct[16] ); +void x264_zigzag_scan_4x4_field_sse ( int16_t level[16], int16_t dct[16] ); +void x264_zigzag_scan_4x4_field_sse2 ( int32_t level[16], int32_t dct[16] ); +void x264_zigzag_scan_4x4_field_avx512( dctcoef level[16], dctcoef dct[16] ); +void x264_zigzag_scan_8x8_field_mmx2 ( int16_t level[64], int16_t dct[64] ); +void x264_zigzag_scan_8x8_field_sse4 ( int32_t level[64], int32_t dct[64] ); +void x264_zigzag_scan_8x8_field_avx ( int32_t level[64], int32_t dct[64] ); +void x264_zigzag_scan_8x8_field_xop ( int16_t level[64], int16_t dct[64] ); +void x264_zigzag_scan_8x8_field_avx512( dctcoef level[64], dctcoef dct[64] ); +int x264_zigzag_sub_4x4_frame_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst ); +int x264_zigzag_sub_4x4_frame_ssse3 ( int16_t level[16], const uint8_t *src, uint8_t *dst ); +int x264_zigzag_sub_4x4ac_frame_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc ); +int x264_zigzag_sub_4x4ac_frame_ssse3( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc ); +int x264_zigzag_sub_4x4_field_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst ); +int x264_zigzag_sub_4x4_field_ssse3 ( int16_t level[16], const uint8_t *src, uint8_t *dst ); +int x264_zigzag_sub_4x4ac_field_avx ( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc ); +int x264_zigzag_sub_4x4ac_field_ssse3( int16_t level[16], const uint8_t *src, uint8_t *dst, int16_t *dc ); +void x264_zigzag_interleave_8x8_cavlc_mmx ( int16_t *dst, int16_t *src, uint8_t *nnz ); +void x264_zigzag_interleave_8x8_cavlc_sse2 ( dctcoef *dst, dctcoef *src, uint8_t *nnz ); +void x264_zigzag_interleave_8x8_cavlc_avx ( dctcoef *dst, dctcoef *src, uint8_t *nnz ); +void x264_zigzag_interleave_8x8_cavlc_avx2 ( int16_t *dst, int16_t *src, uint8_t *nnz ); +void x264_zigzag_interleave_8x8_cavlc_avx512( dctcoef *dst, dctcoef *src, uint8_t *nnz ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc-c.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc-c.c new file mode 100644 index 00000000..c06691c9 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc-c.c @@ -0,0 +1,911 @@ +/***************************************************************************** + * mc-c.c: x86 motion compensation + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "mc.h" + +#define DECL_SUF( func, args )\ + void func##_mmx2 args;\ + void func##_sse2 args;\ + void func##_ssse3 args;\ + void func##_avx2 args;\ + void func##_avx512 args; + +DECL_SUF( x264_pixel_avg_16x16, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_16x8, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_8x16, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_8x8, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_8x4, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_4x16, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_4x8, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_4x4, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) +DECL_SUF( x264_pixel_avg_4x2, ( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t, int )) + +#define MC_WEIGHT(w,type) \ + void x264_mc_weight_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ); + +#define MC_WEIGHT_OFFSET(w,type) \ + void x264_mc_offsetadd_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ); \ + void x264_mc_offsetsub_w##w##_##type( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ); \ + MC_WEIGHT(w,type) + +MC_WEIGHT_OFFSET( 4, mmx2 ) +MC_WEIGHT_OFFSET( 8, mmx2 ) +MC_WEIGHT_OFFSET( 12, mmx2 ) +MC_WEIGHT_OFFSET( 16, mmx2 ) +MC_WEIGHT_OFFSET( 20, mmx2 ) +MC_WEIGHT_OFFSET( 12, sse2 ) +MC_WEIGHT_OFFSET( 16, sse2 ) +MC_WEIGHT_OFFSET( 20, sse2 ) +#if HIGH_BIT_DEPTH +MC_WEIGHT_OFFSET( 8, sse2 ) +#endif +MC_WEIGHT( 8, sse2 ) +MC_WEIGHT( 4, ssse3 ) +MC_WEIGHT( 8, ssse3 ) +MC_WEIGHT( 12, ssse3 ) +MC_WEIGHT( 16, ssse3 ) +MC_WEIGHT( 20, ssse3 ) +MC_WEIGHT( 8, avx2 ) +MC_WEIGHT( 16, avx2 ) +MC_WEIGHT( 20, avx2 ) +#undef MC_OFFSET +#undef MC_WEIGHT + +void x264_mc_copy_w4_mmx ( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_mc_copy_w8_mmx ( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_mc_copy_w8_sse ( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_mc_copy_w16_mmx( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_mc_copy_w16_sse( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_mc_copy_w16_aligned_sse( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_mc_copy_w16_avx( uint16_t *, intptr_t, uint16_t *, intptr_t, int ); +void x264_mc_copy_w16_aligned_avx( uint16_t *, intptr_t, uint16_t *, intptr_t, int ); +void x264_prefetch_fenc_420_mmx2( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_prefetch_fenc_422_mmx2( pixel *, intptr_t, pixel *, intptr_t, int ); +void x264_prefetch_ref_mmx2( pixel *, intptr_t, int ); +void x264_plane_copy_core_sse( pixel *, intptr_t, pixel *, intptr_t, int w, int h ); +void x264_plane_copy_core_avx( pixel *, intptr_t, pixel *, intptr_t, int w, int h ); +void x264_plane_copy_swap_core_ssse3( pixel *, intptr_t, pixel *, intptr_t, int w, int h ); +void x264_plane_copy_swap_core_avx2 ( pixel *, intptr_t, pixel *, intptr_t, int w, int h ); +void x264_plane_copy_interleave_core_mmx2( pixel *dst, intptr_t i_dst, + pixel *srcu, intptr_t i_srcu, + pixel *srcv, intptr_t i_srcv, int w, int h ); +void x264_plane_copy_interleave_core_sse2( pixel *dst, intptr_t i_dst, + pixel *srcu, intptr_t i_srcu, + pixel *srcv, intptr_t i_srcv, int w, int h ); +void x264_plane_copy_interleave_core_avx( pixel *dst, intptr_t i_dst, + pixel *srcu, intptr_t i_srcu, + pixel *srcv, intptr_t i_srcv, int w, int h ); +void x264_plane_copy_deinterleave_sse2( pixel *dsta, intptr_t i_dsta, + pixel *dstb, intptr_t i_dstb, + pixel *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_ssse3( uint8_t *dsta, intptr_t i_dsta, + uint8_t *dstb, intptr_t i_dstb, + uint8_t *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_avx( uint16_t *dsta, intptr_t i_dsta, + uint16_t *dstb, intptr_t i_dstb, + uint16_t *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_avx2( pixel *dsta, intptr_t i_dsta, + pixel *dstb, intptr_t i_dstb, + pixel *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_rgb_sse2 ( pixel *dsta, intptr_t i_dsta, + pixel *dstb, intptr_t i_dstb, + pixel *dstc, intptr_t i_dstc, + pixel *src, intptr_t i_src, int pw, int w, int h ); +void x264_plane_copy_deinterleave_rgb_ssse3( pixel *dsta, intptr_t i_dsta, + pixel *dstb, intptr_t i_dstb, + pixel *dstc, intptr_t i_dstc, + pixel *src, intptr_t i_src, int pw, int w, int h ); +void x264_plane_copy_deinterleave_rgb_avx2 ( pixel *dsta, intptr_t i_dsta, + pixel *dstb, intptr_t i_dstb, + pixel *dstc, intptr_t i_dstc, + pixel *src, intptr_t i_src, int pw, int w, int h ); +void x264_plane_copy_deinterleave_v210_ssse3 ( uint16_t *dstu, intptr_t i_dstu, + uint16_t *dstv, intptr_t i_dstv, + uint32_t *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_v210_avx ( uint16_t *dstu, intptr_t i_dstu, + uint16_t *dstv, intptr_t i_dstv, + uint32_t *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_v210_avx2 ( uint16_t *dstu, intptr_t i_dstu, + uint16_t *dstv, intptr_t i_dstv, + uint32_t *src, intptr_t i_src, int w, int h ); +void x264_plane_copy_deinterleave_v210_avx512( uint16_t *dstu, intptr_t i_dstu, + uint16_t *dstv, intptr_t i_dstv, + uint32_t *src, intptr_t i_src, int w, int h ); +void x264_store_interleave_chroma_mmx2( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height ); +void x264_store_interleave_chroma_sse2( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height ); +void x264_store_interleave_chroma_avx ( pixel *dst, intptr_t i_dst, pixel *srcu, pixel *srcv, int height ); +void x264_load_deinterleave_chroma_fenc_sse2( pixel *dst, pixel *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fenc_ssse3( uint8_t *dst, uint8_t *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fenc_avx( uint16_t *dst, uint16_t *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fenc_avx2( pixel *dst, pixel *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fdec_sse2( pixel *dst, pixel *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fdec_ssse3( uint8_t *dst, uint8_t *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fdec_avx( uint16_t *dst, uint16_t *src, intptr_t i_src, int height ); +void x264_load_deinterleave_chroma_fdec_avx2( uint16_t *dst, uint16_t *src, intptr_t i_src, int height ); +void *x264_memcpy_aligned_sse ( void *dst, const void *src, size_t n ); +void *x264_memcpy_aligned_avx ( void *dst, const void *src, size_t n ); +void *x264_memcpy_aligned_avx512( void *dst, const void *src, size_t n ); +void x264_memzero_aligned_sse ( void *dst, size_t n ); +void x264_memzero_aligned_avx ( void *dst, size_t n ); +void x264_memzero_aligned_avx512( void *dst, size_t n ); +void x264_integral_init4h_sse4( uint16_t *sum, uint8_t *pix, intptr_t stride ); +void x264_integral_init4h_avx2( uint16_t *sum, uint8_t *pix, intptr_t stride ); +void x264_integral_init8h_sse4( uint16_t *sum, uint8_t *pix, intptr_t stride ); +void x264_integral_init8h_avx ( uint16_t *sum, uint8_t *pix, intptr_t stride ); +void x264_integral_init8h_avx2( uint16_t *sum, uint8_t *pix, intptr_t stride ); +void x264_integral_init4v_mmx ( uint16_t *sum8, uint16_t *sum4, intptr_t stride ); +void x264_integral_init4v_sse2 ( uint16_t *sum8, uint16_t *sum4, intptr_t stride ); +void x264_integral_init4v_ssse3( uint16_t *sum8, uint16_t *sum4, intptr_t stride ); +void x264_integral_init4v_avx2( uint16_t *sum8, uint16_t *sum4, intptr_t stride ); +void x264_integral_init8v_mmx ( uint16_t *sum8, intptr_t stride ); +void x264_integral_init8v_sse2( uint16_t *sum8, intptr_t stride ); +void x264_integral_init8v_avx2( uint16_t *sum8, intptr_t stride ); +void x264_mbtree_propagate_cost_sse2 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs, + uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len ); +void x264_mbtree_propagate_cost_avx ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs, + uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len ); +void x264_mbtree_propagate_cost_fma4 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs, + uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len ); +void x264_mbtree_propagate_cost_avx2 ( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs, + uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len ); +void x264_mbtree_propagate_cost_avx512( int16_t *dst, uint16_t *propagate_in, uint16_t *intra_costs, + uint16_t *inter_costs, uint16_t *inv_qscales, float *fps_factor, int len ); +void x264_mbtree_fix8_pack_ssse3( uint16_t *dst, float *src, int count ); +void x264_mbtree_fix8_pack_avx2 ( uint16_t *dst, float *src, int count ); +void x264_mbtree_fix8_unpack_ssse3( float *dst, uint16_t *src, int count ); +void x264_mbtree_fix8_unpack_avx2 ( float *dst, uint16_t *src, int count ); + +#define MC_CHROMA(cpu)\ +void x264_mc_chroma_##cpu( pixel *dstu, pixel *dstv, intptr_t i_dst, pixel *src, intptr_t i_src,\ + int dx, int dy, int i_width, int i_height ); +MC_CHROMA(mmx2) +MC_CHROMA(sse2) +MC_CHROMA(ssse3) +MC_CHROMA(cache64_ssse3) +MC_CHROMA(avx) +MC_CHROMA(avx2) + +#define LOWRES(cpu)\ +void x264_frame_init_lowres_core_##cpu( pixel *src0, pixel *dst0, pixel *dsth, pixel *dstv, pixel *dstc,\ + intptr_t src_stride, intptr_t dst_stride, int width, int height ); +LOWRES(mmx2) +LOWRES(cache32_mmx2) +LOWRES(sse2) +LOWRES(ssse3) +LOWRES(avx) +LOWRES(xop) +LOWRES(avx2) + +#define PIXEL_AVG_W(width,cpu)\ +void x264_pixel_avg2_w##width##_##cpu( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t ); +/* This declares some functions that don't exist, but that isn't a problem. */ +#define PIXEL_AVG_WALL(cpu)\ +PIXEL_AVG_W(4,cpu); PIXEL_AVG_W(8,cpu); PIXEL_AVG_W(10,cpu); PIXEL_AVG_W(12,cpu); PIXEL_AVG_W(16,cpu); PIXEL_AVG_W(18,cpu); PIXEL_AVG_W(20,cpu); + +PIXEL_AVG_WALL(mmx2) +PIXEL_AVG_WALL(cache32_mmx2) +PIXEL_AVG_WALL(cache64_mmx2) +PIXEL_AVG_WALL(cache64_sse2) +PIXEL_AVG_WALL(sse2) +PIXEL_AVG_WALL(cache64_ssse3) +PIXEL_AVG_WALL(avx2) + +#define PIXEL_AVG_WTAB(instr, name1, name2, name3, name4, name5)\ +static void (* const x264_pixel_avg_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, pixel *, intptr_t ) =\ +{\ + NULL,\ + x264_pixel_avg2_w4_##name1,\ + x264_pixel_avg2_w8_##name2,\ + x264_pixel_avg2_w12_##name3,\ + x264_pixel_avg2_w16_##name4,\ + x264_pixel_avg2_w20_##name5,\ +}; + +#if HIGH_BIT_DEPTH +/* we can replace w12/w20 with w10/w18 as only 9/17 pixels in fact are important */ +#define x264_pixel_avg2_w12_mmx2 x264_pixel_avg2_w10_mmx2 +#define x264_pixel_avg2_w20_mmx2 x264_pixel_avg2_w18_mmx2 +#define x264_pixel_avg2_w12_sse2 x264_pixel_avg2_w10_sse2 +#define x264_pixel_avg2_w20_sse2 x264_pixel_avg2_w18_sse2 +#define x264_pixel_avg2_w12_avx2 x264_pixel_avg2_w16_avx2 +#define x264_pixel_avg2_w20_avx2 x264_pixel_avg2_w18_avx2 +#else +/* w16 sse2 is faster than w12 mmx as long as the cacheline issue is resolved */ +#define x264_pixel_avg2_w12_cache64_ssse3 x264_pixel_avg2_w16_cache64_ssse3 +#define x264_pixel_avg2_w12_cache64_sse2 x264_pixel_avg2_w16_cache64_sse2 +#define x264_pixel_avg2_w12_sse3 x264_pixel_avg2_w16_sse3 +#define x264_pixel_avg2_w12_sse2 x264_pixel_avg2_w16_sse2 +#endif // HIGH_BIT_DEPTH + +PIXEL_AVG_WTAB(mmx2, mmx2, mmx2, mmx2, mmx2, mmx2) +#if HIGH_BIT_DEPTH +PIXEL_AVG_WTAB(sse2, mmx2, sse2, sse2, sse2, sse2) +PIXEL_AVG_WTAB(avx2, mmx2, sse2, avx2, avx2, avx2) +#else // !HIGH_BIT_DEPTH +#if ARCH_X86 +PIXEL_AVG_WTAB(cache32_mmx2, mmx2, cache32_mmx2, cache32_mmx2, cache32_mmx2, cache32_mmx2) +PIXEL_AVG_WTAB(cache64_mmx2, mmx2, cache64_mmx2, cache64_mmx2, cache64_mmx2, cache64_mmx2) +#endif +PIXEL_AVG_WTAB(sse2, mmx2, mmx2, sse2, sse2, sse2) +PIXEL_AVG_WTAB(cache64_sse2, mmx2, cache64_mmx2, cache64_sse2, cache64_sse2, cache64_sse2) +PIXEL_AVG_WTAB(cache64_ssse3, mmx2, cache64_mmx2, cache64_ssse3, cache64_ssse3, cache64_sse2) +PIXEL_AVG_WTAB(cache64_ssse3_atom, mmx2, mmx2, cache64_ssse3, cache64_ssse3, sse2) +PIXEL_AVG_WTAB(avx2, mmx2, mmx2, sse2, sse2, avx2) +#endif // HIGH_BIT_DEPTH + +#define MC_COPY_WTAB(instr, name1, name2, name3)\ +static void (* const x264_mc_copy_wtab_##instr[5])( pixel *, intptr_t, pixel *, intptr_t, int ) =\ +{\ + NULL,\ + x264_mc_copy_w4_##name1,\ + x264_mc_copy_w8_##name2,\ + NULL,\ + x264_mc_copy_w16_##name3,\ +}; + +MC_COPY_WTAB(mmx,mmx,mmx,mmx) +#if HIGH_BIT_DEPTH +MC_COPY_WTAB(sse,mmx,sse,sse) +MC_COPY_WTAB(avx,mmx,sse,avx) +#else +MC_COPY_WTAB(sse,mmx,mmx,sse) +#endif + +#define MC_WEIGHT_WTAB(function, instr, name1, name2, w12version)\ + static void (* x264_mc_##function##_wtab_##instr[6])( pixel *, intptr_t, pixel *, intptr_t, const x264_weight_t *, int ) =\ +{\ + x264_mc_##function##_w4_##name1,\ + x264_mc_##function##_w4_##name1,\ + x264_mc_##function##_w8_##name2,\ + x264_mc_##function##_w##w12version##_##instr,\ + x264_mc_##function##_w16_##instr,\ + x264_mc_##function##_w20_##instr,\ +}; + +#if HIGH_BIT_DEPTH +MC_WEIGHT_WTAB(weight,mmx2,mmx2,mmx2,12) +MC_WEIGHT_WTAB(offsetadd,mmx2,mmx2,mmx2,12) +MC_WEIGHT_WTAB(offsetsub,mmx2,mmx2,mmx2,12) +MC_WEIGHT_WTAB(weight,sse2,mmx2,sse2,12) +MC_WEIGHT_WTAB(offsetadd,sse2,mmx2,sse2,16) +MC_WEIGHT_WTAB(offsetsub,sse2,mmx2,sse2,16) + +static void x264_weight_cache_mmx2( x264_t *h, x264_weight_t *w ) +{ + if( w->i_scale == 1<i_denom ) + { + if( w->i_offset < 0 ) + w->weightfn = h->mc.offsetsub; + else + w->weightfn = h->mc.offsetadd; + for( int i = 0; i < 8; i++ ) + w->cachea[i] = abs(w->i_offset<<(BIT_DEPTH-8)); + return; + } + w->weightfn = h->mc.weight; + int den1 = 1<i_denom; + int den2 = w->i_scale<<1; + int den3 = 1+(w->i_offset<<(BIT_DEPTH-8+1)); + for( int i = 0; i < 8; i++ ) + { + w->cachea[i] = den1; + w->cacheb[i] = i&1 ? den3 : den2; + } +} +#else +MC_WEIGHT_WTAB(weight,mmx2,mmx2,mmx2,12) +MC_WEIGHT_WTAB(offsetadd,mmx2,mmx2,mmx2,12) +MC_WEIGHT_WTAB(offsetsub,mmx2,mmx2,mmx2,12) +MC_WEIGHT_WTAB(weight,sse2,mmx2,sse2,16) +MC_WEIGHT_WTAB(offsetadd,sse2,mmx2,mmx2,16) +MC_WEIGHT_WTAB(offsetsub,sse2,mmx2,mmx2,16) +MC_WEIGHT_WTAB(weight,ssse3,ssse3,ssse3,16) +MC_WEIGHT_WTAB(weight,avx2,ssse3,avx2,16) + +static void x264_weight_cache_mmx2( x264_t *h, x264_weight_t *w ) +{ + int i; + int16_t den1; + + if( w->i_scale == 1<i_denom ) + { + if( w->i_offset < 0 ) + w->weightfn = h->mc.offsetsub; + else + w->weightfn = h->mc.offsetadd; + memset( w->cachea, abs(w->i_offset), sizeof(w->cachea) ); + return; + } + w->weightfn = h->mc.weight; + den1 = 1 << (w->i_denom - 1) | w->i_offset << w->i_denom; + for( i = 0; i < 8; i++ ) + { + w->cachea[i] = w->i_scale; + w->cacheb[i] = den1; + } +} + +static void x264_weight_cache_ssse3( x264_t *h, x264_weight_t *w ) +{ + int i, den1; + if( w->i_scale == 1<i_denom ) + { + if( w->i_offset < 0 ) + w->weightfn = h->mc.offsetsub; + else + w->weightfn = h->mc.offsetadd; + + memset( w->cachea, abs( w->i_offset ), sizeof(w->cachea) ); + return; + } + w->weightfn = h->mc.weight; + den1 = w->i_scale << (8 - w->i_denom); + for( i = 0; i < 8; i++ ) + { + w->cachea[i] = den1; + w->cacheb[i] = w->i_offset; + } +} +#endif // !HIGH_BIT_DEPTH + +#define MC_LUMA(name,instr1,instr2)\ +static void mc_luma_##name( pixel *dst, intptr_t i_dst_stride,\ + pixel *src[4], intptr_t i_src_stride,\ + int mvx, int mvy,\ + int i_width, int i_height, const x264_weight_t *weight )\ +{\ + int qpel_idx = ((mvy&3)<<2) + (mvx&3);\ + int offset = (mvy>>2)*i_src_stride + (mvx>>2);\ + pixel *src1 = src[x264_hpel_ref0[qpel_idx]] + offset + ((mvy&3) == 3) * i_src_stride;\ + if( qpel_idx & 5 ) /* qpel interpolation needed */\ + {\ + pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);\ + x264_pixel_avg_wtab_##instr1[i_width>>2](\ + dst, i_dst_stride, src1, i_src_stride,\ + src2, i_height );\ + if( weight->weightfn )\ + weight->weightfn[i_width>>2]( dst, i_dst_stride, dst, i_dst_stride, weight, i_height );\ + }\ + else if( weight->weightfn )\ + weight->weightfn[i_width>>2]( dst, i_dst_stride, src1, i_src_stride, weight, i_height );\ + else\ + x264_mc_copy_wtab_##instr2[i_width>>2](dst, i_dst_stride, src1, i_src_stride, i_height );\ +} + +MC_LUMA(mmx2,mmx2,mmx) +MC_LUMA(sse2,sse2,sse) +#if HIGH_BIT_DEPTH +MC_LUMA(avx2,avx2,avx) +#else +#if ARCH_X86 +MC_LUMA(cache32_mmx2,cache32_mmx2,mmx) +MC_LUMA(cache64_mmx2,cache64_mmx2,mmx) +#endif +MC_LUMA(cache64_sse2,cache64_sse2,sse) +MC_LUMA(cache64_ssse3,cache64_ssse3,sse) +MC_LUMA(cache64_ssse3_atom,cache64_ssse3_atom,sse) +#endif // !HIGH_BIT_DEPTH + +#define GET_REF(name)\ +static pixel *get_ref_##name( pixel *dst, intptr_t *i_dst_stride,\ + pixel *src[4], intptr_t i_src_stride,\ + int mvx, int mvy,\ + int i_width, int i_height, const x264_weight_t *weight )\ +{\ + int qpel_idx = ((mvy&3)<<2) + (mvx&3);\ + int offset = (mvy>>2)*i_src_stride + (mvx>>2);\ + pixel *src1 = src[x264_hpel_ref0[qpel_idx]] + offset + ((mvy&3) == 3) * i_src_stride;\ + if( qpel_idx & 5 ) /* qpel interpolation needed */\ + {\ + pixel *src2 = src[x264_hpel_ref1[qpel_idx]] + offset + ((mvx&3) == 3);\ + x264_pixel_avg_wtab_##name[i_width>>2](\ + dst, *i_dst_stride, src1, i_src_stride,\ + src2, i_height );\ + if( weight->weightfn )\ + weight->weightfn[i_width>>2]( dst, *i_dst_stride, dst, *i_dst_stride, weight, i_height );\ + return dst;\ + }\ + else if( weight->weightfn )\ + {\ + weight->weightfn[i_width>>2]( dst, *i_dst_stride, src1, i_src_stride, weight, i_height );\ + return dst;\ + }\ + else\ + {\ + *i_dst_stride = i_src_stride;\ + return src1;\ + }\ +} + +GET_REF(mmx2) +GET_REF(sse2) +GET_REF(avx2) +#if !HIGH_BIT_DEPTH +#if ARCH_X86 +GET_REF(cache32_mmx2) +GET_REF(cache64_mmx2) +#endif +GET_REF(cache64_sse2) +GET_REF(cache64_ssse3) +GET_REF(cache64_ssse3_atom) +#endif // !HIGH_BIT_DEPTH + +#define HPEL(align, cpu, cpuv, cpuc, cpuh)\ +void x264_hpel_filter_v_##cpuv( pixel *dst, pixel *src, int16_t *buf, intptr_t stride, intptr_t width);\ +void x264_hpel_filter_c_##cpuc( pixel *dst, int16_t *buf, intptr_t width );\ +void x264_hpel_filter_h_##cpuh( pixel *dst, pixel *src, intptr_t width );\ +static void x264_hpel_filter_##cpu( pixel *dsth, pixel *dstv, pixel *dstc, pixel *src,\ + intptr_t stride, int width, int height, int16_t *buf )\ +{\ + intptr_t realign = (intptr_t)src & (align-1);\ + src -= realign;\ + dstv -= realign;\ + dstc -= realign;\ + dsth -= realign;\ + width += realign;\ + while( height-- )\ + {\ + x264_hpel_filter_v_##cpuv( dstv, src, buf+16, stride, width );\ + x264_hpel_filter_c_##cpuc( dstc, buf+16, width );\ + x264_hpel_filter_h_##cpuh( dsth, src, width );\ + dsth += stride;\ + dstv += stride;\ + dstc += stride;\ + src += stride;\ + }\ + x264_sfence();\ +} + +HPEL(8, mmx2, mmx2, mmx2, mmx2) +#if HIGH_BIT_DEPTH +HPEL(16, sse2, sse2, sse2, sse2) +#else // !HIGH_BIT_DEPTH +HPEL(16, sse2_amd, mmx2, mmx2, sse2) +#if ARCH_X86_64 +void x264_hpel_filter_sse2 ( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src, intptr_t stride, int width, int height, int16_t *buf ); +void x264_hpel_filter_ssse3( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src, intptr_t stride, int width, int height, int16_t *buf ); +void x264_hpel_filter_avx ( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src, intptr_t stride, int width, int height, int16_t *buf ); +void x264_hpel_filter_avx2 ( uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, uint8_t *src, intptr_t stride, int width, int height, int16_t *buf ); +#else +HPEL(16, sse2, sse2, sse2, sse2) +HPEL(16, ssse3, ssse3, ssse3, ssse3) +HPEL(16, avx, avx, avx, avx) +HPEL(32, avx2, avx2, avx2, avx2) +#endif +#endif // HIGH_BIT_DEPTH + +PLANE_COPY(16, sse) +PLANE_COPY(32, avx) + +PLANE_COPY_SWAP(16, ssse3) +PLANE_COPY_SWAP(32, avx2) + +#if HIGH_BIT_DEPTH +PLANE_COPY_YUYV(64, sse2) +PLANE_COPY_YUYV(64, avx) +#else +PLANE_COPY_YUYV(32, sse2) +PLANE_COPY_YUYV(32, ssse3) +#endif +PLANE_COPY_YUYV(64, avx2) + +PLANE_INTERLEAVE(mmx2) +PLANE_INTERLEAVE(sse2) +#if HIGH_BIT_DEPTH +PLANE_INTERLEAVE(avx) +#endif + +#if HAVE_X86_INLINE_ASM +#undef MC_CLIP_ADD +#define MC_CLIP_ADD(s,x)\ +do\ +{\ + int temp;\ + asm("movd %0, %%xmm0 \n"\ + "movd %2, %%xmm1 \n"\ + "paddsw %%xmm1, %%xmm0 \n"\ + "movd %%xmm0, %1 \n"\ + :"+m"(s), "=&r"(temp)\ + :"m"(x)\ + );\ + s = temp;\ +} while( 0 ) + +#undef MC_CLIP_ADD2 +#define MC_CLIP_ADD2(s,x)\ +do\ +{\ + asm("movd %0, %%xmm0 \n"\ + "movd %1, %%xmm1 \n"\ + "paddsw %%xmm1, %%xmm0 \n"\ + "movd %%xmm0, %0 \n"\ + :"+m"(M32(s))\ + :"m"(M32(x))\ + );\ +} while( 0 ) +#endif + +PROPAGATE_LIST(ssse3) +PROPAGATE_LIST(avx) +PROPAGATE_LIST(avx2) + +#if ARCH_X86_64 +void x264_mbtree_propagate_list_internal_avx512( size_t len, uint16_t *ref_costs, int16_t (*mvs)[2], int16_t *propagate_amount, + uint16_t *lowres_costs, int bipred_weight, int mb_y, + int width, int height, int stride, int list_mask ); + +static void x264_mbtree_propagate_list_avx512( x264_t *h, uint16_t *ref_costs, int16_t (*mvs)[2], + int16_t *propagate_amount, uint16_t *lowres_costs, + int bipred_weight, int mb_y, int len, int list ) +{ + x264_mbtree_propagate_list_internal_avx512( len, ref_costs, mvs, propagate_amount, lowres_costs, bipred_weight << 9, + mb_y << 16, h->mb.i_mb_width, h->mb.i_mb_height, h->mb.i_mb_stride, + (1 << LOWRES_COST_SHIFT) << list ); +} +#endif + +void x264_mc_init_mmx( int cpu, x264_mc_functions_t *pf ) +{ + if( !(cpu&X264_CPU_MMX) ) + return; + + pf->copy_16x16_unaligned = x264_mc_copy_w16_mmx; + pf->copy[PIXEL_16x16] = x264_mc_copy_w16_mmx; + pf->copy[PIXEL_8x8] = x264_mc_copy_w8_mmx; + pf->copy[PIXEL_4x4] = x264_mc_copy_w4_mmx; + pf->integral_init4v = x264_integral_init4v_mmx; + pf->integral_init8v = x264_integral_init8v_mmx; + + if( !(cpu&X264_CPU_MMX2) ) + return; + + pf->prefetch_fenc_420 = x264_prefetch_fenc_420_mmx2; + pf->prefetch_fenc_422 = x264_prefetch_fenc_422_mmx2; + pf->prefetch_ref = x264_prefetch_ref_mmx2; + + pf->plane_copy_interleave = x264_plane_copy_interleave_mmx2; + pf->store_interleave_chroma = x264_store_interleave_chroma_mmx2; + + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_mmx2; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_mmx2; + pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_mmx2; + pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_mmx2; + pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_mmx2; + pf->avg[PIXEL_4x16] = x264_pixel_avg_4x16_mmx2; + pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_mmx2; + pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_mmx2; + pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_mmx2; + + pf->mc_luma = mc_luma_mmx2; + pf->get_ref = get_ref_mmx2; + pf->mc_chroma = x264_mc_chroma_mmx2; + pf->hpel_filter = x264_hpel_filter_mmx2; + pf->weight = x264_mc_weight_wtab_mmx2; + pf->weight_cache = x264_weight_cache_mmx2; + pf->offsetadd = x264_mc_offsetadd_wtab_mmx2; + pf->offsetsub = x264_mc_offsetsub_wtab_mmx2; + + pf->frame_init_lowres_core = x264_frame_init_lowres_core_mmx2; + + if( cpu&X264_CPU_SSE ) + { + pf->memcpy_aligned = x264_memcpy_aligned_sse; + pf->memzero_aligned = x264_memzero_aligned_sse; + pf->plane_copy = x264_plane_copy_sse; + } + +#if HIGH_BIT_DEPTH +#if ARCH_X86 // all x86_64 cpus with cacheline split issues use sse2 instead + if( cpu&(X264_CPU_CACHELINE_32|X264_CPU_CACHELINE_64) ) + pf->frame_init_lowres_core = x264_frame_init_lowres_core_cache32_mmx2; +#endif + + if( !(cpu&X264_CPU_SSE2) ) + return; + + pf->frame_init_lowres_core = x264_frame_init_lowres_core_sse2; + + pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_sse2; + pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_sse2; + + pf->plane_copy_interleave = x264_plane_copy_interleave_sse2; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_sse2; + pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_sse2; + + if( cpu&X264_CPU_SSE2_IS_FAST ) + { + pf->get_ref = get_ref_sse2; + pf->mc_luma = mc_luma_sse2; + pf->hpel_filter = x264_hpel_filter_sse2; + } + + pf->integral_init4v = x264_integral_init4v_sse2; + pf->integral_init8v = x264_integral_init8v_sse2; + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_sse2; + pf->store_interleave_chroma = x264_store_interleave_chroma_sse2; + pf->offsetadd = x264_mc_offsetadd_wtab_sse2; + pf->offsetsub = x264_mc_offsetsub_wtab_sse2; + + if( cpu&X264_CPU_SSE2_IS_SLOW ) + return; + + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_sse2; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_sse2; + pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_sse2; + pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_sse2; + pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_sse2; + pf->avg[PIXEL_4x16] = x264_pixel_avg_4x16_sse2; + pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_sse2; + pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_sse2; + pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_sse2; + + pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_sse; + pf->weight = x264_mc_weight_wtab_sse2; + + if( !(cpu&X264_CPU_STACK_MOD4) ) + pf->mc_chroma = x264_mc_chroma_sse2; + + if( !(cpu&X264_CPU_SSSE3) ) + return; + + pf->frame_init_lowres_core = x264_frame_init_lowres_core_ssse3; + pf->plane_copy_swap = x264_plane_copy_swap_ssse3; + pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_ssse3; + pf->mbtree_propagate_list = x264_mbtree_propagate_list_ssse3; + pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_ssse3; + pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_ssse3; + + if( !(cpu&(X264_CPU_SLOW_SHUFFLE|X264_CPU_SLOW_ATOM|X264_CPU_SLOW_PALIGNR)) ) + pf->integral_init4v = x264_integral_init4v_ssse3; + + if( !(cpu&X264_CPU_AVX) ) + return; + + pf->frame_init_lowres_core = x264_frame_init_lowres_core_avx; + pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx; + pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_avx; + pf->plane_copy_interleave = x264_plane_copy_interleave_avx; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_avx; + pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_avx; + pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_avx; + pf->store_interleave_chroma = x264_store_interleave_chroma_avx; + pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_avx; + + if( !(cpu&X264_CPU_STACK_MOD4) ) + pf->mc_chroma = x264_mc_chroma_avx; + + if( cpu&X264_CPU_XOP ) + pf->frame_init_lowres_core = x264_frame_init_lowres_core_xop; + + if( cpu&X264_CPU_AVX2 ) + { + pf->mc_luma = mc_luma_avx2; + pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_avx2; + pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_avx2; + } + + if( cpu&X264_CPU_AVX512 ) + { + pf->plane_copy_deinterleave_v210 = x264_plane_copy_deinterleave_v210_avx512; + } +#else // !HIGH_BIT_DEPTH + +#if ARCH_X86 // all x86_64 cpus with cacheline split issues use sse2 instead + if( cpu&X264_CPU_CACHELINE_32 ) + { + pf->mc_luma = mc_luma_cache32_mmx2; + pf->get_ref = get_ref_cache32_mmx2; + pf->frame_init_lowres_core = x264_frame_init_lowres_core_cache32_mmx2; + } + else if( cpu&X264_CPU_CACHELINE_64 ) + { + pf->mc_luma = mc_luma_cache64_mmx2; + pf->get_ref = get_ref_cache64_mmx2; + pf->frame_init_lowres_core = x264_frame_init_lowres_core_cache32_mmx2; + } +#endif + + if( !(cpu&X264_CPU_SSE2) ) + return; + + pf->integral_init4v = x264_integral_init4v_sse2; + pf->integral_init8v = x264_integral_init8v_sse2; + pf->hpel_filter = x264_hpel_filter_sse2_amd; + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_sse2; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_sse2; + pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_sse2; + pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_sse2; + pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_sse2; + pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_sse2; + + if( !(cpu&X264_CPU_SSE2_IS_SLOW) ) + { + pf->weight = x264_mc_weight_wtab_sse2; + if( !(cpu&X264_CPU_SLOW_ATOM) ) + { + pf->offsetadd = x264_mc_offsetadd_wtab_sse2; + pf->offsetsub = x264_mc_offsetsub_wtab_sse2; + } + + pf->copy[PIXEL_16x16] = x264_mc_copy_w16_aligned_sse; + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_sse2; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_sse2; + pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_sse2; + pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_sse2; + pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_sse2; + pf->hpel_filter = x264_hpel_filter_sse2; + pf->frame_init_lowres_core = x264_frame_init_lowres_core_sse2; + if( !(cpu&X264_CPU_STACK_MOD4) ) + pf->mc_chroma = x264_mc_chroma_sse2; + + if( cpu&X264_CPU_SSE2_IS_FAST ) + { + pf->store_interleave_chroma = x264_store_interleave_chroma_sse2; // FIXME sse2fast? sse2medium? + pf->plane_copy_interleave = x264_plane_copy_interleave_sse2; + pf->mc_luma = mc_luma_sse2; + pf->get_ref = get_ref_sse2; + if( cpu&X264_CPU_CACHELINE_64 ) + { + pf->mc_luma = mc_luma_cache64_sse2; + pf->get_ref = get_ref_cache64_sse2; + } + } + } + + if( !(cpu&X264_CPU_SSSE3) ) + return; + + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_ssse3; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_ssse3; + pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_ssse3; + pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_ssse3; + pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_ssse3; + pf->avg[PIXEL_4x16] = x264_pixel_avg_4x16_ssse3; + pf->avg[PIXEL_4x8] = x264_pixel_avg_4x8_ssse3; + pf->avg[PIXEL_4x4] = x264_pixel_avg_4x4_ssse3; + pf->avg[PIXEL_4x2] = x264_pixel_avg_4x2_ssse3; + pf->plane_copy_swap = x264_plane_copy_swap_ssse3; + pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_ssse3; + pf->mbtree_propagate_list = x264_mbtree_propagate_list_ssse3; + pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_ssse3; + pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_ssse3; + + if( !(cpu&X264_CPU_SLOW_PSHUFB) ) + { + pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_ssse3; + pf->load_deinterleave_chroma_fdec = x264_load_deinterleave_chroma_fdec_ssse3; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_ssse3; + pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_ssse3; + } + + if( !(cpu&X264_CPU_SLOW_PALIGNR) ) + { +#if ARCH_X86_64 + if( !(cpu&X264_CPU_SLOW_ATOM) ) /* The 64-bit version is slower, but the 32-bit version is faster? */ +#endif + pf->hpel_filter = x264_hpel_filter_ssse3; + pf->frame_init_lowres_core = x264_frame_init_lowres_core_ssse3; + } + if( !(cpu&X264_CPU_STACK_MOD4) ) + pf->mc_chroma = x264_mc_chroma_ssse3; + + if( cpu&X264_CPU_CACHELINE_64 ) + { + if( !(cpu&X264_CPU_STACK_MOD4) ) + pf->mc_chroma = x264_mc_chroma_cache64_ssse3; + pf->mc_luma = mc_luma_cache64_ssse3; + pf->get_ref = get_ref_cache64_ssse3; + if( cpu&X264_CPU_SLOW_ATOM ) + { + pf->mc_luma = mc_luma_cache64_ssse3_atom; + pf->get_ref = get_ref_cache64_ssse3_atom; + } + } + + pf->weight_cache = x264_weight_cache_ssse3; + pf->weight = x264_mc_weight_wtab_ssse3; + + if( !(cpu&(X264_CPU_SLOW_SHUFFLE|X264_CPU_SLOW_ATOM|X264_CPU_SLOW_PALIGNR)) ) + pf->integral_init4v = x264_integral_init4v_ssse3; + + if( !(cpu&X264_CPU_SSE4) ) + return; + + pf->integral_init4h = x264_integral_init4h_sse4; + pf->integral_init8h = x264_integral_init8h_sse4; + + if( !(cpu&X264_CPU_AVX) ) + return; + + pf->frame_init_lowres_core = x264_frame_init_lowres_core_avx; + pf->integral_init8h = x264_integral_init8h_avx; + pf->hpel_filter = x264_hpel_filter_avx; + + if( !(cpu&X264_CPU_STACK_MOD4) ) + pf->mc_chroma = x264_mc_chroma_avx; + + if( cpu&X264_CPU_XOP ) + pf->frame_init_lowres_core = x264_frame_init_lowres_core_xop; + + if( cpu&X264_CPU_AVX2 ) + { + pf->hpel_filter = x264_hpel_filter_avx2; + pf->mc_chroma = x264_mc_chroma_avx2; + pf->weight = x264_mc_weight_wtab_avx2; + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_avx2; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_avx2; + pf->integral_init8v = x264_integral_init8v_avx2; + pf->integral_init4v = x264_integral_init4v_avx2; + pf->integral_init8h = x264_integral_init8h_avx2; + pf->integral_init4h = x264_integral_init4h_avx2; + pf->frame_init_lowres_core = x264_frame_init_lowres_core_avx2; + pf->plane_copy_deinterleave_rgb = x264_plane_copy_deinterleave_rgb_avx2; + } + + if( cpu&X264_CPU_AVX512 ) + { + pf->avg[PIXEL_16x16] = x264_pixel_avg_16x16_avx512; + pf->avg[PIXEL_16x8] = x264_pixel_avg_16x8_avx512; + pf->avg[PIXEL_8x16] = x264_pixel_avg_8x16_avx512; + pf->avg[PIXEL_8x8] = x264_pixel_avg_8x8_avx512; + pf->avg[PIXEL_8x4] = x264_pixel_avg_8x4_avx512; + } +#endif // HIGH_BIT_DEPTH + + if( !(cpu&X264_CPU_AVX) ) + return; + pf->memcpy_aligned = x264_memcpy_aligned_avx; + pf->memzero_aligned = x264_memzero_aligned_avx; + pf->plane_copy = x264_plane_copy_avx; + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx; + pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx; + + if( cpu&X264_CPU_FMA4 ) + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_fma4; + + if( !(cpu&X264_CPU_AVX2) ) + return; + pf->plane_copy_swap = x264_plane_copy_swap_avx2; + pf->plane_copy_deinterleave = x264_plane_copy_deinterleave_avx2; + pf->plane_copy_deinterleave_yuyv = x264_plane_copy_deinterleave_yuyv_avx2; + pf->load_deinterleave_chroma_fenc = x264_load_deinterleave_chroma_fenc_avx2; + pf->get_ref = get_ref_avx2; + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx2; + pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx2; + pf->mbtree_fix8_pack = x264_mbtree_fix8_pack_avx2; + pf->mbtree_fix8_unpack = x264_mbtree_fix8_unpack_avx2; + + if( !(cpu&X264_CPU_AVX512) ) + return; + pf->memcpy_aligned = x264_memcpy_aligned_avx512; + pf->memzero_aligned = x264_memzero_aligned_avx512; + pf->mbtree_propagate_cost = x264_mbtree_propagate_cost_avx512; +#if ARCH_X86_64 + pf->mbtree_propagate_list = x264_mbtree_propagate_list_avx512; +#endif +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc.h new file mode 100644 index 00000000..394fb7bb --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/mc.h @@ -0,0 +1,32 @@ +/***************************************************************************** + * mc.h: x86 motion compensation + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_I386_MC_H +#define X264_I386_MC_H + +void x264_mc_init_mmx( int cpu, x264_mc_functions_t *pf ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/pixel.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/pixel.h new file mode 100644 index 00000000..56cfc5cb --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/pixel.h @@ -0,0 +1,220 @@ +/***************************************************************************** + * pixel.h: x86 pixel metrics + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_I386_PIXEL_H +#define X264_I386_PIXEL_H + +#define DECL_PIXELS( ret, name, suffix, args ) \ + ret x264_pixel_##name##_16x16_##suffix args;\ + ret x264_pixel_##name##_16x8_##suffix args;\ + ret x264_pixel_##name##_8x16_##suffix args;\ + ret x264_pixel_##name##_8x8_##suffix args;\ + ret x264_pixel_##name##_8x4_##suffix args;\ + ret x264_pixel_##name##_4x16_##suffix args;\ + ret x264_pixel_##name##_4x8_##suffix args;\ + ret x264_pixel_##name##_4x4_##suffix args;\ + +#define DECL_X1( name, suffix ) \ + DECL_PIXELS( int, name, suffix, ( pixel *, intptr_t, pixel *, intptr_t ) ) + +#define DECL_X4( name, suffix ) \ + DECL_PIXELS( void, name##_x3, suffix, ( pixel *, pixel *, pixel *, pixel *, intptr_t, int * ) )\ + DECL_PIXELS( void, name##_x4, suffix, ( pixel *, pixel *, pixel *, pixel *, pixel *, intptr_t, int * ) ) + +DECL_X1( sad, mmx2 ) +DECL_X1( sad, sse2 ) +DECL_X1( sad, sse3 ) +DECL_X1( sad, sse2_aligned ) +DECL_X1( sad, ssse3 ) +DECL_X1( sad, ssse3_aligned ) +DECL_X1( sad, avx2 ) +DECL_X1( sad, avx512 ) +DECL_X4( sad, mmx2 ) +DECL_X4( sad, sse2 ) +DECL_X4( sad, sse3 ) +DECL_X4( sad, ssse3 ) +DECL_X4( sad, xop ) +DECL_X4( sad, avx ) +DECL_X4( sad, avx2 ) +DECL_X4( sad, avx512 ) +DECL_X1( ssd, mmx ) +DECL_X1( ssd, mmx2 ) +DECL_X1( ssd, sse2slow ) +DECL_X1( ssd, sse2 ) +DECL_X1( ssd, ssse3 ) +DECL_X1( ssd, avx ) +DECL_X1( ssd, xop ) +DECL_X1( ssd, avx2 ) +DECL_X1( satd, mmx2 ) +DECL_X1( satd, sse2 ) +DECL_X1( satd, ssse3 ) +DECL_X1( satd, ssse3_atom ) +DECL_X1( satd, sse4 ) +DECL_X1( satd, avx ) +DECL_X1( satd, xop ) +DECL_X1( satd, avx2 ) +DECL_X1( satd, avx512 ) +DECL_X1( sa8d, mmx2 ) +DECL_X1( sa8d, sse2 ) +DECL_X1( sa8d, ssse3 ) +DECL_X1( sa8d, ssse3_atom ) +DECL_X1( sa8d, sse4 ) +DECL_X1( sa8d, avx ) +DECL_X1( sa8d, xop ) +DECL_X1( sa8d, avx2 ) +DECL_X1( sa8d, avx512 ) +DECL_X1( sad, cache32_mmx2 ); +DECL_X1( sad, cache64_mmx2 ); +DECL_X1( sad, cache64_sse2 ); +DECL_X1( sad, cache64_ssse3 ); +DECL_X4( sad, cache32_mmx2 ); +DECL_X4( sad, cache64_mmx2 ); +DECL_X4( sad, cache64_sse2 ); +DECL_X4( sad, cache64_ssse3 ); + +DECL_PIXELS( uint64_t, var, sse2, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, var, avx, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, var, avx2, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, var, avx512, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, mmx2, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, sse2, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, ssse3, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, ssse3_atom, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, sse4, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, avx, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, xop, ( pixel *pix, intptr_t i_stride )) +DECL_PIXELS( uint64_t, hadamard_ac, avx2, ( pixel *pix, intptr_t i_stride )) + + +void x264_intra_satd_x3_4x4_mmx2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_4x4_mmx2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_4x4_sse2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_4x4_ssse3 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_4x4_avx ( pixel *, pixel *, int * ); +void x264_intra_satd_x3_8x8c_mmx2 ( pixel *, pixel *, int * ); +void x264_intra_satd_x3_8x8c_ssse3 ( uint8_t *, uint8_t *, int * ); +void x264_intra_sad_x3_8x8c_mmx2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_8x8c_sse2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_8x8c_ssse3 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_8x8c_avx2 ( pixel *, pixel *, int * ); +void x264_intra_satd_x3_16x16_mmx2 ( pixel *, pixel *, int * ); +void x264_intra_satd_x3_16x16_ssse3( uint8_t *, uint8_t *, int * ); +void x264_intra_sad_x3_16x16_mmx2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_16x16_sse2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_16x16_ssse3 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_16x16_avx2 ( pixel *, pixel *, int * ); +void x264_intra_sa8d_x3_8x8_mmx2 ( uint8_t *, uint8_t *, int * ); +void x264_intra_sa8d_x3_8x8_sse2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_8x8_mmx2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_8x8_sse2 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_8x8_ssse3 ( pixel *, pixel *, int * ); +void x264_intra_sad_x3_8x8_avx2 ( uint16_t*, uint16_t*, int * ); +int x264_intra_satd_x9_4x4_ssse3( uint8_t *, uint8_t *, uint16_t * ); +int x264_intra_satd_x9_4x4_sse4 ( uint8_t *, uint8_t *, uint16_t * ); +int x264_intra_satd_x9_4x4_avx ( uint8_t *, uint8_t *, uint16_t * ); +int x264_intra_satd_x9_4x4_xop ( uint8_t *, uint8_t *, uint16_t * ); +int x264_intra_sad_x9_4x4_ssse3 ( uint8_t *, uint8_t *, uint16_t * ); +int x264_intra_sad_x9_4x4_sse4 ( uint8_t *, uint8_t *, uint16_t * ); +int x264_intra_sad_x9_4x4_avx ( uint8_t *, uint8_t *, uint16_t * ); +int x264_intra_sa8d_x9_8x8_ssse3( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * ); +int x264_intra_sa8d_x9_8x8_sse4 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * ); +int x264_intra_sa8d_x9_8x8_avx ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * ); +int x264_intra_sad_x9_8x8_ssse3 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * ); +int x264_intra_sad_x9_8x8_sse4 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * ); +int x264_intra_sad_x9_8x8_avx ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * ); +int x264_intra_sad_x9_8x8_avx2 ( uint8_t *, uint8_t *, uint8_t *, uint16_t *, uint16_t * ); + +void x264_pixel_ssd_nv12_core_sse2( pixel *pixuv1, intptr_t stride1, + pixel *pixuv2, intptr_t stride2, int width, + int height, uint64_t *ssd_u, uint64_t *ssd_v ); +void x264_pixel_ssd_nv12_core_avx ( pixel *pixuv1, intptr_t stride1, + pixel *pixuv2, intptr_t stride2, int width, + int height, uint64_t *ssd_u, uint64_t *ssd_v ); +void x264_pixel_ssd_nv12_core_xop ( pixel *pixuv1, intptr_t stride1, + pixel *pixuv2, intptr_t stride2, int width, + int height, uint64_t *ssd_u, uint64_t *ssd_v ); +void x264_pixel_ssd_nv12_core_avx2( pixel *pixuv1, intptr_t stride1, + pixel *pixuv2, intptr_t stride2, int width, + int height, uint64_t *ssd_u, uint64_t *ssd_v ); +void x264_pixel_ssim_4x4x2_core_mmx2( const uint8_t *pix1, intptr_t stride1, + const uint8_t *pix2, intptr_t stride2, int sums[2][4] ); +void x264_pixel_ssim_4x4x2_core_sse2( const pixel *pix1, intptr_t stride1, + const pixel *pix2, intptr_t stride2, int sums[2][4] ); +void x264_pixel_ssim_4x4x2_core_avx ( const pixel *pix1, intptr_t stride1, + const pixel *pix2, intptr_t stride2, int sums[2][4] ); +float x264_pixel_ssim_end4_sse2( int sum0[5][4], int sum1[5][4], int width ); +float x264_pixel_ssim_end4_avx ( int sum0[5][4], int sum1[5][4], int width ); +int x264_pixel_var2_8x8_sse2 ( pixel *fenc, pixel *fdec, int ssd[2] ); +int x264_pixel_var2_8x8_ssse3 ( uint8_t *fenc, uint8_t *fdec, int ssd[2] ); +int x264_pixel_var2_8x8_avx2 ( pixel *fenc, pixel *fdec, int ssd[2] ); +int x264_pixel_var2_8x8_avx512 ( pixel *fenc, pixel *fdec, int ssd[2] ); +int x264_pixel_var2_8x16_sse2 ( pixel *fenc, pixel *fdec, int ssd[2] ); +int x264_pixel_var2_8x16_ssse3 ( uint8_t *fenc, uint8_t *fdec, int ssd[2] ); +int x264_pixel_var2_8x16_avx2 ( pixel *fenc, pixel *fdec, int ssd[2] ); +int x264_pixel_var2_8x16_avx512( pixel *fenc, pixel *fdec, int ssd[2] ); +int x264_pixel_vsad_mmx2 ( pixel *src, intptr_t stride, int height ); +int x264_pixel_vsad_sse2 ( pixel *src, intptr_t stride, int height ); +int x264_pixel_vsad_ssse3( pixel *src, intptr_t stride, int height ); +int x264_pixel_vsad_xop ( pixel *src, intptr_t stride, int height ); +int x264_pixel_vsad_avx2 ( uint16_t *src, intptr_t stride, int height ); +int x264_pixel_asd8_sse2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height ); +int x264_pixel_asd8_ssse3( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height ); +int x264_pixel_asd8_xop ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2, int height ); +uint64_t x264_pixel_sa8d_satd_16x16_sse2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); +uint64_t x264_pixel_sa8d_satd_16x16_ssse3 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); +uint64_t x264_pixel_sa8d_satd_16x16_ssse3_atom( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); +uint64_t x264_pixel_sa8d_satd_16x16_sse4 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); +uint64_t x264_pixel_sa8d_satd_16x16_avx ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); +uint64_t x264_pixel_sa8d_satd_16x16_xop ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); +uint64_t x264_pixel_sa8d_satd_16x16_avx2 ( pixel *pix1, intptr_t stride1, pixel *pix2, intptr_t stride2 ); + + +#define DECL_ADS( size, suffix ) \ +int x264_pixel_ads##size##_##suffix( int enc_dc[size], uint16_t *sums, int delta,\ + uint16_t *cost_mvx, int16_t *mvs, int width, int thresh ); +DECL_ADS( 4, mmx2 ) +DECL_ADS( 2, mmx2 ) +DECL_ADS( 1, mmx2 ) +DECL_ADS( 4, sse2 ) +DECL_ADS( 2, sse2 ) +DECL_ADS( 1, sse2 ) +DECL_ADS( 4, ssse3 ) +DECL_ADS( 2, ssse3 ) +DECL_ADS( 1, ssse3 ) +DECL_ADS( 4, avx ) +DECL_ADS( 2, avx ) +DECL_ADS( 1, avx ) +DECL_ADS( 4, avx2 ) +DECL_ADS( 2, avx2 ) +DECL_ADS( 1, avx2 ) + +#undef DECL_PIXELS +#undef DECL_X1 +#undef DECL_X4 +#undef DECL_ADS + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict-c.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict-c.c new file mode 100644 index 00000000..27da63a2 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict-c.c @@ -0,0 +1,609 @@ +/***************************************************************************** + * predict-c.c: intra prediction + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "predict.h" +#include "pixel.h" + +#define PREDICT_P_SUM(j,i)\ + H += i * ( src[j+i - FDEC_STRIDE ] - src[j-i - FDEC_STRIDE ] );\ + V += i * ( src[(j+i)*FDEC_STRIDE -1] - src[(j-i)*FDEC_STRIDE -1] ); + +#if HAVE_X86_INLINE_ASM +#if HIGH_BIT_DEPTH +ALIGNED_16( static const int16_t pw_12345678[8] ) = {1,2,3,4,5,6,7,8}; +ALIGNED_16( static const int16_t pw_m87654321[8] ) = {-8,-7,-6,-5,-4,-3,-2,-1}; +ALIGNED_16( static const int16_t pw_m32101234[8] ) = {-3,-2,-1,0,1,2,3,4}; +#else // !HIGH_BIT_DEPTH +ALIGNED_8( static const int8_t pb_12345678[8] ) = {1,2,3,4,5,6,7,8}; +ALIGNED_8( static const int8_t pb_m87654321[8] ) = {-8,-7,-6,-5,-4,-3,-2,-1}; +ALIGNED_8( static const int8_t pb_m32101234[8] ) = {-3,-2,-1,0,1,2,3,4}; +#endif // HIGH_BIT_DEPTH +#endif // HAVE_X86_INLINE_ASM + +#define PREDICT_16x16_P_CORE\ + int H = 0;\ + int V = 0;\ + PREDICT_P_SUM(7,1)\ + PREDICT_P_SUM(7,2)\ + PREDICT_P_SUM(7,3)\ + PREDICT_P_SUM(7,4)\ + PREDICT_P_SUM(7,5)\ + PREDICT_P_SUM(7,6)\ + PREDICT_P_SUM(7,7)\ + PREDICT_P_SUM(7,8) + +#define PREDICT_16x16_P_END(name)\ + int a = 16 * ( src[15*FDEC_STRIDE -1] + src[15 - FDEC_STRIDE] );\ + int b = ( 5 * H + 32 ) >> 6;\ + int c = ( 5 * V + 32 ) >> 6;\ + int i00 = a - b * 7 - c * 7 + 16;\ + /* b*15 + c*15 can overflow: it's easier to just branch away in this rare case + * than to try to consider it in the asm. */\ + if( BIT_DEPTH > 8 && (i00 > 0x7fff || abs(b) > 1092 || abs(c) > 1092) )\ + x264_predict_16x16_p_c( src );\ + else\ + x264_predict_16x16_p_core_##name( src, i00, b, c ); + +#define PREDICT_16x16_P(name, name2)\ +static void x264_predict_16x16_p_##name( pixel *src )\ +{\ + PREDICT_16x16_P_CORE\ + PREDICT_16x16_P_END(name2)\ +} + +#if HAVE_X86_INLINE_ASM +#if HIGH_BIT_DEPTH +#define PREDICT_16x16_P_ASM\ + asm (\ + "movdqu %1, %%xmm1 \n"\ + "movdqa %2, %%xmm0 \n"\ + "pmaddwd %3, %%xmm0 \n"\ + "pmaddwd %4, %%xmm1 \n"\ + "paddd %%xmm1, %%xmm0 \n"\ + "movhlps %%xmm0, %%xmm1 \n"\ + "paddd %%xmm1, %%xmm0 \n"\ + "pshuflw $14, %%xmm0, %%xmm1 \n"\ + "paddd %%xmm1, %%xmm0 \n"\ + "movd %%xmm0, %0 \n"\ + :"=r"(H)\ + :"m"(src[-FDEC_STRIDE-1]), "m"(src[-FDEC_STRIDE+8]),\ + "m"(*pw_12345678), "m"(*pw_m87654321)\ + ); +#else // !HIGH_BIT_DEPTH +#define PREDICT_16x16_P_ASM\ + asm (\ + "movq %1, %%mm1 \n"\ + "movq %2, %%mm0 \n"\ + "palignr $7, %3, %%mm1 \n"\ + "pmaddubsw %4, %%mm0 \n"\ + "pmaddubsw %5, %%mm1 \n"\ + "paddw %%mm1, %%mm0 \n"\ + "pshufw $14, %%mm0, %%mm1 \n"\ + "paddw %%mm1, %%mm0 \n"\ + "pshufw $1, %%mm0, %%mm1 \n"\ + "paddw %%mm1, %%mm0 \n"\ + "movd %%mm0, %0 \n"\ + "movswl %w0, %0 \n"\ + :"=r"(H)\ + :"m"(src[-FDEC_STRIDE]), "m"(src[-FDEC_STRIDE+8]),\ + "m"(src[-FDEC_STRIDE-8]), "m"(*pb_12345678), "m"(*pb_m87654321)\ + ); +#endif // HIGH_BIT_DEPTH + +#define PREDICT_16x16_P_CORE_INLINE\ + int H, V;\ + PREDICT_16x16_P_ASM\ + V = 8 * ( src[15*FDEC_STRIDE-1] - src[-1*FDEC_STRIDE-1] )\ + + 7 * ( src[14*FDEC_STRIDE-1] - src[ 0*FDEC_STRIDE-1] )\ + + 6 * ( src[13*FDEC_STRIDE-1] - src[ 1*FDEC_STRIDE-1] )\ + + 5 * ( src[12*FDEC_STRIDE-1] - src[ 2*FDEC_STRIDE-1] )\ + + 4 * ( src[11*FDEC_STRIDE-1] - src[ 3*FDEC_STRIDE-1] )\ + + 3 * ( src[10*FDEC_STRIDE-1] - src[ 4*FDEC_STRIDE-1] )\ + + 2 * ( src[ 9*FDEC_STRIDE-1] - src[ 5*FDEC_STRIDE-1] )\ + + 1 * ( src[ 8*FDEC_STRIDE-1] - src[ 6*FDEC_STRIDE-1] ); + +#define PREDICT_16x16_P_INLINE(name, name2)\ +static void x264_predict_16x16_p_##name( pixel *src )\ +{\ + PREDICT_16x16_P_CORE_INLINE\ + PREDICT_16x16_P_END(name2)\ +} +#else // !HAVE_X86_INLINE_ASM +#define PREDICT_16x16_P_INLINE(name, name2) PREDICT_16x16_P(name, name2) +#endif // HAVE_X86_INLINE_ASM + +#if HIGH_BIT_DEPTH +PREDICT_16x16_P_INLINE( sse2, sse2 ) +#else // !HIGH_BIT_DEPTH +#if !ARCH_X86_64 +PREDICT_16x16_P( mmx2, mmx2 ) +#endif // !ARCH_X86_64 +PREDICT_16x16_P( sse2, sse2 ) +#if HAVE_X86_INLINE_ASM +PREDICT_16x16_P_INLINE( ssse3, sse2 ) +#endif // HAVE_X86_INLINE_ASM +PREDICT_16x16_P_INLINE( avx, avx ) +#endif // HIGH_BIT_DEPTH +PREDICT_16x16_P_INLINE( avx2, avx2 ) + +#define PREDICT_8x16C_P_CORE\ + int H = 0, V = 0;\ + for( int i = 0; i < 4; i++ )\ + H += ( i + 1 ) * ( src[4 + i - FDEC_STRIDE] - src[2 - i - FDEC_STRIDE] );\ + for( int i = 0; i < 8; i++ )\ + V += ( i + 1 ) * ( src[-1 + (i+8)*FDEC_STRIDE] - src[-1 + (6-i)*FDEC_STRIDE] ); + +#if HIGH_BIT_DEPTH +#define PREDICT_8x16C_P_END(name)\ + int a = 16 * ( src[-1 + 15*FDEC_STRIDE] + src[7 - FDEC_STRIDE] );\ + int b = ( 17 * H + 16 ) >> 5;\ + int c = ( 5 * V + 32 ) >> 6;\ + x264_predict_8x16c_p_core_##name( src, a, b, c ); +#else // !HIGH_BIT_DEPTH +#define PREDICT_8x16C_P_END(name)\ + int a = 16 * ( src[-1 + 15*FDEC_STRIDE] + src[7 - FDEC_STRIDE] );\ + int b = ( 17 * H + 16 ) >> 5;\ + int c = ( 5 * V + 32 ) >> 6;\ + int i00 = a -3*b -7*c + 16;\ + x264_predict_8x16c_p_core_##name( src, i00, b, c ); +#endif // HIGH_BIT_DEPTH + +#define PREDICT_8x16C_P(name)\ +static void x264_predict_8x16c_p_##name( pixel *src )\ +{\ + PREDICT_8x16C_P_CORE\ + PREDICT_8x16C_P_END(name)\ +} + +#if !ARCH_X86_64 && !HIGH_BIT_DEPTH +PREDICT_8x16C_P( mmx2 ) +#endif // !ARCH_X86_64 && !HIGH_BIT_DEPTH +PREDICT_8x16C_P( sse2 ) +PREDICT_8x16C_P( avx ) +PREDICT_8x16C_P( avx2 ) + +#define PREDICT_8x8C_P_CORE\ + int H = 0;\ + int V = 0;\ + PREDICT_P_SUM(3,1)\ + PREDICT_P_SUM(3,2)\ + PREDICT_P_SUM(3,3)\ + PREDICT_P_SUM(3,4) + +#if HIGH_BIT_DEPTH +#define PREDICT_8x8C_P_END(name)\ + int a = 16 * ( src[7*FDEC_STRIDE -1] + src[7 - FDEC_STRIDE] );\ + int b = ( 17 * H + 16 ) >> 5;\ + int c = ( 17 * V + 16 ) >> 5;\ + x264_predict_8x8c_p_core_##name( src, a, b, c ); +#else // !HIGH_BIT_DEPTH +#define PREDICT_8x8C_P_END(name)\ + int a = 16 * ( src[7*FDEC_STRIDE -1] + src[7 - FDEC_STRIDE] );\ + int b = ( 17 * H + 16 ) >> 5;\ + int c = ( 17 * V + 16 ) >> 5;\ + int i00 = a -3*b -3*c + 16;\ + x264_predict_8x8c_p_core_##name( src, i00, b, c ); +#endif // HIGH_BIT_DEPTH + +#define PREDICT_8x8C_P(name, name2)\ +static void x264_predict_8x8c_p_##name( pixel *src )\ +{\ + PREDICT_8x8C_P_CORE\ + PREDICT_8x8C_P_END(name2)\ +} + +#if HAVE_X86_INLINE_ASM +#if HIGH_BIT_DEPTH +#define PREDICT_8x8C_P_ASM\ + asm (\ + "movdqa %1, %%xmm0 \n"\ + "pmaddwd %2, %%xmm0 \n"\ + "movhlps %%xmm0, %%xmm1 \n"\ + "paddd %%xmm1, %%xmm0 \n"\ + "pshuflw $14, %%xmm0, %%xmm1 \n"\ + "paddd %%xmm1, %%xmm0 \n"\ + "movd %%xmm0, %0 \n"\ + :"=r"(H)\ + :"m"(src[-FDEC_STRIDE]), "m"(*pw_m32101234)\ + ); +#else // !HIGH_BIT_DEPTH +#define PREDICT_8x8C_P_ASM\ + asm (\ + "movq %1, %%mm0 \n"\ + "pmaddubsw %2, %%mm0 \n"\ + "pshufw $14, %%mm0, %%mm1 \n"\ + "paddw %%mm1, %%mm0 \n"\ + "pshufw $1, %%mm0, %%mm1 \n"\ + "paddw %%mm1, %%mm0 \n"\ + "movd %%mm0, %0 \n"\ + "movswl %w0, %0 \n"\ + :"=r"(H)\ + :"m"(src[-FDEC_STRIDE]), "m"(*pb_m32101234)\ + ); +#endif // HIGH_BIT_DEPTH + +#define PREDICT_8x8C_P_CORE_INLINE\ + int H, V;\ + PREDICT_8x8C_P_ASM\ + V = 1 * ( src[4*FDEC_STRIDE -1] - src[ 2*FDEC_STRIDE -1] )\ + + 2 * ( src[5*FDEC_STRIDE -1] - src[ 1*FDEC_STRIDE -1] )\ + + 3 * ( src[6*FDEC_STRIDE -1] - src[ 0*FDEC_STRIDE -1] )\ + + 4 * ( src[7*FDEC_STRIDE -1] - src[-1*FDEC_STRIDE -1] );\ + H += -4 * src[-1*FDEC_STRIDE -1]; + +#define PREDICT_8x8C_P_INLINE(name, name2)\ +static void x264_predict_8x8c_p_##name( pixel *src )\ +{\ + PREDICT_8x8C_P_CORE_INLINE\ + PREDICT_8x8C_P_END(name2)\ +} +#else // !HAVE_X86_INLINE_ASM +#define PREDICT_8x8C_P_INLINE(name, name2) PREDICT_8x8C_P(name, name2) +#endif // HAVE_X86_INLINE_ASM + +#if HIGH_BIT_DEPTH +PREDICT_8x8C_P_INLINE( sse2, sse2 ) +#else //!HIGH_BIT_DEPTH +#if !ARCH_X86_64 +PREDICT_8x8C_P( mmx2, mmx2 ) +#endif // !ARCH_X86_64 +PREDICT_8x8C_P( sse2, sse2 ) +#if HAVE_X86_INLINE_ASM +PREDICT_8x8C_P_INLINE( ssse3, sse2 ) +#endif // HAVE_X86_INLINE_ASM +#endif // HIGH_BIT_DEPTH +PREDICT_8x8C_P_INLINE( avx, avx ) +PREDICT_8x8C_P_INLINE( avx2, avx2 ) + +#if ARCH_X86_64 && !HIGH_BIT_DEPTH +static void x264_predict_8x8c_dc_left( uint8_t *src ) +{ + int y; + uint32_t s0 = 0, s1 = 0; + uint64_t dc0, dc1; + + for( y = 0; y < 4; y++ ) + { + s0 += src[y * FDEC_STRIDE - 1]; + s1 += src[(y+4) * FDEC_STRIDE - 1]; + } + dc0 = (( s0 + 2 ) >> 2) * 0x0101010101010101ULL; + dc1 = (( s1 + 2 ) >> 2) * 0x0101010101010101ULL; + + for( y = 0; y < 4; y++ ) + { + M64( src ) = dc0; + src += FDEC_STRIDE; + } + for( y = 0; y < 4; y++ ) + { + M64( src ) = dc1; + src += FDEC_STRIDE; + } +} +#endif // ARCH_X86_64 && !HIGH_BIT_DEPTH + +/**************************************************************************** + * Exported functions: + ****************************************************************************/ +void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_MMX2) ) + return; + pf[I_PRED_16x16_V] = x264_predict_16x16_v_mmx2; + pf[I_PRED_16x16_H] = x264_predict_16x16_h_mmx2; +#if HIGH_BIT_DEPTH + if( !(cpu&X264_CPU_SSE) ) + return; + pf[I_PRED_16x16_V] = x264_predict_16x16_v_sse; + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_sse2; + pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_sse2; + pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_sse2; + pf[I_PRED_16x16_H] = x264_predict_16x16_h_sse2; + pf[I_PRED_16x16_P] = x264_predict_16x16_p_sse2; + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_16x16_V] = x264_predict_16x16_v_avx; + if( !(cpu&X264_CPU_AVX2) ) + return; + pf[I_PRED_16x16_H] = x264_predict_16x16_h_avx2; +#else +#if !ARCH_X86_64 + pf[I_PRED_16x16_P] = x264_predict_16x16_p_mmx2; +#endif + if( !(cpu&X264_CPU_SSE) ) + return; + pf[I_PRED_16x16_V] = x264_predict_16x16_v_sse; + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_sse2; + if( cpu&X264_CPU_SSE2_IS_SLOW ) + return; + pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_sse2; + pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_sse2; + pf[I_PRED_16x16_P] = x264_predict_16x16_p_sse2; + if( !(cpu&X264_CPU_SSSE3) ) + return; + if( !(cpu&X264_CPU_SLOW_PSHUFB) ) + pf[I_PRED_16x16_H] = x264_predict_16x16_h_ssse3; +#if HAVE_X86_INLINE_ASM + pf[I_PRED_16x16_P] = x264_predict_16x16_p_ssse3; +#endif + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_16x16_P] = x264_predict_16x16_p_avx; +#endif // HIGH_BIT_DEPTH + + if( cpu&X264_CPU_AVX2 ) + { + pf[I_PRED_16x16_P] = x264_predict_16x16_p_avx2; + pf[I_PRED_16x16_DC] = x264_predict_16x16_dc_avx2; + pf[I_PRED_16x16_DC_TOP] = x264_predict_16x16_dc_top_avx2; + pf[I_PRED_16x16_DC_LEFT] = x264_predict_16x16_dc_left_avx2; + } +} + +void x264_predict_8x8c_init_mmx( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_MMX) ) + return; +#if HIGH_BIT_DEPTH + pf[I_PRED_CHROMA_V] = x264_predict_8x8c_v_mmx; + if( !(cpu&X264_CPU_MMX2) ) + return; + pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_mmx2; + pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_mmx2; + if( !(cpu&X264_CPU_SSE) ) + return; + pf[I_PRED_CHROMA_V] = x264_predict_8x8c_v_sse; + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_sse2; + pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_sse2; + pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_sse2; + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_sse2; + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx; + if( !(cpu&X264_CPU_AVX2) ) + return; + pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_avx2; +#else +#if ARCH_X86_64 + pf[I_PRED_CHROMA_DC_LEFT] = x264_predict_8x8c_dc_left; +#endif + pf[I_PRED_CHROMA_V] = x264_predict_8x8c_v_mmx; + if( !(cpu&X264_CPU_MMX2) ) + return; + pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x8c_dc_top_mmx2; + pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_mmx2; +#if !ARCH_X86_64 + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_mmx2; +#endif + pf[I_PRED_CHROMA_DC] = x264_predict_8x8c_dc_mmx2; + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_sse2; + if( !(cpu&X264_CPU_SSSE3) ) + return; + pf[I_PRED_CHROMA_H] = x264_predict_8x8c_h_ssse3; +#if HAVE_X86_INLINE_ASM + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_ssse3; +#endif + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx; +#endif // HIGH_BIT_DEPTH + + if( cpu&X264_CPU_AVX2 ) + { + pf[I_PRED_CHROMA_P] = x264_predict_8x8c_p_avx2; + } +} + +void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] ) +{ + if( !(cpu&X264_CPU_MMX) ) + return; +#if HIGH_BIT_DEPTH + if( !(cpu&X264_CPU_MMX2) ) + return; + pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_mmx2; + pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_mmx2; + if( !(cpu&X264_CPU_SSE) ) + return; + pf[I_PRED_CHROMA_V] = x264_predict_8x16c_v_sse; + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x16c_dc_top_sse2; + pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_sse2; + pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_sse2; + pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_sse2; + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx; + if( !(cpu&X264_CPU_AVX2) ) + return; + pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_avx2; +#else + pf[I_PRED_CHROMA_V] = x264_predict_8x16c_v_mmx; + if( !(cpu&X264_CPU_MMX2) ) + return; + pf[I_PRED_CHROMA_DC_TOP] = x264_predict_8x16c_dc_top_mmx2; + pf[I_PRED_CHROMA_DC] = x264_predict_8x16c_dc_mmx2; + pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_mmx2; +#if !ARCH_X86_64 + pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_mmx2; +#endif + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_sse2; + if( !(cpu&X264_CPU_SSSE3) ) + return; + pf[I_PRED_CHROMA_H] = x264_predict_8x16c_h_ssse3; + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx; +#endif // HIGH_BIT_DEPTH + + if( cpu&X264_CPU_AVX2 ) + { + pf[I_PRED_CHROMA_P] = x264_predict_8x16c_p_avx2; + } +} + +void x264_predict_8x8_init_mmx( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter ) +{ + if( !(cpu&X264_CPU_MMX2) ) + return; +#if HIGH_BIT_DEPTH + if( !(cpu&X264_CPU_SSE) ) + return; + pf[I_PRED_8x8_V] = x264_predict_8x8_v_sse; + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_8x8_H] = x264_predict_8x8_h_sse2; + pf[I_PRED_8x8_DC] = x264_predict_8x8_dc_sse2; + pf[I_PRED_8x8_DC_TOP] = x264_predict_8x8_dc_top_sse2; + pf[I_PRED_8x8_DC_LEFT]= x264_predict_8x8_dc_left_sse2; + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_sse2; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_sse2; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_sse2; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_sse2; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_sse2; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_sse2; + *predict_8x8_filter = x264_predict_8x8_filter_sse2; + if( !(cpu&X264_CPU_SSSE3) ) + return; + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_ssse3; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_ssse3; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_ssse3; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_ssse3; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_ssse3; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_ssse3; + *predict_8x8_filter = x264_predict_8x8_filter_ssse3; + if( cpu&X264_CPU_CACHELINE_64 ) + { + pf[I_PRED_8x8_DDL]= x264_predict_8x8_ddl_cache64_ssse3; + pf[I_PRED_8x8_DDR]= x264_predict_8x8_ddr_cache64_ssse3; + } + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_avx; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_avx; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_avx; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_avx; + *predict_8x8_filter = x264_predict_8x8_filter_avx; +#else + pf[I_PRED_8x8_V] = x264_predict_8x8_v_mmx2; + pf[I_PRED_8x8_H] = x264_predict_8x8_h_mmx2; + pf[I_PRED_8x8_DC] = x264_predict_8x8_dc_mmx2; + pf[I_PRED_8x8_DC_TOP] = x264_predict_8x8_dc_top_mmx2; + pf[I_PRED_8x8_DC_LEFT]= x264_predict_8x8_dc_left_mmx2; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_mmx2; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_mmx2; + *predict_8x8_filter = x264_predict_8x8_filter_mmx2; +#if ARCH_X86 + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_mmx2; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_mmx2; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_mmx2; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_mmx2; +#endif + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_sse2; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_sse2; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_sse2; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_sse2; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_sse2; + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_sse2; + if( !(cpu&X264_CPU_SSSE3) ) + return; + if( !(cpu&X264_CPU_SLOW_PALIGNR) ) + { + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_ssse3; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_ssse3; + } + pf[I_PRED_8x8_HU] = x264_predict_8x8_hu_ssse3; + *predict_8x8_filter = x264_predict_8x8_filter_ssse3; + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_8x8_DDL] = x264_predict_8x8_ddl_avx; + pf[I_PRED_8x8_DDR] = x264_predict_8x8_ddr_avx; + pf[I_PRED_8x8_VL] = x264_predict_8x8_vl_avx; + pf[I_PRED_8x8_VR] = x264_predict_8x8_vr_avx; + pf[I_PRED_8x8_HD] = x264_predict_8x8_hd_avx; +#endif // HIGH_BIT_DEPTH +} + +void x264_predict_4x4_init_mmx( int cpu, x264_predict_t pf[12] ) +{ + if( !(cpu&X264_CPU_MMX2) ) + return; + pf[I_PRED_4x4_DC] = x264_predict_4x4_dc_mmx2; + pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_mmx2; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_mmx2; + pf[I_PRED_4x4_VL] = x264_predict_4x4_vl_mmx2; + pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_mmx2; + pf[I_PRED_4x4_HU] = x264_predict_4x4_hu_mmx2; +#if HIGH_BIT_DEPTH + if( !(cpu&X264_CPU_SSE2) ) + return; + pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_sse2; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_sse2; + pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_sse2; + pf[I_PRED_4x4_VL] = x264_predict_4x4_vl_sse2; + pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_sse2; + if( !(cpu&X264_CPU_SSSE3) ) + return; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_ssse3; + pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_ssse3; + pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_ssse3; + if( !(cpu&X264_CPU_AVX) ) + return; + pf[I_PRED_4x4_DDL] = x264_predict_4x4_ddl_avx; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_avx; + pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_avx; + pf[I_PRED_4x4_VL] = x264_predict_4x4_vl_avx; + pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_avx; + if( !(cpu&X264_CPU_AVX2) ) + return; + pf[I_PRED_4x4_H] = x264_predict_4x4_h_avx2; +#else + pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_mmx2; + if( !(cpu&X264_CPU_SSSE3) ) + return; + pf[I_PRED_4x4_DDR] = x264_predict_4x4_ddr_ssse3; + pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_ssse3; + pf[I_PRED_4x4_HD] = x264_predict_4x4_hd_ssse3; + if( cpu&X264_CPU_CACHELINE_64 ) + pf[I_PRED_4x4_VR] = x264_predict_4x4_vr_cache64_ssse3; +#endif // HIGH_BIT_DEPTH +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict.h new file mode 100644 index 00000000..9f9052c2 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/predict.h @@ -0,0 +1,144 @@ +/***************************************************************************** + * predict.h: x86 intra prediction + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_I386_PREDICT_H +#define X264_I386_PREDICT_H + +void x264_predict_16x16_init_mmx( int cpu, x264_predict_t pf[7] ); +void x264_predict_8x16c_init_mmx( int cpu, x264_predict_t pf[7] ); +void x264_predict_8x8c_init_mmx ( int cpu, x264_predict_t pf[7] ); +void x264_predict_4x4_init_mmx ( int cpu, x264_predict_t pf[12] ); +void x264_predict_8x8_init_mmx ( int cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_8x8_filter ); + +void x264_predict_16x16_v_mmx2( pixel *src ); +void x264_predict_16x16_v_sse ( pixel *src ); +void x264_predict_16x16_v_avx ( uint16_t *src ); +void x264_predict_16x16_h_mmx2( pixel *src ); +void x264_predict_16x16_h_sse2( uint16_t *src ); +void x264_predict_16x16_h_ssse3( uint8_t *src ); +void x264_predict_16x16_h_avx2( uint16_t *src ); +void x264_predict_16x16_dc_sse2( pixel *src ); +void x264_predict_16x16_dc_avx2( pixel *src ); +void x264_predict_16x16_dc_left_sse2( pixel *src ); +void x264_predict_16x16_dc_left_avx2( pixel *src ); +void x264_predict_16x16_dc_top_sse2( pixel *src ); +void x264_predict_16x16_dc_top_avx2( pixel *src ); +void x264_predict_16x16_p_core_mmx2( uint8_t *src, int i00, int b, int c ); +void x264_predict_16x16_p_core_sse2( pixel *src, int i00, int b, int c ); +void x264_predict_16x16_p_core_avx( pixel *src, int i00, int b, int c ); +void x264_predict_16x16_p_core_avx2( pixel *src, int i00, int b, int c ); +void x264_predict_8x16c_dc_mmx2( pixel *src ); +void x264_predict_8x16c_dc_sse2( uint16_t *src ); +void x264_predict_8x16c_dc_top_mmx2( uint8_t *src ); +void x264_predict_8x16c_dc_top_sse2( uint16_t *src ); +void x264_predict_8x16c_v_mmx( uint8_t *src ); +void x264_predict_8x16c_v_sse( uint16_t *src ); +void x264_predict_8x16c_h_mmx2( pixel *src ); +void x264_predict_8x16c_h_sse2( uint16_t *src ); +void x264_predict_8x16c_h_ssse3( uint8_t *src ); +void x264_predict_8x16c_h_avx2( uint16_t *src ); +void x264_predict_8x16c_p_core_mmx2( uint8_t *src, int i00, int b, int c ); +void x264_predict_8x16c_p_core_sse2( pixel *src, int i00, int b, int c ); +void x264_predict_8x16c_p_core_avx ( pixel *src, int i00, int b, int c ); +void x264_predict_8x16c_p_core_avx2( pixel *src, int i00, int b, int c ); +void x264_predict_8x8c_p_core_mmx2( uint8_t *src, int i00, int b, int c ); +void x264_predict_8x8c_p_core_sse2( pixel *src, int i00, int b, int c ); +void x264_predict_8x8c_p_core_avx ( pixel *src, int i00, int b, int c ); +void x264_predict_8x8c_p_core_avx2( pixel *src, int i00, int b, int c ); +void x264_predict_8x8c_dc_mmx2( pixel *src ); +void x264_predict_8x8c_dc_sse2( uint16_t *src ); +void x264_predict_8x8c_dc_top_mmx2( uint8_t *src ); +void x264_predict_8x8c_dc_top_sse2( uint16_t *src ); +void x264_predict_8x8c_v_mmx( pixel *src ); +void x264_predict_8x8c_v_sse( uint16_t *src ); +void x264_predict_8x8c_h_mmx2( pixel *src ); +void x264_predict_8x8c_h_sse2( uint16_t *src ); +void x264_predict_8x8c_h_ssse3( uint8_t *src ); +void x264_predict_8x8c_h_avx2( uint16_t *src ); +void x264_predict_8x8_v_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_v_sse ( uint16_t *src, uint16_t edge[36] ); +void x264_predict_8x8_h_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_h_sse2( uint16_t *src, uint16_t edge[36] ); +void x264_predict_8x8_hd_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_hu_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_dc_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_dc_sse2( uint16_t *src, uint16_t edge[36] ); +void x264_predict_8x8_dc_top_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_dc_top_sse2( uint16_t *src, uint16_t edge[36] ); +void x264_predict_8x8_dc_left_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_dc_left_sse2( uint16_t *src, uint16_t edge[36] ); +void x264_predict_8x8_ddl_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_ddl_sse2( pixel *src, pixel edge[36] ); +void x264_predict_8x8_ddl_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_ddl_cache64_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_ddl_avx( pixel *src, pixel edge[36] ); +void x264_predict_8x8_ddr_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_ddr_sse2( pixel *src, pixel edge[36] ); +void x264_predict_8x8_ddr_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_ddr_cache64_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_ddr_avx( pixel *src, pixel edge[36] ); +void x264_predict_8x8_vl_sse2( pixel *src, pixel edge[36] ); +void x264_predict_8x8_vl_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_vl_avx( pixel *src, pixel edge[36] ); +void x264_predict_8x8_vl_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_vr_mmx2( uint8_t *src, uint8_t edge[36] ); +void x264_predict_8x8_vr_sse2( pixel *src, pixel edge[36] ); +void x264_predict_8x8_vr_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_vr_avx( pixel *src, pixel edge[36] ); +void x264_predict_8x8_hu_sse2( pixel *src, pixel edge[36] ); +void x264_predict_8x8_hu_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_hu_avx( pixel *src, pixel edge[36] ); +void x264_predict_8x8_hd_sse2( pixel *src, pixel edge[36] ); +void x264_predict_8x8_hd_ssse3( pixel *src, pixel edge[36] ); +void x264_predict_8x8_hd_avx( pixel *src, pixel edge[36] ); +void x264_predict_8x8_filter_mmx2( uint8_t *src, uint8_t edge[36], int i_neighbor, int i_filters ); +void x264_predict_8x8_filter_sse2( uint16_t *src, uint16_t edge[36], int i_neighbor, int i_filters ); +void x264_predict_8x8_filter_ssse3( pixel *src, pixel edge[36], int i_neighbor, int i_filters ); +void x264_predict_8x8_filter_avx( uint16_t *src, uint16_t edge[36], int i_neighbor, int i_filters ); +void x264_predict_4x4_h_avx2( uint16_t *src ); +void x264_predict_4x4_ddl_mmx2( pixel *src ); +void x264_predict_4x4_ddl_sse2( uint16_t *src ); +void x264_predict_4x4_ddl_avx( uint16_t *src ); +void x264_predict_4x4_ddr_mmx2( pixel *src ); +void x264_predict_4x4_vl_mmx2( pixel *src ); +void x264_predict_4x4_vl_sse2( uint16_t *src ); +void x264_predict_4x4_vl_avx( uint16_t *src ); +void x264_predict_4x4_vr_mmx2( uint8_t *src ); +void x264_predict_4x4_vr_sse2( uint16_t *src ); +void x264_predict_4x4_vr_ssse3( pixel *src ); +void x264_predict_4x4_vr_cache64_ssse3( uint8_t *src ); +void x264_predict_4x4_vr_avx( uint16_t *src ); +void x264_predict_4x4_hd_mmx2( pixel *src ); +void x264_predict_4x4_hd_sse2( uint16_t *src ); +void x264_predict_4x4_hd_ssse3( pixel *src ); +void x264_predict_4x4_hd_avx( uint16_t *src ); +void x264_predict_4x4_dc_mmx2( pixel *src ); +void x264_predict_4x4_ddr_sse2( uint16_t *src ); +void x264_predict_4x4_ddr_ssse3( pixel *src ); +void x264_predict_4x4_ddr_avx( uint16_t *src ); +void x264_predict_4x4_hu_mmx2( pixel *src ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/quant.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/quant.h new file mode 100644 index 00000000..6b74aace --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/quant.h @@ -0,0 +1,156 @@ +/***************************************************************************** + * quant.h: x86 quantization and level-run + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Loren Merritt + * Fiona Glaser + * Christian Heine + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_I386_QUANT_H +#define X264_I386_QUANT_H + +int x264_quant_2x2_dc_mmx2( dctcoef dct[4], int mf, int bias ); +int x264_quant_4x4_dc_mmx2( dctcoef dct[16], int mf, int bias ); +int x264_quant_4x4_mmx2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_8x8_mmx2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] ); +int x264_quant_2x2_dc_sse2( dctcoef dct[16], int mf, int bias ); +int x264_quant_4x4_dc_sse2( dctcoef dct[16], int mf, int bias ); +int x264_quant_4x4_sse2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_4x4x4_sse2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_8x8_sse2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] ); +int x264_quant_2x2_dc_ssse3( dctcoef dct[4], int mf, int bias ); +int x264_quant_4x4_dc_ssse3( dctcoef dct[16], int mf, int bias ); +int x264_quant_4x4_ssse3( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_4x4x4_ssse3( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_8x8_ssse3( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] ); +int x264_quant_2x2_dc_sse4( dctcoef dct[16], int mf, int bias ); +int x264_quant_4x4_dc_sse4( dctcoef dct[16], int mf, int bias ); +int x264_quant_4x4_sse4( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_4x4x4_sse4( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_8x8_sse4( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] ); +int x264_quant_4x4_avx2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] ); +int x264_quant_4x4_dc_avx2( dctcoef dct[16], int mf, int bias ); +int x264_quant_8x8_avx2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] ); +int x264_quant_4x4x4_avx2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] ); +void x264_dequant_4x4_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_4x4dc_mmx2( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_4x4dc_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_sse2( dctcoef dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_4x4dc_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_avx( dctcoef dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_4x4dc_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_xop( dctcoef dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_4x4dc_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_avx2( dctcoef dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_avx512( dctcoef dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_avx512( dctcoef dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_flat16_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_flat16_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_flat16_sse2( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_flat16_sse2( int16_t dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_4x4_flat16_avx2( int16_t dct[16], int dequant_mf[6][16], int i_qp ); +void x264_dequant_8x8_flat16_avx2( int16_t dct[64], int dequant_mf[6][64], int i_qp ); +void x264_dequant_8x8_flat16_avx512( int16_t dct[64], int dequant_mf[6][64], int i_qp ); +void x264_idct_dequant_2x4_dc_sse2( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp ); +void x264_idct_dequant_2x4_dc_avx ( dctcoef dct[8], dctcoef dct4x4[8][16], int dequant_mf[6][16], int i_qp ); +void x264_idct_dequant_2x4_dconly_sse2( dctcoef dct[8], int dequant_mf[6][16], int i_qp ); +void x264_idct_dequant_2x4_dconly_avx ( dctcoef dct[8], int dequant_mf[6][16], int i_qp ); +int x264_optimize_chroma_2x2_dc_sse2( dctcoef dct[4], int dequant_mf ); +int x264_optimize_chroma_2x2_dc_ssse3( dctcoef dct[4], int dequant_mf ); +int x264_optimize_chroma_2x2_dc_sse4( dctcoef dct[4], int dequant_mf ); +int x264_optimize_chroma_2x2_dc_avx( dctcoef dct[4], int dequant_mf ); +void x264_denoise_dct_mmx ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size ); +void x264_denoise_dct_sse2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size ); +void x264_denoise_dct_ssse3( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size ); +void x264_denoise_dct_avx ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size ); +void x264_denoise_dct_avx2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size ); +int x264_decimate_score15_sse2( dctcoef *dct ); +int x264_decimate_score15_ssse3( dctcoef *dct ); +int x264_decimate_score15_avx512( dctcoef *dct ); +int x264_decimate_score16_sse2( dctcoef *dct ); +int x264_decimate_score16_ssse3( dctcoef *dct ); +int x264_decimate_score16_avx512( dctcoef *dct ); +int x264_decimate_score64_sse2( dctcoef *dct ); +int x264_decimate_score64_ssse3( dctcoef *dct ); +int x264_decimate_score64_avx2( int16_t *dct ); +int x264_decimate_score64_avx512( dctcoef *dct ); +int x264_coeff_last4_mmx2( dctcoef *dct ); +int x264_coeff_last8_mmx2( dctcoef *dct ); +int x264_coeff_last15_mmx2( dctcoef *dct ); +int x264_coeff_last16_mmx2( dctcoef *dct ); +int x264_coeff_last64_mmx2( dctcoef *dct ); +int x264_coeff_last8_sse2( dctcoef *dct ); +int x264_coeff_last15_sse2( dctcoef *dct ); +int x264_coeff_last16_sse2( dctcoef *dct ); +int x264_coeff_last64_sse2( dctcoef *dct ); +int x264_coeff_last4_lzcnt( dctcoef *dct ); +int x264_coeff_last8_lzcnt( dctcoef *dct ); +int x264_coeff_last15_lzcnt( dctcoef *dct ); +int x264_coeff_last16_lzcnt( dctcoef *dct ); +int x264_coeff_last64_lzcnt( dctcoef *dct ); +int x264_coeff_last64_avx2 ( dctcoef *dct ); +int x264_coeff_last4_avx512( int32_t *dct ); +int x264_coeff_last8_avx512( dctcoef *dct ); +int x264_coeff_last15_avx512( dctcoef *dct ); +int x264_coeff_last16_avx512( dctcoef *dct ); +int x264_coeff_last64_avx512( dctcoef *dct ); +int x264_coeff_level_run16_mmx2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run16_sse2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run16_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run16_ssse3( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run16_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run16_avx2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run15_mmx2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run15_sse2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run15_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run15_ssse3( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run15_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run15_avx2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run4_mmx2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run4_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run4_ssse3( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run4_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run8_mmx2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run8_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run8_sse2( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run8_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run8_ssse3( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_coeff_level_run8_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel ); +int x264_trellis_cabac_4x4_sse2 ( TRELLIS_PARAMS, int b_ac ); +int x264_trellis_cabac_4x4_ssse3( TRELLIS_PARAMS, int b_ac ); +int x264_trellis_cabac_8x8_sse2 ( TRELLIS_PARAMS, int b_interlaced ); +int x264_trellis_cabac_8x8_ssse3( TRELLIS_PARAMS, int b_interlaced ); +int x264_trellis_cabac_4x4_psy_sse2 ( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis ); +int x264_trellis_cabac_4x4_psy_ssse3( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis ); +int x264_trellis_cabac_8x8_psy_sse2 ( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis ); +int x264_trellis_cabac_8x8_psy_ssse3( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis ); +int x264_trellis_cabac_dc_sse2 ( TRELLIS_PARAMS, int i_coefs ); +int x264_trellis_cabac_dc_ssse3( TRELLIS_PARAMS, int i_coefs ); +int x264_trellis_cabac_chroma_422_dc_sse2 ( TRELLIS_PARAMS ); +int x264_trellis_cabac_chroma_422_dc_ssse3( TRELLIS_PARAMS ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/util.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/util.h new file mode 100644 index 00000000..d5e15ba3 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/common/x86/util.h @@ -0,0 +1,254 @@ +/***************************************************************************** + * util.h: x86 inline asm + ***************************************************************************** + * Copyright (C) 2008-2017 x264 project + * + * Authors: Fiona Glaser + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_X86_UTIL_H +#define X264_X86_UTIL_H + +#ifdef __SSE__ +#include + +#undef M128_ZERO +#define M128_ZERO ((__m128){0,0,0,0}) +#define x264_union128_t x264_union128_sse_t +typedef union { __m128 i; uint64_t a[2]; uint32_t b[4]; uint16_t c[8]; uint8_t d[16]; } MAY_ALIAS x264_union128_sse_t; +#if HAVE_VECTOREXT +typedef uint32_t v4si __attribute__((vector_size (16))); +#endif +#endif // __SSE__ + +#if HAVE_X86_INLINE_ASM && HAVE_MMX + +#define x264_median_mv x264_median_mv_mmx2 +static ALWAYS_INLINE void x264_median_mv_mmx2( int16_t *dst, int16_t *a, int16_t *b, int16_t *c ) +{ + asm( + "movd %1, %%mm0 \n" + "movd %2, %%mm1 \n" + "movq %%mm0, %%mm3 \n" + "movd %3, %%mm2 \n" + "pmaxsw %%mm1, %%mm0 \n" + "pminsw %%mm3, %%mm1 \n" + "pminsw %%mm2, %%mm0 \n" + "pmaxsw %%mm1, %%mm0 \n" + "movd %%mm0, %0 \n" + :"=m"(*(x264_union32_t*)dst) + :"m"(M32( a )), "m"(M32( b )), "m"(M32( c )) + ); +} + +#define x264_predictor_difference x264_predictor_difference_mmx2 +static ALWAYS_INLINE int x264_predictor_difference_mmx2( int16_t (*mvc)[2], intptr_t i_mvc ) +{ + int sum; + static const uint64_t pw_1 = 0x0001000100010001ULL; + + asm( + "pxor %%mm4, %%mm4 \n" + "test $1, %1 \n" + "jnz 3f \n" + "movd -8(%2,%1,4), %%mm0 \n" + "movd -4(%2,%1,4), %%mm3 \n" + "psubw %%mm3, %%mm0 \n" + "jmp 2f \n" + "3: \n" + "dec %1 \n" + "1: \n" + "movq -8(%2,%1,4), %%mm0 \n" + "psubw -4(%2,%1,4), %%mm0 \n" + "2: \n" + "sub $2, %1 \n" + "pxor %%mm2, %%mm2 \n" + "psubw %%mm0, %%mm2 \n" + "pmaxsw %%mm2, %%mm0 \n" + "paddusw %%mm0, %%mm4 \n" + "jg 1b \n" + "pmaddwd %4, %%mm4 \n" + "pshufw $14, %%mm4, %%mm0 \n" + "paddd %%mm0, %%mm4 \n" + "movd %%mm4, %0 \n" + :"=r"(sum), "+r"(i_mvc) + :"r"(mvc), "m"(M64( mvc )), "m"(pw_1) + ); + return sum; +} + +#define x264_cabac_mvd_sum x264_cabac_mvd_sum_mmx2 +static ALWAYS_INLINE uint16_t x264_cabac_mvd_sum_mmx2(uint8_t *mvdleft, uint8_t *mvdtop) +{ + static const uint64_t pb_2 = 0x0202020202020202ULL; + static const uint64_t pb_32 = 0x2020202020202020ULL; + static const uint64_t pb_33 = 0x2121212121212121ULL; + int amvd; + asm( + "movd %1, %%mm0 \n" + "movd %2, %%mm1 \n" + "paddusb %%mm1, %%mm0 \n" + "pminub %5, %%mm0 \n" + "pxor %%mm2, %%mm2 \n" + "movq %%mm0, %%mm1 \n" + "pcmpgtb %3, %%mm0 \n" + "pcmpgtb %4, %%mm1 \n" + "psubb %%mm0, %%mm2 \n" + "psubb %%mm1, %%mm2 \n" + "movd %%mm2, %0 \n" + :"=r"(amvd) + :"m"(M16( mvdleft )),"m"(M16( mvdtop )), + "m"(pb_2),"m"(pb_32),"m"(pb_33) + ); + return amvd; +} + +#define x264_predictor_clip x264_predictor_clip_mmx2 +static int ALWAYS_INLINE x264_predictor_clip_mmx2( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv ) +{ + static const uint32_t pd_32 = 0x20; + intptr_t tmp = (intptr_t)mv_limit, mvc_max = i_mvc, i = 0; + + asm( + "movq (%2), %%mm5 \n" + "movd %6, %%mm3 \n" + "psllw $2, %%mm5 \n" // Convert to subpel + "pshufw $0xEE, %%mm5, %%mm6 \n" + "dec %k3 \n" + "jz 2f \n" // if( i_mvc == 1 ) {do the last iteration} + "punpckldq %%mm3, %%mm3 \n" + "punpckldq %%mm5, %%mm5 \n" + "movd %7, %%mm4 \n" + "lea (%0,%3,4), %3 \n" + "1: \n" + "movq (%0), %%mm0 \n" + "add $8, %0 \n" + "movq %%mm3, %%mm1 \n" + "pxor %%mm2, %%mm2 \n" + "pcmpeqd %%mm0, %%mm1 \n" // mv == pmv + "pcmpeqd %%mm0, %%mm2 \n" // mv == 0 + "por %%mm1, %%mm2 \n" // (mv == pmv || mv == 0) * -1 + "pmovmskb %%mm2, %k2 \n" // (mv == pmv || mv == 0) * 0xf + "pmaxsw %%mm5, %%mm0 \n" + "pminsw %%mm6, %%mm0 \n" + "pand %%mm4, %%mm2 \n" // (mv0 == pmv || mv0 == 0) * 32 + "psrlq %%mm2, %%mm0 \n" // drop mv0 if it's skipped + "movq %%mm0, (%5,%4,4) \n" + "and $24, %k2 \n" + "add $2, %4 \n" + "add $8, %k2 \n" + "shr $4, %k2 \n" // (4-val)>>1 + "sub %2, %4 \n" // +1 for each valid motion vector + "cmp %3, %0 \n" + "jl 1b \n" + "jg 3f \n" // if( i == i_mvc - 1 ) {do the last iteration} + + /* Do the last iteration */ + "2: \n" + "movd (%0), %%mm0 \n" + "pxor %%mm2, %%mm2 \n" + "pcmpeqd %%mm0, %%mm3 \n" + "pcmpeqd %%mm0, %%mm2 \n" + "por %%mm3, %%mm2 \n" + "pmovmskb %%mm2, %k2 \n" + "pmaxsw %%mm5, %%mm0 \n" + "pminsw %%mm6, %%mm0 \n" + "movd %%mm0, (%5,%4,4) \n" + "inc %4 \n" + "and $1, %k2 \n" + "sub %2, %4 \n" // output += !(mv == pmv || mv == 0) + "3: \n" + :"+r"(mvc), "=m"(M64( dst )), "+r"(tmp), "+r"(mvc_max), "+r"(i) + :"r"(dst), "g"(pmv), "m"(pd_32), "m"(M64( mvc )) + ); + return i; +} + +/* Same as the above, except we do (mv + 2) >> 2 on the input. */ +#define x264_predictor_roundclip x264_predictor_roundclip_mmx2 +static int ALWAYS_INLINE x264_predictor_roundclip_mmx2( int16_t (*dst)[2], int16_t (*mvc)[2], int i_mvc, int16_t mv_limit[2][2], uint32_t pmv ) +{ + static const uint64_t pw_2 = 0x0002000200020002ULL; + static const uint32_t pd_32 = 0x20; + intptr_t tmp = (intptr_t)mv_limit, mvc_max = i_mvc, i = 0; + + asm( + "movq (%2), %%mm5 \n" + "movq %6, %%mm7 \n" + "movd %7, %%mm3 \n" + "pshufw $0xEE, %%mm5, %%mm6 \n" + "dec %k3 \n" + "jz 2f \n" + "punpckldq %%mm3, %%mm3 \n" + "punpckldq %%mm5, %%mm5 \n" + "movd %8, %%mm4 \n" + "lea (%0,%3,4), %3 \n" + "1: \n" + "movq (%0), %%mm0 \n" + "add $8, %0 \n" + "paddw %%mm7, %%mm0 \n" + "psraw $2, %%mm0 \n" + "movq %%mm3, %%mm1 \n" + "pxor %%mm2, %%mm2 \n" + "pcmpeqd %%mm0, %%mm1 \n" + "pcmpeqd %%mm0, %%mm2 \n" + "por %%mm1, %%mm2 \n" + "pmovmskb %%mm2, %k2 \n" + "pmaxsw %%mm5, %%mm0 \n" + "pminsw %%mm6, %%mm0 \n" + "pand %%mm4, %%mm2 \n" + "psrlq %%mm2, %%mm0 \n" + "movq %%mm0, (%5,%4,4) \n" + "and $24, %k2 \n" + "add $2, %4 \n" + "add $8, %k2 \n" + "shr $4, %k2 \n" + "sub %2, %4 \n" + "cmp %3, %0 \n" + "jl 1b \n" + "jg 3f \n" + + /* Do the last iteration */ + "2: \n" + "movd (%0), %%mm0 \n" + "paddw %%mm7, %%mm0 \n" + "psraw $2, %%mm0 \n" + "pxor %%mm2, %%mm2 \n" + "pcmpeqd %%mm0, %%mm3 \n" + "pcmpeqd %%mm0, %%mm2 \n" + "por %%mm3, %%mm2 \n" + "pmovmskb %%mm2, %k2 \n" + "pmaxsw %%mm5, %%mm0 \n" + "pminsw %%mm6, %%mm0 \n" + "movd %%mm0, (%5,%4,4) \n" + "inc %4 \n" + "and $1, %k2 \n" + "sub %2, %4 \n" + "3: \n" + :"+r"(mvc), "=m"(M64( dst )), "+r"(tmp), "+r"(mvc_max), "+r"(i) + :"r"(dst), "m"(pw_2), "g"(pmv), "m"(pd_32), "m"(M64( mvc )) + ); + return i; +} + +#endif + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.c new file mode 100644 index 00000000..036d6c15 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.c @@ -0,0 +1,4009 @@ +/***************************************************************************** + * analyse.c: macroblock analysis + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "macroblock.h" +#include "me.h" +#include "ratecontrol.h" +#include "analyse.h" +#include "rdo.c" + +typedef struct +{ + x264_me_t me16x16; + x264_me_t bi16x16; /* for b16x16 BI mode, since MVs can differ from l0/l1 */ + x264_me_t me8x8[4]; + x264_me_t me4x4[4][4]; + x264_me_t me8x4[4][2]; + x264_me_t me4x8[4][2]; + x264_me_t me16x8[2]; + x264_me_t me8x16[2]; + int i_rd16x16; + int i_cost8x8; + int i_cost4x4[4]; /* cost per 8x8 partition */ + int i_cost8x4[4]; /* cost per 8x8 partition */ + int i_cost4x8[4]; /* cost per 8x8 partition */ + int i_cost16x8; + int i_cost8x16; + /* [ref][0] is 16x16 mv, [ref][1..4] are 8x8 mv from partition [0..3] */ + ALIGNED_4( int16_t mvc[32][5][2] ); +} x264_mb_analysis_list_t; + +typedef struct +{ + /* conduct the analysis using this lamda and QP */ + int i_lambda; + int i_lambda2; + int i_qp; + uint16_t *p_cost_mv; + uint16_t *p_cost_ref[2]; + int i_mbrd; + + + /* I: Intra part */ + /* Take some shortcuts in intra search if intra is deemed unlikely */ + int b_fast_intra; + int b_force_intra; /* For Periodic Intra Refresh. Only supported in P-frames. */ + int b_avoid_topright; /* For Periodic Intra Refresh: don't predict from top-right pixels. */ + int b_try_skip; + + /* Luma part */ + int i_satd_i16x16; + int i_satd_i16x16_dir[7]; + int i_predict16x16; + + int i_satd_i8x8; + int i_cbp_i8x8_luma; + ALIGNED_16( uint16_t i_satd_i8x8_dir[4][16] ); + int i_predict8x8[4]; + + int i_satd_i4x4; + int i_predict4x4[16]; + + int i_satd_pcm; + + /* Chroma part */ + int i_satd_chroma; + int i_satd_chroma_dir[7]; + int i_predict8x8chroma; + + /* II: Inter part P/B frame */ + x264_mb_analysis_list_t l0; + x264_mb_analysis_list_t l1; + + int i_cost16x16bi; /* used the same ref and mv as l0 and l1 (at least for now) */ + int i_cost16x16direct; + int i_cost8x8bi; + int i_cost8x8direct[4]; + int i_satd8x8[3][4]; /* [L0,L1,BI][8x8 0..3] SATD only */ + int i_cost_est16x8[2]; /* Per-partition estimated cost */ + int i_cost_est8x16[2]; + int i_cost16x8bi; + int i_cost8x16bi; + int i_rd16x16bi; + int i_rd16x16direct; + int i_rd16x8bi; + int i_rd8x16bi; + int i_rd8x8bi; + + int i_mb_partition16x8[2]; /* mb_partition_e */ + int i_mb_partition8x16[2]; + int i_mb_type16x8; /* mb_class_e */ + int i_mb_type8x16; + + int b_direct_available; + int b_early_terminate; + +} x264_mb_analysis_t; + +/* lambda = pow(2,qp/6-2) */ +const uint16_t x264_lambda_tab[QP_MAX_MAX+1] = +{ + 1, 1, 1, 1, 1, 1, 1, 1, /* 0- 7 */ + 1, 1, 1, 1, 1, 1, 1, 1, /* 8-15 */ + 2, 2, 2, 2, 3, 3, 3, 4, /* 16-23 */ + 4, 4, 5, 6, 6, 7, 8, 9, /* 24-31 */ + 10, 11, 13, 14, 16, 18, 20, 23, /* 32-39 */ + 25, 29, 32, 36, 40, 45, 51, 57, /* 40-47 */ + 64, 72, 81, 91, 102, 114, 128, 144, /* 48-55 */ + 161, 181, 203, 228, 256, 287, 323, 362, /* 56-63 */ + 406, 456, 512, 575, 645, 724, 813, 912, /* 64-71 */ +1024,1149,1290,1448,1625,1825,2048,2299, /* 72-79 */ +2580,2896, /* 80-81 */ +}; + +/* lambda2 = pow(lambda,2) * .9 * 256 */ +/* Capped to avoid overflow */ +const int x264_lambda2_tab[QP_MAX_MAX+1] = +{ + 14, 18, 22, 28, 36, 45, 57, 72, /* 0- 7 */ + 91, 115, 145, 182, 230, 290, 365, 460, /* 8-15 */ + 580, 731, 921, 1161, 1462, 1843, 2322, 2925, /* 16-23 */ + 3686, 4644, 5851, 7372, 9289, 11703, 14745, 18578, /* 24-31 */ + 23407, 29491, 37156, 46814, 58982, 74313, 93628, 117964, /* 32-39 */ + 148626, 187257, 235929, 297252, 374514, 471859, 594505, 749029, /* 40-47 */ + 943718, 1189010, 1498059, 1887436, 2378021, 2996119, 3774873, 4756042, /* 48-55 */ + 5992238, 7549747, 9512085, 11984476, 15099494, 19024170,23968953,30198988, /* 56-63 */ + 38048341, 47937906, 60397977, 76096683, 95875813,120795955, /* 64-69 */ +134217727,134217727,134217727,134217727,134217727,134217727, /* 70-75 */ +134217727,134217727,134217727,134217727,134217727,134217727, /* 76-81 */ +}; + +const uint8_t x264_exp2_lut[64] = +{ + 0, 3, 6, 8, 11, 14, 17, 20, 23, 26, 29, 32, 36, 39, 42, 45, + 48, 52, 55, 58, 62, 65, 69, 72, 76, 80, 83, 87, 91, 94, 98, 102, + 106, 110, 114, 118, 122, 126, 130, 135, 139, 143, 147, 152, 156, 161, 165, 170, + 175, 179, 184, 189, 194, 198, 203, 208, 214, 219, 224, 229, 234, 240, 245, 250 +}; + +const float x264_log2_lut[128] = +{ + 0.00000, 0.01123, 0.02237, 0.03342, 0.04439, 0.05528, 0.06609, 0.07682, + 0.08746, 0.09803, 0.10852, 0.11894, 0.12928, 0.13955, 0.14975, 0.15987, + 0.16993, 0.17991, 0.18982, 0.19967, 0.20945, 0.21917, 0.22882, 0.23840, + 0.24793, 0.25739, 0.26679, 0.27612, 0.28540, 0.29462, 0.30378, 0.31288, + 0.32193, 0.33092, 0.33985, 0.34873, 0.35755, 0.36632, 0.37504, 0.38370, + 0.39232, 0.40088, 0.40939, 0.41785, 0.42626, 0.43463, 0.44294, 0.45121, + 0.45943, 0.46761, 0.47573, 0.48382, 0.49185, 0.49985, 0.50779, 0.51570, + 0.52356, 0.53138, 0.53916, 0.54689, 0.55459, 0.56224, 0.56986, 0.57743, + 0.58496, 0.59246, 0.59991, 0.60733, 0.61471, 0.62205, 0.62936, 0.63662, + 0.64386, 0.65105, 0.65821, 0.66534, 0.67243, 0.67948, 0.68650, 0.69349, + 0.70044, 0.70736, 0.71425, 0.72110, 0.72792, 0.73471, 0.74147, 0.74819, + 0.75489, 0.76155, 0.76818, 0.77479, 0.78136, 0.78790, 0.79442, 0.80090, + 0.80735, 0.81378, 0.82018, 0.82655, 0.83289, 0.83920, 0.84549, 0.85175, + 0.85798, 0.86419, 0.87036, 0.87652, 0.88264, 0.88874, 0.89482, 0.90087, + 0.90689, 0.91289, 0.91886, 0.92481, 0.93074, 0.93664, 0.94251, 0.94837, + 0.95420, 0.96000, 0.96578, 0.97154, 0.97728, 0.98299, 0.98868, 0.99435, +}; + +/* Avoid an int/float conversion. */ +const float x264_log2_lz_lut[32] = +{ + 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 +}; + +// should the intra and inter lambdas be different? +// I'm just matching the behaviour of deadzone quant. +static const int x264_trellis_lambda2_tab[2][QP_MAX_MAX+1] = +{ + // inter lambda = .85 * .85 * 2**(qp/3. + 10 - LAMBDA_BITS) + { + 46, 58, 73, 92, 117, 147, + 185, 233, 294, 370, 466, 587, + 740, 932, 1174, 1480, 1864, 2349, + 2959, 3728, 4697, 5918, 7457, 9395, + 11837, 14914, 18790, 23674, 29828, 37581, + 47349, 59656, 75163, 94699, 119313, 150326, + 189399, 238627, 300652, 378798, 477255, 601304, + 757596, 954511, 1202608, 1515192, 1909022, 2405217, + 3030384, 3818045, 4810435, 6060769, 7636091, 9620872, + 12121539, 15272182, 19241743, 24243077, 30544363, 38483486, + 48486154, 61088726, 76966972, 96972308, + 122177453,134217727,134217727,134217727,134217727,134217727, + 134217727,134217727,134217727,134217727,134217727,134217727, + }, + // intra lambda = .65 * .65 * 2**(qp/3. + 10 - LAMBDA_BITS) + { + 27, 34, 43, 54, 68, 86, + 108, 136, 172, 216, 273, 343, + 433, 545, 687, 865, 1090, 1374, + 1731, 2180, 2747, 3461, 4361, 5494, + 6922, 8721, 10988, 13844, 17442, 21976, + 27688, 34885, 43953, 55377, 69771, 87906, + 110755, 139543, 175813, 221511, 279087, 351627, + 443023, 558174, 703255, 886046, 1116348, 1406511, + 1772093, 2232697, 2813022, 3544186, 4465396, 5626046, + 7088374, 8930791, 11252092, 14176748, 17861583, 22504184, + 28353495, 35723165, 45008368, 56706990, + 71446330, 90016736,113413980,134217727,134217727,134217727, + 134217727,134217727,134217727,134217727,134217727,134217727, + 134217727,134217727,134217727,134217727,134217727,134217727, + } +}; + +#define MAX_CHROMA_LAMBDA_OFFSET 36 +static const uint16_t x264_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET+1] = +{ + 16, 20, 25, 32, 40, 50, + 64, 80, 101, 128, 161, 203, + 256, 322, 406, 512, 645, 812, + 1024, 1290, 1625, 2048, 2580, 3250, + 4096, 5160, 6501, 8192, 10321, 13003, + 16384, 20642, 26007, 32768, 41285, 52015, + 65535 +}; + +/* TODO: calculate CABAC costs */ +static const uint8_t i_mb_b_cost_table[X264_MBTYPE_MAX] = +{ + 9, 9, 9, 9, 0, 0, 0, 1, 3, 7, 7, 7, 3, 7, 7, 7, 5, 9, 0 +}; +static const uint8_t i_mb_b16x8_cost_table[17] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 7, 7, 5, 7, 9, 9, 9 +}; +static const uint8_t i_sub_mb_b_cost_table[13] = +{ + 7, 5, 5, 3, 7, 5, 7, 3, 7, 7, 7, 5, 1 +}; +static const uint8_t i_sub_mb_p_cost_table[4] = +{ + 5, 3, 3, 1 +}; + +static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a ); + +static uint16_t x264_cost_ref[QP_MAX+1][3][33]; +static UNUSED x264_pthread_mutex_t cost_ref_mutex = X264_PTHREAD_MUTEX_INITIALIZER; +static uint16_t x264_cost_i4x4_mode[(QP_MAX+2)*32]; + +static int init_costs( x264_t *h, float *logs, int qp ) +{ + if( h->cost_mv[qp] ) + return 0; + + int mv_range = h->param.analyse.i_mv_range; + int lambda = x264_lambda_tab[qp]; + /* factor of 4 from qpel, 2 from sign, and 2 because mv can be opposite from mvp */ + CHECKED_MALLOC( h->cost_mv[qp], (4*4*mv_range + 1) * sizeof(uint16_t) ); + h->cost_mv[qp] += 2*4*mv_range; + for( int i = 0; i <= 2*4*mv_range; i++ ) + { + h->cost_mv[qp][-i] = + h->cost_mv[qp][i] = X264_MIN( (int)(lambda * logs[i] + .5f), UINT16_MAX ); + } + x264_pthread_mutex_lock( &cost_ref_mutex ); + for( int i = 0; i < 3; i++ ) + for( int j = 0; j < 33; j++ ) + x264_cost_ref[qp][i][j] = i ? X264_MIN( lambda * bs_size_te( i, j ), UINT16_MAX ) : 0; + x264_pthread_mutex_unlock( &cost_ref_mutex ); + if( h->param.analyse.i_me_method >= X264_ME_ESA && !h->cost_mv_fpel[qp][0] ) + { + for( int j = 0; j < 4; j++ ) + { + CHECKED_MALLOC( h->cost_mv_fpel[qp][j], (4*mv_range + 1) * sizeof(uint16_t) ); + h->cost_mv_fpel[qp][j] += 2*mv_range; + for( int i = -2*mv_range; i < 2*mv_range; i++ ) + h->cost_mv_fpel[qp][j][i] = h->cost_mv[qp][i*4+j]; + } + } + uint16_t *cost_i4x4_mode = (uint16_t*)ALIGN((intptr_t)x264_cost_i4x4_mode,64) + qp*32; + for( int i = 0; i < 17; i++ ) + cost_i4x4_mode[i] = 3*lambda*(i!=8); + return 0; +fail: + return -1; +} + +int x264_analyse_init_costs( x264_t *h ) +{ + int mv_range = h->param.analyse.i_mv_range; + float *logs = x264_malloc( (2*4*mv_range+1) * sizeof(float) ); + if( !logs ) + return -1; + + logs[0] = 0.718f; + for( int i = 1; i <= 2*4*mv_range; i++ ) + logs[i] = log2f( i+1 ) * 2.0f + 1.718f; + + for( int qp = X264_MIN( h->param.rc.i_qp_min, QP_MAX_SPEC ); qp <= h->param.rc.i_qp_max; qp++ ) + if( init_costs( h, logs, qp ) ) + goto fail; + + if( init_costs( h, logs, X264_LOOKAHEAD_QP ) ) + goto fail; + + x264_free( logs ); + return 0; +fail: + x264_free( logs ); + return -1; +} + +void x264_analyse_free_costs( x264_t *h ) +{ + int mv_range = h->param.analyse.i_mv_range; + for( int i = 0; i < QP_MAX+1; i++ ) + { + if( h->cost_mv[i] ) + x264_free( h->cost_mv[i] - 2*4*mv_range ); + if( h->cost_mv_fpel[i][0] ) + for( int j = 0; j < 4; j++ ) + x264_free( h->cost_mv_fpel[i][j] - 2*mv_range ); + } +} + +void x264_analyse_weight_frame( x264_t *h, int end ) +{ + for( int j = 0; j < h->i_ref[0]; j++ ) + { + if( h->sh.weight[j][0].weightfn ) + { + x264_frame_t *frame = h->fref[0][j]; + int width = frame->i_width[0] + 2*PADH; + int i_padv = PADV << PARAM_INTERLACED; + int offset, height; + pixel *src = frame->filtered[0][0] - frame->i_stride[0]*i_padv - PADH; + height = X264_MIN( 16 + end + i_padv, h->fref[0][j]->i_lines[0] + i_padv*2 ) - h->fenc->i_lines_weighted; + offset = h->fenc->i_lines_weighted*frame->i_stride[0]; + h->fenc->i_lines_weighted += height; + if( height ) + for( int k = j; k < h->i_ref[0]; k++ ) + if( h->sh.weight[k][0].weightfn ) + { + pixel *dst = h->fenc->weighted[k] - h->fenc->i_stride[0]*i_padv - PADH; + x264_weight_scale_plane( h, dst + offset, frame->i_stride[0], + src + offset, frame->i_stride[0], + width, height, &h->sh.weight[k][0] ); + } + break; + } + } +} + +/* initialize an array of lambda*nbits for all possible mvs */ +static void x264_mb_analyse_load_costs( x264_t *h, x264_mb_analysis_t *a ) +{ + a->p_cost_mv = h->cost_mv[a->i_qp]; + a->p_cost_ref[0] = x264_cost_ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l0_active-1,0,2)]; + a->p_cost_ref[1] = x264_cost_ref[a->i_qp][x264_clip3(h->sh.i_num_ref_idx_l1_active-1,0,2)]; +} + +static void x264_mb_analyse_init_qp( x264_t *h, x264_mb_analysis_t *a, int qp ) +{ + int effective_chroma_qp = h->chroma_qp_table[SPEC_QP(qp)] + X264_MAX( qp - QP_MAX_SPEC, 0 ); + a->i_lambda = x264_lambda_tab[qp]; + a->i_lambda2 = x264_lambda2_tab[qp]; + + h->mb.b_trellis = h->param.analyse.i_trellis > 1 && a->i_mbrd; + if( h->param.analyse.i_trellis ) + { + h->mb.i_trellis_lambda2[0][0] = x264_trellis_lambda2_tab[0][qp]; + h->mb.i_trellis_lambda2[0][1] = x264_trellis_lambda2_tab[1][qp]; + h->mb.i_trellis_lambda2[1][0] = x264_trellis_lambda2_tab[0][effective_chroma_qp]; + h->mb.i_trellis_lambda2[1][1] = x264_trellis_lambda2_tab[1][effective_chroma_qp]; + } + h->mb.i_psy_rd_lambda = a->i_lambda; + /* Adjusting chroma lambda based on QP offset hurts PSNR but improves visual quality. */ + int chroma_offset_idx = X264_MIN( qp-effective_chroma_qp+12, MAX_CHROMA_LAMBDA_OFFSET ); + h->mb.i_chroma_lambda2_offset = h->param.analyse.b_psy ? x264_chroma_lambda2_offset_tab[chroma_offset_idx] : 256; + + if( qp > QP_MAX_SPEC ) + { + h->nr_offset = h->nr_offset_emergency[qp-QP_MAX_SPEC-1]; + h->nr_residual_sum = h->nr_residual_sum_buf[1]; + h->nr_count = h->nr_count_buf[1]; + h->mb.b_noise_reduction = 1; + qp = QP_MAX_SPEC; /* Out-of-spec QPs are just used for calculating lambda values. */ + } + else + { + h->nr_offset = h->nr_offset_denoise; + h->nr_residual_sum = h->nr_residual_sum_buf[0]; + h->nr_count = h->nr_count_buf[0]; + h->mb.b_noise_reduction = 0; + } + + a->i_qp = h->mb.i_qp = qp; + h->mb.i_chroma_qp = h->chroma_qp_table[qp]; +} + +static void x264_mb_analyse_init( x264_t *h, x264_mb_analysis_t *a, int qp ) +{ + int subme = h->param.analyse.i_subpel_refine - (h->sh.i_type == SLICE_TYPE_B); + + /* mbrd == 1 -> RD mode decision */ + /* mbrd == 2 -> RD refinement */ + /* mbrd == 3 -> QPRD */ + a->i_mbrd = (subme>=6) + (subme>=8) + (h->param.analyse.i_subpel_refine>=10); + h->mb.b_deblock_rdo = h->param.analyse.i_subpel_refine >= 9 && h->sh.i_disable_deblocking_filter_idc != 1; + a->b_early_terminate = h->param.analyse.i_subpel_refine < 11; + + x264_mb_analyse_init_qp( h, a, qp ); + + h->mb.b_transform_8x8 = 0; + + /* I: Intra part */ + a->i_satd_i16x16 = + a->i_satd_i8x8 = + a->i_satd_i4x4 = + a->i_satd_chroma = COST_MAX; + + /* non-RD PCM decision is inaccurate (as is psy-rd), so don't do it. + * PCM cost can overflow with high lambda2, so cap it at COST_MAX. */ + uint64_t pcm_cost = ((uint64_t)X264_PCM_COST*a->i_lambda2 + 128) >> 8; + a->i_satd_pcm = !h->param.i_avcintra_class && !h->mb.i_psy_rd && a->i_mbrd && pcm_cost < COST_MAX ? pcm_cost : COST_MAX; + + a->b_fast_intra = 0; + a->b_avoid_topright = 0; + h->mb.i_skip_intra = + h->mb.b_lossless ? 0 : + a->i_mbrd ? 2 : + !h->param.analyse.i_trellis && !h->param.analyse.i_noise_reduction; + + /* II: Inter part P/B frame */ + if( h->sh.i_type != SLICE_TYPE_I ) + { + int i_fmv_range = 4 * h->param.analyse.i_mv_range; + // limit motion search to a slightly smaller range than the theoretical limit, + // since the search may go a few iterations past its given range + int i_fpel_border = 6; // umh: 1 for diamond, 2 for octagon, 2 for hpel + + /* Calculate max allowed MV range */ + h->mb.mv_min[0] = 4*( -16*h->mb.i_mb_x - 24 ); + h->mb.mv_max[0] = 4*( 16*( h->mb.i_mb_width - h->mb.i_mb_x - 1 ) + 24 ); + h->mb.mv_min_spel[0] = X264_MAX( h->mb.mv_min[0], -i_fmv_range ); + h->mb.mv_max_spel[0] = X264_MIN( h->mb.mv_max[0], i_fmv_range-1 ); + if( h->param.b_intra_refresh && h->sh.i_type == SLICE_TYPE_P ) + { + int max_x = (h->fref[0][0]->i_pir_end_col * 16 - 3)*4; /* 3 pixels of hpel border */ + int max_mv = max_x - 4*16*h->mb.i_mb_x; + /* If we're left of the refresh bar, don't reference right of it. */ + if( max_mv > 0 && h->mb.i_mb_x < h->fdec->i_pir_start_col ) + h->mb.mv_max_spel[0] = X264_MIN( h->mb.mv_max_spel[0], max_mv ); + } + h->mb.mv_limit_fpel[0][0] = (h->mb.mv_min_spel[0]>>2) + i_fpel_border; + h->mb.mv_limit_fpel[1][0] = (h->mb.mv_max_spel[0]>>2) - i_fpel_border; + if( h->mb.i_mb_x == 0 && !(h->mb.i_mb_y & PARAM_INTERLACED) ) + { + int mb_y = h->mb.i_mb_y >> SLICE_MBAFF; + int thread_mvy_range = i_fmv_range; + + if( h->i_thread_frames > 1 ) + { + int pix_y = (h->mb.i_mb_y | PARAM_INTERLACED) * 16; + int thresh = pix_y + h->param.analyse.i_mv_range_thread; + for( int i = (h->sh.i_type == SLICE_TYPE_B); i >= 0; i-- ) + for( int j = 0; j < h->i_ref[i]; j++ ) + { + x264_frame_cond_wait( h->fref[i][j]->orig, thresh ); + thread_mvy_range = X264_MIN( thread_mvy_range, h->fref[i][j]->orig->i_lines_completed - pix_y ); + } + + if( h->param.b_deterministic ) + thread_mvy_range = h->param.analyse.i_mv_range_thread; + if( PARAM_INTERLACED ) + thread_mvy_range >>= 1; + + x264_analyse_weight_frame( h, pix_y + thread_mvy_range ); + } + + if( PARAM_INTERLACED ) + { + /* 0 == top progressive, 1 == bot progressive, 2 == interlaced */ + for( int i = 0; i < 3; i++ ) + { + int j = i == 2; + mb_y = (h->mb.i_mb_y >> j) + (i == 1); + h->mb.mv_miny_row[i] = 4*( -16*mb_y - 24 ); + h->mb.mv_maxy_row[i] = 4*( 16*( (h->mb.i_mb_height>>j) - mb_y - 1 ) + 24 ); + h->mb.mv_miny_spel_row[i] = X264_MAX( h->mb.mv_miny_row[i], -i_fmv_range ); + h->mb.mv_maxy_spel_row[i] = X264_MIN3( h->mb.mv_maxy_row[i], i_fmv_range-1, 4*thread_mvy_range ); + h->mb.mv_miny_fpel_row[i] = (h->mb.mv_miny_spel_row[i]>>2) + i_fpel_border; + h->mb.mv_maxy_fpel_row[i] = (h->mb.mv_maxy_spel_row[i]>>2) - i_fpel_border; + } + } + else + { + h->mb.mv_min[1] = 4*( -16*mb_y - 24 ); + h->mb.mv_max[1] = 4*( 16*( h->mb.i_mb_height - mb_y - 1 ) + 24 ); + h->mb.mv_min_spel[1] = X264_MAX( h->mb.mv_min[1], -i_fmv_range ); + h->mb.mv_max_spel[1] = X264_MIN3( h->mb.mv_max[1], i_fmv_range-1, 4*thread_mvy_range ); + h->mb.mv_limit_fpel[0][1] = (h->mb.mv_min_spel[1]>>2) + i_fpel_border; + h->mb.mv_limit_fpel[1][1] = (h->mb.mv_max_spel[1]>>2) - i_fpel_border; + } + } + if( PARAM_INTERLACED ) + { + int i = MB_INTERLACED ? 2 : h->mb.i_mb_y&1; + h->mb.mv_min[1] = h->mb.mv_miny_row[i]; + h->mb.mv_max[1] = h->mb.mv_maxy_row[i]; + h->mb.mv_min_spel[1] = h->mb.mv_miny_spel_row[i]; + h->mb.mv_max_spel[1] = h->mb.mv_maxy_spel_row[i]; + h->mb.mv_limit_fpel[0][1] = h->mb.mv_miny_fpel_row[i]; + h->mb.mv_limit_fpel[1][1] = h->mb.mv_maxy_fpel_row[i]; + } + + a->l0.me16x16.cost = + a->l0.i_rd16x16 = + a->l0.i_cost8x8 = + a->l0.i_cost16x8 = + a->l0.i_cost8x16 = COST_MAX; + if( h->sh.i_type == SLICE_TYPE_B ) + { + a->l1.me16x16.cost = + a->l1.i_rd16x16 = + a->l1.i_cost8x8 = + a->i_cost8x8direct[0] = + a->i_cost8x8direct[1] = + a->i_cost8x8direct[2] = + a->i_cost8x8direct[3] = + a->l1.i_cost16x8 = + a->l1.i_cost8x16 = + a->i_rd16x16bi = + a->i_rd16x16direct = + a->i_rd8x8bi = + a->i_rd16x8bi = + a->i_rd8x16bi = + a->i_cost16x16bi = + a->i_cost16x16direct = + a->i_cost8x8bi = + a->i_cost16x8bi = + a->i_cost8x16bi = COST_MAX; + } + else if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 ) + for( int i = 0; i < 4; i++ ) + { + a->l0.i_cost4x4[i] = + a->l0.i_cost8x4[i] = + a->l0.i_cost4x8[i] = COST_MAX; + } + + /* Fast intra decision */ + if( a->b_early_terminate && h->mb.i_mb_xy - h->sh.i_first_mb > 4 ) + { + /* Always run in fast-intra mode for subme < 3 */ + if( h->mb.i_subpel_refine > 2 && + ( IS_INTRA( h->mb.i_mb_type_left[0] ) || + IS_INTRA( h->mb.i_mb_type_top ) || + IS_INTRA( h->mb.i_mb_type_topleft ) || + IS_INTRA( h->mb.i_mb_type_topright ) || + (h->sh.i_type == SLICE_TYPE_P && IS_INTRA( h->fref[0][0]->mb_type[h->mb.i_mb_xy] )) || + (h->mb.i_mb_xy - h->sh.i_first_mb < 3*(h->stat.frame.i_mb_count[I_4x4] + h->stat.frame.i_mb_count[I_8x8] + h->stat.frame.i_mb_count[I_16x16])) ) ) + { /* intra is likely */ } + else + { + a->b_fast_intra = 1; + } + } + h->mb.b_skip_mc = 0; + if( h->param.b_intra_refresh && h->sh.i_type == SLICE_TYPE_P && + h->mb.i_mb_x >= h->fdec->i_pir_start_col && h->mb.i_mb_x <= h->fdec->i_pir_end_col ) + { + a->b_force_intra = 1; + a->b_fast_intra = 0; + a->b_avoid_topright = h->mb.i_mb_x == h->fdec->i_pir_end_col; + } + else + a->b_force_intra = 0; + } +} + +/* Prediction modes allowed for various combinations of neighbors. */ +/* Terminated by a -1. */ +/* In order, no neighbors, left, top, top/left, top/left/topleft */ +static const int8_t i16x16_mode_available[5][5] = +{ + {I_PRED_16x16_DC_128, -1, -1, -1, -1}, + {I_PRED_16x16_DC_LEFT, I_PRED_16x16_H, -1, -1, -1}, + {I_PRED_16x16_DC_TOP, I_PRED_16x16_V, -1, -1, -1}, + {I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, -1, -1}, + {I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, I_PRED_16x16_P, -1}, +}; + +static const int8_t chroma_mode_available[5][5] = +{ + {I_PRED_CHROMA_DC_128, -1, -1, -1, -1}, + {I_PRED_CHROMA_DC_LEFT, I_PRED_CHROMA_H, -1, -1, -1}, + {I_PRED_CHROMA_DC_TOP, I_PRED_CHROMA_V, -1, -1, -1}, + {I_PRED_CHROMA_V, I_PRED_CHROMA_H, I_PRED_CHROMA_DC, -1, -1}, + {I_PRED_CHROMA_V, I_PRED_CHROMA_H, I_PRED_CHROMA_DC, I_PRED_CHROMA_P, -1}, +}; + +static const int8_t i8x8_mode_available[2][5][10] = +{ + { + {I_PRED_4x4_DC_128, -1, -1, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC_LEFT, I_PRED_4x4_H, I_PRED_4x4_HU, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC_TOP, I_PRED_4x4_V, I_PRED_4x4_DDL, I_PRED_4x4_VL, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_DDL, I_PRED_4x4_VL, I_PRED_4x4_HU, -1, -1, -1, -1}, + {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR, I_PRED_4x4_HD, I_PRED_4x4_VL, I_PRED_4x4_HU, -1}, + }, + { + {I_PRED_4x4_DC_128, -1, -1, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC_LEFT, I_PRED_4x4_H, I_PRED_4x4_HU, -1, -1, -1, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_H, I_PRED_4x4_HU, -1, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_H, I_PRED_4x4_HD, I_PRED_4x4_HU, -1, -1, -1, -1, -1, -1, -1}, + } +}; + +static const int8_t i4x4_mode_available[2][5][10] = +{ + { + {I_PRED_4x4_DC_128, -1, -1, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC_LEFT, I_PRED_4x4_H, I_PRED_4x4_HU, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC_TOP, I_PRED_4x4_V, I_PRED_4x4_DDL, I_PRED_4x4_VL, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_DDL, I_PRED_4x4_VL, I_PRED_4x4_HU, -1, -1, -1, -1}, + {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR, I_PRED_4x4_HD, I_PRED_4x4_VL, I_PRED_4x4_HU, -1}, + }, + { + {I_PRED_4x4_DC_128, -1, -1, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC_LEFT, I_PRED_4x4_H, I_PRED_4x4_HU, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC_TOP, I_PRED_4x4_V, -1, -1, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_HU, -1, -1, -1, -1, -1, -1}, + {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_DDR, I_PRED_4x4_VR, I_PRED_4x4_HD, I_PRED_4x4_HU, -1, -1, -1}, + } +}; + +static ALWAYS_INLINE const int8_t *predict_16x16_mode_available( int i_neighbour ) +{ + int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT); + idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT); + return i16x16_mode_available[idx]; +} + +static ALWAYS_INLINE const int8_t *predict_chroma_mode_available( int i_neighbour ) +{ + int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT); + idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT); + return chroma_mode_available[idx]; +} + +static ALWAYS_INLINE const int8_t *predict_8x8_mode_available( int force_intra, int i_neighbour, int i ) +{ + int avoid_topright = force_intra && (i&1); + int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT); + idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT); + return i8x8_mode_available[avoid_topright][idx]; +} + +static ALWAYS_INLINE const int8_t *predict_4x4_mode_available( int force_intra, int i_neighbour, int i ) +{ + int avoid_topright = force_intra && ((i&5) == 5); + int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT); + idx = (idx == (MB_TOP|MB_LEFT|MB_TOPLEFT)) ? 4 : idx & (MB_TOP|MB_LEFT); + return i4x4_mode_available[avoid_topright][idx]; +} + +/* For trellis=2, we need to do this for both sizes of DCT, for trellis=1 we only need to use it on the chosen mode. */ +static void inline x264_psy_trellis_init( x264_t *h, int do_both_dct ) +{ + ALIGNED_16( static pixel zero[16*FDEC_STRIDE] ) = {0}; + + if( do_both_dct || h->mb.b_transform_8x8 ) + h->dctf.sub16x16_dct8( h->mb.pic.fenc_dct8, h->mb.pic.p_fenc[0], zero ); + if( do_both_dct || !h->mb.b_transform_8x8 ) + h->dctf.sub16x16_dct( h->mb.pic.fenc_dct4, h->mb.pic.p_fenc[0], zero ); +} + +/* Reset fenc satd scores cache for psy RD */ +static inline void x264_mb_init_fenc_cache( x264_t *h, int b_satd ) +{ + if( h->param.analyse.i_trellis == 2 && h->mb.i_psy_trellis ) + x264_psy_trellis_init( h, h->param.analyse.b_transform_8x8 ); + if( !h->mb.i_psy_rd ) + return; + + M128( &h->mb.pic.fenc_hadamard_cache[0] ) = M128_ZERO; + M128( &h->mb.pic.fenc_hadamard_cache[2] ) = M128_ZERO; + M128( &h->mb.pic.fenc_hadamard_cache[4] ) = M128_ZERO; + M128( &h->mb.pic.fenc_hadamard_cache[6] ) = M128_ZERO; + h->mb.pic.fenc_hadamard_cache[8] = 0; + if( b_satd ) + h->mc.memzero_aligned( h->mb.pic.fenc_satd_cache, sizeof(h->mb.pic.fenc_satd_cache) ); +} + +static void x264_mb_analyse_intra_chroma( x264_t *h, x264_mb_analysis_t *a ) +{ + if( a->i_satd_chroma < COST_MAX ) + return; + + if( CHROMA444 ) + { + if( !h->mb.b_chroma_me ) + { + a->i_satd_chroma = 0; + return; + } + + /* Cheap approximation of chroma costs to avoid a full i4x4/i8x8 analysis. */ + if( h->mb.b_lossless ) + { + x264_predict_lossless_16x16( h, 1, a->i_predict16x16 ); + x264_predict_lossless_16x16( h, 2, a->i_predict16x16 ); + } + else + { + h->predict_16x16[a->i_predict16x16]( h->mb.pic.p_fdec[1] ); + h->predict_16x16[a->i_predict16x16]( h->mb.pic.p_fdec[2] ); + } + a->i_satd_chroma = h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[1], FENC_STRIDE, h->mb.pic.p_fdec[1], FDEC_STRIDE ) + + h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[2], FENC_STRIDE, h->mb.pic.p_fdec[2], FDEC_STRIDE ); + return; + } + + const int8_t *predict_mode = predict_chroma_mode_available( h->mb.i_neighbour_intra ); + int chromapix = h->luma2chroma_pixel[PIXEL_16x16]; + + /* Prediction selection for chroma */ + if( predict_mode[3] >= 0 && !h->mb.b_lossless ) + { + int satdu[4], satdv[4]; + h->pixf.intra_mbcmp_x3_chroma( h->mb.pic.p_fenc[1], h->mb.pic.p_fdec[1], satdu ); + h->pixf.intra_mbcmp_x3_chroma( h->mb.pic.p_fenc[2], h->mb.pic.p_fdec[2], satdv ); + h->predict_chroma[I_PRED_CHROMA_P]( h->mb.pic.p_fdec[1] ); + h->predict_chroma[I_PRED_CHROMA_P]( h->mb.pic.p_fdec[2] ); + satdu[I_PRED_CHROMA_P] = h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[1], FENC_STRIDE, h->mb.pic.p_fdec[1], FDEC_STRIDE ); + satdv[I_PRED_CHROMA_P] = h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[2], FENC_STRIDE, h->mb.pic.p_fdec[2], FDEC_STRIDE ); + + for( ; *predict_mode >= 0; predict_mode++ ) + { + int i_mode = *predict_mode; + int i_satd = satdu[i_mode] + satdv[i_mode] + a->i_lambda * bs_size_ue( i_mode ); + + a->i_satd_chroma_dir[i_mode] = i_satd; + COPY2_IF_LT( a->i_satd_chroma, i_satd, a->i_predict8x8chroma, i_mode ); + } + } + else + { + for( ; *predict_mode >= 0; predict_mode++ ) + { + int i_satd; + int i_mode = *predict_mode; + + /* we do the prediction */ + if( h->mb.b_lossless ) + x264_predict_lossless_chroma( h, i_mode ); + else + { + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[1] ); + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[2] ); + } + + /* we calculate the cost */ + i_satd = h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[1], FENC_STRIDE, h->mb.pic.p_fdec[1], FDEC_STRIDE ) + + h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[2], FENC_STRIDE, h->mb.pic.p_fdec[2], FDEC_STRIDE ) + + a->i_lambda * bs_size_ue( x264_mb_chroma_pred_mode_fix[i_mode] ); + + a->i_satd_chroma_dir[i_mode] = i_satd; + COPY2_IF_LT( a->i_satd_chroma, i_satd, a->i_predict8x8chroma, i_mode ); + } + } + + h->mb.i_chroma_pred_mode = a->i_predict8x8chroma; +} + +/* FIXME: should we do any sort of merged chroma analysis with 4:4:4? */ +static void x264_mb_analyse_intra( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter ) +{ + const unsigned int flags = h->sh.i_type == SLICE_TYPE_I ? h->param.analyse.intra : h->param.analyse.inter; + pixel *p_src = h->mb.pic.p_fenc[0]; + pixel *p_dst = h->mb.pic.p_fdec[0]; + static const int8_t intra_analysis_shortcut[2][2][2][5] = + { + {{{I_PRED_4x4_HU, -1, -1, -1, -1}, + {I_PRED_4x4_DDL, I_PRED_4x4_VL, -1, -1, -1}}, + {{I_PRED_4x4_DDR, I_PRED_4x4_HD, I_PRED_4x4_HU, -1, -1}, + {I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR, I_PRED_4x4_VL, -1}}}, + {{{I_PRED_4x4_HU, -1, -1, -1, -1}, + {-1, -1, -1, -1, -1}}, + {{I_PRED_4x4_DDR, I_PRED_4x4_HD, I_PRED_4x4_HU, -1, -1}, + {I_PRED_4x4_DDR, I_PRED_4x4_VR, -1, -1, -1}}}, + }; + + int idx; + int lambda = a->i_lambda; + + /*---------------- Try all mode and calculate their score ---------------*/ + /* Disabled i16x16 for AVC-Intra compat */ + if( !h->param.i_avcintra_class ) + { + const int8_t *predict_mode = predict_16x16_mode_available( h->mb.i_neighbour_intra ); + + /* Not heavily tuned */ + static const uint8_t i16x16_thresh_lut[11] = { 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4 }; + int i16x16_thresh = a->b_fast_intra ? (i16x16_thresh_lut[h->mb.i_subpel_refine]*i_satd_inter)>>1 : COST_MAX; + + if( !h->mb.b_lossless && predict_mode[3] >= 0 ) + { + h->pixf.intra_mbcmp_x3_16x16( p_src, p_dst, a->i_satd_i16x16_dir ); + a->i_satd_i16x16_dir[0] += lambda * bs_size_ue(0); + a->i_satd_i16x16_dir[1] += lambda * bs_size_ue(1); + a->i_satd_i16x16_dir[2] += lambda * bs_size_ue(2); + COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[0], a->i_predict16x16, 0 ); + COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[1], a->i_predict16x16, 1 ); + COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[2], a->i_predict16x16, 2 ); + + /* Plane is expensive, so don't check it unless one of the previous modes was useful. */ + if( a->i_satd_i16x16 <= i16x16_thresh ) + { + h->predict_16x16[I_PRED_16x16_P]( p_dst ); + a->i_satd_i16x16_dir[I_PRED_16x16_P] = h->pixf.mbcmp[PIXEL_16x16]( p_src, FENC_STRIDE, p_dst, FDEC_STRIDE ); + a->i_satd_i16x16_dir[I_PRED_16x16_P] += lambda * bs_size_ue(3); + COPY2_IF_LT( a->i_satd_i16x16, a->i_satd_i16x16_dir[I_PRED_16x16_P], a->i_predict16x16, 3 ); + } + } + else + { + for( ; *predict_mode >= 0; predict_mode++ ) + { + int i_satd; + int i_mode = *predict_mode; + + if( h->mb.b_lossless ) + x264_predict_lossless_16x16( h, 0, i_mode ); + else + h->predict_16x16[i_mode]( p_dst ); + + i_satd = h->pixf.mbcmp[PIXEL_16x16]( p_src, FENC_STRIDE, p_dst, FDEC_STRIDE ) + + lambda * bs_size_ue( x264_mb_pred_mode16x16_fix[i_mode] ); + COPY2_IF_LT( a->i_satd_i16x16, i_satd, a->i_predict16x16, i_mode ); + a->i_satd_i16x16_dir[i_mode] = i_satd; + } + } + + if( h->sh.i_type == SLICE_TYPE_B ) + /* cavlc mb type prefix */ + a->i_satd_i16x16 += lambda * i_mb_b_cost_table[I_16x16]; + + if( a->i_satd_i16x16 > i16x16_thresh ) + return; + } + + uint16_t *cost_i4x4_mode = (uint16_t*)ALIGN((intptr_t)x264_cost_i4x4_mode,64) + a->i_qp*32 + 8; + /* 8x8 prediction selection */ + if( flags & X264_ANALYSE_I8x8 ) + { + ALIGNED_ARRAY_32( pixel, edge,[36] ); + x264_pixel_cmp_t sa8d = (h->pixf.mbcmp[0] == h->pixf.satd[0]) ? h->pixf.sa8d[PIXEL_8x8] : h->pixf.mbcmp[PIXEL_8x8]; + int i_satd_thresh = a->i_mbrd ? COST_MAX : X264_MIN( i_satd_inter, a->i_satd_i16x16 ); + + // FIXME some bias like in i4x4? + int i_cost = lambda * 4; /* base predmode costs */ + h->mb.i_cbp_luma = 0; + + if( h->sh.i_type == SLICE_TYPE_B ) + i_cost += lambda * i_mb_b_cost_table[I_8x8]; + + for( idx = 0;; idx++ ) + { + int x = idx&1; + int y = idx>>1; + pixel *p_src_by = p_src + 8*x + 8*y*FENC_STRIDE; + pixel *p_dst_by = p_dst + 8*x + 8*y*FDEC_STRIDE; + int i_best = COST_MAX; + int i_pred_mode = x264_mb_predict_intra4x4_mode( h, 4*idx ); + + const int8_t *predict_mode = predict_8x8_mode_available( a->b_avoid_topright, h->mb.i_neighbour8[idx], idx ); + h->predict_8x8_filter( p_dst_by, edge, h->mb.i_neighbour8[idx], ALL_NEIGHBORS ); + + if( h->pixf.intra_mbcmp_x9_8x8 && predict_mode[8] >= 0 ) + { + /* No shortcuts here. The SSSE3 implementation of intra_mbcmp_x9 is fast enough. */ + i_best = h->pixf.intra_mbcmp_x9_8x8( p_src_by, p_dst_by, edge, cost_i4x4_mode-i_pred_mode, a->i_satd_i8x8_dir[idx] ); + i_cost += i_best & 0xffff; + i_best >>= 16; + a->i_predict8x8[idx] = i_best; + if( idx == 3 || i_cost > i_satd_thresh ) + break; + x264_macroblock_cache_intra8x8_pred( h, 2*x, 2*y, i_best ); + } + else + { + if( !h->mb.b_lossless && predict_mode[5] >= 0 ) + { + ALIGNED_ARRAY_16( int32_t, satd,[9] ); + h->pixf.intra_mbcmp_x3_8x8( p_src_by, edge, satd ); + int favor_vertical = satd[I_PRED_4x4_H] > satd[I_PRED_4x4_V]; + satd[i_pred_mode] -= 3 * lambda; + for( int i = 2; i >= 0; i-- ) + { + int cost = satd[i]; + a->i_satd_i8x8_dir[idx][i] = cost + 4 * lambda; + COPY2_IF_LT( i_best, cost, a->i_predict8x8[idx], i ); + } + + /* Take analysis shortcuts: don't analyse modes that are too + * far away direction-wise from the favored mode. */ + if( a->i_mbrd < 1 + a->b_fast_intra ) + predict_mode = intra_analysis_shortcut[a->b_avoid_topright][predict_mode[8] >= 0][favor_vertical]; + else + predict_mode += 3; + } + + for( ; *predict_mode >= 0 && (i_best >= 0 || a->i_mbrd >= 2); predict_mode++ ) + { + int i_satd; + int i_mode = *predict_mode; + + if( h->mb.b_lossless ) + x264_predict_lossless_8x8( h, p_dst_by, 0, idx, i_mode, edge ); + else + h->predict_8x8[i_mode]( p_dst_by, edge ); + + i_satd = sa8d( p_dst_by, FDEC_STRIDE, p_src_by, FENC_STRIDE ); + if( i_pred_mode == x264_mb_pred_mode4x4_fix(i_mode) ) + i_satd -= 3 * lambda; + + COPY2_IF_LT( i_best, i_satd, a->i_predict8x8[idx], i_mode ); + a->i_satd_i8x8_dir[idx][i_mode] = i_satd + 4 * lambda; + } + i_cost += i_best + 3*lambda; + + if( idx == 3 || i_cost > i_satd_thresh ) + break; + if( h->mb.b_lossless ) + x264_predict_lossless_8x8( h, p_dst_by, 0, idx, a->i_predict8x8[idx], edge ); + else + h->predict_8x8[a->i_predict8x8[idx]]( p_dst_by, edge ); + x264_macroblock_cache_intra8x8_pred( h, 2*x, 2*y, a->i_predict8x8[idx] ); + } + /* we need to encode this block now (for next ones) */ + x264_mb_encode_i8x8( h, 0, idx, a->i_qp, a->i_predict8x8[idx], edge, 0 ); + } + + if( idx == 3 ) + { + a->i_satd_i8x8 = i_cost; + if( h->mb.i_skip_intra ) + { + h->mc.copy[PIXEL_16x16]( h->mb.pic.i8x8_fdec_buf, 16, p_dst, FDEC_STRIDE, 16 ); + h->mb.pic.i8x8_nnz_buf[0] = M32( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ); + h->mb.pic.i8x8_nnz_buf[1] = M32( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ); + h->mb.pic.i8x8_nnz_buf[2] = M32( &h->mb.cache.non_zero_count[x264_scan8[ 8]] ); + h->mb.pic.i8x8_nnz_buf[3] = M32( &h->mb.cache.non_zero_count[x264_scan8[10]] ); + h->mb.pic.i8x8_cbp = h->mb.i_cbp_luma; + if( h->mb.i_skip_intra == 2 ) + h->mc.memcpy_aligned( h->mb.pic.i8x8_dct_buf, h->dct.luma8x8, sizeof(h->mb.pic.i8x8_dct_buf) ); + } + } + else + { + static const uint16_t cost_div_fix8[3] = {1024,512,341}; + a->i_satd_i8x8 = COST_MAX; + i_cost = (i_cost * cost_div_fix8[idx]) >> 8; + } + /* Not heavily tuned */ + static const uint8_t i8x8_thresh[11] = { 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6 }; + if( a->b_early_terminate && X264_MIN(i_cost, a->i_satd_i16x16) > (i_satd_inter*i8x8_thresh[h->mb.i_subpel_refine])>>2 ) + return; + } + + /* 4x4 prediction selection */ + if( flags & X264_ANALYSE_I4x4 ) + { + int i_cost = lambda * (24+16); /* 24from JVT (SATD0), 16 from base predmode costs */ + int i_satd_thresh = a->b_early_terminate ? X264_MIN3( i_satd_inter, a->i_satd_i16x16, a->i_satd_i8x8 ) : COST_MAX; + h->mb.i_cbp_luma = 0; + + if( a->b_early_terminate && a->i_mbrd ) + i_satd_thresh = i_satd_thresh * (10-a->b_fast_intra)/8; + + if( h->sh.i_type == SLICE_TYPE_B ) + i_cost += lambda * i_mb_b_cost_table[I_4x4]; + + for( idx = 0;; idx++ ) + { + pixel *p_src_by = p_src + block_idx_xy_fenc[idx]; + pixel *p_dst_by = p_dst + block_idx_xy_fdec[idx]; + int i_best = COST_MAX; + int i_pred_mode = x264_mb_predict_intra4x4_mode( h, idx ); + + const int8_t *predict_mode = predict_4x4_mode_available( a->b_avoid_topright, h->mb.i_neighbour4[idx], idx ); + + if( (h->mb.i_neighbour4[idx] & (MB_TOPRIGHT|MB_TOP)) == MB_TOP ) + /* emulate missing topright samples */ + MPIXEL_X4( &p_dst_by[4 - FDEC_STRIDE] ) = PIXEL_SPLAT_X4( p_dst_by[3 - FDEC_STRIDE] ); + + if( h->pixf.intra_mbcmp_x9_4x4 && predict_mode[8] >= 0 ) + { + /* No shortcuts here. The SSSE3 implementation of intra_mbcmp_x9 is fast enough. */ + i_best = h->pixf.intra_mbcmp_x9_4x4( p_src_by, p_dst_by, cost_i4x4_mode-i_pred_mode ); + i_cost += i_best & 0xffff; + i_best >>= 16; + a->i_predict4x4[idx] = i_best; + if( i_cost > i_satd_thresh || idx == 15 ) + break; + h->mb.cache.intra4x4_pred_mode[x264_scan8[idx]] = i_best; + } + else + { + if( !h->mb.b_lossless && predict_mode[5] >= 0 ) + { + ALIGNED_ARRAY_16( int32_t, satd,[9] ); + h->pixf.intra_mbcmp_x3_4x4( p_src_by, p_dst_by, satd ); + int favor_vertical = satd[I_PRED_4x4_H] > satd[I_PRED_4x4_V]; + satd[i_pred_mode] -= 3 * lambda; + i_best = satd[I_PRED_4x4_DC]; a->i_predict4x4[idx] = I_PRED_4x4_DC; + COPY2_IF_LT( i_best, satd[I_PRED_4x4_H], a->i_predict4x4[idx], I_PRED_4x4_H ); + COPY2_IF_LT( i_best, satd[I_PRED_4x4_V], a->i_predict4x4[idx], I_PRED_4x4_V ); + + /* Take analysis shortcuts: don't analyse modes that are too + * far away direction-wise from the favored mode. */ + if( a->i_mbrd < 1 + a->b_fast_intra ) + predict_mode = intra_analysis_shortcut[a->b_avoid_topright][predict_mode[8] >= 0][favor_vertical]; + else + predict_mode += 3; + } + + if( i_best > 0 ) + { + for( ; *predict_mode >= 0; predict_mode++ ) + { + int i_satd; + int i_mode = *predict_mode; + + if( h->mb.b_lossless ) + x264_predict_lossless_4x4( h, p_dst_by, 0, idx, i_mode ); + else + h->predict_4x4[i_mode]( p_dst_by ); + + i_satd = h->pixf.mbcmp[PIXEL_4x4]( p_src_by, FENC_STRIDE, p_dst_by, FDEC_STRIDE ); + if( i_pred_mode == x264_mb_pred_mode4x4_fix(i_mode) ) + { + i_satd -= lambda * 3; + if( i_satd <= 0 ) + { + i_best = i_satd; + a->i_predict4x4[idx] = i_mode; + break; + } + } + + COPY2_IF_LT( i_best, i_satd, a->i_predict4x4[idx], i_mode ); + } + } + + i_cost += i_best + 3 * lambda; + if( i_cost > i_satd_thresh || idx == 15 ) + break; + if( h->mb.b_lossless ) + x264_predict_lossless_4x4( h, p_dst_by, 0, idx, a->i_predict4x4[idx] ); + else + h->predict_4x4[a->i_predict4x4[idx]]( p_dst_by ); + h->mb.cache.intra4x4_pred_mode[x264_scan8[idx]] = a->i_predict4x4[idx]; + } + /* we need to encode this block now (for next ones) */ + x264_mb_encode_i4x4( h, 0, idx, a->i_qp, a->i_predict4x4[idx], 0 ); + } + if( idx == 15 ) + { + a->i_satd_i4x4 = i_cost; + if( h->mb.i_skip_intra ) + { + h->mc.copy[PIXEL_16x16]( h->mb.pic.i4x4_fdec_buf, 16, p_dst, FDEC_STRIDE, 16 ); + h->mb.pic.i4x4_nnz_buf[0] = M32( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ); + h->mb.pic.i4x4_nnz_buf[1] = M32( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ); + h->mb.pic.i4x4_nnz_buf[2] = M32( &h->mb.cache.non_zero_count[x264_scan8[ 8]] ); + h->mb.pic.i4x4_nnz_buf[3] = M32( &h->mb.cache.non_zero_count[x264_scan8[10]] ); + h->mb.pic.i4x4_cbp = h->mb.i_cbp_luma; + if( h->mb.i_skip_intra == 2 ) + h->mc.memcpy_aligned( h->mb.pic.i4x4_dct_buf, h->dct.luma4x4, sizeof(h->mb.pic.i4x4_dct_buf) ); + } + } + else + a->i_satd_i4x4 = COST_MAX; + } +} + +static void x264_intra_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_thresh ) +{ + if( !a->b_early_terminate ) + i_satd_thresh = COST_MAX; + + if( a->i_satd_i16x16 < i_satd_thresh ) + { + h->mb.i_type = I_16x16; + x264_analyse_update_cache( h, a ); + a->i_satd_i16x16 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + else + a->i_satd_i16x16 = COST_MAX; + + if( a->i_satd_i4x4 < i_satd_thresh ) + { + h->mb.i_type = I_4x4; + x264_analyse_update_cache( h, a ); + a->i_satd_i4x4 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + else + a->i_satd_i4x4 = COST_MAX; + + if( a->i_satd_i8x8 < i_satd_thresh ) + { + h->mb.i_type = I_8x8; + x264_analyse_update_cache( h, a ); + a->i_satd_i8x8 = x264_rd_cost_mb( h, a->i_lambda2 ); + a->i_cbp_i8x8_luma = h->mb.i_cbp_luma; + } + else + a->i_satd_i8x8 = COST_MAX; +} + +static void x264_intra_rd_refine( x264_t *h, x264_mb_analysis_t *a ) +{ + uint64_t i_satd, i_best; + int plane_count = CHROMA444 ? 3 : 1; + h->mb.i_skip_intra = 0; + + if( h->mb.i_type == I_16x16 ) + { + int old_pred_mode = a->i_predict16x16; + const int8_t *predict_mode = predict_16x16_mode_available( h->mb.i_neighbour_intra ); + int i_thresh = a->b_early_terminate ? a->i_satd_i16x16_dir[old_pred_mode] * 9/8 : COST_MAX; + i_best = a->i_satd_i16x16; + for( ; *predict_mode >= 0; predict_mode++ ) + { + int i_mode = *predict_mode; + if( i_mode == old_pred_mode || a->i_satd_i16x16_dir[i_mode] > i_thresh ) + continue; + h->mb.i_intra16x16_pred_mode = i_mode; + i_satd = x264_rd_cost_mb( h, a->i_lambda2 ); + COPY2_IF_LT( i_best, i_satd, a->i_predict16x16, i_mode ); + } + } + + /* RD selection for chroma prediction */ + if( !CHROMA444 ) + { + const int8_t *predict_mode = predict_chroma_mode_available( h->mb.i_neighbour_intra ); + if( predict_mode[1] >= 0 ) + { + int8_t predict_mode_sorted[4]; + int i_max; + int i_thresh = a->b_early_terminate ? a->i_satd_chroma * 5/4 : COST_MAX; + + for( i_max = 0; *predict_mode >= 0; predict_mode++ ) + { + int i_mode = *predict_mode; + if( a->i_satd_chroma_dir[i_mode] < i_thresh && i_mode != a->i_predict8x8chroma ) + predict_mode_sorted[i_max++] = i_mode; + } + + if( i_max > 0 ) + { + int i_cbp_chroma_best = h->mb.i_cbp_chroma; + int i_chroma_lambda = x264_lambda2_tab[h->mb.i_chroma_qp]; + /* the previous thing encoded was x264_intra_rd(), so the pixels and + * coefs for the current chroma mode are still around, so we only + * have to recount the bits. */ + i_best = x264_rd_cost_chroma( h, i_chroma_lambda, a->i_predict8x8chroma, 0 ); + for( int i = 0; i < i_max; i++ ) + { + int i_mode = predict_mode_sorted[i]; + if( h->mb.b_lossless ) + x264_predict_lossless_chroma( h, i_mode ); + else + { + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[1] ); + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[2] ); + } + /* if we've already found a mode that needs no residual, then + * probably any mode with a residual will be worse. + * so avoid dct on the remaining modes to improve speed. */ + i_satd = x264_rd_cost_chroma( h, i_chroma_lambda, i_mode, h->mb.i_cbp_chroma != 0x00 ); + COPY3_IF_LT( i_best, i_satd, a->i_predict8x8chroma, i_mode, i_cbp_chroma_best, h->mb.i_cbp_chroma ); + } + h->mb.i_chroma_pred_mode = a->i_predict8x8chroma; + h->mb.i_cbp_chroma = i_cbp_chroma_best; + } + } + } + + if( h->mb.i_type == I_4x4 ) + { + pixel4 pels[3][4] = {{0}}; // doesn't need initting, just shuts up a gcc warning + int nnz[3] = {0}; + for( int idx = 0; idx < 16; idx++ ) + { + pixel *dst[3] = {h->mb.pic.p_fdec[0] + block_idx_xy_fdec[idx], + h->mb.pic.p_fdec[1] + block_idx_xy_fdec[idx], + h->mb.pic.p_fdec[2] + block_idx_xy_fdec[idx]}; + i_best = COST_MAX64; + + const int8_t *predict_mode = predict_4x4_mode_available( a->b_avoid_topright, h->mb.i_neighbour4[idx], idx ); + + if( (h->mb.i_neighbour4[idx] & (MB_TOPRIGHT|MB_TOP)) == MB_TOP ) + for( int p = 0; p < plane_count; p++ ) + /* emulate missing topright samples */ + MPIXEL_X4( dst[p]+4-FDEC_STRIDE ) = PIXEL_SPLAT_X4( dst[p][3-FDEC_STRIDE] ); + + for( ; *predict_mode >= 0; predict_mode++ ) + { + int i_mode = *predict_mode; + i_satd = x264_rd_cost_i4x4( h, a->i_lambda2, idx, i_mode ); + + if( i_best > i_satd ) + { + a->i_predict4x4[idx] = i_mode; + i_best = i_satd; + for( int p = 0; p < plane_count; p++ ) + { + pels[p][0] = MPIXEL_X4( dst[p]+0*FDEC_STRIDE ); + pels[p][1] = MPIXEL_X4( dst[p]+1*FDEC_STRIDE ); + pels[p][2] = MPIXEL_X4( dst[p]+2*FDEC_STRIDE ); + pels[p][3] = MPIXEL_X4( dst[p]+3*FDEC_STRIDE ); + nnz[p] = h->mb.cache.non_zero_count[x264_scan8[idx+p*16]]; + } + } + } + + for( int p = 0; p < plane_count; p++ ) + { + MPIXEL_X4( dst[p]+0*FDEC_STRIDE ) = pels[p][0]; + MPIXEL_X4( dst[p]+1*FDEC_STRIDE ) = pels[p][1]; + MPIXEL_X4( dst[p]+2*FDEC_STRIDE ) = pels[p][2]; + MPIXEL_X4( dst[p]+3*FDEC_STRIDE ) = pels[p][3]; + h->mb.cache.non_zero_count[x264_scan8[idx+p*16]] = nnz[p]; + } + + h->mb.cache.intra4x4_pred_mode[x264_scan8[idx]] = a->i_predict4x4[idx]; + } + } + else if( h->mb.i_type == I_8x8 ) + { + ALIGNED_ARRAY_32( pixel, edge,[4],[32] ); // really [3][36], but they can overlap + pixel4 pels_h[3][2] = {{0}}; + pixel pels_v[3][7] = {{0}}; + uint16_t nnz[3][2] = {{0}}; //shut up gcc + for( int idx = 0; idx < 4; idx++ ) + { + int x = idx&1; + int y = idx>>1; + int s8 = X264_SCAN8_0 + 2*x + 16*y; + pixel *dst[3] = {h->mb.pic.p_fdec[0] + 8*x + 8*y*FDEC_STRIDE, + h->mb.pic.p_fdec[1] + 8*x + 8*y*FDEC_STRIDE, + h->mb.pic.p_fdec[2] + 8*x + 8*y*FDEC_STRIDE}; + int cbp_luma_new = 0; + int i_thresh = a->b_early_terminate ? a->i_satd_i8x8_dir[idx][a->i_predict8x8[idx]] * 11/8 : COST_MAX; + + i_best = COST_MAX64; + + const int8_t *predict_mode = predict_8x8_mode_available( a->b_avoid_topright, h->mb.i_neighbour8[idx], idx ); + for( int p = 0; p < plane_count; p++ ) + h->predict_8x8_filter( dst[p], edge[p], h->mb.i_neighbour8[idx], ALL_NEIGHBORS ); + + for( ; *predict_mode >= 0; predict_mode++ ) + { + int i_mode = *predict_mode; + if( a->i_satd_i8x8_dir[idx][i_mode] > i_thresh ) + continue; + + h->mb.i_cbp_luma = a->i_cbp_i8x8_luma; + i_satd = x264_rd_cost_i8x8( h, a->i_lambda2, idx, i_mode, edge ); + + if( i_best > i_satd ) + { + a->i_predict8x8[idx] = i_mode; + cbp_luma_new = h->mb.i_cbp_luma; + i_best = i_satd; + + for( int p = 0; p < plane_count; p++ ) + { + pels_h[p][0] = MPIXEL_X4( dst[p]+7*FDEC_STRIDE+0 ); + pels_h[p][1] = MPIXEL_X4( dst[p]+7*FDEC_STRIDE+4 ); + if( !(idx&1) ) + for( int j = 0; j < 7; j++ ) + pels_v[p][j] = dst[p][7+j*FDEC_STRIDE]; + nnz[p][0] = M16( &h->mb.cache.non_zero_count[s8 + 0*8 + p*16] ); + nnz[p][1] = M16( &h->mb.cache.non_zero_count[s8 + 1*8 + p*16] ); + } + } + } + a->i_cbp_i8x8_luma = cbp_luma_new; + for( int p = 0; p < plane_count; p++ ) + { + MPIXEL_X4( dst[p]+7*FDEC_STRIDE+0 ) = pels_h[p][0]; + MPIXEL_X4( dst[p]+7*FDEC_STRIDE+4 ) = pels_h[p][1]; + if( !(idx&1) ) + for( int j = 0; j < 7; j++ ) + dst[p][7+j*FDEC_STRIDE] = pels_v[p][j]; + M16( &h->mb.cache.non_zero_count[s8 + 0*8 + p*16] ) = nnz[p][0]; + M16( &h->mb.cache.non_zero_count[s8 + 1*8 + p*16] ) = nnz[p][1]; + } + + x264_macroblock_cache_intra8x8_pred( h, 2*x, 2*y, a->i_predict8x8[idx] ); + } + } +} + +#define LOAD_FENC(m, src, xoff, yoff) \ +{ \ + (m)->p_cost_mv = a->p_cost_mv; \ + (m)->i_stride[0] = h->mb.pic.i_stride[0]; \ + (m)->i_stride[1] = h->mb.pic.i_stride[1]; \ + (m)->i_stride[2] = h->mb.pic.i_stride[2]; \ + (m)->p_fenc[0] = &(src)[0][(xoff)+(yoff)*FENC_STRIDE]; \ + (m)->p_fenc[1] = &(src)[1][((xoff)>>CHROMA_H_SHIFT)+((yoff)>>CHROMA_V_SHIFT)*FENC_STRIDE]; \ + (m)->p_fenc[2] = &(src)[2][((xoff)>>CHROMA_H_SHIFT)+((yoff)>>CHROMA_V_SHIFT)*FENC_STRIDE]; \ +} + +#define LOAD_HPELS(m, src, list, ref, xoff, yoff) \ +{ \ + (m)->p_fref_w = (m)->p_fref[0] = &(src)[0][(xoff)+(yoff)*(m)->i_stride[0]]; \ + (m)->p_fref[1] = &(src)[1][(xoff)+(yoff)*(m)->i_stride[0]]; \ + (m)->p_fref[2] = &(src)[2][(xoff)+(yoff)*(m)->i_stride[0]]; \ + (m)->p_fref[3] = &(src)[3][(xoff)+(yoff)*(m)->i_stride[0]]; \ + if( CHROMA444 ) \ + { \ + (m)->p_fref[ 4] = &(src)[ 4][(xoff)+(yoff)*(m)->i_stride[1]]; \ + (m)->p_fref[ 5] = &(src)[ 5][(xoff)+(yoff)*(m)->i_stride[1]]; \ + (m)->p_fref[ 6] = &(src)[ 6][(xoff)+(yoff)*(m)->i_stride[1]]; \ + (m)->p_fref[ 7] = &(src)[ 7][(xoff)+(yoff)*(m)->i_stride[1]]; \ + (m)->p_fref[ 8] = &(src)[ 8][(xoff)+(yoff)*(m)->i_stride[2]]; \ + (m)->p_fref[ 9] = &(src)[ 9][(xoff)+(yoff)*(m)->i_stride[2]]; \ + (m)->p_fref[10] = &(src)[10][(xoff)+(yoff)*(m)->i_stride[2]]; \ + (m)->p_fref[11] = &(src)[11][(xoff)+(yoff)*(m)->i_stride[2]]; \ + } \ + else \ + (m)->p_fref[4] = &(src)[4][(xoff)+((yoff)>>CHROMA_V_SHIFT)*(m)->i_stride[1]]; \ + (m)->integral = &h->mb.pic.p_integral[list][ref][(xoff)+(yoff)*(m)->i_stride[0]]; \ + (m)->weight = x264_weight_none; \ + (m)->i_ref = ref; \ +} + +#define LOAD_WPELS(m, src, list, ref, xoff, yoff) \ + (m)->p_fref_w = &(src)[(xoff)+(yoff)*(m)->i_stride[0]]; \ + (m)->weight = h->sh.weight[i_ref]; + +#define REF_COST(list, ref) \ + (a->p_cost_ref[list][ref]) + +static void x264_mb_analyse_inter_p16x16( x264_t *h, x264_mb_analysis_t *a ) +{ + x264_me_t m; + int i_mvc; + ALIGNED_4( int16_t mvc[8][2] ); + int i_halfpel_thresh = INT_MAX; + int *p_halfpel_thresh = (a->b_early_terminate && h->mb.pic.i_fref[0]>1) ? &i_halfpel_thresh : NULL; + + /* 16x16 Search on all ref frame */ + m.i_pixel = PIXEL_16x16; + LOAD_FENC( &m, h->mb.pic.p_fenc, 0, 0 ); + + a->l0.me16x16.cost = INT_MAX; + for( int i_ref = 0; i_ref < h->mb.pic.i_fref[0]; i_ref++ ) + { + m.i_ref_cost = REF_COST( 0, i_ref ); + i_halfpel_thresh -= m.i_ref_cost; + + /* search with ref */ + LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 0, 0 ); + LOAD_WPELS( &m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 0, 0 ); + + x264_mb_predict_mv_16x16( h, 0, i_ref, m.mvp ); + + if( h->mb.ref_blind_dupe == i_ref ) + { + CP32( m.mv, a->l0.mvc[0][0] ); + x264_me_refine_qpel_refdupe( h, &m, p_halfpel_thresh ); + } + else + { + x264_mb_predict_mv_ref16x16( h, 0, i_ref, mvc, &i_mvc ); + x264_me_search_ref( h, &m, mvc, i_mvc, p_halfpel_thresh ); + } + + /* save mv for predicting neighbors */ + CP32( h->mb.mvr[0][i_ref][h->mb.i_mb_xy], m.mv ); + CP32( a->l0.mvc[i_ref][0], m.mv ); + + /* early termination + * SSD threshold would probably be better than SATD */ + if( i_ref == 0 + && a->b_try_skip + && m.cost-m.cost_mv < 300*a->i_lambda + && abs(m.mv[0]-h->mb.cache.pskip_mv[0]) + + abs(m.mv[1]-h->mb.cache.pskip_mv[1]) <= 1 + && x264_macroblock_probe_pskip( h ) ) + { + h->mb.i_type = P_SKIP; + x264_analyse_update_cache( h, a ); + assert( h->mb.cache.pskip_mv[1] <= h->mb.mv_max_spel[1] || h->i_thread_frames == 1 ); + return; + } + + m.cost += m.i_ref_cost; + i_halfpel_thresh += m.i_ref_cost; + + if( m.cost < a->l0.me16x16.cost ) + h->mc.memcpy_aligned( &a->l0.me16x16, &m, sizeof(x264_me_t) ); + } + + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.me16x16.i_ref ); + assert( a->l0.me16x16.mv[1] <= h->mb.mv_max_spel[1] || h->i_thread_frames == 1 ); + + h->mb.i_type = P_L0; + if( a->i_mbrd ) + { + x264_mb_init_fenc_cache( h, a->i_mbrd >= 2 || h->param.analyse.inter & X264_ANALYSE_PSUB8x8 ); + if( a->l0.me16x16.i_ref == 0 && M32( a->l0.me16x16.mv ) == M32( h->mb.cache.pskip_mv ) && !a->b_force_intra ) + { + h->mb.i_partition = D_16x16; + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv ); + a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 ); + if( !(h->mb.i_cbp_luma|h->mb.i_cbp_chroma) ) + h->mb.i_type = P_SKIP; + } + } +} + +static void x264_mb_analyse_inter_p8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a ) +{ + x264_me_t m; + pixel **p_fenc = h->mb.pic.p_fenc; + int i_maxref = h->mb.pic.i_fref[0]-1; + + h->mb.i_partition = D_8x8; + + #define CHECK_NEIGHBOUR(i)\ + {\ + int ref = h->mb.cache.ref[0][X264_SCAN8_0+i];\ + if( ref > i_maxref && ref != h->mb.ref_blind_dupe )\ + i_maxref = ref;\ + } + + /* early termination: if 16x16 chose ref 0, then evalute no refs older + * than those used by the neighbors */ + if( a->b_early_terminate && (i_maxref > 0 && (a->l0.me16x16.i_ref == 0 || a->l0.me16x16.i_ref == h->mb.ref_blind_dupe) && + h->mb.i_mb_type_top > 0 && h->mb.i_mb_type_left[0] > 0) ) + { + i_maxref = 0; + CHECK_NEIGHBOUR( -8 - 1 ); + CHECK_NEIGHBOUR( -8 + 0 ); + CHECK_NEIGHBOUR( -8 + 2 ); + CHECK_NEIGHBOUR( -8 + 4 ); + CHECK_NEIGHBOUR( 0 - 1 ); + CHECK_NEIGHBOUR( 2*8 - 1 ); + } + #undef CHECK_NEIGHBOUR + + for( int i_ref = 0; i_ref <= i_maxref; i_ref++ ) + CP32( a->l0.mvc[i_ref][0], h->mb.mvr[0][i_ref][h->mb.i_mb_xy] ); + + for( int i = 0; i < 4; i++ ) + { + x264_me_t *l0m = &a->l0.me8x8[i]; + int x8 = i&1; + int y8 = i>>1; + + m.i_pixel = PIXEL_8x8; + + LOAD_FENC( &m, p_fenc, 8*x8, 8*y8 ); + l0m->cost = INT_MAX; + for( int i_ref = 0; i_ref <= i_maxref || i_ref == h->mb.ref_blind_dupe; ) + { + m.i_ref_cost = REF_COST( 0, i_ref ); + + LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 8*x8, 8*y8 ); + LOAD_WPELS( &m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 8*x8, 8*y8 ); + + x264_macroblock_cache_ref( h, 2*x8, 2*y8, 2, 2, 0, i_ref ); + x264_mb_predict_mv( h, 0, 4*i, 2, m.mvp ); + if( h->mb.ref_blind_dupe == i_ref ) + { + CP32( m.mv, a->l0.mvc[0][i+1] ); + x264_me_refine_qpel_refdupe( h, &m, NULL ); + } + else + x264_me_search( h, &m, a->l0.mvc[i_ref], i+1 ); + + m.cost += m.i_ref_cost; + + CP32( a->l0.mvc[i_ref][i+1], m.mv ); + + if( m.cost < l0m->cost ) + h->mc.memcpy_aligned( l0m, &m, sizeof(x264_me_t) ); + if( i_ref == i_maxref && i_maxref < h->mb.ref_blind_dupe ) + i_ref = h->mb.ref_blind_dupe; + else + i_ref++; + } + x264_macroblock_cache_mv_ptr( h, 2*x8, 2*y8, 2, 2, 0, l0m->mv ); + x264_macroblock_cache_ref( h, 2*x8, 2*y8, 2, 2, 0, l0m->i_ref ); + + a->i_satd8x8[0][i] = l0m->cost - ( l0m->cost_mv + l0m->i_ref_cost ); + + /* If CABAC is on and we're not doing sub-8x8 analysis, the costs + are effectively zero. */ + if( !h->param.b_cabac || (h->param.analyse.inter & X264_ANALYSE_PSUB8x8) ) + l0m->cost += a->i_lambda * i_sub_mb_p_cost_table[D_L0_8x8]; + } + + a->l0.i_cost8x8 = a->l0.me8x8[0].cost + a->l0.me8x8[1].cost + + a->l0.me8x8[2].cost + a->l0.me8x8[3].cost; + /* P_8x8 ref0 has no ref cost */ + if( !h->param.b_cabac && !(a->l0.me8x8[0].i_ref | a->l0.me8x8[1].i_ref | + a->l0.me8x8[2].i_ref | a->l0.me8x8[3].i_ref) ) + a->l0.i_cost8x8 -= REF_COST( 0, 0 ) * 4; + M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101; +} + +static void x264_mb_analyse_inter_p8x8( x264_t *h, x264_mb_analysis_t *a ) +{ + /* Duplicate refs are rarely useful in p8x8 due to the high cost of the + * reference frame flags. Thus, if we're not doing mixedrefs, just + * don't bother analysing the dupes. */ + const int i_ref = h->mb.ref_blind_dupe == a->l0.me16x16.i_ref ? 0 : a->l0.me16x16.i_ref; + const int i_ref_cost = h->param.b_cabac || i_ref ? REF_COST( 0, i_ref ) : 0; + pixel **p_fenc = h->mb.pic.p_fenc; + int i_mvc; + int16_t (*mvc)[2] = a->l0.mvc[i_ref]; + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_8x8; + + i_mvc = 1; + CP32( mvc[0], a->l0.me16x16.mv ); + + for( int i = 0; i < 4; i++ ) + { + x264_me_t *m = &a->l0.me8x8[i]; + int x8 = i&1; + int y8 = i>>1; + + m->i_pixel = PIXEL_8x8; + m->i_ref_cost = i_ref_cost; + + LOAD_FENC( m, p_fenc, 8*x8, 8*y8 ); + LOAD_HPELS( m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 8*x8, 8*y8 ); + LOAD_WPELS( m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 8*x8, 8*y8 ); + + x264_mb_predict_mv( h, 0, 4*i, 2, m->mvp ); + x264_me_search( h, m, mvc, i_mvc ); + + x264_macroblock_cache_mv_ptr( h, 2*x8, 2*y8, 2, 2, 0, m->mv ); + + CP32( mvc[i_mvc], m->mv ); + i_mvc++; + + a->i_satd8x8[0][i] = m->cost - m->cost_mv; + + /* mb type cost */ + m->cost += i_ref_cost; + if( !h->param.b_cabac || (h->param.analyse.inter & X264_ANALYSE_PSUB8x8) ) + m->cost += a->i_lambda * i_sub_mb_p_cost_table[D_L0_8x8]; + } + + a->l0.i_cost8x8 = a->l0.me8x8[0].cost + a->l0.me8x8[1].cost + + a->l0.me8x8[2].cost + a->l0.me8x8[3].cost; + /* theoretically this should include 4*ref_cost, + * but 3 seems a better approximation of cabac. */ + if( h->param.b_cabac ) + a->l0.i_cost8x8 -= i_ref_cost; + M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101; +} + +static void x264_mb_analyse_inter_p16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd ) +{ + x264_me_t m; + pixel **p_fenc = h->mb.pic.p_fenc; + ALIGNED_4( int16_t mvc[3][2] ); + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_16x8; + + for( int i = 0; i < 2; i++ ) + { + x264_me_t *l0m = &a->l0.me16x8[i]; + const int minref = X264_MIN( a->l0.me8x8[2*i].i_ref, a->l0.me8x8[2*i+1].i_ref ); + const int maxref = X264_MAX( a->l0.me8x8[2*i].i_ref, a->l0.me8x8[2*i+1].i_ref ); + const int ref8[2] = { minref, maxref }; + const int i_ref8s = ( ref8[0] == ref8[1] ) ? 1 : 2; + + m.i_pixel = PIXEL_16x8; + + LOAD_FENC( &m, p_fenc, 0, 8*i ); + l0m->cost = INT_MAX; + for( int j = 0; j < i_ref8s; j++ ) + { + const int i_ref = ref8[j]; + m.i_ref_cost = REF_COST( 0, i_ref ); + + /* if we skipped the 16x16 predictor, we wouldn't have to copy anything... */ + CP32( mvc[0], a->l0.mvc[i_ref][0] ); + CP32( mvc[1], a->l0.mvc[i_ref][2*i+1] ); + CP32( mvc[2], a->l0.mvc[i_ref][2*i+2] ); + + LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 0, 8*i ); + LOAD_WPELS( &m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 0, 8*i ); + + x264_macroblock_cache_ref( h, 0, 2*i, 4, 2, 0, i_ref ); + x264_mb_predict_mv( h, 0, 8*i, 4, m.mvp ); + /* We can only take this shortcut if the first search was performed on ref0. */ + if( h->mb.ref_blind_dupe == i_ref && !ref8[0] ) + { + /* We can just leave the MV from the previous ref search. */ + x264_me_refine_qpel_refdupe( h, &m, NULL ); + } + else + x264_me_search( h, &m, mvc, 3 ); + + m.cost += m.i_ref_cost; + + if( m.cost < l0m->cost ) + h->mc.memcpy_aligned( l0m, &m, sizeof(x264_me_t) ); + } + + /* Early termination based on the current SATD score of partition[0] + plus the estimated SATD score of partition[1] */ + if( a->b_early_terminate && (!i && l0m->cost + a->i_cost_est16x8[1] > i_best_satd * (4 + !!a->i_mbrd) / 4) ) + { + a->l0.i_cost16x8 = COST_MAX; + return; + } + + x264_macroblock_cache_mv_ptr( h, 0, 2*i, 4, 2, 0, l0m->mv ); + x264_macroblock_cache_ref( h, 0, 2*i, 4, 2, 0, l0m->i_ref ); + } + + a->l0.i_cost16x8 = a->l0.me16x8[0].cost + a->l0.me16x8[1].cost; +} + +static void x264_mb_analyse_inter_p8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd ) +{ + x264_me_t m; + pixel **p_fenc = h->mb.pic.p_fenc; + ALIGNED_4( int16_t mvc[3][2] ); + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_8x16; + + for( int i = 0; i < 2; i++ ) + { + x264_me_t *l0m = &a->l0.me8x16[i]; + const int minref = X264_MIN( a->l0.me8x8[i].i_ref, a->l0.me8x8[i+2].i_ref ); + const int maxref = X264_MAX( a->l0.me8x8[i].i_ref, a->l0.me8x8[i+2].i_ref ); + const int ref8[2] = { minref, maxref }; + const int i_ref8s = ( ref8[0] == ref8[1] ) ? 1 : 2; + + m.i_pixel = PIXEL_8x16; + + LOAD_FENC( &m, p_fenc, 8*i, 0 ); + l0m->cost = INT_MAX; + for( int j = 0; j < i_ref8s; j++ ) + { + const int i_ref = ref8[j]; + m.i_ref_cost = REF_COST( 0, i_ref ); + + CP32( mvc[0], a->l0.mvc[i_ref][0] ); + CP32( mvc[1], a->l0.mvc[i_ref][i+1] ); + CP32( mvc[2], a->l0.mvc[i_ref][i+3] ); + + LOAD_HPELS( &m, h->mb.pic.p_fref[0][i_ref], 0, i_ref, 8*i, 0 ); + LOAD_WPELS( &m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 8*i, 0 ); + + x264_macroblock_cache_ref( h, 2*i, 0, 2, 4, 0, i_ref ); + x264_mb_predict_mv( h, 0, 4*i, 2, m.mvp ); + /* We can only take this shortcut if the first search was performed on ref0. */ + if( h->mb.ref_blind_dupe == i_ref && !ref8[0] ) + { + /* We can just leave the MV from the previous ref search. */ + x264_me_refine_qpel_refdupe( h, &m, NULL ); + } + else + x264_me_search( h, &m, mvc, 3 ); + + m.cost += m.i_ref_cost; + + if( m.cost < l0m->cost ) + h->mc.memcpy_aligned( l0m, &m, sizeof(x264_me_t) ); + } + + /* Early termination based on the current SATD score of partition[0] + plus the estimated SATD score of partition[1] */ + if( a->b_early_terminate && (!i && l0m->cost + a->i_cost_est8x16[1] > i_best_satd * (4 + !!a->i_mbrd) / 4) ) + { + a->l0.i_cost8x16 = COST_MAX; + return; + } + + x264_macroblock_cache_mv_ptr( h, 2*i, 0, 2, 4, 0, l0m->mv ); + x264_macroblock_cache_ref( h, 2*i, 0, 2, 4, 0, l0m->i_ref ); + } + + a->l0.i_cost8x16 = a->l0.me8x16[0].cost + a->l0.me8x16[1].cost; +} + +static ALWAYS_INLINE int x264_mb_analyse_inter_p4x4_chroma_internal( x264_t *h, x264_mb_analysis_t *a, + pixel **p_fref, int i8x8, int size, int chroma ) +{ + ALIGNED_ARRAY_32( pixel, pix1,[16*16] ); + pixel *pix2 = pix1+8; + int i_stride = h->mb.pic.i_stride[1]; + int chroma_h_shift = chroma <= CHROMA_422; + int chroma_v_shift = chroma == CHROMA_420; + int or = 8*(i8x8&1) + (4>>chroma_v_shift)*(i8x8&2)*i_stride; + int i_ref = a->l0.me8x8[i8x8].i_ref; + int mvy_offset = chroma_v_shift && MB_INTERLACED & i_ref ? (h->mb.i_mb_y & 1)*4 - 2 : 0; + x264_weight_t *weight = h->sh.weight[i_ref]; + + // FIXME weight can be done on 4x4 blocks even if mc is smaller +#define CHROMA4x4MC( width, height, me, x, y ) \ + if( chroma == CHROMA_444 ) \ + { \ + int mvx = (me).mv[0] + 4*2*x; \ + int mvy = (me).mv[1] + 4*2*y; \ + h->mc.mc_luma( &pix1[2*x+2*y*16], 16, &h->mb.pic.p_fref[0][i_ref][4], i_stride, \ + mvx, mvy, 2*width, 2*height, &h->sh.weight[i_ref][1] ); \ + h->mc.mc_luma( &pix2[2*x+2*y*16], 16, &h->mb.pic.p_fref[0][i_ref][8], i_stride, \ + mvx, mvy, 2*width, 2*height, &h->sh.weight[i_ref][2] ); \ + } \ + else \ + { \ + int offset = x + (2>>chroma_v_shift)*16*y; \ + int chroma_height = (2>>chroma_v_shift)*height; \ + h->mc.mc_chroma( &pix1[offset], &pix2[offset], 16, &p_fref[4][or+2*x+(2>>chroma_v_shift)*y*i_stride], i_stride, \ + (me).mv[0], (2>>chroma_v_shift)*((me).mv[1]+mvy_offset), width, chroma_height ); \ + if( weight[1].weightfn ) \ + weight[1].weightfn[width>>2]( &pix1[offset], 16, &pix1[offset], 16, &weight[1], chroma_height ); \ + if( weight[2].weightfn ) \ + weight[2].weightfn[width>>2]( &pix2[offset], 16, &pix2[offset], 16, &weight[2], chroma_height ); \ + } + + if( size == PIXEL_4x4 ) + { + x264_me_t *m = a->l0.me4x4[i8x8]; + CHROMA4x4MC( 2,2, m[0], 0,0 ); + CHROMA4x4MC( 2,2, m[1], 2,0 ); + CHROMA4x4MC( 2,2, m[2], 0,2 ); + CHROMA4x4MC( 2,2, m[3], 2,2 ); + } + else if( size == PIXEL_8x4 ) + { + x264_me_t *m = a->l0.me8x4[i8x8]; + CHROMA4x4MC( 4,2, m[0], 0,0 ); + CHROMA4x4MC( 4,2, m[1], 0,2 ); + } + else + { + x264_me_t *m = a->l0.me4x8[i8x8]; + CHROMA4x4MC( 2,4, m[0], 0,0 ); + CHROMA4x4MC( 2,4, m[1], 2,0 ); + } +#undef CHROMA4x4MC + + int oe = (8>>chroma_h_shift)*(i8x8&1) + (4>>chroma_v_shift)*(i8x8&2)*FENC_STRIDE; + int chromapix = chroma == CHROMA_444 ? PIXEL_8x8 : chroma == CHROMA_422 ? PIXEL_4x8 : PIXEL_4x4; + return h->pixf.mbcmp[chromapix]( &h->mb.pic.p_fenc[1][oe], FENC_STRIDE, pix1, 16 ) + + h->pixf.mbcmp[chromapix]( &h->mb.pic.p_fenc[2][oe], FENC_STRIDE, pix2, 16 ); +} + +static int x264_mb_analyse_inter_p4x4_chroma( x264_t *h, x264_mb_analysis_t *a, pixel **p_fref, int i8x8, int size ) +{ + if( CHROMA_FORMAT == CHROMA_444 ) + return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_444 ); + else if( CHROMA_FORMAT == CHROMA_422 ) + return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_422 ); + else + return x264_mb_analyse_inter_p4x4_chroma_internal( h, a, p_fref, i8x8, size, CHROMA_420 ); +} + +static void x264_mb_analyse_inter_p4x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 ) +{ + pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref]; + pixel **p_fenc = h->mb.pic.p_fenc; + const int i_ref = a->l0.me8x8[i8x8].i_ref; + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_8x8; + + for( int i4x4 = 0; i4x4 < 4; i4x4++ ) + { + const int idx = 4*i8x8 + i4x4; + const int x4 = block_idx_x[idx]; + const int y4 = block_idx_y[idx]; + const int i_mvc = (i4x4 == 0); + + x264_me_t *m = &a->l0.me4x4[i8x8][i4x4]; + + m->i_pixel = PIXEL_4x4; + + LOAD_FENC( m, p_fenc, 4*x4, 4*y4 ); + LOAD_HPELS( m, p_fref, 0, i_ref, 4*x4, 4*y4 ); + LOAD_WPELS( m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 4*x4, 4*y4 ); + + x264_mb_predict_mv( h, 0, idx, 1, m->mvp ); + x264_me_search( h, m, &a->l0.me8x8[i8x8].mv, i_mvc ); + + x264_macroblock_cache_mv_ptr( h, x4, y4, 1, 1, 0, m->mv ); + } + a->l0.i_cost4x4[i8x8] = a->l0.me4x4[i8x8][0].cost + + a->l0.me4x4[i8x8][1].cost + + a->l0.me4x4[i8x8][2].cost + + a->l0.me4x4[i8x8][3].cost + + REF_COST( 0, i_ref ) + + a->i_lambda * i_sub_mb_p_cost_table[D_L0_4x4]; + if( h->mb.b_chroma_me && !CHROMA444 ) + a->l0.i_cost4x4[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x4 ); +} + +static void x264_mb_analyse_inter_p8x4( x264_t *h, x264_mb_analysis_t *a, int i8x8 ) +{ + pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref]; + pixel **p_fenc = h->mb.pic.p_fenc; + const int i_ref = a->l0.me8x8[i8x8].i_ref; + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_8x8; + + for( int i8x4 = 0; i8x4 < 2; i8x4++ ) + { + const int idx = 4*i8x8 + 2*i8x4; + const int x4 = block_idx_x[idx]; + const int y4 = block_idx_y[idx]; + const int i_mvc = (i8x4 == 0); + + x264_me_t *m = &a->l0.me8x4[i8x8][i8x4]; + + m->i_pixel = PIXEL_8x4; + + LOAD_FENC( m, p_fenc, 4*x4, 4*y4 ); + LOAD_HPELS( m, p_fref, 0, i_ref, 4*x4, 4*y4 ); + LOAD_WPELS( m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 4*x4, 4*y4 ); + + x264_mb_predict_mv( h, 0, idx, 2, m->mvp ); + x264_me_search( h, m, &a->l0.me4x4[i8x8][0].mv, i_mvc ); + + x264_macroblock_cache_mv_ptr( h, x4, y4, 2, 1, 0, m->mv ); + } + a->l0.i_cost8x4[i8x8] = a->l0.me8x4[i8x8][0].cost + a->l0.me8x4[i8x8][1].cost + + REF_COST( 0, i_ref ) + + a->i_lambda * i_sub_mb_p_cost_table[D_L0_8x4]; + if( h->mb.b_chroma_me && !CHROMA444 ) + a->l0.i_cost8x4[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_8x4 ); +} + +static void x264_mb_analyse_inter_p4x8( x264_t *h, x264_mb_analysis_t *a, int i8x8 ) +{ + pixel **p_fref = h->mb.pic.p_fref[0][a->l0.me8x8[i8x8].i_ref]; + pixel **p_fenc = h->mb.pic.p_fenc; + const int i_ref = a->l0.me8x8[i8x8].i_ref; + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_8x8; + + for( int i4x8 = 0; i4x8 < 2; i4x8++ ) + { + const int idx = 4*i8x8 + i4x8; + const int x4 = block_idx_x[idx]; + const int y4 = block_idx_y[idx]; + const int i_mvc = (i4x8 == 0); + + x264_me_t *m = &a->l0.me4x8[i8x8][i4x8]; + + m->i_pixel = PIXEL_4x8; + + LOAD_FENC( m, p_fenc, 4*x4, 4*y4 ); + LOAD_HPELS( m, p_fref, 0, i_ref, 4*x4, 4*y4 ); + LOAD_WPELS( m, h->mb.pic.p_fref_w[i_ref], 0, i_ref, 4*x4, 4*y4 ); + + x264_mb_predict_mv( h, 0, idx, 1, m->mvp ); + x264_me_search( h, m, &a->l0.me4x4[i8x8][0].mv, i_mvc ); + + x264_macroblock_cache_mv_ptr( h, x4, y4, 1, 2, 0, m->mv ); + } + a->l0.i_cost4x8[i8x8] = a->l0.me4x8[i8x8][0].cost + a->l0.me4x8[i8x8][1].cost + + REF_COST( 0, i_ref ) + + a->i_lambda * i_sub_mb_p_cost_table[D_L0_4x8]; + if( h->mb.b_chroma_me && !CHROMA444 ) + a->l0.i_cost4x8[i8x8] += x264_mb_analyse_inter_p4x4_chroma( h, a, p_fref, i8x8, PIXEL_4x8 ); +} + +static ALWAYS_INLINE int x264_analyse_bi_chroma( x264_t *h, x264_mb_analysis_t *a, int idx, int i_pixel ) +{ + ALIGNED_ARRAY_32( pixel, pix, [4],[16*16] ); + ALIGNED_ARRAY_32( pixel, bi, [2],[16*16] ); + int i_chroma_cost = 0; + int chromapix = h->luma2chroma_pixel[i_pixel]; + +#define COST_BI_CHROMA( m0, m1, width, height ) \ +{ \ + if( CHROMA444 ) \ + { \ + h->mc.mc_luma( pix[0], 16, &m0.p_fref[4], m0.i_stride[1], \ + m0.mv[0], m0.mv[1], width, height, x264_weight_none ); \ + h->mc.mc_luma( pix[1], 16, &m0.p_fref[8], m0.i_stride[2], \ + m0.mv[0], m0.mv[1], width, height, x264_weight_none ); \ + h->mc.mc_luma( pix[2], 16, &m1.p_fref[4], m1.i_stride[1], \ + m1.mv[0], m1.mv[1], width, height, x264_weight_none ); \ + h->mc.mc_luma( pix[3], 16, &m1.p_fref[8], m1.i_stride[2], \ + m1.mv[0], m1.mv[1], width, height, x264_weight_none ); \ + } \ + else \ + { \ + int v_shift = CHROMA_V_SHIFT; \ + int l0_mvy_offset = v_shift & MB_INTERLACED & m0.i_ref ? (h->mb.i_mb_y & 1)*4 - 2 : 0; \ + int l1_mvy_offset = v_shift & MB_INTERLACED & m1.i_ref ? (h->mb.i_mb_y & 1)*4 - 2 : 0; \ + h->mc.mc_chroma( pix[0], pix[1], 16, m0.p_fref[4], m0.i_stride[1], \ + m0.mv[0], 2*(m0.mv[1]+l0_mvy_offset)>>v_shift, width>>1, height>>v_shift ); \ + h->mc.mc_chroma( pix[2], pix[3], 16, m1.p_fref[4], m1.i_stride[1], \ + m1.mv[0], 2*(m1.mv[1]+l1_mvy_offset)>>v_shift, width>>1, height>>v_shift ); \ + } \ + h->mc.avg[chromapix]( bi[0], 16, pix[0], 16, pix[2], 16, h->mb.bipred_weight[m0.i_ref][m1.i_ref] ); \ + h->mc.avg[chromapix]( bi[1], 16, pix[1], 16, pix[3], 16, h->mb.bipred_weight[m0.i_ref][m1.i_ref] ); \ + i_chroma_cost = h->pixf.mbcmp[chromapix]( m0.p_fenc[1], FENC_STRIDE, bi[0], 16 ) \ + + h->pixf.mbcmp[chromapix]( m0.p_fenc[2], FENC_STRIDE, bi[1], 16 ); \ +} + + if( i_pixel == PIXEL_16x16 ) + COST_BI_CHROMA( a->l0.bi16x16, a->l1.bi16x16, 16, 16 ) + else if( i_pixel == PIXEL_16x8 ) + COST_BI_CHROMA( a->l0.me16x8[idx], a->l1.me16x8[idx], 16, 8 ) + else if( i_pixel == PIXEL_8x16 ) + COST_BI_CHROMA( a->l0.me8x16[idx], a->l1.me8x16[idx], 8, 16 ) + else + COST_BI_CHROMA( a->l0.me8x8[idx], a->l1.me8x8[idx], 8, 8 ) + + return i_chroma_cost; +} + +static void x264_mb_analyse_inter_direct( x264_t *h, x264_mb_analysis_t *a ) +{ + /* Assumes that fdec still contains the results of + * x264_mb_predict_mv_direct16x16 and x264_mb_mc */ + + pixel *p_fenc = h->mb.pic.p_fenc[0]; + pixel *p_fdec = h->mb.pic.p_fdec[0]; + + a->i_cost16x16direct = a->i_lambda * i_mb_b_cost_table[B_DIRECT]; + if( h->param.analyse.inter & X264_ANALYSE_BSUB16x16 ) + { + int chromapix = h->luma2chroma_pixel[PIXEL_8x8]; + + for( int i = 0; i < 4; i++ ) + { + const int x = (i&1)*8; + const int y = (i>>1)*8; + a->i_cost8x8direct[i] = h->pixf.mbcmp[PIXEL_8x8]( &p_fenc[x+y*FENC_STRIDE], FENC_STRIDE, + &p_fdec[x+y*FDEC_STRIDE], FDEC_STRIDE ); + if( h->mb.b_chroma_me ) + { + int fenc_offset = (x>>CHROMA_H_SHIFT) + (y>>CHROMA_V_SHIFT)*FENC_STRIDE; + int fdec_offset = (x>>CHROMA_H_SHIFT) + (y>>CHROMA_V_SHIFT)*FDEC_STRIDE; + a->i_cost8x8direct[i] += h->pixf.mbcmp[chromapix]( &h->mb.pic.p_fenc[1][fenc_offset], FENC_STRIDE, + &h->mb.pic.p_fdec[1][fdec_offset], FDEC_STRIDE ) + + h->pixf.mbcmp[chromapix]( &h->mb.pic.p_fenc[2][fenc_offset], FENC_STRIDE, + &h->mb.pic.p_fdec[2][fdec_offset], FDEC_STRIDE ); + } + a->i_cost16x16direct += a->i_cost8x8direct[i]; + + /* mb type cost */ + a->i_cost8x8direct[i] += a->i_lambda * i_sub_mb_b_cost_table[D_DIRECT_8x8]; + } + } + else + { + a->i_cost16x16direct += h->pixf.mbcmp[PIXEL_16x16]( p_fenc, FENC_STRIDE, p_fdec, FDEC_STRIDE ); + if( h->mb.b_chroma_me ) + { + int chromapix = h->luma2chroma_pixel[PIXEL_16x16]; + a->i_cost16x16direct += h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[1], FENC_STRIDE, h->mb.pic.p_fdec[1], FDEC_STRIDE ) + + h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[2], FENC_STRIDE, h->mb.pic.p_fdec[2], FDEC_STRIDE ); + } + } +} + +static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a ) +{ + ALIGNED_ARRAY_32( pixel, pix0,[16*16] ); + ALIGNED_ARRAY_32( pixel, pix1,[16*16] ); + pixel *src0, *src1; + intptr_t stride0 = 16, stride1 = 16; + int i_ref, i_mvc; + ALIGNED_4( int16_t mvc[9][2] ); + int try_skip = a->b_try_skip; + int list1_skipped = 0; + int i_halfpel_thresh[2] = {INT_MAX, INT_MAX}; + int *p_halfpel_thresh[2] = {(a->b_early_terminate && h->mb.pic.i_fref[0]>1) ? &i_halfpel_thresh[0] : NULL, + (a->b_early_terminate && h->mb.pic.i_fref[1]>1) ? &i_halfpel_thresh[1] : NULL}; + + x264_me_t m; + m.i_pixel = PIXEL_16x16; + + LOAD_FENC( &m, h->mb.pic.p_fenc, 0, 0 ); + + /* 16x16 Search on list 0 and list 1 */ + a->l0.me16x16.cost = INT_MAX; + a->l1.me16x16.cost = INT_MAX; + for( int l = 1; l >= 0; ) + { + x264_mb_analysis_list_t *lX = l ? &a->l1 : &a->l0; + + /* This loop is extremely munged in order to facilitate the following order of operations, + * necessary for an efficient fast skip. + * 1. Search list1 ref0. + * 2. Search list0 ref0. + * 3. Try skip. + * 4. Search the rest of list0. + * 5. Go back and finish list1. + */ + for( i_ref = (list1_skipped && l == 1) ? 1 : 0; i_ref < h->mb.pic.i_fref[l]; i_ref++ ) + { + if( try_skip && l == 1 && i_ref > 0 ) + { + list1_skipped = 1; + break; + } + + m.i_ref_cost = REF_COST( l, i_ref ); + + /* search with ref */ + LOAD_HPELS( &m, h->mb.pic.p_fref[l][i_ref], l, i_ref, 0, 0 ); + x264_mb_predict_mv_16x16( h, l, i_ref, m.mvp ); + x264_mb_predict_mv_ref16x16( h, l, i_ref, mvc, &i_mvc ); + x264_me_search_ref( h, &m, mvc, i_mvc, p_halfpel_thresh[l] ); + + /* add ref cost */ + m.cost += m.i_ref_cost; + + if( m.cost < lX->me16x16.cost ) + h->mc.memcpy_aligned( &lX->me16x16, &m, sizeof(x264_me_t) ); + + /* save mv for predicting neighbors */ + CP32( lX->mvc[i_ref][0], m.mv ); + CP32( h->mb.mvr[l][i_ref][h->mb.i_mb_xy], m.mv ); + + /* Fast skip detection. */ + if( i_ref == 0 && try_skip ) + { + if( abs(lX->me16x16.mv[0]-h->mb.cache.direct_mv[l][0][0]) + + abs(lX->me16x16.mv[1]-h->mb.cache.direct_mv[l][0][1]) > 1 ) + { + try_skip = 0; + } + else if( !l ) + { + /* We already tested skip */ + h->mb.i_type = B_SKIP; + x264_analyse_update_cache( h, a ); + return; + } + } + } + if( list1_skipped && l == 1 && i_ref == h->mb.pic.i_fref[1] ) + break; + if( list1_skipped && l == 0 ) + l = 1; + else + l--; + } + + /* get cost of BI mode */ + h->mc.memcpy_aligned( &a->l0.bi16x16, &a->l0.me16x16, sizeof(x264_me_t) ); + h->mc.memcpy_aligned( &a->l1.bi16x16, &a->l1.me16x16, sizeof(x264_me_t) ); + int ref_costs = REF_COST( 0, a->l0.bi16x16.i_ref ) + REF_COST( 1, a->l1.bi16x16.i_ref ); + src0 = h->mc.get_ref( pix0, &stride0, + h->mb.pic.p_fref[0][a->l0.bi16x16.i_ref], h->mb.pic.i_stride[0], + a->l0.bi16x16.mv[0], a->l0.bi16x16.mv[1], 16, 16, x264_weight_none ); + src1 = h->mc.get_ref( pix1, &stride1, + h->mb.pic.p_fref[1][a->l1.bi16x16.i_ref], h->mb.pic.i_stride[0], + a->l1.bi16x16.mv[0], a->l1.bi16x16.mv[1], 16, 16, x264_weight_none ); + + h->mc.avg[PIXEL_16x16]( pix0, 16, src0, stride0, src1, stride1, h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref] ); + + a->i_cost16x16bi = h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[0], FENC_STRIDE, pix0, 16 ) + + ref_costs + + a->l0.bi16x16.cost_mv + + a->l1.bi16x16.cost_mv; + + if( h->mb.b_chroma_me ) + a->i_cost16x16bi += x264_analyse_bi_chroma( h, a, 0, PIXEL_16x16 ); + + /* Always try the 0,0,0,0 vector; helps avoid errant motion vectors in fades */ + if( M32( a->l0.bi16x16.mv ) | M32( a->l1.bi16x16.mv ) ) + { + int l0_mv_cost = a->l0.bi16x16.p_cost_mv[-a->l0.bi16x16.mvp[0]] + + a->l0.bi16x16.p_cost_mv[-a->l0.bi16x16.mvp[1]]; + int l1_mv_cost = a->l1.bi16x16.p_cost_mv[-a->l1.bi16x16.mvp[0]] + + a->l1.bi16x16.p_cost_mv[-a->l1.bi16x16.mvp[1]]; + h->mc.avg[PIXEL_16x16]( pix0, 16, h->mb.pic.p_fref[0][a->l0.bi16x16.i_ref][0], h->mb.pic.i_stride[0], + h->mb.pic.p_fref[1][a->l1.bi16x16.i_ref][0], h->mb.pic.i_stride[0], + h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref] ); + int cost00 = h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[0], FENC_STRIDE, pix0, 16 ) + + ref_costs + l0_mv_cost + l1_mv_cost; + + if( h->mb.b_chroma_me && cost00 < a->i_cost16x16bi ) + { + ALIGNED_ARRAY_16( pixel, bi, [16*FENC_STRIDE] ); + + if( CHROMA444 ) + { + h->mc.avg[PIXEL_16x16]( bi, FENC_STRIDE, h->mb.pic.p_fref[0][a->l0.bi16x16.i_ref][4], h->mb.pic.i_stride[1], + h->mb.pic.p_fref[1][a->l1.bi16x16.i_ref][4], h->mb.pic.i_stride[1], + h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref] ); + cost00 += h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[1], FENC_STRIDE, bi, FENC_STRIDE ); + h->mc.avg[PIXEL_16x16]( bi, FENC_STRIDE, h->mb.pic.p_fref[0][a->l0.bi16x16.i_ref][8], h->mb.pic.i_stride[2], + h->mb.pic.p_fref[1][a->l1.bi16x16.i_ref][8], h->mb.pic.i_stride[2], + h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref] ); + cost00 += h->pixf.mbcmp[PIXEL_16x16]( h->mb.pic.p_fenc[2], FENC_STRIDE, bi, FENC_STRIDE ); + } + else + { + ALIGNED_ARRAY_32( pixel, pixuv, [2],[16*FENC_STRIDE] ); + int chromapix = h->luma2chroma_pixel[PIXEL_16x16]; + int v_shift = CHROMA_V_SHIFT; + + if( v_shift & MB_INTERLACED & a->l0.bi16x16.i_ref ) + { + int l0_mvy_offset = (h->mb.i_mb_y & 1)*4 - 2; + h->mc.mc_chroma( pixuv[0], pixuv[0]+8, FENC_STRIDE, h->mb.pic.p_fref[0][a->l0.bi16x16.i_ref][4], + h->mb.pic.i_stride[1], 0, 0 + l0_mvy_offset, 8, 8 ); + } + else + h->mc.load_deinterleave_chroma_fenc( pixuv[0], h->mb.pic.p_fref[0][a->l0.bi16x16.i_ref][4], + h->mb.pic.i_stride[1], 16>>v_shift ); + + if( v_shift & MB_INTERLACED & a->l1.bi16x16.i_ref ) + { + int l1_mvy_offset = (h->mb.i_mb_y & 1)*4 - 2; + h->mc.mc_chroma( pixuv[1], pixuv[1]+8, FENC_STRIDE, h->mb.pic.p_fref[1][a->l1.bi16x16.i_ref][4], + h->mb.pic.i_stride[1], 0, 0 + l1_mvy_offset, 8, 8 ); + } + else + h->mc.load_deinterleave_chroma_fenc( pixuv[1], h->mb.pic.p_fref[1][a->l1.bi16x16.i_ref][4], + h->mb.pic.i_stride[1], 16>>v_shift ); + + h->mc.avg[chromapix]( bi, FENC_STRIDE, pixuv[0], FENC_STRIDE, pixuv[1], FENC_STRIDE, + h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref] ); + h->mc.avg[chromapix]( bi+8, FENC_STRIDE, pixuv[0]+8, FENC_STRIDE, pixuv[1]+8, FENC_STRIDE, + h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref] ); + + cost00 += h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[1], FENC_STRIDE, bi, FENC_STRIDE ) + + h->pixf.mbcmp[chromapix]( h->mb.pic.p_fenc[2], FENC_STRIDE, bi+8, FENC_STRIDE ); + } + } + + if( cost00 < a->i_cost16x16bi ) + { + M32( a->l0.bi16x16.mv ) = 0; + M32( a->l1.bi16x16.mv ) = 0; + a->l0.bi16x16.cost_mv = l0_mv_cost; + a->l1.bi16x16.cost_mv = l1_mv_cost; + a->i_cost16x16bi = cost00; + } + } + + /* mb type cost */ + a->i_cost16x16bi += a->i_lambda * i_mb_b_cost_table[B_BI_BI]; + a->l0.me16x16.cost += a->i_lambda * i_mb_b_cost_table[B_L0_L0]; + a->l1.me16x16.cost += a->i_lambda * i_mb_b_cost_table[B_L1_L1]; +} + +static inline void x264_mb_cache_mv_p8x8( x264_t *h, x264_mb_analysis_t *a, int i ) +{ + int x = 2*(i&1); + int y = i&2; + + switch( h->mb.i_sub_partition[i] ) + { + case D_L0_8x8: + x264_macroblock_cache_mv_ptr( h, x, y, 2, 2, 0, a->l0.me8x8[i].mv ); + break; + case D_L0_8x4: + x264_macroblock_cache_mv_ptr( h, x, y+0, 2, 1, 0, a->l0.me8x4[i][0].mv ); + x264_macroblock_cache_mv_ptr( h, x, y+1, 2, 1, 0, a->l0.me8x4[i][1].mv ); + break; + case D_L0_4x8: + x264_macroblock_cache_mv_ptr( h, x+0, y, 1, 2, 0, a->l0.me4x8[i][0].mv ); + x264_macroblock_cache_mv_ptr( h, x+1, y, 1, 2, 0, a->l0.me4x8[i][1].mv ); + break; + case D_L0_4x4: + x264_macroblock_cache_mv_ptr( h, x+0, y+0, 1, 1, 0, a->l0.me4x4[i][0].mv ); + x264_macroblock_cache_mv_ptr( h, x+1, y+0, 1, 1, 0, a->l0.me4x4[i][1].mv ); + x264_macroblock_cache_mv_ptr( h, x+0, y+1, 1, 1, 0, a->l0.me4x4[i][2].mv ); + x264_macroblock_cache_mv_ptr( h, x+1, y+1, 1, 1, 0, a->l0.me4x4[i][3].mv ); + break; + default: + x264_log( h, X264_LOG_ERROR, "internal error\n" ); + break; + } +} + +static void x264_mb_load_mv_direct8x8( x264_t *h, int idx ) +{ + int x = 2*(idx&1); + int y = idx&2; + x264_macroblock_cache_ref( h, x, y, 2, 2, 0, h->mb.cache.direct_ref[0][idx] ); + x264_macroblock_cache_ref( h, x, y, 2, 2, 1, h->mb.cache.direct_ref[1][idx] ); + x264_macroblock_cache_mv_ptr( h, x, y, 2, 2, 0, h->mb.cache.direct_mv[0][idx] ); + x264_macroblock_cache_mv_ptr( h, x, y, 2, 2, 1, h->mb.cache.direct_mv[1][idx] ); +} + +#define CACHE_MV_BI(x,y,dx,dy,me0,me1,part) \ + if( x264_mb_partition_listX_table[0][part] ) \ + { \ + x264_macroblock_cache_ref( h, x,y,dx,dy, 0, me0.i_ref ); \ + x264_macroblock_cache_mv_ptr( h, x,y,dx,dy, 0, me0.mv ); \ + } \ + else \ + { \ + x264_macroblock_cache_ref( h, x,y,dx,dy, 0, -1 ); \ + x264_macroblock_cache_mv( h, x,y,dx,dy, 0, 0 ); \ + if( b_mvd ) \ + x264_macroblock_cache_mvd( h, x,y,dx,dy, 0, 0 ); \ + } \ + if( x264_mb_partition_listX_table[1][part] ) \ + { \ + x264_macroblock_cache_ref( h, x,y,dx,dy, 1, me1.i_ref ); \ + x264_macroblock_cache_mv_ptr( h, x,y,dx,dy, 1, me1.mv ); \ + } \ + else \ + { \ + x264_macroblock_cache_ref( h, x,y,dx,dy, 1, -1 ); \ + x264_macroblock_cache_mv( h, x,y,dx,dy, 1, 0 ); \ + if( b_mvd ) \ + x264_macroblock_cache_mvd( h, x,y,dx,dy, 1, 0 ); \ + } + +static inline void x264_mb_cache_mv_b8x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd ) +{ + int x = 2*(i&1); + int y = i&2; + if( h->mb.i_sub_partition[i] == D_DIRECT_8x8 ) + { + x264_mb_load_mv_direct8x8( h, i ); + if( b_mvd ) + { + x264_macroblock_cache_mvd( h, x, y, 2, 2, 0, 0 ); + x264_macroblock_cache_mvd( h, x, y, 2, 2, 1, 0 ); + x264_macroblock_cache_skip( h, x, y, 2, 2, 1 ); + } + } + else + { + CACHE_MV_BI( x, y, 2, 2, a->l0.me8x8[i], a->l1.me8x8[i], h->mb.i_sub_partition[i] ); + } +} +static inline void x264_mb_cache_mv_b16x8( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd ) +{ + CACHE_MV_BI( 0, 2*i, 4, 2, a->l0.me16x8[i], a->l1.me16x8[i], a->i_mb_partition16x8[i] ); +} +static inline void x264_mb_cache_mv_b8x16( x264_t *h, x264_mb_analysis_t *a, int i, int b_mvd ) +{ + CACHE_MV_BI( 2*i, 0, 2, 4, a->l0.me8x16[i], a->l1.me8x16[i], a->i_mb_partition8x16[i] ); +} +#undef CACHE_MV_BI + +static void x264_mb_analyse_inter_b8x8_mixed_ref( x264_t *h, x264_mb_analysis_t *a ) +{ + ALIGNED_ARRAY_16( pixel, pix,[2],[8*8] ); + int i_maxref[2] = {h->mb.pic.i_fref[0]-1, h->mb.pic.i_fref[1]-1}; + + /* early termination: if 16x16 chose ref 0, then evalute no refs older + * than those used by the neighbors */ + #define CHECK_NEIGHBOUR(i)\ + {\ + int ref = h->mb.cache.ref[l][X264_SCAN8_0+i];\ + if( ref > i_maxref[l] )\ + i_maxref[l] = ref;\ + } + + for( int l = 0; l < 2; l++ ) + { + x264_mb_analysis_list_t *lX = l ? &a->l1 : &a->l0; + if( i_maxref[l] > 0 && lX->me16x16.i_ref == 0 && + h->mb.i_mb_type_top > 0 && h->mb.i_mb_type_left[0] > 0 ) + { + i_maxref[l] = 0; + CHECK_NEIGHBOUR( -8 - 1 ); + CHECK_NEIGHBOUR( -8 + 0 ); + CHECK_NEIGHBOUR( -8 + 2 ); + CHECK_NEIGHBOUR( -8 + 4 ); + CHECK_NEIGHBOUR( 0 - 1 ); + CHECK_NEIGHBOUR( 2*8 - 1 ); + } + } + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_8x8; + + a->i_cost8x8bi = 0; + + for( int i = 0; i < 4; i++ ) + { + int x8 = i&1; + int y8 = i>>1; + int i_part_cost; + int i_part_cost_bi; + intptr_t stride[2] = {8,8}; + pixel *src[2]; + x264_me_t m; + m.i_pixel = PIXEL_8x8; + LOAD_FENC( &m, h->mb.pic.p_fenc, 8*x8, 8*y8 ); + + for( int l = 0; l < 2; l++ ) + { + x264_mb_analysis_list_t *lX = l ? &a->l1 : &a->l0; + + lX->me8x8[i].cost = INT_MAX; + for( int i_ref = 0; i_ref <= i_maxref[l]; i_ref++ ) + { + m.i_ref_cost = REF_COST( l, i_ref ); + + LOAD_HPELS( &m, h->mb.pic.p_fref[l][i_ref], l, i_ref, 8*x8, 8*y8 ); + + x264_macroblock_cache_ref( h, x8*2, y8*2, 2, 2, l, i_ref ); + x264_mb_predict_mv( h, l, 4*i, 2, m.mvp ); + x264_me_search( h, &m, lX->mvc[i_ref], i+1 ); + m.cost += m.i_ref_cost; + + if( m.cost < lX->me8x8[i].cost ) + { + h->mc.memcpy_aligned( &lX->me8x8[i], &m, sizeof(x264_me_t) ); + a->i_satd8x8[l][i] = m.cost - ( m.cost_mv + m.i_ref_cost ); + } + + /* save mv for predicting other partitions within this MB */ + CP32( lX->mvc[i_ref][i+1], m.mv ); + } + } + + /* BI mode */ + src[0] = h->mc.get_ref( pix[0], &stride[0], a->l0.me8x8[i].p_fref, a->l0.me8x8[i].i_stride[0], + a->l0.me8x8[i].mv[0], a->l0.me8x8[i].mv[1], 8, 8, x264_weight_none ); + src[1] = h->mc.get_ref( pix[1], &stride[1], a->l1.me8x8[i].p_fref, a->l1.me8x8[i].i_stride[0], + a->l1.me8x8[i].mv[0], a->l1.me8x8[i].mv[1], 8, 8, x264_weight_none ); + h->mc.avg[PIXEL_8x8]( pix[0], 8, src[0], stride[0], src[1], stride[1], + h->mb.bipred_weight[a->l0.me8x8[i].i_ref][a->l1.me8x8[i].i_ref] ); + + a->i_satd8x8[2][i] = h->pixf.mbcmp[PIXEL_8x8]( a->l0.me8x8[i].p_fenc[0], FENC_STRIDE, pix[0], 8 ); + i_part_cost_bi = a->i_satd8x8[2][i] + a->l0.me8x8[i].cost_mv + a->l1.me8x8[i].cost_mv + + a->l0.me8x8[i].i_ref_cost + a->l1.me8x8[i].i_ref_cost + + a->i_lambda * i_sub_mb_b_cost_table[D_BI_8x8]; + + if( h->mb.b_chroma_me ) + { + int i_chroma_cost = x264_analyse_bi_chroma( h, a, i, PIXEL_8x8 ); + i_part_cost_bi += i_chroma_cost; + a->i_satd8x8[2][i] += i_chroma_cost; + } + + a->l0.me8x8[i].cost += a->i_lambda * i_sub_mb_b_cost_table[D_L0_8x8]; + a->l1.me8x8[i].cost += a->i_lambda * i_sub_mb_b_cost_table[D_L1_8x8]; + + i_part_cost = a->l0.me8x8[i].cost; + h->mb.i_sub_partition[i] = D_L0_8x8; + COPY2_IF_LT( i_part_cost, a->l1.me8x8[i].cost, h->mb.i_sub_partition[i], D_L1_8x8 ); + COPY2_IF_LT( i_part_cost, i_part_cost_bi, h->mb.i_sub_partition[i], D_BI_8x8 ); + COPY2_IF_LT( i_part_cost, a->i_cost8x8direct[i], h->mb.i_sub_partition[i], D_DIRECT_8x8 ); + a->i_cost8x8bi += i_part_cost; + + /* XXX Needed for x264_mb_predict_mv */ + x264_mb_cache_mv_b8x8( h, a, i, 0 ); + } + + /* mb type cost */ + a->i_cost8x8bi += a->i_lambda * i_mb_b_cost_table[B_8x8]; +} + +static void x264_mb_analyse_inter_b8x8( x264_t *h, x264_mb_analysis_t *a ) +{ + pixel **p_fref[2] = + { h->mb.pic.p_fref[0][a->l0.me16x16.i_ref], + h->mb.pic.p_fref[1][a->l1.me16x16.i_ref] }; + ALIGNED_ARRAY_16( pixel, pix,[2],[8*8] ); + + /* XXX Needed for x264_mb_predict_mv */ + h->mb.i_partition = D_8x8; + + a->i_cost8x8bi = 0; + + for( int i = 0; i < 4; i++ ) + { + int x8 = i&1; + int y8 = i>>1; + int i_part_cost; + int i_part_cost_bi = 0; + intptr_t stride[2] = {8,8}; + pixel *src[2]; + + for( int l = 0; l < 2; l++ ) + { + x264_mb_analysis_list_t *lX = l ? &a->l1 : &a->l0; + x264_me_t *m = &lX->me8x8[i]; + m->i_pixel = PIXEL_8x8; + LOAD_FENC( m, h->mb.pic.p_fenc, 8*x8, 8*y8 ); + + m->i_ref_cost = REF_COST( l, lX->me16x16.i_ref ); + m->i_ref = lX->me16x16.i_ref; + + LOAD_HPELS( m, p_fref[l], l, lX->me16x16.i_ref, 8*x8, 8*y8 ); + + x264_macroblock_cache_ref( h, x8*2, y8*2, 2, 2, l, lX->me16x16.i_ref ); + x264_mb_predict_mv( h, l, 4*i, 2, m->mvp ); + x264_me_search( h, m, &lX->me16x16.mv, 1 ); + a->i_satd8x8[l][i] = m->cost - m->cost_mv; + m->cost += m->i_ref_cost; + + x264_macroblock_cache_mv_ptr( h, 2*x8, 2*y8, 2, 2, l, m->mv ); + + /* save mv for predicting other partitions within this MB */ + CP32( lX->mvc[lX->me16x16.i_ref][i+1], m->mv ); + + /* BI mode */ + src[l] = h->mc.get_ref( pix[l], &stride[l], m->p_fref, m->i_stride[0], + m->mv[0], m->mv[1], 8, 8, x264_weight_none ); + i_part_cost_bi += m->cost_mv + m->i_ref_cost; + } + h->mc.avg[PIXEL_8x8]( pix[0], 8, src[0], stride[0], src[1], stride[1], h->mb.bipred_weight[a->l0.me16x16.i_ref][a->l1.me16x16.i_ref] ); + a->i_satd8x8[2][i] = h->pixf.mbcmp[PIXEL_8x8]( a->l0.me8x8[i].p_fenc[0], FENC_STRIDE, pix[0], 8 ); + i_part_cost_bi += a->i_satd8x8[2][i] + a->i_lambda * i_sub_mb_b_cost_table[D_BI_8x8]; + a->l0.me8x8[i].cost += a->i_lambda * i_sub_mb_b_cost_table[D_L0_8x8]; + a->l1.me8x8[i].cost += a->i_lambda * i_sub_mb_b_cost_table[D_L1_8x8]; + + if( h->mb.b_chroma_me ) + { + int i_chroma_cost = x264_analyse_bi_chroma( h, a, i, PIXEL_8x8 ); + i_part_cost_bi += i_chroma_cost; + a->i_satd8x8[2][i] += i_chroma_cost; + } + + i_part_cost = a->l0.me8x8[i].cost; + h->mb.i_sub_partition[i] = D_L0_8x8; + COPY2_IF_LT( i_part_cost, a->l1.me8x8[i].cost, h->mb.i_sub_partition[i], D_L1_8x8 ); + COPY2_IF_LT( i_part_cost, i_part_cost_bi, h->mb.i_sub_partition[i], D_BI_8x8 ); + COPY2_IF_LT( i_part_cost, a->i_cost8x8direct[i], h->mb.i_sub_partition[i], D_DIRECT_8x8 ); + a->i_cost8x8bi += i_part_cost; + + /* XXX Needed for x264_mb_predict_mv */ + x264_mb_cache_mv_b8x8( h, a, i, 0 ); + } + + /* mb type cost */ + a->i_cost8x8bi += a->i_lambda * i_mb_b_cost_table[B_8x8]; +} + +static void x264_mb_analyse_inter_b16x8( x264_t *h, x264_mb_analysis_t *a, int i_best_satd ) +{ + ALIGNED_ARRAY_32( pixel, pix,[2],[16*8] ); + ALIGNED_4( int16_t mvc[3][2] ); + + h->mb.i_partition = D_16x8; + a->i_cost16x8bi = 0; + + for( int i = 0; i < 2; i++ ) + { + int i_part_cost; + int i_part_cost_bi = 0; + intptr_t stride[2] = {16,16}; + pixel *src[2]; + x264_me_t m; + m.i_pixel = PIXEL_16x8; + LOAD_FENC( &m, h->mb.pic.p_fenc, 0, 8*i ); + + for( int l = 0; l < 2; l++ ) + { + x264_mb_analysis_list_t *lX = l ? &a->l1 : &a->l0; + int ref8[2] = { lX->me8x8[2*i].i_ref, lX->me8x8[2*i+1].i_ref }; + int i_ref8s = ( ref8[0] == ref8[1] ) ? 1 : 2; + lX->me16x8[i].cost = INT_MAX; + for( int j = 0; j < i_ref8s; j++ ) + { + int i_ref = ref8[j]; + m.i_ref_cost = REF_COST( l, i_ref ); + + LOAD_HPELS( &m, h->mb.pic.p_fref[l][i_ref], l, i_ref, 0, 8*i ); + + CP32( mvc[0], lX->mvc[i_ref][0] ); + CP32( mvc[1], lX->mvc[i_ref][2*i+1] ); + CP32( mvc[2], lX->mvc[i_ref][2*i+2] ); + + x264_macroblock_cache_ref( h, 0, 2*i, 4, 2, l, i_ref ); + x264_mb_predict_mv( h, l, 8*i, 4, m.mvp ); + x264_me_search( h, &m, mvc, 3 ); + m.cost += m.i_ref_cost; + + if( m.cost < lX->me16x8[i].cost ) + h->mc.memcpy_aligned( &lX->me16x8[i], &m, sizeof(x264_me_t) ); + } + } + + /* BI mode */ + src[0] = h->mc.get_ref( pix[0], &stride[0], a->l0.me16x8[i].p_fref, a->l0.me16x8[i].i_stride[0], + a->l0.me16x8[i].mv[0], a->l0.me16x8[i].mv[1], 16, 8, x264_weight_none ); + src[1] = h->mc.get_ref( pix[1], &stride[1], a->l1.me16x8[i].p_fref, a->l1.me16x8[i].i_stride[0], + a->l1.me16x8[i].mv[0], a->l1.me16x8[i].mv[1], 16, 8, x264_weight_none ); + h->mc.avg[PIXEL_16x8]( pix[0], 16, src[0], stride[0], src[1], stride[1], + h->mb.bipred_weight[a->l0.me16x8[i].i_ref][a->l1.me16x8[i].i_ref] ); + + i_part_cost_bi = h->pixf.mbcmp[PIXEL_16x8]( a->l0.me16x8[i].p_fenc[0], FENC_STRIDE, pix[0], 16 ) + + a->l0.me16x8[i].cost_mv + a->l1.me16x8[i].cost_mv + a->l0.me16x8[i].i_ref_cost + + a->l1.me16x8[i].i_ref_cost; + + if( h->mb.b_chroma_me ) + i_part_cost_bi += x264_analyse_bi_chroma( h, a, i, PIXEL_16x8 ); + + i_part_cost = a->l0.me16x8[i].cost; + a->i_mb_partition16x8[i] = D_L0_8x8; /* not actually 8x8, only the L0 matters */ + + if( a->l1.me16x8[i].cost < i_part_cost ) + { + i_part_cost = a->l1.me16x8[i].cost; + a->i_mb_partition16x8[i] = D_L1_8x8; + } + if( i_part_cost_bi + a->i_lambda * 1 < i_part_cost ) + { + i_part_cost = i_part_cost_bi; + a->i_mb_partition16x8[i] = D_BI_8x8; + } + a->i_cost16x8bi += i_part_cost; + + /* Early termination based on the current SATD score of partition[0] + plus the estimated SATD score of partition[1] */ + if( a->b_early_terminate && (!i && i_part_cost + a->i_cost_est16x8[1] > i_best_satd + * (16 + (!!a->i_mbrd + !!h->mb.i_psy_rd))/16) ) + { + a->i_cost16x8bi = COST_MAX; + return; + } + + x264_mb_cache_mv_b16x8( h, a, i, 0 ); + } + + /* mb type cost */ + a->i_mb_type16x8 = B_L0_L0 + + (a->i_mb_partition16x8[0]>>2) * 3 + + (a->i_mb_partition16x8[1]>>2); + a->i_cost16x8bi += a->i_lambda * i_mb_b16x8_cost_table[a->i_mb_type16x8]; +} + +static void x264_mb_analyse_inter_b8x16( x264_t *h, x264_mb_analysis_t *a, int i_best_satd ) +{ + ALIGNED_ARRAY_16( pixel, pix,[2],[8*16] ); + ALIGNED_4( int16_t mvc[3][2] ); + + h->mb.i_partition = D_8x16; + a->i_cost8x16bi = 0; + + for( int i = 0; i < 2; i++ ) + { + int i_part_cost; + int i_part_cost_bi = 0; + intptr_t stride[2] = {8,8}; + pixel *src[2]; + x264_me_t m; + m.i_pixel = PIXEL_8x16; + LOAD_FENC( &m, h->mb.pic.p_fenc, 8*i, 0 ); + + for( int l = 0; l < 2; l++ ) + { + x264_mb_analysis_list_t *lX = l ? &a->l1 : &a->l0; + int ref8[2] = { lX->me8x8[i].i_ref, lX->me8x8[i+2].i_ref }; + int i_ref8s = ( ref8[0] == ref8[1] ) ? 1 : 2; + lX->me8x16[i].cost = INT_MAX; + for( int j = 0; j < i_ref8s; j++ ) + { + int i_ref = ref8[j]; + m.i_ref_cost = REF_COST( l, i_ref ); + + LOAD_HPELS( &m, h->mb.pic.p_fref[l][i_ref], l, i_ref, 8*i, 0 ); + + CP32( mvc[0], lX->mvc[i_ref][0] ); + CP32( mvc[1], lX->mvc[i_ref][i+1] ); + CP32( mvc[2], lX->mvc[i_ref][i+3] ); + + x264_macroblock_cache_ref( h, 2*i, 0, 2, 4, l, i_ref ); + x264_mb_predict_mv( h, l, 4*i, 2, m.mvp ); + x264_me_search( h, &m, mvc, 3 ); + m.cost += m.i_ref_cost; + + if( m.cost < lX->me8x16[i].cost ) + h->mc.memcpy_aligned( &lX->me8x16[i], &m, sizeof(x264_me_t) ); + } + } + + /* BI mode */ + src[0] = h->mc.get_ref( pix[0], &stride[0], a->l0.me8x16[i].p_fref, a->l0.me8x16[i].i_stride[0], + a->l0.me8x16[i].mv[0], a->l0.me8x16[i].mv[1], 8, 16, x264_weight_none ); + src[1] = h->mc.get_ref( pix[1], &stride[1], a->l1.me8x16[i].p_fref, a->l1.me8x16[i].i_stride[0], + a->l1.me8x16[i].mv[0], a->l1.me8x16[i].mv[1], 8, 16, x264_weight_none ); + h->mc.avg[PIXEL_8x16]( pix[0], 8, src[0], stride[0], src[1], stride[1], h->mb.bipred_weight[a->l0.me8x16[i].i_ref][a->l1.me8x16[i].i_ref] ); + + i_part_cost_bi = h->pixf.mbcmp[PIXEL_8x16]( a->l0.me8x16[i].p_fenc[0], FENC_STRIDE, pix[0], 8 ) + + a->l0.me8x16[i].cost_mv + a->l1.me8x16[i].cost_mv + a->l0.me8x16[i].i_ref_cost + + a->l1.me8x16[i].i_ref_cost; + + if( h->mb.b_chroma_me ) + i_part_cost_bi += x264_analyse_bi_chroma( h, a, i, PIXEL_8x16 ); + + i_part_cost = a->l0.me8x16[i].cost; + a->i_mb_partition8x16[i] = D_L0_8x8; + + if( a->l1.me8x16[i].cost < i_part_cost ) + { + i_part_cost = a->l1.me8x16[i].cost; + a->i_mb_partition8x16[i] = D_L1_8x8; + } + if( i_part_cost_bi + a->i_lambda * 1 < i_part_cost ) + { + i_part_cost = i_part_cost_bi; + a->i_mb_partition8x16[i] = D_BI_8x8; + } + a->i_cost8x16bi += i_part_cost; + + /* Early termination based on the current SATD score of partition[0] + plus the estimated SATD score of partition[1] */ + if( a->b_early_terminate && (!i && i_part_cost + a->i_cost_est8x16[1] > i_best_satd + * (16 + (!!a->i_mbrd + !!h->mb.i_psy_rd))/16) ) + { + a->i_cost8x16bi = COST_MAX; + return; + } + + x264_mb_cache_mv_b8x16( h, a, i, 0 ); + } + + /* mb type cost */ + a->i_mb_type8x16 = B_L0_L0 + + (a->i_mb_partition8x16[0]>>2) * 3 + + (a->i_mb_partition8x16[1]>>2); + a->i_cost8x16bi += a->i_lambda * i_mb_b16x8_cost_table[a->i_mb_type8x16]; +} + +static void x264_mb_analyse_p_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd ) +{ + int thresh = a->b_early_terminate ? i_satd * 5/4 + 1 : COST_MAX; + + h->mb.i_type = P_L0; + if( a->l0.i_rd16x16 == COST_MAX && (!a->b_early_terminate || a->l0.me16x16.cost <= i_satd * 3/2) ) + { + h->mb.i_partition = D_16x16; + x264_analyse_update_cache( h, a ); + a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + + if( a->l0.i_cost16x8 < thresh ) + { + h->mb.i_partition = D_16x8; + x264_analyse_update_cache( h, a ); + a->l0.i_cost16x8 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + else + a->l0.i_cost16x8 = COST_MAX; + + if( a->l0.i_cost8x16 < thresh ) + { + h->mb.i_partition = D_8x16; + x264_analyse_update_cache( h, a ); + a->l0.i_cost8x16 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + else + a->l0.i_cost8x16 = COST_MAX; + + if( a->l0.i_cost8x8 < thresh ) + { + h->mb.i_type = P_8x8; + h->mb.i_partition = D_8x8; + if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 ) + { + x264_macroblock_cache_ref( h, 0, 0, 2, 2, 0, a->l0.me8x8[0].i_ref ); + x264_macroblock_cache_ref( h, 2, 0, 2, 2, 0, a->l0.me8x8[1].i_ref ); + x264_macroblock_cache_ref( h, 0, 2, 2, 2, 0, a->l0.me8x8[2].i_ref ); + x264_macroblock_cache_ref( h, 2, 2, 2, 2, 0, a->l0.me8x8[3].i_ref ); + /* FIXME: In the 8x8 blocks where RDO isn't run, the NNZ values used for context selection + * for future blocks are those left over from previous RDO calls. */ + for( int i = 0; i < 4; i++ ) + { + int costs[4] = {a->l0.i_cost4x4[i], a->l0.i_cost8x4[i], a->l0.i_cost4x8[i], a->l0.me8x8[i].cost}; + int sub8x8_thresh = a->b_early_terminate ? X264_MIN4( costs[0], costs[1], costs[2], costs[3] ) * 5 / 4 : COST_MAX; + int subtype, btype = D_L0_8x8; + uint64_t bcost = COST_MAX64; + for( subtype = D_L0_4x4; subtype <= D_L0_8x8; subtype++ ) + { + uint64_t cost; + if( costs[subtype] > sub8x8_thresh ) + continue; + h->mb.i_sub_partition[i] = subtype; + x264_mb_cache_mv_p8x8( h, a, i ); + if( subtype == btype ) + continue; + cost = x264_rd_cost_part( h, a->i_lambda2, i<<2, PIXEL_8x8 ); + COPY2_IF_LT( bcost, cost, btype, subtype ); + } + if( h->mb.i_sub_partition[i] != btype ) + { + h->mb.i_sub_partition[i] = btype; + x264_mb_cache_mv_p8x8( h, a, i ); + } + } + } + else + x264_analyse_update_cache( h, a ); + a->l0.i_cost8x8 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + else + a->l0.i_cost8x8 = COST_MAX; +} + +static void x264_mb_analyse_b_rd( x264_t *h, x264_mb_analysis_t *a, int i_satd_inter ) +{ + int thresh = a->b_early_terminate ? i_satd_inter * (17 + (!!h->mb.i_psy_rd))/16 + 1 : COST_MAX; + + if( a->b_direct_available && a->i_rd16x16direct == COST_MAX ) + { + h->mb.i_type = B_DIRECT; + /* Assumes direct/skip MC is still in fdec */ + /* Requires b-rdo to be done before intra analysis */ + h->mb.b_skip_mc = 1; + x264_analyse_update_cache( h, a ); + a->i_rd16x16direct = x264_rd_cost_mb( h, a->i_lambda2 ); + h->mb.b_skip_mc = 0; + } + + //FIXME not all the update_cache calls are needed + h->mb.i_partition = D_16x16; + /* L0 */ + if( a->l0.me16x16.cost < thresh && a->l0.i_rd16x16 == COST_MAX ) + { + h->mb.i_type = B_L0_L0; + x264_analyse_update_cache( h, a ); + a->l0.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + + /* L1 */ + if( a->l1.me16x16.cost < thresh && a->l1.i_rd16x16 == COST_MAX ) + { + h->mb.i_type = B_L1_L1; + x264_analyse_update_cache( h, a ); + a->l1.i_rd16x16 = x264_rd_cost_mb( h, a->i_lambda2 ); + } + + /* BI */ + if( a->i_cost16x16bi < thresh && a->i_rd16x16bi == COST_MAX ) + { + h->mb.i_type = B_BI_BI; + x264_analyse_update_cache( h, a ); + a->i_rd16x16bi = x264_rd_cost_mb( h, a->i_lambda2 ); + } + + /* 8x8 */ + if( a->i_cost8x8bi < thresh && a->i_rd8x8bi == COST_MAX ) + { + h->mb.i_type = B_8x8; + h->mb.i_partition = D_8x8; + x264_analyse_update_cache( h, a ); + a->i_rd8x8bi = x264_rd_cost_mb( h, a->i_lambda2 ); + x264_macroblock_cache_skip( h, 0, 0, 4, 4, 0 ); + } + + /* 16x8 */ + if( a->i_cost16x8bi < thresh && a->i_rd16x8bi == COST_MAX ) + { + h->mb.i_type = a->i_mb_type16x8; + h->mb.i_partition = D_16x8; + x264_analyse_update_cache( h, a ); + a->i_rd16x8bi = x264_rd_cost_mb( h, a->i_lambda2 ); + } + + /* 8x16 */ + if( a->i_cost8x16bi < thresh && a->i_rd8x16bi == COST_MAX ) + { + h->mb.i_type = a->i_mb_type8x16; + h->mb.i_partition = D_8x16; + x264_analyse_update_cache( h, a ); + a->i_rd8x16bi = x264_rd_cost_mb( h, a->i_lambda2 ); + } +} + +static void x264_refine_bidir( x264_t *h, x264_mb_analysis_t *a ) +{ + int i_biweight; + + if( IS_INTRA(h->mb.i_type) ) + return; + + switch( h->mb.i_partition ) + { + case D_16x16: + if( h->mb.i_type == B_BI_BI ) + { + i_biweight = h->mb.bipred_weight[a->l0.bi16x16.i_ref][a->l1.bi16x16.i_ref]; + x264_me_refine_bidir_satd( h, &a->l0.bi16x16, &a->l1.bi16x16, i_biweight ); + } + break; + case D_16x8: + for( int i = 0; i < 2; i++ ) + if( a->i_mb_partition16x8[i] == D_BI_8x8 ) + { + i_biweight = h->mb.bipred_weight[a->l0.me16x8[i].i_ref][a->l1.me16x8[i].i_ref]; + x264_me_refine_bidir_satd( h, &a->l0.me16x8[i], &a->l1.me16x8[i], i_biweight ); + } + break; + case D_8x16: + for( int i = 0; i < 2; i++ ) + if( a->i_mb_partition8x16[i] == D_BI_8x8 ) + { + i_biweight = h->mb.bipred_weight[a->l0.me8x16[i].i_ref][a->l1.me8x16[i].i_ref]; + x264_me_refine_bidir_satd( h, &a->l0.me8x16[i], &a->l1.me8x16[i], i_biweight ); + } + break; + case D_8x8: + for( int i = 0; i < 4; i++ ) + if( h->mb.i_sub_partition[i] == D_BI_8x8 ) + { + i_biweight = h->mb.bipred_weight[a->l0.me8x8[i].i_ref][a->l1.me8x8[i].i_ref]; + x264_me_refine_bidir_satd( h, &a->l0.me8x8[i], &a->l1.me8x8[i], i_biweight ); + } + break; + } +} + +static inline void x264_mb_analyse_transform( x264_t *h ) +{ + if( x264_mb_transform_8x8_allowed( h ) && h->param.analyse.b_transform_8x8 && !h->mb.b_lossless ) + { + /* Only luma MC is really needed for 4:2:0, but the full MC is re-used in macroblock_encode. */ + x264_mb_mc( h ); + + int plane_count = CHROMA444 && h->mb.b_chroma_me ? 3 : 1; + int i_cost8 = 0, i_cost4 = 0; + /* Not all platforms have a merged SATD function */ + if( h->pixf.sa8d_satd[PIXEL_16x16] ) + { + uint64_t cost = 0; + for( int p = 0; p < plane_count; p++ ) + { + cost += h->pixf.sa8d_satd[PIXEL_16x16]( h->mb.pic.p_fenc[p], FENC_STRIDE, + h->mb.pic.p_fdec[p], FDEC_STRIDE ); + + } + i_cost8 = (uint32_t)cost; + i_cost4 = (uint32_t)(cost >> 32); + } + else + { + for( int p = 0; p < plane_count; p++ ) + { + i_cost8 += h->pixf.sa8d[PIXEL_16x16]( h->mb.pic.p_fenc[p], FENC_STRIDE, + h->mb.pic.p_fdec[p], FDEC_STRIDE ); + i_cost4 += h->pixf.satd[PIXEL_16x16]( h->mb.pic.p_fenc[p], FENC_STRIDE, + h->mb.pic.p_fdec[p], FDEC_STRIDE ); + } + } + + h->mb.b_transform_8x8 = i_cost8 < i_cost4; + h->mb.b_skip_mc = 1; + } +} + +static inline void x264_mb_analyse_transform_rd( x264_t *h, x264_mb_analysis_t *a, int *i_satd, int *i_rd ) +{ + if( h->param.analyse.b_transform_8x8 && h->pps->b_transform_8x8_mode ) + { + uint32_t subpart_bak = M32( h->mb.i_sub_partition ); + /* Try switching the subpartitions to 8x8 so that we can use 8x8 transform mode */ + if( h->mb.i_type == P_8x8 ) + M32( h->mb.i_sub_partition ) = D_L0_8x8*0x01010101; + else if( !x264_transform_allowed[h->mb.i_type] ) + return; + + x264_analyse_update_cache( h, a ); + h->mb.b_transform_8x8 ^= 1; + /* FIXME only luma is needed for 4:2:0, but the score for comparison already includes chroma */ + int i_rd8 = x264_rd_cost_mb( h, a->i_lambda2 ); + + if( *i_rd >= i_rd8 ) + { + if( *i_rd > 0 ) + *i_satd = (int64_t)(*i_satd) * i_rd8 / *i_rd; + *i_rd = i_rd8; + } + else + { + h->mb.b_transform_8x8 ^= 1; + M32( h->mb.i_sub_partition ) = subpart_bak; + } + } +} + +/* Rate-distortion optimal QP selection. + * FIXME: More than half of the benefit of this function seems to be + * in the way it improves the coding of chroma DC (by decimating or + * finding a better way to code a single DC coefficient.) + * There must be a more efficient way to get that portion of the benefit + * without doing full QP-RD, but RD-decimation doesn't seem to do the + * trick. */ +static inline void x264_mb_analyse_qp_rd( x264_t *h, x264_mb_analysis_t *a ) +{ + int bcost, cost, failures, prevcost, origcost; + int orig_qp = h->mb.i_qp, bqp = h->mb.i_qp; + int last_qp_tried = 0; + origcost = bcost = x264_rd_cost_mb( h, a->i_lambda2 ); + int origcbp = h->mb.cbp[h->mb.i_mb_xy]; + + /* If CBP is already zero, don't raise the quantizer any higher. */ + for( int direction = origcbp ? 1 : -1; direction >= -1; direction-=2 ) + { + /* Without psy-RD, require monotonicity when moving quant away from previous + * macroblock's quant; allow 1 failure when moving quant towards previous quant. + * With psy-RD, allow 1 failure when moving quant away from previous quant, + * allow 2 failures when moving quant towards previous quant. + * Psy-RD generally seems to result in more chaotic RD score-vs-quantizer curves. */ + int threshold = (!!h->mb.i_psy_rd); + /* Raise the threshold for failures if we're moving towards the last QP. */ + if( ( h->mb.i_last_qp < orig_qp && direction == -1 ) || + ( h->mb.i_last_qp > orig_qp && direction == 1 ) ) + threshold++; + h->mb.i_qp = orig_qp; + failures = 0; + prevcost = origcost; + + /* If the current QP results in an empty CBP, it's highly likely that lower QPs + * (up to a point) will too. So, jump down to where the threshold will kick in + * and check the QP there. If the CBP is still empty, skip the main loop. + * If it isn't empty, we would have ended up having to check this QP anyways, + * so as long as we store it for later lookup, we lose nothing. */ + int already_checked_qp = -1; + int already_checked_cost = COST_MAX; + if( direction == -1 ) + { + if( !origcbp ) + { + h->mb.i_qp = X264_MAX( h->mb.i_qp - threshold - 1, SPEC_QP( h->param.rc.i_qp_min ) ); + h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp]; + already_checked_cost = x264_rd_cost_mb( h, a->i_lambda2 ); + if( !h->mb.cbp[h->mb.i_mb_xy] ) + { + /* If our empty-CBP block is lower QP than the last QP, + * the last QP almost surely doesn't have a CBP either. */ + if( h->mb.i_last_qp > h->mb.i_qp ) + last_qp_tried = 1; + break; + } + already_checked_qp = h->mb.i_qp; + h->mb.i_qp = orig_qp; + } + } + + h->mb.i_qp += direction; + while( h->mb.i_qp >= h->param.rc.i_qp_min && h->mb.i_qp <= SPEC_QP( h->param.rc.i_qp_max ) ) + { + if( h->mb.i_last_qp == h->mb.i_qp ) + last_qp_tried = 1; + if( h->mb.i_qp == already_checked_qp ) + cost = already_checked_cost; + else + { + h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp]; + cost = x264_rd_cost_mb( h, a->i_lambda2 ); + COPY2_IF_LT( bcost, cost, bqp, h->mb.i_qp ); + } + + /* We can't assume that the costs are monotonic over QPs. + * Tie case-as-failure seems to give better results. */ + if( cost < prevcost ) + failures = 0; + else + failures++; + prevcost = cost; + + if( failures > threshold ) + break; + if( direction == 1 && !h->mb.cbp[h->mb.i_mb_xy] ) + break; + h->mb.i_qp += direction; + } + } + + /* Always try the last block's QP. */ + if( !last_qp_tried ) + { + h->mb.i_qp = h->mb.i_last_qp; + h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp]; + cost = x264_rd_cost_mb( h, a->i_lambda2 ); + COPY2_IF_LT( bcost, cost, bqp, h->mb.i_qp ); + } + + h->mb.i_qp = bqp; + h->mb.i_chroma_qp = h->chroma_qp_table[h->mb.i_qp]; + + /* Check transform again; decision from before may no longer be optimal. */ + if( h->mb.i_qp != orig_qp && h->param.analyse.b_transform_8x8 && + x264_mb_transform_8x8_allowed( h ) ) + { + h->mb.b_transform_8x8 ^= 1; + cost = x264_rd_cost_mb( h, a->i_lambda2 ); + if( cost > bcost ) + h->mb.b_transform_8x8 ^= 1; + } +} + +/***************************************************************************** + * x264_macroblock_analyse: + *****************************************************************************/ +void x264_macroblock_analyse( x264_t *h ) +{ + x264_mb_analysis_t analysis; + int i_cost = COST_MAX; + + h->mb.i_qp = x264_ratecontrol_mb_qp( h ); + /* If the QP of this MB is within 1 of the previous MB, code the same QP as the previous MB, + * to lower the bit cost of the qp_delta. Don't do this if QPRD is enabled. */ + if( h->param.rc.i_aq_mode && h->param.analyse.i_subpel_refine < 10 ) + h->mb.i_qp = abs(h->mb.i_qp - h->mb.i_last_qp) == 1 ? h->mb.i_last_qp : h->mb.i_qp; + + if( h->param.analyse.b_mb_info ) + h->fdec->effective_qp[h->mb.i_mb_xy] = h->mb.i_qp; /* Store the real analysis QP. */ + x264_mb_analyse_init( h, &analysis, h->mb.i_qp ); + + /*--------------------------- Do the analysis ---------------------------*/ + if( h->sh.i_type == SLICE_TYPE_I ) + { +intra_analysis: + if( analysis.i_mbrd ) + x264_mb_init_fenc_cache( h, analysis.i_mbrd >= 2 ); + x264_mb_analyse_intra( h, &analysis, COST_MAX ); + if( analysis.i_mbrd ) + x264_intra_rd( h, &analysis, COST_MAX ); + + i_cost = analysis.i_satd_i16x16; + h->mb.i_type = I_16x16; + COPY2_IF_LT( i_cost, analysis.i_satd_i4x4, h->mb.i_type, I_4x4 ); + COPY2_IF_LT( i_cost, analysis.i_satd_i8x8, h->mb.i_type, I_8x8 ); + if( analysis.i_satd_pcm < i_cost ) + h->mb.i_type = I_PCM; + + else if( analysis.i_mbrd >= 2 ) + x264_intra_rd_refine( h, &analysis ); + } + else if( h->sh.i_type == SLICE_TYPE_P ) + { + int b_skip = 0; + + h->mc.prefetch_ref( h->mb.pic.p_fref[0][0][h->mb.i_mb_x&3], h->mb.pic.i_stride[0], 0 ); + + analysis.b_try_skip = 0; + if( analysis.b_force_intra ) + { + if( !h->param.analyse.b_psy ) + { + x264_mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) ); + goto intra_analysis; + } + } + else + { + /* Special fast-skip logic using information from mb_info. */ + if( h->fdec->mb_info && (h->fdec->mb_info[h->mb.i_mb_xy]&X264_MBINFO_CONSTANT) ) + { + if( !SLICE_MBAFF && (h->fdec->i_frame - h->fref[0][0]->i_frame) == 1 && !h->sh.b_weighted_pred && + h->fref[0][0]->effective_qp[h->mb.i_mb_xy] <= h->mb.i_qp ) + { + h->mb.i_partition = D_16x16; + /* Use the P-SKIP MV if we can... */ + if( !M32(h->mb.cache.pskip_mv) ) + { + b_skip = 1; + h->mb.i_type = P_SKIP; + } + /* Otherwise, just force a 16x16 block. */ + else + { + h->mb.i_type = P_L0; + analysis.l0.me16x16.i_ref = 0; + M32( analysis.l0.me16x16.mv ) = 0; + } + goto skip_analysis; + } + /* Reset the information accordingly */ + else if( h->param.analyse.b_mb_info_update ) + h->fdec->mb_info[h->mb.i_mb_xy] &= ~X264_MBINFO_CONSTANT; + } + + int skip_invalid = h->i_thread_frames > 1 && h->mb.cache.pskip_mv[1] > h->mb.mv_max_spel[1]; + /* If the current macroblock is off the frame, just skip it. */ + if( HAVE_INTERLACED && !MB_INTERLACED && h->mb.i_mb_y * 16 >= h->param.i_height && !skip_invalid ) + b_skip = 1; + /* Fast P_SKIP detection */ + else if( h->param.analyse.b_fast_pskip ) + { + if( skip_invalid ) + // FIXME don't need to check this if the reference frame is done + {} + else if( h->param.analyse.i_subpel_refine >= 3 ) + analysis.b_try_skip = 1; + else if( h->mb.i_mb_type_left[0] == P_SKIP || + h->mb.i_mb_type_top == P_SKIP || + h->mb.i_mb_type_topleft == P_SKIP || + h->mb.i_mb_type_topright == P_SKIP ) + b_skip = x264_macroblock_probe_pskip( h ); + } + } + + h->mc.prefetch_ref( h->mb.pic.p_fref[0][0][h->mb.i_mb_x&3], h->mb.pic.i_stride[0], 1 ); + + if( b_skip ) + { + h->mb.i_type = P_SKIP; + h->mb.i_partition = D_16x16; + assert( h->mb.cache.pskip_mv[1] <= h->mb.mv_max_spel[1] || h->i_thread_frames == 1 ); +skip_analysis: + /* Set up MVs for future predictors */ + for( int i = 0; i < h->mb.pic.i_fref[0]; i++ ) + M32( h->mb.mvr[0][i][h->mb.i_mb_xy] ) = 0; + } + else + { + const unsigned int flags = h->param.analyse.inter; + int i_type; + int i_partition; + int i_satd_inter, i_satd_intra; + + x264_mb_analyse_load_costs( h, &analysis ); + + x264_mb_analyse_inter_p16x16( h, &analysis ); + + if( h->mb.i_type == P_SKIP ) + { + for( int i = 1; i < h->mb.pic.i_fref[0]; i++ ) + M32( h->mb.mvr[0][i][h->mb.i_mb_xy] ) = 0; + return; + } + + if( flags & X264_ANALYSE_PSUB16x16 ) + { + if( h->param.analyse.b_mixed_references ) + x264_mb_analyse_inter_p8x8_mixed_ref( h, &analysis ); + else + x264_mb_analyse_inter_p8x8( h, &analysis ); + } + + /* Select best inter mode */ + i_type = P_L0; + i_partition = D_16x16; + i_cost = analysis.l0.me16x16.cost; + + if( ( flags & X264_ANALYSE_PSUB16x16 ) && (!analysis.b_early_terminate || + analysis.l0.i_cost8x8 < analysis.l0.me16x16.cost) ) + { + i_type = P_8x8; + i_partition = D_8x8; + i_cost = analysis.l0.i_cost8x8; + + /* Do sub 8x8 */ + if( flags & X264_ANALYSE_PSUB8x8 ) + { + for( int i = 0; i < 4; i++ ) + { + x264_mb_analyse_inter_p4x4( h, &analysis, i ); + int i_thresh8x4 = analysis.l0.me4x4[i][1].cost_mv + analysis.l0.me4x4[i][2].cost_mv; + if( !analysis.b_early_terminate || analysis.l0.i_cost4x4[i] < analysis.l0.me8x8[i].cost + i_thresh8x4 ) + { + int i_cost8x8 = analysis.l0.i_cost4x4[i]; + h->mb.i_sub_partition[i] = D_L0_4x4; + + x264_mb_analyse_inter_p8x4( h, &analysis, i ); + COPY2_IF_LT( i_cost8x8, analysis.l0.i_cost8x4[i], + h->mb.i_sub_partition[i], D_L0_8x4 ); + + x264_mb_analyse_inter_p4x8( h, &analysis, i ); + COPY2_IF_LT( i_cost8x8, analysis.l0.i_cost4x8[i], + h->mb.i_sub_partition[i], D_L0_4x8 ); + + i_cost += i_cost8x8 - analysis.l0.me8x8[i].cost; + } + x264_mb_cache_mv_p8x8( h, &analysis, i ); + } + analysis.l0.i_cost8x8 = i_cost; + } + } + + /* Now do 16x8/8x16 */ + int i_thresh16x8 = analysis.l0.me8x8[1].cost_mv + analysis.l0.me8x8[2].cost_mv; + if( ( flags & X264_ANALYSE_PSUB16x16 ) && (!analysis.b_early_terminate || + analysis.l0.i_cost8x8 < analysis.l0.me16x16.cost + i_thresh16x8) ) + { + int i_avg_mv_ref_cost = (analysis.l0.me8x8[2].cost_mv + analysis.l0.me8x8[2].i_ref_cost + + analysis.l0.me8x8[3].cost_mv + analysis.l0.me8x8[3].i_ref_cost + 1) >> 1; + analysis.i_cost_est16x8[1] = analysis.i_satd8x8[0][2] + analysis.i_satd8x8[0][3] + i_avg_mv_ref_cost; + + x264_mb_analyse_inter_p16x8( h, &analysis, i_cost ); + COPY3_IF_LT( i_cost, analysis.l0.i_cost16x8, i_type, P_L0, i_partition, D_16x8 ); + + i_avg_mv_ref_cost = (analysis.l0.me8x8[1].cost_mv + analysis.l0.me8x8[1].i_ref_cost + + analysis.l0.me8x8[3].cost_mv + analysis.l0.me8x8[3].i_ref_cost + 1) >> 1; + analysis.i_cost_est8x16[1] = analysis.i_satd8x8[0][1] + analysis.i_satd8x8[0][3] + i_avg_mv_ref_cost; + + x264_mb_analyse_inter_p8x16( h, &analysis, i_cost ); + COPY3_IF_LT( i_cost, analysis.l0.i_cost8x16, i_type, P_L0, i_partition, D_8x16 ); + } + + h->mb.i_partition = i_partition; + + /* refine qpel */ + //FIXME mb_type costs? + if( analysis.i_mbrd || !h->mb.i_subpel_refine ) + { + /* refine later */ + } + else if( i_partition == D_16x16 ) + { + x264_me_refine_qpel( h, &analysis.l0.me16x16 ); + i_cost = analysis.l0.me16x16.cost; + } + else if( i_partition == D_16x8 ) + { + x264_me_refine_qpel( h, &analysis.l0.me16x8[0] ); + x264_me_refine_qpel( h, &analysis.l0.me16x8[1] ); + i_cost = analysis.l0.me16x8[0].cost + analysis.l0.me16x8[1].cost; + } + else if( i_partition == D_8x16 ) + { + x264_me_refine_qpel( h, &analysis.l0.me8x16[0] ); + x264_me_refine_qpel( h, &analysis.l0.me8x16[1] ); + i_cost = analysis.l0.me8x16[0].cost + analysis.l0.me8x16[1].cost; + } + else if( i_partition == D_8x8 ) + { + i_cost = 0; + for( int i8x8 = 0; i8x8 < 4; i8x8++ ) + { + switch( h->mb.i_sub_partition[i8x8] ) + { + case D_L0_8x8: + x264_me_refine_qpel( h, &analysis.l0.me8x8[i8x8] ); + i_cost += analysis.l0.me8x8[i8x8].cost; + break; + case D_L0_8x4: + x264_me_refine_qpel( h, &analysis.l0.me8x4[i8x8][0] ); + x264_me_refine_qpel( h, &analysis.l0.me8x4[i8x8][1] ); + i_cost += analysis.l0.me8x4[i8x8][0].cost + + analysis.l0.me8x4[i8x8][1].cost; + break; + case D_L0_4x8: + x264_me_refine_qpel( h, &analysis.l0.me4x8[i8x8][0] ); + x264_me_refine_qpel( h, &analysis.l0.me4x8[i8x8][1] ); + i_cost += analysis.l0.me4x8[i8x8][0].cost + + analysis.l0.me4x8[i8x8][1].cost; + break; + + case D_L0_4x4: + x264_me_refine_qpel( h, &analysis.l0.me4x4[i8x8][0] ); + x264_me_refine_qpel( h, &analysis.l0.me4x4[i8x8][1] ); + x264_me_refine_qpel( h, &analysis.l0.me4x4[i8x8][2] ); + x264_me_refine_qpel( h, &analysis.l0.me4x4[i8x8][3] ); + i_cost += analysis.l0.me4x4[i8x8][0].cost + + analysis.l0.me4x4[i8x8][1].cost + + analysis.l0.me4x4[i8x8][2].cost + + analysis.l0.me4x4[i8x8][3].cost; + break; + default: + x264_log( h, X264_LOG_ERROR, "internal error (!8x8 && !4x4)\n" ); + break; + } + } + } + + if( h->mb.b_chroma_me ) + { + if( CHROMA444 ) + { + x264_mb_analyse_intra( h, &analysis, i_cost ); + x264_mb_analyse_intra_chroma( h, &analysis ); + } + else + { + x264_mb_analyse_intra_chroma( h, &analysis ); + x264_mb_analyse_intra( h, &analysis, i_cost - analysis.i_satd_chroma ); + } + analysis.i_satd_i16x16 += analysis.i_satd_chroma; + analysis.i_satd_i8x8 += analysis.i_satd_chroma; + analysis.i_satd_i4x4 += analysis.i_satd_chroma; + } + else + x264_mb_analyse_intra( h, &analysis, i_cost ); + + i_satd_inter = i_cost; + i_satd_intra = X264_MIN3( analysis.i_satd_i16x16, + analysis.i_satd_i8x8, + analysis.i_satd_i4x4 ); + + if( analysis.i_mbrd ) + { + x264_mb_analyse_p_rd( h, &analysis, X264_MIN(i_satd_inter, i_satd_intra) ); + i_type = P_L0; + i_partition = D_16x16; + i_cost = analysis.l0.i_rd16x16; + COPY2_IF_LT( i_cost, analysis.l0.i_cost16x8, i_partition, D_16x8 ); + COPY2_IF_LT( i_cost, analysis.l0.i_cost8x16, i_partition, D_8x16 ); + COPY3_IF_LT( i_cost, analysis.l0.i_cost8x8, i_partition, D_8x8, i_type, P_8x8 ); + h->mb.i_type = i_type; + h->mb.i_partition = i_partition; + if( i_cost < COST_MAX ) + x264_mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost ); + x264_intra_rd( h, &analysis, i_satd_inter * 5/4 + 1 ); + } + + COPY2_IF_LT( i_cost, analysis.i_satd_i16x16, i_type, I_16x16 ); + COPY2_IF_LT( i_cost, analysis.i_satd_i8x8, i_type, I_8x8 ); + COPY2_IF_LT( i_cost, analysis.i_satd_i4x4, i_type, I_4x4 ); + COPY2_IF_LT( i_cost, analysis.i_satd_pcm, i_type, I_PCM ); + + h->mb.i_type = i_type; + + if( analysis.b_force_intra && !IS_INTRA(i_type) ) + { + /* Intra masking: copy fdec to fenc and re-encode the block as intra in order to make it appear as if + * it was an inter block. */ + x264_analyse_update_cache( h, &analysis ); + x264_macroblock_encode( h ); + for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ ) + h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fenc[p], FENC_STRIDE, h->mb.pic.p_fdec[p], FDEC_STRIDE, 16 ); + if( !CHROMA444 ) + { + int height = 16 >> CHROMA_V_SHIFT; + h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fenc[1], FENC_STRIDE, h->mb.pic.p_fdec[1], FDEC_STRIDE, height ); + h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fenc[2], FENC_STRIDE, h->mb.pic.p_fdec[2], FDEC_STRIDE, height ); + } + x264_mb_analyse_init_qp( h, &analysis, X264_MAX( h->mb.i_qp - h->mb.ip_offset, h->param.rc.i_qp_min ) ); + goto intra_analysis; + } + + if( analysis.i_mbrd >= 2 && h->mb.i_type != I_PCM ) + { + if( IS_INTRA( h->mb.i_type ) ) + { + x264_intra_rd_refine( h, &analysis ); + } + else if( i_partition == D_16x16 ) + { + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, analysis.l0.me16x16.i_ref ); + analysis.l0.me16x16.cost = i_cost; + x264_me_refine_qpel_rd( h, &analysis.l0.me16x16, analysis.i_lambda2, 0, 0 ); + } + else if( i_partition == D_16x8 ) + { + M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101; + x264_macroblock_cache_ref( h, 0, 0, 4, 2, 0, analysis.l0.me16x8[0].i_ref ); + x264_macroblock_cache_ref( h, 0, 2, 4, 2, 0, analysis.l0.me16x8[1].i_ref ); + x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[0], analysis.i_lambda2, 0, 0 ); + x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[1], analysis.i_lambda2, 8, 0 ); + } + else if( i_partition == D_8x16 ) + { + M32( h->mb.i_sub_partition ) = D_L0_8x8 * 0x01010101; + x264_macroblock_cache_ref( h, 0, 0, 2, 4, 0, analysis.l0.me8x16[0].i_ref ); + x264_macroblock_cache_ref( h, 2, 0, 2, 4, 0, analysis.l0.me8x16[1].i_ref ); + x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[0], analysis.i_lambda2, 0, 0 ); + x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[1], analysis.i_lambda2, 4, 0 ); + } + else if( i_partition == D_8x8 ) + { + x264_analyse_update_cache( h, &analysis ); + for( int i8x8 = 0; i8x8 < 4; i8x8++ ) + { + if( h->mb.i_sub_partition[i8x8] == D_L0_8x8 ) + { + x264_me_refine_qpel_rd( h, &analysis.l0.me8x8[i8x8], analysis.i_lambda2, i8x8*4, 0 ); + } + else if( h->mb.i_sub_partition[i8x8] == D_L0_8x4 ) + { + x264_me_refine_qpel_rd( h, &analysis.l0.me8x4[i8x8][0], analysis.i_lambda2, i8x8*4+0, 0 ); + x264_me_refine_qpel_rd( h, &analysis.l0.me8x4[i8x8][1], analysis.i_lambda2, i8x8*4+2, 0 ); + } + else if( h->mb.i_sub_partition[i8x8] == D_L0_4x8 ) + { + x264_me_refine_qpel_rd( h, &analysis.l0.me4x8[i8x8][0], analysis.i_lambda2, i8x8*4+0, 0 ); + x264_me_refine_qpel_rd( h, &analysis.l0.me4x8[i8x8][1], analysis.i_lambda2, i8x8*4+1, 0 ); + } + else if( h->mb.i_sub_partition[i8x8] == D_L0_4x4 ) + { + x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][0], analysis.i_lambda2, i8x8*4+0, 0 ); + x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][1], analysis.i_lambda2, i8x8*4+1, 0 ); + x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][2], analysis.i_lambda2, i8x8*4+2, 0 ); + x264_me_refine_qpel_rd( h, &analysis.l0.me4x4[i8x8][3], analysis.i_lambda2, i8x8*4+3, 0 ); + } + } + } + } + } + } + else if( h->sh.i_type == SLICE_TYPE_B ) + { + int i_bskip_cost = COST_MAX; + int b_skip = 0; + + if( analysis.i_mbrd ) + x264_mb_init_fenc_cache( h, analysis.i_mbrd >= 2 ); + + h->mb.i_type = B_SKIP; + if( h->mb.b_direct_auto_write ) + { + /* direct=auto heuristic: prefer whichever mode allows more Skip macroblocks */ + for( int i = 0; i < 2; i++ ) + { + int b_changed = 1; + h->sh.b_direct_spatial_mv_pred ^= 1; + analysis.b_direct_available = x264_mb_predict_mv_direct16x16( h, i && analysis.b_direct_available ? &b_changed : NULL ); + if( analysis.b_direct_available ) + { + if( b_changed ) + { + x264_mb_mc( h ); + b_skip = x264_macroblock_probe_bskip( h ); + } + h->stat.frame.i_direct_score[ h->sh.b_direct_spatial_mv_pred ] += b_skip; + } + else + b_skip = 0; + } + } + else + analysis.b_direct_available = x264_mb_predict_mv_direct16x16( h, NULL ); + + analysis.b_try_skip = 0; + if( analysis.b_direct_available ) + { + if( !h->mb.b_direct_auto_write ) + x264_mb_mc( h ); + /* If the current macroblock is off the frame, just skip it. */ + if( HAVE_INTERLACED && !MB_INTERLACED && h->mb.i_mb_y * 16 >= h->param.i_height ) + b_skip = 1; + else if( analysis.i_mbrd ) + { + i_bskip_cost = ssd_mb( h ); + /* 6 = minimum cavlc cost of a non-skipped MB */ + b_skip = h->mb.b_skip_mc = i_bskip_cost <= ((6 * analysis.i_lambda2 + 128) >> 8); + } + else if( !h->mb.b_direct_auto_write ) + { + /* Conditioning the probe on neighboring block types + * doesn't seem to help speed or quality. */ + analysis.b_try_skip = x264_macroblock_probe_bskip( h ); + if( h->param.analyse.i_subpel_refine < 3 ) + b_skip = analysis.b_try_skip; + } + /* Set up MVs for future predictors */ + if( b_skip ) + { + for( int i = 0; i < h->mb.pic.i_fref[0]; i++ ) + M32( h->mb.mvr[0][i][h->mb.i_mb_xy] ) = 0; + for( int i = 0; i < h->mb.pic.i_fref[1]; i++ ) + M32( h->mb.mvr[1][i][h->mb.i_mb_xy] ) = 0; + } + } + + if( !b_skip ) + { + const unsigned int flags = h->param.analyse.inter; + int i_type; + int i_partition; + int i_satd_inter; + h->mb.b_skip_mc = 0; + h->mb.i_type = B_DIRECT; + + x264_mb_analyse_load_costs( h, &analysis ); + + /* select best inter mode */ + /* direct must be first */ + if( analysis.b_direct_available ) + x264_mb_analyse_inter_direct( h, &analysis ); + + x264_mb_analyse_inter_b16x16( h, &analysis ); + + if( h->mb.i_type == B_SKIP ) + { + for( int i = 1; i < h->mb.pic.i_fref[0]; i++ ) + M32( h->mb.mvr[0][i][h->mb.i_mb_xy] ) = 0; + for( int i = 1; i < h->mb.pic.i_fref[1]; i++ ) + M32( h->mb.mvr[1][i][h->mb.i_mb_xy] ) = 0; + return; + } + + i_type = B_L0_L0; + i_partition = D_16x16; + i_cost = analysis.l0.me16x16.cost; + COPY2_IF_LT( i_cost, analysis.l1.me16x16.cost, i_type, B_L1_L1 ); + COPY2_IF_LT( i_cost, analysis.i_cost16x16bi, i_type, B_BI_BI ); + COPY2_IF_LT( i_cost, analysis.i_cost16x16direct, i_type, B_DIRECT ); + + if( analysis.i_mbrd && analysis.b_early_terminate && analysis.i_cost16x16direct <= i_cost * 33/32 ) + { + x264_mb_analyse_b_rd( h, &analysis, i_cost ); + if( i_bskip_cost < analysis.i_rd16x16direct && + i_bskip_cost < analysis.i_rd16x16bi && + i_bskip_cost < analysis.l0.i_rd16x16 && + i_bskip_cost < analysis.l1.i_rd16x16 ) + { + h->mb.i_type = B_SKIP; + x264_analyse_update_cache( h, &analysis ); + return; + } + } + + if( flags & X264_ANALYSE_BSUB16x16 ) + { + if( h->param.analyse.b_mixed_references ) + x264_mb_analyse_inter_b8x8_mixed_ref( h, &analysis ); + else + x264_mb_analyse_inter_b8x8( h, &analysis ); + + COPY3_IF_LT( i_cost, analysis.i_cost8x8bi, i_type, B_8x8, i_partition, D_8x8 ); + + /* Try to estimate the cost of b16x8/b8x16 based on the satd scores of the b8x8 modes */ + int i_cost_est16x8bi_total = 0, i_cost_est8x16bi_total = 0; + int i_mb_type, i_partition16x8[2], i_partition8x16[2]; + for( int i = 0; i < 2; i++ ) + { + int avg_l0_mv_ref_cost, avg_l1_mv_ref_cost; + int i_l0_satd, i_l1_satd, i_bi_satd, i_best_cost; + // 16x8 + i_best_cost = COST_MAX; + i_l0_satd = analysis.i_satd8x8[0][i*2] + analysis.i_satd8x8[0][i*2+1]; + i_l1_satd = analysis.i_satd8x8[1][i*2] + analysis.i_satd8x8[1][i*2+1]; + i_bi_satd = analysis.i_satd8x8[2][i*2] + analysis.i_satd8x8[2][i*2+1]; + avg_l0_mv_ref_cost = ( analysis.l0.me8x8[i*2].cost_mv + analysis.l0.me8x8[i*2].i_ref_cost + + analysis.l0.me8x8[i*2+1].cost_mv + analysis.l0.me8x8[i*2+1].i_ref_cost + 1 ) >> 1; + avg_l1_mv_ref_cost = ( analysis.l1.me8x8[i*2].cost_mv + analysis.l1.me8x8[i*2].i_ref_cost + + analysis.l1.me8x8[i*2+1].cost_mv + analysis.l1.me8x8[i*2+1].i_ref_cost + 1 ) >> 1; + COPY2_IF_LT( i_best_cost, i_l0_satd + avg_l0_mv_ref_cost, i_partition16x8[i], D_L0_8x8 ); + COPY2_IF_LT( i_best_cost, i_l1_satd + avg_l1_mv_ref_cost, i_partition16x8[i], D_L1_8x8 ); + COPY2_IF_LT( i_best_cost, i_bi_satd + avg_l0_mv_ref_cost + avg_l1_mv_ref_cost, i_partition16x8[i], D_BI_8x8 ); + analysis.i_cost_est16x8[i] = i_best_cost; + + // 8x16 + i_best_cost = COST_MAX; + i_l0_satd = analysis.i_satd8x8[0][i] + analysis.i_satd8x8[0][i+2]; + i_l1_satd = analysis.i_satd8x8[1][i] + analysis.i_satd8x8[1][i+2]; + i_bi_satd = analysis.i_satd8x8[2][i] + analysis.i_satd8x8[2][i+2]; + avg_l0_mv_ref_cost = ( analysis.l0.me8x8[i].cost_mv + analysis.l0.me8x8[i].i_ref_cost + + analysis.l0.me8x8[i+2].cost_mv + analysis.l0.me8x8[i+2].i_ref_cost + 1 ) >> 1; + avg_l1_mv_ref_cost = ( analysis.l1.me8x8[i].cost_mv + analysis.l1.me8x8[i].i_ref_cost + + analysis.l1.me8x8[i+2].cost_mv + analysis.l1.me8x8[i+2].i_ref_cost + 1 ) >> 1; + COPY2_IF_LT( i_best_cost, i_l0_satd + avg_l0_mv_ref_cost, i_partition8x16[i], D_L0_8x8 ); + COPY2_IF_LT( i_best_cost, i_l1_satd + avg_l1_mv_ref_cost, i_partition8x16[i], D_L1_8x8 ); + COPY2_IF_LT( i_best_cost, i_bi_satd + avg_l0_mv_ref_cost + avg_l1_mv_ref_cost, i_partition8x16[i], D_BI_8x8 ); + analysis.i_cost_est8x16[i] = i_best_cost; + } + i_mb_type = B_L0_L0 + (i_partition16x8[0]>>2) * 3 + (i_partition16x8[1]>>2); + analysis.i_cost_est16x8[1] += analysis.i_lambda * i_mb_b16x8_cost_table[i_mb_type]; + i_cost_est16x8bi_total = analysis.i_cost_est16x8[0] + analysis.i_cost_est16x8[1]; + i_mb_type = B_L0_L0 + (i_partition8x16[0]>>2) * 3 + (i_partition8x16[1]>>2); + analysis.i_cost_est8x16[1] += analysis.i_lambda * i_mb_b16x8_cost_table[i_mb_type]; + i_cost_est8x16bi_total = analysis.i_cost_est8x16[0] + analysis.i_cost_est8x16[1]; + + /* We can gain a little speed by checking the mode with the lowest estimated cost first */ + int try_16x8_first = i_cost_est16x8bi_total < i_cost_est8x16bi_total; + if( try_16x8_first && (!analysis.b_early_terminate || i_cost_est16x8bi_total < i_cost) ) + { + x264_mb_analyse_inter_b16x8( h, &analysis, i_cost ); + COPY3_IF_LT( i_cost, analysis.i_cost16x8bi, i_type, analysis.i_mb_type16x8, i_partition, D_16x8 ); + } + if( !analysis.b_early_terminate || i_cost_est8x16bi_total < i_cost ) + { + x264_mb_analyse_inter_b8x16( h, &analysis, i_cost ); + COPY3_IF_LT( i_cost, analysis.i_cost8x16bi, i_type, analysis.i_mb_type8x16, i_partition, D_8x16 ); + } + if( !try_16x8_first && (!analysis.b_early_terminate || i_cost_est16x8bi_total < i_cost) ) + { + x264_mb_analyse_inter_b16x8( h, &analysis, i_cost ); + COPY3_IF_LT( i_cost, analysis.i_cost16x8bi, i_type, analysis.i_mb_type16x8, i_partition, D_16x8 ); + } + } + + if( analysis.i_mbrd || !h->mb.i_subpel_refine ) + { + /* refine later */ + } + /* refine qpel */ + else if( i_partition == D_16x16 ) + { + analysis.l0.me16x16.cost -= analysis.i_lambda * i_mb_b_cost_table[B_L0_L0]; + analysis.l1.me16x16.cost -= analysis.i_lambda * i_mb_b_cost_table[B_L1_L1]; + if( i_type == B_L0_L0 ) + { + x264_me_refine_qpel( h, &analysis.l0.me16x16 ); + i_cost = analysis.l0.me16x16.cost + + analysis.i_lambda * i_mb_b_cost_table[B_L0_L0]; + } + else if( i_type == B_L1_L1 ) + { + x264_me_refine_qpel( h, &analysis.l1.me16x16 ); + i_cost = analysis.l1.me16x16.cost + + analysis.i_lambda * i_mb_b_cost_table[B_L1_L1]; + } + else if( i_type == B_BI_BI ) + { + x264_me_refine_qpel( h, &analysis.l0.bi16x16 ); + x264_me_refine_qpel( h, &analysis.l1.bi16x16 ); + } + } + else if( i_partition == D_16x8 ) + { + for( int i = 0; i < 2; i++ ) + { + if( analysis.i_mb_partition16x8[i] != D_L1_8x8 ) + x264_me_refine_qpel( h, &analysis.l0.me16x8[i] ); + if( analysis.i_mb_partition16x8[i] != D_L0_8x8 ) + x264_me_refine_qpel( h, &analysis.l1.me16x8[i] ); + } + } + else if( i_partition == D_8x16 ) + { + for( int i = 0; i < 2; i++ ) + { + if( analysis.i_mb_partition8x16[i] != D_L1_8x8 ) + x264_me_refine_qpel( h, &analysis.l0.me8x16[i] ); + if( analysis.i_mb_partition8x16[i] != D_L0_8x8 ) + x264_me_refine_qpel( h, &analysis.l1.me8x16[i] ); + } + } + else if( i_partition == D_8x8 ) + { + for( int i = 0; i < 4; i++ ) + { + x264_me_t *m; + int i_part_cost_old; + int i_type_cost; + int i_part_type = h->mb.i_sub_partition[i]; + int b_bidir = (i_part_type == D_BI_8x8); + + if( i_part_type == D_DIRECT_8x8 ) + continue; + if( x264_mb_partition_listX_table[0][i_part_type] ) + { + m = &analysis.l0.me8x8[i]; + i_part_cost_old = m->cost; + i_type_cost = analysis.i_lambda * i_sub_mb_b_cost_table[D_L0_8x8]; + m->cost -= i_type_cost; + x264_me_refine_qpel( h, m ); + if( !b_bidir ) + analysis.i_cost8x8bi += m->cost + i_type_cost - i_part_cost_old; + } + if( x264_mb_partition_listX_table[1][i_part_type] ) + { + m = &analysis.l1.me8x8[i]; + i_part_cost_old = m->cost; + i_type_cost = analysis.i_lambda * i_sub_mb_b_cost_table[D_L1_8x8]; + m->cost -= i_type_cost; + x264_me_refine_qpel( h, m ); + if( !b_bidir ) + analysis.i_cost8x8bi += m->cost + i_type_cost - i_part_cost_old; + } + /* TODO: update mvp? */ + } + } + + i_satd_inter = i_cost; + + if( analysis.i_mbrd ) + { + x264_mb_analyse_b_rd( h, &analysis, i_satd_inter ); + i_type = B_SKIP; + i_cost = i_bskip_cost; + i_partition = D_16x16; + COPY2_IF_LT( i_cost, analysis.l0.i_rd16x16, i_type, B_L0_L0 ); + COPY2_IF_LT( i_cost, analysis.l1.i_rd16x16, i_type, B_L1_L1 ); + COPY2_IF_LT( i_cost, analysis.i_rd16x16bi, i_type, B_BI_BI ); + COPY2_IF_LT( i_cost, analysis.i_rd16x16direct, i_type, B_DIRECT ); + COPY3_IF_LT( i_cost, analysis.i_rd16x8bi, i_type, analysis.i_mb_type16x8, i_partition, D_16x8 ); + COPY3_IF_LT( i_cost, analysis.i_rd8x16bi, i_type, analysis.i_mb_type8x16, i_partition, D_8x16 ); + COPY3_IF_LT( i_cost, analysis.i_rd8x8bi, i_type, B_8x8, i_partition, D_8x8 ); + + h->mb.i_type = i_type; + h->mb.i_partition = i_partition; + } + + if( h->mb.b_chroma_me ) + { + if( CHROMA444 ) + { + x264_mb_analyse_intra( h, &analysis, i_satd_inter ); + x264_mb_analyse_intra_chroma( h, &analysis ); + } + else + { + x264_mb_analyse_intra_chroma( h, &analysis ); + x264_mb_analyse_intra( h, &analysis, i_satd_inter - analysis.i_satd_chroma ); + } + analysis.i_satd_i16x16 += analysis.i_satd_chroma; + analysis.i_satd_i8x8 += analysis.i_satd_chroma; + analysis.i_satd_i4x4 += analysis.i_satd_chroma; + } + else + x264_mb_analyse_intra( h, &analysis, i_satd_inter ); + + if( analysis.i_mbrd ) + { + x264_mb_analyse_transform_rd( h, &analysis, &i_satd_inter, &i_cost ); + x264_intra_rd( h, &analysis, i_satd_inter * 17/16 + 1 ); + } + + COPY2_IF_LT( i_cost, analysis.i_satd_i16x16, i_type, I_16x16 ); + COPY2_IF_LT( i_cost, analysis.i_satd_i8x8, i_type, I_8x8 ); + COPY2_IF_LT( i_cost, analysis.i_satd_i4x4, i_type, I_4x4 ); + COPY2_IF_LT( i_cost, analysis.i_satd_pcm, i_type, I_PCM ); + + h->mb.i_type = i_type; + h->mb.i_partition = i_partition; + + if( analysis.i_mbrd >= 2 && IS_INTRA( i_type ) && i_type != I_PCM ) + x264_intra_rd_refine( h, &analysis ); + if( h->mb.i_subpel_refine >= 5 ) + x264_refine_bidir( h, &analysis ); + + if( analysis.i_mbrd >= 2 && i_type > B_DIRECT && i_type < B_SKIP ) + { + int i_biweight; + x264_analyse_update_cache( h, &analysis ); + + if( i_partition == D_16x16 ) + { + if( i_type == B_L0_L0 ) + { + analysis.l0.me16x16.cost = i_cost; + x264_me_refine_qpel_rd( h, &analysis.l0.me16x16, analysis.i_lambda2, 0, 0 ); + } + else if( i_type == B_L1_L1 ) + { + analysis.l1.me16x16.cost = i_cost; + x264_me_refine_qpel_rd( h, &analysis.l1.me16x16, analysis.i_lambda2, 0, 1 ); + } + else if( i_type == B_BI_BI ) + { + i_biweight = h->mb.bipred_weight[analysis.l0.bi16x16.i_ref][analysis.l1.bi16x16.i_ref]; + x264_me_refine_bidir_rd( h, &analysis.l0.bi16x16, &analysis.l1.bi16x16, i_biweight, 0, analysis.i_lambda2 ); + } + } + else if( i_partition == D_16x8 ) + { + for( int i = 0; i < 2; i++ ) + { + h->mb.i_sub_partition[i*2] = h->mb.i_sub_partition[i*2+1] = analysis.i_mb_partition16x8[i]; + if( analysis.i_mb_partition16x8[i] == D_L0_8x8 ) + x264_me_refine_qpel_rd( h, &analysis.l0.me16x8[i], analysis.i_lambda2, i*8, 0 ); + else if( analysis.i_mb_partition16x8[i] == D_L1_8x8 ) + x264_me_refine_qpel_rd( h, &analysis.l1.me16x8[i], analysis.i_lambda2, i*8, 1 ); + else if( analysis.i_mb_partition16x8[i] == D_BI_8x8 ) + { + i_biweight = h->mb.bipred_weight[analysis.l0.me16x8[i].i_ref][analysis.l1.me16x8[i].i_ref]; + x264_me_refine_bidir_rd( h, &analysis.l0.me16x8[i], &analysis.l1.me16x8[i], i_biweight, i*2, analysis.i_lambda2 ); + } + } + } + else if( i_partition == D_8x16 ) + { + for( int i = 0; i < 2; i++ ) + { + h->mb.i_sub_partition[i] = h->mb.i_sub_partition[i+2] = analysis.i_mb_partition8x16[i]; + if( analysis.i_mb_partition8x16[i] == D_L0_8x8 ) + x264_me_refine_qpel_rd( h, &analysis.l0.me8x16[i], analysis.i_lambda2, i*4, 0 ); + else if( analysis.i_mb_partition8x16[i] == D_L1_8x8 ) + x264_me_refine_qpel_rd( h, &analysis.l1.me8x16[i], analysis.i_lambda2, i*4, 1 ); + else if( analysis.i_mb_partition8x16[i] == D_BI_8x8 ) + { + i_biweight = h->mb.bipred_weight[analysis.l0.me8x16[i].i_ref][analysis.l1.me8x16[i].i_ref]; + x264_me_refine_bidir_rd( h, &analysis.l0.me8x16[i], &analysis.l1.me8x16[i], i_biweight, i, analysis.i_lambda2 ); + } + } + } + else if( i_partition == D_8x8 ) + { + for( int i = 0; i < 4; i++ ) + { + if( h->mb.i_sub_partition[i] == D_L0_8x8 ) + x264_me_refine_qpel_rd( h, &analysis.l0.me8x8[i], analysis.i_lambda2, i*4, 0 ); + else if( h->mb.i_sub_partition[i] == D_L1_8x8 ) + x264_me_refine_qpel_rd( h, &analysis.l1.me8x8[i], analysis.i_lambda2, i*4, 1 ); + else if( h->mb.i_sub_partition[i] == D_BI_8x8 ) + { + i_biweight = h->mb.bipred_weight[analysis.l0.me8x8[i].i_ref][analysis.l1.me8x8[i].i_ref]; + x264_me_refine_bidir_rd( h, &analysis.l0.me8x8[i], &analysis.l1.me8x8[i], i_biweight, i, analysis.i_lambda2 ); + } + } + } + } + } + } + + x264_analyse_update_cache( h, &analysis ); + + /* In rare cases we can end up qpel-RDing our way back to a larger partition size + * without realizing it. Check for this and account for it if necessary. */ + if( analysis.i_mbrd >= 2 ) + { + /* Don't bother with bipred or 8x8-and-below, the odds are incredibly low. */ + static const uint8_t check_mv_lists[X264_MBTYPE_MAX] = {[P_L0]=1, [B_L0_L0]=1, [B_L1_L1]=2}; + int list = check_mv_lists[h->mb.i_type] - 1; + if( list >= 0 && h->mb.i_partition != D_16x16 && + M32( &h->mb.cache.mv[list][x264_scan8[0]] ) == M32( &h->mb.cache.mv[list][x264_scan8[12]] ) && + h->mb.cache.ref[list][x264_scan8[0]] == h->mb.cache.ref[list][x264_scan8[12]] ) + h->mb.i_partition = D_16x16; + } + + if( !analysis.i_mbrd ) + x264_mb_analyse_transform( h ); + + if( analysis.i_mbrd == 3 && !IS_SKIP(h->mb.i_type) ) + x264_mb_analyse_qp_rd( h, &analysis ); + + h->mb.b_trellis = h->param.analyse.i_trellis; + h->mb.b_noise_reduction = h->mb.b_noise_reduction || (!!h->param.analyse.i_noise_reduction && !IS_INTRA( h->mb.i_type )); + + if( !IS_SKIP(h->mb.i_type) && h->mb.i_psy_trellis && h->param.analyse.i_trellis == 1 ) + x264_psy_trellis_init( h, 0 ); + if( h->mb.b_trellis == 1 || h->mb.b_noise_reduction ) + h->mb.i_skip_intra = 0; +} + +/*-------------------- Update MB from the analysis ----------------------*/ +static void x264_analyse_update_cache( x264_t *h, x264_mb_analysis_t *a ) +{ + switch( h->mb.i_type ) + { + case I_4x4: + for( int i = 0; i < 16; i++ ) + h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] = a->i_predict4x4[i]; + + x264_mb_analyse_intra_chroma( h, a ); + break; + case I_8x8: + for( int i = 0; i < 4; i++ ) + x264_macroblock_cache_intra8x8_pred( h, 2*(i&1), 2*(i>>1), a->i_predict8x8[i] ); + + x264_mb_analyse_intra_chroma( h, a ); + break; + case I_16x16: + h->mb.i_intra16x16_pred_mode = a->i_predict16x16; + x264_mb_analyse_intra_chroma( h, a ); + break; + + case I_PCM: + break; + + case P_L0: + switch( h->mb.i_partition ) + { + case D_16x16: + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.me16x16.i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv ); + break; + + case D_16x8: + x264_macroblock_cache_ref( h, 0, 0, 4, 2, 0, a->l0.me16x8[0].i_ref ); + x264_macroblock_cache_ref( h, 0, 2, 4, 2, 0, a->l0.me16x8[1].i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 2, 0, a->l0.me16x8[0].mv ); + x264_macroblock_cache_mv_ptr( h, 0, 2, 4, 2, 0, a->l0.me16x8[1].mv ); + break; + + case D_8x16: + x264_macroblock_cache_ref( h, 0, 0, 2, 4, 0, a->l0.me8x16[0].i_ref ); + x264_macroblock_cache_ref( h, 2, 0, 2, 4, 0, a->l0.me8x16[1].i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 2, 4, 0, a->l0.me8x16[0].mv ); + x264_macroblock_cache_mv_ptr( h, 2, 0, 2, 4, 0, a->l0.me8x16[1].mv ); + break; + + default: + x264_log( h, X264_LOG_ERROR, "internal error P_L0 and partition=%d\n", h->mb.i_partition ); + break; + } + break; + + case P_8x8: + x264_macroblock_cache_ref( h, 0, 0, 2, 2, 0, a->l0.me8x8[0].i_ref ); + x264_macroblock_cache_ref( h, 2, 0, 2, 2, 0, a->l0.me8x8[1].i_ref ); + x264_macroblock_cache_ref( h, 0, 2, 2, 2, 0, a->l0.me8x8[2].i_ref ); + x264_macroblock_cache_ref( h, 2, 2, 2, 2, 0, a->l0.me8x8[3].i_ref ); + for( int i = 0; i < 4; i++ ) + x264_mb_cache_mv_p8x8( h, a, i ); + break; + + case P_SKIP: + { + h->mb.i_partition = D_16x16; + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, 0 ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, h->mb.cache.pskip_mv ); + break; + } + + case B_SKIP: + case B_DIRECT: + h->mb.i_partition = h->mb.cache.direct_partition; + x264_mb_load_mv_direct8x8( h, 0 ); + x264_mb_load_mv_direct8x8( h, 1 ); + x264_mb_load_mv_direct8x8( h, 2 ); + x264_mb_load_mv_direct8x8( h, 3 ); + break; + + case B_8x8: + /* optimize: cache might not need to be rewritten */ + for( int i = 0; i < 4; i++ ) + x264_mb_cache_mv_b8x8( h, a, i, 1 ); + break; + + default: /* the rest of the B types */ + switch( h->mb.i_partition ) + { + case D_16x16: + switch( h->mb.i_type ) + { + case B_L0_L0: + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.me16x16.i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.me16x16.mv ); + + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, -1 ); + x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 1, 0 ); + x264_macroblock_cache_mvd( h, 0, 0, 4, 4, 1, 0 ); + break; + case B_L1_L1: + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, -1 ); + x264_macroblock_cache_mv ( h, 0, 0, 4, 4, 0, 0 ); + x264_macroblock_cache_mvd( h, 0, 0, 4, 4, 0, 0 ); + + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, a->l1.me16x16.i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 1, a->l1.me16x16.mv ); + break; + case B_BI_BI: + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 0, a->l0.bi16x16.i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 0, a->l0.bi16x16.mv ); + + x264_macroblock_cache_ref( h, 0, 0, 4, 4, 1, a->l1.bi16x16.i_ref ); + x264_macroblock_cache_mv_ptr( h, 0, 0, 4, 4, 1, a->l1.bi16x16.mv ); + break; + } + break; + case D_16x8: + x264_mb_cache_mv_b16x8( h, a, 0, 1 ); + x264_mb_cache_mv_b16x8( h, a, 1, 1 ); + break; + case D_8x16: + x264_mb_cache_mv_b8x16( h, a, 0, 1 ); + x264_mb_cache_mv_b8x16( h, a, 1, 1 ); + break; + default: + x264_log( h, X264_LOG_ERROR, "internal error (invalid MB type)\n" ); + break; + } + } + +#ifndef NDEBUG + if( h->i_thread_frames > 1 && !IS_INTRA(h->mb.i_type) ) + { + for( int l = 0; l <= (h->sh.i_type == SLICE_TYPE_B); l++ ) + { + int completed; + int ref = h->mb.cache.ref[l][x264_scan8[0]]; + if( ref < 0 ) + continue; + completed = h->fref[l][ ref >> MB_INTERLACED ]->orig->i_lines_completed; + if( (h->mb.cache.mv[l][x264_scan8[15]][1] >> (2 - MB_INTERLACED)) + h->mb.i_mb_y*16 > completed ) + { + x264_log( h, X264_LOG_WARNING, "internal error (MV out of thread range)\n"); + x264_log( h, X264_LOG_DEBUG, "mb type: %d \n", h->mb.i_type); + x264_log( h, X264_LOG_DEBUG, "mv: l%dr%d (%d,%d) \n", l, ref, + h->mb.cache.mv[l][x264_scan8[15]][0], + h->mb.cache.mv[l][x264_scan8[15]][1] ); + x264_log( h, X264_LOG_DEBUG, "limit: %d \n", h->mb.mv_max_spel[1]); + x264_log( h, X264_LOG_DEBUG, "mb_xy: %d,%d \n", h->mb.i_mb_x, h->mb.i_mb_y); + x264_log( h, X264_LOG_DEBUG, "completed: %d \n", completed ); + x264_log( h, X264_LOG_WARNING, "recovering by using intra mode\n"); + x264_mb_analyse_intra( h, a, COST_MAX ); + h->mb.i_type = I_16x16; + h->mb.i_intra16x16_pred_mode = a->i_predict16x16; + x264_mb_analyse_intra_chroma( h, a ); + } + } + } +#endif +} + +#include "slicetype.c" + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.h new file mode 100644 index 00000000..05e3afb9 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/analyse.h @@ -0,0 +1,44 @@ +/***************************************************************************** + * analyse.h: macroblock analysis + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ANALYSE_H +#define X264_ANALYSE_H + +int x264_analyse_init_costs( x264_t *h ); +void x264_analyse_free_costs( x264_t *h ); +void x264_analyse_weight_frame( x264_t *h, int end ); +void x264_macroblock_analyse( x264_t *h ); +void x264_slicetype_decide( x264_t *h ); + +void x264_slicetype_analyse( x264_t *h, int intra_minigop ); + +int x264_lookahead_init( x264_t *h, int i_slicetype_length ); +int x264_lookahead_is_empty( x264_t *h ); +void x264_lookahead_put_frame( x264_t *h, x264_frame_t *frame ); +void x264_lookahead_get_frames( x264_t *h ); +void x264_lookahead_delete( x264_t *h ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cabac.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cabac.c new file mode 100644 index 00000000..9debd1ec --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cabac.c @@ -0,0 +1,1284 @@ +/***************************************************************************** + * cabac.c: cabac bitstream writing + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "macroblock.h" + +#ifndef RDO_SKIP_BS +#define RDO_SKIP_BS 0 +#endif + +static inline void x264_cabac_mb_type_intra( x264_t *h, x264_cabac_t *cb, int i_mb_type, + int ctx0, int ctx1, int ctx2, int ctx3, int ctx4, int ctx5 ) +{ + if( i_mb_type == I_4x4 || i_mb_type == I_8x8 ) + { + x264_cabac_encode_decision_noup( cb, ctx0, 0 ); + } +#if !RDO_SKIP_BS + else if( i_mb_type == I_PCM ) + { + x264_cabac_encode_decision_noup( cb, ctx0, 1 ); + x264_cabac_encode_flush( h, cb ); + } +#endif + else + { + int i_pred = x264_mb_pred_mode16x16_fix[h->mb.i_intra16x16_pred_mode]; + + x264_cabac_encode_decision_noup( cb, ctx0, 1 ); + x264_cabac_encode_terminal( cb ); + + x264_cabac_encode_decision_noup( cb, ctx1, !!h->mb.i_cbp_luma ); + if( h->mb.i_cbp_chroma == 0 ) + x264_cabac_encode_decision_noup( cb, ctx2, 0 ); + else + { + x264_cabac_encode_decision( cb, ctx2, 1 ); + x264_cabac_encode_decision_noup( cb, ctx3, h->mb.i_cbp_chroma>>1 ); + } + x264_cabac_encode_decision( cb, ctx4, i_pred>>1 ); + x264_cabac_encode_decision_noup( cb, ctx5, i_pred&1 ); + } +} + +#if !RDO_SKIP_BS +static void x264_cabac_field_decoding_flag( x264_t *h, x264_cabac_t *cb ) +{ + int ctx = 0; + ctx += h->mb.field_decoding_flag & !!h->mb.i_mb_x; + ctx += (h->mb.i_mb_top_mbpair_xy >= 0 + && h->mb.slice_table[h->mb.i_mb_top_mbpair_xy] == h->sh.i_first_mb + && h->mb.field[h->mb.i_mb_top_mbpair_xy]); + + x264_cabac_encode_decision_noup( cb, 70 + ctx, MB_INTERLACED ); + h->mb.field_decoding_flag = MB_INTERLACED; +} +#endif + +static void x264_cabac_intra4x4_pred_mode( x264_cabac_t *cb, int i_pred, int i_mode ) +{ + if( i_pred == i_mode ) + x264_cabac_encode_decision( cb, 68, 1 ); + else + { + x264_cabac_encode_decision( cb, 68, 0 ); + if( i_mode > i_pred ) + i_mode--; + x264_cabac_encode_decision( cb, 69, (i_mode )&0x01 ); + x264_cabac_encode_decision( cb, 69, (i_mode >> 1)&0x01 ); + x264_cabac_encode_decision( cb, 69, (i_mode >> 2) ); + } +} + +static void x264_cabac_intra_chroma_pred_mode( x264_t *h, x264_cabac_t *cb ) +{ + int i_mode = x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode]; + int ctx = 0; + + /* No need to test for I4x4 or I_16x16 as cache_save handle that */ + if( (h->mb.i_neighbour & MB_LEFT) && h->mb.chroma_pred_mode[h->mb.i_mb_left_xy[0]] != 0 ) + ctx++; + if( (h->mb.i_neighbour & MB_TOP) && h->mb.chroma_pred_mode[h->mb.i_mb_top_xy] != 0 ) + ctx++; + + x264_cabac_encode_decision_noup( cb, 64 + ctx, i_mode > 0 ); + if( i_mode > 0 ) + { + x264_cabac_encode_decision( cb, 64 + 3, i_mode > 1 ); + if( i_mode > 1 ) + x264_cabac_encode_decision_noup( cb, 64 + 3, i_mode > 2 ); + } +} + +static void x264_cabac_cbp_luma( x264_t *h, x264_cabac_t *cb ) +{ + int cbp = h->mb.i_cbp_luma; + int cbp_l = h->mb.cache.i_cbp_left; + int cbp_t = h->mb.cache.i_cbp_top; + x264_cabac_encode_decision ( cb, 76 - ((cbp_l >> 1) & 1) - ((cbp_t >> 1) & 2), (cbp >> 0) & 1 ); + x264_cabac_encode_decision ( cb, 76 - ((cbp >> 0) & 1) - ((cbp_t >> 2) & 2), (cbp >> 1) & 1 ); + x264_cabac_encode_decision ( cb, 76 - ((cbp_l >> 3) & 1) - ((cbp << 1) & 2), (cbp >> 2) & 1 ); + x264_cabac_encode_decision_noup( cb, 76 - ((cbp >> 2) & 1) - ((cbp >> 0) & 2), (cbp >> 3) & 1 ); +} + +static void x264_cabac_cbp_chroma( x264_t *h, x264_cabac_t *cb ) +{ + int cbp_a = h->mb.cache.i_cbp_left & 0x30; + int cbp_b = h->mb.cache.i_cbp_top & 0x30; + int ctx = 0; + + if( cbp_a && h->mb.cache.i_cbp_left != -1 ) ctx++; + if( cbp_b && h->mb.cache.i_cbp_top != -1 ) ctx+=2; + if( h->mb.i_cbp_chroma == 0 ) + x264_cabac_encode_decision_noup( cb, 77 + ctx, 0 ); + else + { + x264_cabac_encode_decision_noup( cb, 77 + ctx, 1 ); + + ctx = 4; + if( cbp_a == 0x20 ) ctx++; + if( cbp_b == 0x20 ) ctx += 2; + x264_cabac_encode_decision_noup( cb, 77 + ctx, h->mb.i_cbp_chroma >> 1 ); + } +} + +static void x264_cabac_qp_delta( x264_t *h, x264_cabac_t *cb ) +{ + int i_dqp = h->mb.i_qp - h->mb.i_last_qp; + int ctx; + + /* Avoid writing a delta quant if we have an empty i16x16 block, e.g. in a completely + * flat background area. Don't do this if it would raise the quantizer, since that could + * cause unexpected deblocking artifacts. */ + if( h->mb.i_type == I_16x16 && !h->mb.cbp[h->mb.i_mb_xy] && h->mb.i_qp > h->mb.i_last_qp ) + { +#if !RDO_SKIP_BS + h->mb.i_qp = h->mb.i_last_qp; +#endif + i_dqp = 0; + } + + ctx = h->mb.i_last_dqp && (h->mb.type[h->mb.i_mb_prev_xy] == I_16x16 || (h->mb.cbp[h->mb.i_mb_prev_xy]&0x3f)); + + if( i_dqp != 0 ) + { + /* Faster than (i_dqp <= 0 ? (-2*i_dqp) : (2*i_dqp-1)). + * If you so much as sneeze on these lines, gcc will compile this suboptimally. */ + i_dqp *= 2; + int val = 1 - i_dqp; + if( val < 0 ) val = i_dqp; + val--; + /* dqp is interpreted modulo (QP_MAX_SPEC+1) */ + if( val >= QP_MAX_SPEC && val != QP_MAX_SPEC+1 ) + val = 2*QP_MAX_SPEC+1 - val; + do + { + x264_cabac_encode_decision( cb, 60 + ctx, 1 ); + ctx = 2+(ctx>>1); + } while( --val ); + } + x264_cabac_encode_decision_noup( cb, 60 + ctx, 0 ); +} + +#if !RDO_SKIP_BS +void x264_cabac_mb_skip( x264_t *h, int b_skip ) +{ + int ctx = h->mb.cache.i_neighbour_skip + 11; + if( h->sh.i_type != SLICE_TYPE_P ) + ctx += 13; + x264_cabac_encode_decision( &h->cabac, ctx, b_skip ); +} +#endif + +static inline void x264_cabac_subpartition_p( x264_cabac_t *cb, int i_sub ) +{ + if( i_sub == D_L0_8x8 ) + { + x264_cabac_encode_decision( cb, 21, 1 ); + return; + } + x264_cabac_encode_decision( cb, 21, 0 ); + if( i_sub == D_L0_8x4 ) + x264_cabac_encode_decision( cb, 22, 0 ); + else + { + x264_cabac_encode_decision( cb, 22, 1 ); + x264_cabac_encode_decision( cb, 23, i_sub == D_L0_4x8 ); + } +} + +static ALWAYS_INLINE void x264_cabac_subpartition_b( x264_cabac_t *cb, int i_sub ) +{ + if( i_sub == D_DIRECT_8x8 ) + { + x264_cabac_encode_decision( cb, 36, 0 ); + return; + } + x264_cabac_encode_decision( cb, 36, 1 ); + if( i_sub == D_BI_8x8 ) + { + x264_cabac_encode_decision( cb, 37, 1 ); + x264_cabac_encode_decision( cb, 38, 0 ); + x264_cabac_encode_decision( cb, 39, 0 ); + x264_cabac_encode_decision( cb, 39, 0 ); + return; + } + x264_cabac_encode_decision( cb, 37, 0 ); + x264_cabac_encode_decision( cb, 39, i_sub == D_L1_8x8 ); +} + +static ALWAYS_INLINE void x264_cabac_transform_size( x264_t *h, x264_cabac_t *cb ) +{ + int ctx = 399 + h->mb.cache.i_neighbour_transform_size; + x264_cabac_encode_decision_noup( cb, ctx, h->mb.b_transform_8x8 ); +} + +static ALWAYS_INLINE void x264_cabac_ref_internal( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int bframe ) +{ + const int i8 = x264_scan8[idx]; + const int i_refa = h->mb.cache.ref[i_list][i8 - 1]; + const int i_refb = h->mb.cache.ref[i_list][i8 - 8]; + int ctx = 0; + + if( i_refa > 0 && (!bframe || !h->mb.cache.skip[i8 - 1]) ) + ctx++; + if( i_refb > 0 && (!bframe || !h->mb.cache.skip[i8 - 8]) ) + ctx += 2; + + for( int i_ref = h->mb.cache.ref[i_list][i8]; i_ref > 0; i_ref-- ) + { + x264_cabac_encode_decision( cb, 54 + ctx, 1 ); + ctx = (ctx>>2)+4; + } + x264_cabac_encode_decision( cb, 54 + ctx, 0 ); +} + +static NOINLINE void x264_cabac_ref_p( x264_t *h, x264_cabac_t *cb, int idx ) +{ + x264_cabac_ref_internal( h, cb, 0, idx, 0 ); +} +static NOINLINE void x264_cabac_ref_b( x264_t *h, x264_cabac_t *cb, int i_list, int idx ) +{ + x264_cabac_ref_internal( h, cb, i_list, idx, 1 ); +} + +static ALWAYS_INLINE int x264_cabac_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd, int ctx ) +{ + int ctxbase = l ? 47 : 40; + + if( mvd == 0 ) + { + x264_cabac_encode_decision( cb, ctxbase + ctx, 0 ); + return 0; + } + + int i_abs = abs( mvd ); + x264_cabac_encode_decision( cb, ctxbase + ctx, 1 ); +#if RDO_SKIP_BS + if( i_abs <= 3 ) + { + for( int i = 1; i < i_abs; i++ ) + x264_cabac_encode_decision( cb, ctxbase + i + 2, 1 ); + x264_cabac_encode_decision( cb, ctxbase + i_abs + 2, 0 ); + x264_cabac_encode_bypass( cb, mvd >> 31 ); + } + else + { + x264_cabac_encode_decision( cb, ctxbase + 3, 1 ); + x264_cabac_encode_decision( cb, ctxbase + 4, 1 ); + x264_cabac_encode_decision( cb, ctxbase + 5, 1 ); + if( i_abs < 9 ) + { + cb->f8_bits_encoded += x264_cabac_size_unary[i_abs - 3][cb->state[ctxbase+6]]; + cb->state[ctxbase+6] = x264_cabac_transition_unary[i_abs - 3][cb->state[ctxbase+6]]; + } + else + { + cb->f8_bits_encoded += cabac_size_5ones[cb->state[ctxbase+6]]; + cb->state[ctxbase+6] = cabac_transition_5ones[cb->state[ctxbase+6]]; + x264_cabac_encode_ue_bypass( cb, 3, i_abs - 9 ); + } + } +#else + static const uint8_t ctxes[8] = { 3,4,5,6,6,6,6,6 }; + + if( i_abs < 9 ) + { + for( int i = 1; i < i_abs; i++ ) + x264_cabac_encode_decision( cb, ctxbase + ctxes[i-1], 1 ); + x264_cabac_encode_decision( cb, ctxbase + ctxes[i_abs-1], 0 ); + } + else + { + for( int i = 1; i < 9; i++ ) + x264_cabac_encode_decision( cb, ctxbase + ctxes[i-1], 1 ); + x264_cabac_encode_ue_bypass( cb, 3, i_abs - 9 ); + } + x264_cabac_encode_bypass( cb, mvd >> 31 ); +#endif + /* Since we don't need to keep track of MVDs larger than 66, just cap the value. + * This lets us store MVDs as 8-bit values instead of 16-bit. */ + return X264_MIN( i_abs, 66 ); +} + +static NOINLINE uint16_t x264_cabac_mvd( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int width ) +{ + ALIGNED_4( int16_t mvp[2] ); + int mdx, mdy; + + /* Calculate mvd */ + x264_mb_predict_mv( h, i_list, idx, width, mvp ); + mdx = h->mb.cache.mv[i_list][x264_scan8[idx]][0] - mvp[0]; + mdy = h->mb.cache.mv[i_list][x264_scan8[idx]][1] - mvp[1]; + uint16_t amvd = x264_cabac_mvd_sum(h->mb.cache.mvd[i_list][x264_scan8[idx] - 1], + h->mb.cache.mvd[i_list][x264_scan8[idx] - 8]); + + /* encode */ + mdx = x264_cabac_mvd_cpn( h, cb, i_list, idx, 0, mdx, amvd&0xFF ); + mdy = x264_cabac_mvd_cpn( h, cb, i_list, idx, 1, mdy, amvd>>8 ); + + return pack8to16(mdx,mdy); +} + +#define x264_cabac_mvd(h,cb,i_list,idx,width,height)\ +do\ +{\ + uint16_t mvd = x264_cabac_mvd(h,cb,i_list,idx,width);\ + x264_macroblock_cache_mvd( h, block_idx_x[idx], block_idx_y[idx], width, height, i_list, mvd );\ +} while( 0 ) + +static inline void x264_cabac_8x8_mvd( x264_t *h, x264_cabac_t *cb, int i ) +{ + switch( h->mb.i_sub_partition[i] ) + { + case D_L0_8x8: + x264_cabac_mvd( h, cb, 0, 4*i, 2, 2 ); + break; + case D_L0_8x4: + x264_cabac_mvd( h, cb, 0, 4*i+0, 2, 1 ); + x264_cabac_mvd( h, cb, 0, 4*i+2, 2, 1 ); + break; + case D_L0_4x8: + x264_cabac_mvd( h, cb, 0, 4*i+0, 1, 2 ); + x264_cabac_mvd( h, cb, 0, 4*i+1, 1, 2 ); + break; + case D_L0_4x4: + x264_cabac_mvd( h, cb, 0, 4*i+0, 1, 1 ); + x264_cabac_mvd( h, cb, 0, 4*i+1, 1, 1 ); + x264_cabac_mvd( h, cb, 0, 4*i+2, 1, 1 ); + x264_cabac_mvd( h, cb, 0, 4*i+3, 1, 1 ); + break; + default: + assert(0); + } +} + +static ALWAYS_INLINE void x264_cabac_mb_header_i( x264_t *h, x264_cabac_t *cb, int i_mb_type, int slice_type, int chroma ) +{ + if( slice_type == SLICE_TYPE_I ) + { + int ctx = 0; + if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left[0] != I_4x4 ) + ctx++; + if( (h->mb.i_neighbour & MB_TOP) && h->mb.i_mb_type_top != I_4x4 ) + ctx++; + + x264_cabac_mb_type_intra( h, cb, i_mb_type, 3+ctx, 3+3, 3+4, 3+5, 3+6, 3+7 ); + } + else if( slice_type == SLICE_TYPE_P ) + { + /* prefix */ + x264_cabac_encode_decision_noup( cb, 14, 1 ); + + /* suffix */ + x264_cabac_mb_type_intra( h, cb, i_mb_type, 17+0, 17+1, 17+2, 17+2, 17+3, 17+3 ); + } + else if( slice_type == SLICE_TYPE_B ) + { + /* prefix */ + x264_cabac_encode_decision_noup( cb, 27+3, 1 ); + x264_cabac_encode_decision_noup( cb, 27+4, 1 ); + x264_cabac_encode_decision( cb, 27+5, 1 ); + x264_cabac_encode_decision( cb, 27+5, 0 ); + x264_cabac_encode_decision( cb, 27+5, 1 ); + + /* suffix */ + x264_cabac_mb_type_intra( h, cb, i_mb_type, 32+0, 32+1, 32+2, 32+2, 32+3, 32+3 ); + } + + if( i_mb_type == I_PCM ) + return; + + if( i_mb_type != I_16x16 ) + { + if( h->pps->b_transform_8x8_mode ) + x264_cabac_transform_size( h, cb ); + + int di = h->mb.b_transform_8x8 ? 4 : 1; + for( int i = 0; i < 16; i += di ) + { + const int i_pred = x264_mb_predict_intra4x4_mode( h, i ); + const int i_mode = x264_mb_pred_mode4x4_fix( h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] ); + x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode ); + } + } + + if( chroma ) + x264_cabac_intra_chroma_pred_mode( h, cb ); +} + +static ALWAYS_INLINE void x264_cabac_mb_header_p( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma ) +{ + if( i_mb_type == P_L0 ) + { + x264_cabac_encode_decision_noup( cb, 14, 0 ); + if( h->mb.i_partition == D_16x16 ) + { + x264_cabac_encode_decision_noup( cb, 15, 0 ); + x264_cabac_encode_decision_noup( cb, 16, 0 ); + if( h->mb.pic.i_fref[0] > 1 ) + x264_cabac_ref_p( h, cb, 0 ); + x264_cabac_mvd( h, cb, 0, 0, 4, 4 ); + } + else if( h->mb.i_partition == D_16x8 ) + { + x264_cabac_encode_decision_noup( cb, 15, 1 ); + x264_cabac_encode_decision_noup( cb, 17, 1 ); + if( h->mb.pic.i_fref[0] > 1 ) + { + x264_cabac_ref_p( h, cb, 0 ); + x264_cabac_ref_p( h, cb, 8 ); + } + x264_cabac_mvd( h, cb, 0, 0, 4, 2 ); + x264_cabac_mvd( h, cb, 0, 8, 4, 2 ); + } + else //if( h->mb.i_partition == D_8x16 ) + { + x264_cabac_encode_decision_noup( cb, 15, 1 ); + x264_cabac_encode_decision_noup( cb, 17, 0 ); + if( h->mb.pic.i_fref[0] > 1 ) + { + x264_cabac_ref_p( h, cb, 0 ); + x264_cabac_ref_p( h, cb, 4 ); + } + x264_cabac_mvd( h, cb, 0, 0, 2, 4 ); + x264_cabac_mvd( h, cb, 0, 4, 2, 4 ); + } + } + else if( i_mb_type == P_8x8 ) + { + x264_cabac_encode_decision_noup( cb, 14, 0 ); + x264_cabac_encode_decision_noup( cb, 15, 0 ); + x264_cabac_encode_decision_noup( cb, 16, 1 ); + + /* sub mb type */ + for( int i = 0; i < 4; i++ ) + x264_cabac_subpartition_p( cb, h->mb.i_sub_partition[i] ); + + /* ref 0 */ + if( h->mb.pic.i_fref[0] > 1 ) + { + x264_cabac_ref_p( h, cb, 0 ); + x264_cabac_ref_p( h, cb, 4 ); + x264_cabac_ref_p( h, cb, 8 ); + x264_cabac_ref_p( h, cb, 12 ); + } + + for( int i = 0; i < 4; i++ ) + x264_cabac_8x8_mvd( h, cb, i ); + } + else /* intra */ + x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_P, chroma ); +} + +static ALWAYS_INLINE void x264_cabac_mb_header_b( x264_t *h, x264_cabac_t *cb, int i_mb_type, int chroma ) +{ + int ctx = 0; + if( (h->mb.i_neighbour & MB_LEFT) && h->mb.i_mb_type_left[0] != B_SKIP && h->mb.i_mb_type_left[0] != B_DIRECT ) + ctx++; + if( (h->mb.i_neighbour & MB_TOP) && h->mb.i_mb_type_top != B_SKIP && h->mb.i_mb_type_top != B_DIRECT ) + ctx++; + + if( i_mb_type == B_DIRECT ) + { + x264_cabac_encode_decision_noup( cb, 27+ctx, 0 ); + return; + } + x264_cabac_encode_decision_noup( cb, 27+ctx, 1 ); + + if( i_mb_type == B_8x8 ) + { + x264_cabac_encode_decision_noup( cb, 27+3, 1 ); + x264_cabac_encode_decision_noup( cb, 27+4, 1 ); + x264_cabac_encode_decision( cb, 27+5, 1 ); + x264_cabac_encode_decision( cb, 27+5, 1 ); + x264_cabac_encode_decision_noup( cb, 27+5, 1 ); + + /* sub mb type */ + for( int i = 0; i < 4; i++ ) + x264_cabac_subpartition_b( cb, h->mb.i_sub_partition[i] ); + + /* ref */ + if( h->mb.pic.i_fref[0] > 1 ) + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] ) + x264_cabac_ref_b( h, cb, 0, 4*i ); + + if( h->mb.pic.i_fref[1] > 1 ) + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] ) + x264_cabac_ref_b( h, cb, 1, 4*i ); + + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] ) + x264_cabac_mvd( h, cb, 0, 4*i, 2, 2 ); + + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] ) + x264_cabac_mvd( h, cb, 1, 4*i, 2, 2 ); + } + else if( i_mb_type >= B_L0_L0 && i_mb_type <= B_BI_BI ) + { + /* All B modes */ + static const uint8_t i_mb_bits[9*3] = + { + 0x31, 0x29, 0x4, /* L0 L0 */ + 0x35, 0x2d, 0, /* L0 L1 */ + 0x43, 0x63, 0, /* L0 BI */ + 0x3d, 0x2f, 0, /* L1 L0 */ + 0x39, 0x25, 0x6, /* L1 L1 */ + 0x53, 0x73, 0, /* L1 BI */ + 0x4b, 0x6b, 0, /* BI L0 */ + 0x5b, 0x7b, 0, /* BI L1 */ + 0x47, 0x67, 0x21 /* BI BI */ + }; + + const int idx = (i_mb_type - B_L0_L0) * 3 + (h->mb.i_partition - D_16x8); + int bits = i_mb_bits[idx]; + + x264_cabac_encode_decision_noup( cb, 27+3, bits&1 ); + x264_cabac_encode_decision( cb, 27+5-(bits&1), (bits>>1)&1 ); bits >>= 2; + if( bits != 1 ) + { + x264_cabac_encode_decision( cb, 27+5, bits&1 ); bits >>= 1; + x264_cabac_encode_decision( cb, 27+5, bits&1 ); bits >>= 1; + x264_cabac_encode_decision( cb, 27+5, bits&1 ); bits >>= 1; + if( bits != 1 ) + x264_cabac_encode_decision_noup( cb, 27+5, bits&1 ); + } + + const uint8_t (*b_list)[2] = x264_mb_type_list_table[i_mb_type]; + if( h->mb.pic.i_fref[0] > 1 ) + { + if( b_list[0][0] ) + x264_cabac_ref_b( h, cb, 0, 0 ); + if( b_list[0][1] && h->mb.i_partition != D_16x16 ) + x264_cabac_ref_b( h, cb, 0, 8 >> (h->mb.i_partition == D_8x16) ); + } + if( h->mb.pic.i_fref[1] > 1 ) + { + if( b_list[1][0] ) + x264_cabac_ref_b( h, cb, 1, 0 ); + if( b_list[1][1] && h->mb.i_partition != D_16x16 ) + x264_cabac_ref_b( h, cb, 1, 8 >> (h->mb.i_partition == D_8x16) ); + } + for( int i_list = 0; i_list < 2; i_list++ ) + { + if( h->mb.i_partition == D_16x16 ) + { + if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 4, 4 ); + } + else if( h->mb.i_partition == D_16x8 ) + { + if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 4, 2 ); + if( b_list[i_list][1] ) x264_cabac_mvd( h, cb, i_list, 8, 4, 2 ); + } + else //if( h->mb.i_partition == D_8x16 ) + { + if( b_list[i_list][0] ) x264_cabac_mvd( h, cb, i_list, 0, 2, 4 ); + if( b_list[i_list][1] ) x264_cabac_mvd( h, cb, i_list, 4, 2, 4 ); + } + } + } + else /* intra */ + x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_B, chroma ); +} + +static int ALWAYS_INLINE x264_cabac_cbf_ctxidxinc( x264_t *h, int i_cat, int i_idx, int b_intra, int b_dc ) +{ + static const uint16_t base_ctx[14] = {85,89,93,97,101,1012,460,464,468,1016,472,476,480,1020}; + + if( b_dc ) + { + i_idx -= LUMA_DC; + if( i_cat == DCT_CHROMA_DC ) + { + int i_nza = h->mb.cache.i_cbp_left != -1 ? (h->mb.cache.i_cbp_left >> (8 + i_idx)) & 1 : b_intra; + int i_nzb = h->mb.cache.i_cbp_top != -1 ? (h->mb.cache.i_cbp_top >> (8 + i_idx)) & 1 : b_intra; + return base_ctx[i_cat] + 2*i_nzb + i_nza; + } + else + { + int i_nza = (h->mb.cache.i_cbp_left >> (8 + i_idx)) & 1; + int i_nzb = (h->mb.cache.i_cbp_top >> (8 + i_idx)) & 1; + return base_ctx[i_cat] + 2*i_nzb + i_nza; + } + } + else + { + int i_nza = h->mb.cache.non_zero_count[x264_scan8[i_idx] - 1]; + int i_nzb = h->mb.cache.non_zero_count[x264_scan8[i_idx] - 8]; + if( x264_constant_p(b_intra) && !b_intra ) + return base_ctx[i_cat] + ((2*i_nzb + i_nza)&0x7f); + else + { + i_nza &= 0x7f + (b_intra << 7); + i_nzb &= 0x7f + (b_intra << 7); + return base_ctx[i_cat] + 2*!!i_nzb + !!i_nza; + } + } +} + +#if !RDO_SKIP_BS +extern const uint8_t x264_significant_coeff_flag_offset_8x8[2][64]; +extern const uint8_t x264_last_coeff_flag_offset_8x8[63]; +extern const uint8_t x264_coeff_flag_offset_chroma_422_dc[7]; +extern const uint16_t x264_significant_coeff_flag_offset[2][16]; +extern const uint16_t x264_last_coeff_flag_offset[2][16]; +extern const uint16_t x264_coeff_abs_level_m1_offset[16]; +extern const uint8_t x264_count_cat_m1[14]; +#else +/* Padded to [64] for easier addressing */ +const uint8_t x264_significant_coeff_flag_offset_8x8[2][64] = +{{ + 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, + 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7, + 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11, + 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 +},{ + 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, + 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, + 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9, + 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 +}}; +const uint8_t x264_last_coeff_flag_offset_8x8[63] = +{ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, + 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8 +}; +const uint8_t x264_coeff_flag_offset_chroma_422_dc[7] = { 0, 0, 1, 1, 2, 2, 2 }; /* MIN( i/2, 2 ) */ +const uint16_t x264_significant_coeff_flag_offset[2][16] = +{ + { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718, 0, 0 }, + { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733, 0, 0 } +}; +const uint16_t x264_last_coeff_flag_offset[2][16] = +{ + { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748, 0, 0 }, + { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757, 0, 0 } +}; +const uint16_t x264_coeff_abs_level_m1_offset[16] = +{ + 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766 +}; +const uint8_t x264_count_cat_m1[14] = {15, 14, 15, 3, 14, 63, 15, 14, 15, 63, 15, 14, 15, 63}; +#endif + +// node ctx: 0..3: abslevel1 (with abslevelgt1 == 0). +// 4..7: abslevelgt1 + 3 (and abslevel1 doesn't matter). +/* map node ctx => cabac ctx for level=1 */ +static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 }; +/* map node ctx => cabac ctx for level>1 */ +static const uint8_t coeff_abs_levelgt1_ctx[8] = { 5, 5, 5, 5, 6, 7, 8, 9 }; +/* 4:2:2 chroma dc uses a slightly different state machine for some reason, also note that + * 4:2:0 chroma dc doesn't use the last state so it has identical output with both arrays. */ +static const uint8_t coeff_abs_levelgt1_ctx_chroma_dc[8] = { 5, 5, 5, 5, 6, 7, 8, 8 }; + +static const uint8_t coeff_abs_level_transition[2][8] = { +/* update node ctx after coding a level=1 */ + { 1, 2, 3, 3, 4, 5, 6, 7 }, +/* update node ctx after coding a level>1 */ + { 4, 4, 4, 4, 5, 6, 7, 7 } +}; + +#if !RDO_SKIP_BS +static ALWAYS_INLINE void x264_cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int chroma422dc ) +{ + int ctx_sig = x264_significant_coeff_flag_offset[MB_INTERLACED][ctx_block_cat]; + int ctx_last = x264_last_coeff_flag_offset[MB_INTERLACED][ctx_block_cat]; + int ctx_level = x264_coeff_abs_level_m1_offset[ctx_block_cat]; + int coeff_idx = -1, node_ctx = 0; + int last = h->quantf.coeff_last[ctx_block_cat]( l ); + const uint8_t *levelgt1_ctx = chroma422dc ? coeff_abs_levelgt1_ctx_chroma_dc : coeff_abs_levelgt1_ctx; + dctcoef coeffs[64]; + +#define WRITE_SIGMAP( sig_off, last_off )\ +{\ + int i = 0;\ + while( 1 )\ + {\ + if( l[i] )\ + {\ + coeffs[++coeff_idx] = l[i];\ + x264_cabac_encode_decision( cb, ctx_sig + sig_off, 1 );\ + if( i == last )\ + {\ + x264_cabac_encode_decision( cb, ctx_last + last_off, 1 );\ + break;\ + }\ + else\ + x264_cabac_encode_decision( cb, ctx_last + last_off, 0 );\ + }\ + else\ + x264_cabac_encode_decision( cb, ctx_sig + sig_off, 0 );\ + if( ++i == count_m1 )\ + {\ + coeffs[++coeff_idx] = l[i];\ + break;\ + }\ + }\ +} + + if( chroma422dc ) + { + int count_m1 = 7; + WRITE_SIGMAP( x264_coeff_flag_offset_chroma_422_dc[i], x264_coeff_flag_offset_chroma_422_dc[i] ) + } + else + { + int count_m1 = x264_count_cat_m1[ctx_block_cat]; + if( count_m1 == 63 ) + { + const uint8_t *sig_offset = x264_significant_coeff_flag_offset_8x8[MB_INTERLACED]; + WRITE_SIGMAP( sig_offset[i], x264_last_coeff_flag_offset_8x8[i] ) + } + else + WRITE_SIGMAP( i, i ) + } + + do + { + /* write coeff_abs - 1 */ + int coeff = coeffs[coeff_idx]; + int abs_coeff = abs(coeff); + int coeff_sign = coeff >> 31; + int ctx = coeff_abs_level1_ctx[node_ctx] + ctx_level; + + if( abs_coeff > 1 ) + { + x264_cabac_encode_decision( cb, ctx, 1 ); + ctx = levelgt1_ctx[node_ctx] + ctx_level; + for( int i = X264_MIN( abs_coeff, 15 ) - 2; i > 0; i-- ) + x264_cabac_encode_decision( cb, ctx, 1 ); + if( abs_coeff < 15 ) + x264_cabac_encode_decision( cb, ctx, 0 ); + else + x264_cabac_encode_ue_bypass( cb, 0, abs_coeff - 15 ); + + node_ctx = coeff_abs_level_transition[1][node_ctx]; + } + else + { + x264_cabac_encode_decision( cb, ctx, 0 ); + node_ctx = coeff_abs_level_transition[0][node_ctx]; + } + + x264_cabac_encode_bypass( cb, coeff_sign ); + } while( --coeff_idx >= 0 ); +} + +void x264_cabac_block_residual_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ + x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0 ); +} + +static void ALWAYS_INLINE x264_cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ +#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ ) + h->bsf.cabac_block_residual_internal( l, MB_INTERLACED, ctx_block_cat, cb ); +#else + x264_cabac_block_residual_c( h, cb, ctx_block_cat, l ); +#endif +} +static void x264_cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ + /* Template a version specifically for chroma 4:2:2 DC in order to avoid + * slowing down everything else due to the added complexity. */ + x264_cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 1 ); +} +#define x264_cabac_block_residual_8x8( h, cb, cat, l ) x264_cabac_block_residual( h, cb, cat, l ) +#else + +/* Faster RDO by merging sigmap and level coding. Note that for 8x8dct and chroma 4:2:2 dc this is + * slightly incorrect because the sigmap is not reversible (contexts are repeated). However, there + * is nearly no quality penalty for this (~0.001db) and the speed boost (~30%) is worth it. */ +static void ALWAYS_INLINE x264_cabac_block_residual_internal( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l, int b_8x8, int chroma422dc ) +{ + const uint8_t *sig_offset = x264_significant_coeff_flag_offset_8x8[MB_INTERLACED]; + int ctx_sig = x264_significant_coeff_flag_offset[MB_INTERLACED][ctx_block_cat]; + int ctx_last = x264_last_coeff_flag_offset[MB_INTERLACED][ctx_block_cat]; + int ctx_level = x264_coeff_abs_level_m1_offset[ctx_block_cat]; + int last = h->quantf.coeff_last[ctx_block_cat]( l ); + int coeff_abs = abs(l[last]); + int ctx = coeff_abs_level1_ctx[0] + ctx_level; + int node_ctx; + const uint8_t *levelgt1_ctx = chroma422dc ? coeff_abs_levelgt1_ctx_chroma_dc : coeff_abs_levelgt1_ctx; + + if( last != (b_8x8 ? 63 : chroma422dc ? 7 : x264_count_cat_m1[ctx_block_cat]) ) + { + x264_cabac_encode_decision( cb, ctx_sig + (b_8x8 ? sig_offset[last] : + chroma422dc ? x264_coeff_flag_offset_chroma_422_dc[last] : last), 1 ); + x264_cabac_encode_decision( cb, ctx_last + (b_8x8 ? x264_last_coeff_flag_offset_8x8[last] : + chroma422dc ? x264_coeff_flag_offset_chroma_422_dc[last] : last), 1 ); + } + + if( coeff_abs > 1 ) + { + x264_cabac_encode_decision( cb, ctx, 1 ); + ctx = levelgt1_ctx[0] + ctx_level; + if( coeff_abs < 15 ) + { + cb->f8_bits_encoded += x264_cabac_size_unary[coeff_abs-1][cb->state[ctx]]; + cb->state[ctx] = x264_cabac_transition_unary[coeff_abs-1][cb->state[ctx]]; + } + else + { + cb->f8_bits_encoded += x264_cabac_size_unary[14][cb->state[ctx]]; + cb->state[ctx] = x264_cabac_transition_unary[14][cb->state[ctx]]; + x264_cabac_encode_ue_bypass( cb, 0, coeff_abs - 15 ); + } + node_ctx = coeff_abs_level_transition[1][0]; + } + else + { + x264_cabac_encode_decision( cb, ctx, 0 ); + node_ctx = coeff_abs_level_transition[0][0]; + x264_cabac_encode_bypass( cb, 0 ); // sign + } + + for( int i = last-1; i >= 0; i-- ) + { + if( l[i] ) + { + coeff_abs = abs(l[i]); + x264_cabac_encode_decision( cb, ctx_sig + (b_8x8 ? sig_offset[i] : + chroma422dc ? x264_coeff_flag_offset_chroma_422_dc[i] : i), 1 ); + x264_cabac_encode_decision( cb, ctx_last + (b_8x8 ? x264_last_coeff_flag_offset_8x8[i] : + chroma422dc ? x264_coeff_flag_offset_chroma_422_dc[i] : i), 0 ); + ctx = coeff_abs_level1_ctx[node_ctx] + ctx_level; + + if( coeff_abs > 1 ) + { + x264_cabac_encode_decision( cb, ctx, 1 ); + ctx = levelgt1_ctx[node_ctx] + ctx_level; + if( coeff_abs < 15 ) + { + cb->f8_bits_encoded += x264_cabac_size_unary[coeff_abs-1][cb->state[ctx]]; + cb->state[ctx] = x264_cabac_transition_unary[coeff_abs-1][cb->state[ctx]]; + } + else + { + cb->f8_bits_encoded += x264_cabac_size_unary[14][cb->state[ctx]]; + cb->state[ctx] = x264_cabac_transition_unary[14][cb->state[ctx]]; + x264_cabac_encode_ue_bypass( cb, 0, coeff_abs - 15 ); + } + node_ctx = coeff_abs_level_transition[1][node_ctx]; + } + else + { + x264_cabac_encode_decision( cb, ctx, 0 ); + node_ctx = coeff_abs_level_transition[0][node_ctx]; + x264_cabac_encode_bypass( cb, 0 ); + } + } + else + x264_cabac_encode_decision( cb, ctx_sig + (b_8x8 ? sig_offset[i] : + chroma422dc ? x264_coeff_flag_offset_chroma_422_dc[i] : i), 0 ); + } +} + +void x264_cabac_block_residual_8x8_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ + x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 1, 0 ); +} +void x264_cabac_block_residual_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ + x264_cabac_block_residual_internal( h, cb, ctx_block_cat, l, 0, 0 ); +} + +static ALWAYS_INLINE void x264_cabac_block_residual_8x8( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ +#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ ) + h->bsf.cabac_block_residual_8x8_rd_internal( l, MB_INTERLACED, ctx_block_cat, cb ); +#else + x264_cabac_block_residual_8x8_rd_c( h, cb, ctx_block_cat, l ); +#endif +} +static ALWAYS_INLINE void x264_cabac_block_residual( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ +#if ARCH_X86_64 && HAVE_MMX && !defined( __MACH__ ) + h->bsf.cabac_block_residual_rd_internal( l, MB_INTERLACED, ctx_block_cat, cb ); +#else + x264_cabac_block_residual_rd_c( h, cb, ctx_block_cat, l ); +#endif +} + +static void x264_cabac_block_residual_422_dc( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ) +{ + x264_cabac_block_residual_internal( h, cb, DCT_CHROMA_DC, l, 0, 1 ); +} +#endif + +#define x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, b_dc, name )\ +do\ +{\ + int ctxidxinc = x264_cabac_cbf_ctxidxinc( h, ctx_block_cat, i_idx, b_intra, b_dc );\ + if( h->mb.cache.non_zero_count[x264_scan8[i_idx]] )\ + {\ + x264_cabac_encode_decision( cb, ctxidxinc, 1 );\ + x264_cabac_block_residual##name( h, cb, ctx_block_cat, l );\ + }\ + else\ + x264_cabac_encode_decision( cb, ctxidxinc, 0 );\ +} while( 0 ) + +#define x264_cabac_block_residual_dc_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\ + x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 1, ) + +#define x264_cabac_block_residual_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\ + x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, ) + +#define x264_cabac_block_residual_8x8_cbf( h, cb, ctx_block_cat, i_idx, l, b_intra )\ + x264_cabac_block_residual_cbf_internal( h, cb, ctx_block_cat, i_idx, l, b_intra, 0, _8x8 ) + +#define x264_cabac_block_residual_422_dc_cbf( h, cb, ch, b_intra )\ + x264_cabac_block_residual_cbf_internal( h, cb, DCT_CHROMA_DC, CHROMA_DC+(ch), h->dct.chroma_dc[ch], b_intra, 1, _422_dc ) + +static ALWAYS_INLINE void x264_macroblock_write_cabac_internal( x264_t *h, x264_cabac_t *cb, int plane_count, int chroma ) +{ + const int i_mb_type = h->mb.i_type; + +#if !RDO_SKIP_BS + const int i_mb_pos_start = x264_cabac_pos( cb ); + int i_mb_pos_tex; + + if( SLICE_MBAFF && + (!(h->mb.i_mb_y & 1) || IS_SKIP(h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride])) ) + { + x264_cabac_field_decoding_flag( h, cb ); + } +#endif + + if( h->sh.i_type == SLICE_TYPE_P ) + x264_cabac_mb_header_p( h, cb, i_mb_type, chroma ); + else if( h->sh.i_type == SLICE_TYPE_B ) + x264_cabac_mb_header_b( h, cb, i_mb_type, chroma ); + else //if( h->sh.i_type == SLICE_TYPE_I ) + x264_cabac_mb_header_i( h, cb, i_mb_type, SLICE_TYPE_I, chroma ); + +#if !RDO_SKIP_BS + i_mb_pos_tex = x264_cabac_pos( cb ); + h->stat.frame.i_mv_bits += i_mb_pos_tex - i_mb_pos_start; + + if( i_mb_type == I_PCM ) + { + bs_t s; + bs_init( &s, cb->p, cb->p_end - cb->p ); + + for( int p = 0; p < plane_count; p++ ) + for( int i = 0; i < 256; i++ ) + bs_write( &s, BIT_DEPTH, h->mb.pic.p_fenc[p][i] ); + if( chroma ) + for( int ch = 1; ch < 3; ch++ ) + for( int i = 0; i < 16>>CHROMA_V_SHIFT; i++ ) + for( int j = 0; j < 8; j++ ) + bs_write( &s, BIT_DEPTH, h->mb.pic.p_fenc[ch][i*FENC_STRIDE+j] ); + + bs_flush( &s ); + cb->p = s.p; + x264_cabac_encode_init_core( cb ); + + h->stat.frame.i_tex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex; + return; + } +#endif + + if( i_mb_type != I_16x16 ) + { + x264_cabac_cbp_luma( h, cb ); + if( chroma ) + x264_cabac_cbp_chroma( h, cb ); + } + + if( x264_mb_transform_8x8_allowed( h ) && h->mb.i_cbp_luma ) + { + x264_cabac_transform_size( h, cb ); + } + + if( h->mb.i_cbp_luma || (chroma && h->mb.i_cbp_chroma) || i_mb_type == I_16x16 ) + { + const int b_intra = IS_INTRA( i_mb_type ); + x264_cabac_qp_delta( h, cb ); + + /* write residual */ + if( i_mb_type == I_16x16 ) + { + /* DC Luma */ + for( int p = 0; p < plane_count; p++ ) + { + x264_cabac_block_residual_dc_cbf( h, cb, ctx_cat_plane[DCT_LUMA_DC][p], LUMA_DC+p, h->dct.luma16x16_dc[p], 1 ); + + /* AC Luma */ + if( h->mb.i_cbp_luma ) + for( int i = p*16; i < p*16+16; i++ ) + x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_AC][p], i, h->dct.luma4x4[i]+1, 1 ); + } + } + else if( h->mb.b_transform_8x8 ) + { + if( plane_count == 3 ) + { + ALIGNED_4( uint8_t nnzbak[3][8] ); + +/* Stupid nnz munging in the case that neighbors don't have + * 8x8 transform enabled. */ +#define BACKUP( dst, src, res )\ + dst = src;\ + src = res; + +#define RESTORE( dst, src, res )\ + src = dst; + +#define MUNGE_8x8_NNZ( MUNGE )\ +if( (h->mb.i_neighbour & MB_LEFT) && !h->mb.mb_transform_size[h->mb.i_mb_left_xy[0]] && !(h->mb.cbp[h->mb.i_mb_left_xy[0]] & 0x1000) )\ +{\ + MUNGE( nnzbak[0][0], h->mb.cache.non_zero_count[x264_scan8[16*0+ 0] - 1], 0x00 )\ + MUNGE( nnzbak[0][1], h->mb.cache.non_zero_count[x264_scan8[16*0+ 2] - 1], 0x00 )\ + MUNGE( nnzbak[1][0], h->mb.cache.non_zero_count[x264_scan8[16*1+ 0] - 1], 0x00 )\ + MUNGE( nnzbak[1][1], h->mb.cache.non_zero_count[x264_scan8[16*1+ 2] - 1], 0x00 )\ + MUNGE( nnzbak[2][0], h->mb.cache.non_zero_count[x264_scan8[16*2+ 0] - 1], 0x00 )\ + MUNGE( nnzbak[2][1], h->mb.cache.non_zero_count[x264_scan8[16*2+ 2] - 1], 0x00 )\ +}\ +if( (h->mb.i_neighbour & MB_LEFT) && !h->mb.mb_transform_size[h->mb.i_mb_left_xy[1]] && !(h->mb.cbp[h->mb.i_mb_left_xy[1]] & 0x1000) )\ +{\ + MUNGE( nnzbak[0][2], h->mb.cache.non_zero_count[x264_scan8[16*0+ 8] - 1], 0x00 )\ + MUNGE( nnzbak[0][3], h->mb.cache.non_zero_count[x264_scan8[16*0+10] - 1], 0x00 )\ + MUNGE( nnzbak[1][2], h->mb.cache.non_zero_count[x264_scan8[16*1+ 8] - 1], 0x00 )\ + MUNGE( nnzbak[1][3], h->mb.cache.non_zero_count[x264_scan8[16*1+10] - 1], 0x00 )\ + MUNGE( nnzbak[2][2], h->mb.cache.non_zero_count[x264_scan8[16*2+ 8] - 1], 0x00 )\ + MUNGE( nnzbak[2][3], h->mb.cache.non_zero_count[x264_scan8[16*2+10] - 1], 0x00 )\ +}\ +if( (h->mb.i_neighbour & MB_TOP) && !h->mb.mb_transform_size[h->mb.i_mb_top_xy] && !(h->mb.cbp[h->mb.i_mb_top_xy] & 0x1000) )\ +{\ + MUNGE( M32( &nnzbak[0][4] ), M32( &h->mb.cache.non_zero_count[x264_scan8[16*0] - 8] ), 0x00000000U )\ + MUNGE( M32( &nnzbak[1][4] ), M32( &h->mb.cache.non_zero_count[x264_scan8[16*1] - 8] ), 0x00000000U )\ + MUNGE( M32( &nnzbak[2][4] ), M32( &h->mb.cache.non_zero_count[x264_scan8[16*2] - 8] ), 0x00000000U )\ +} + + MUNGE_8x8_NNZ( BACKUP ) + + for( int p = 0; p < 3; p++ ) + FOREACH_BIT( i, 0, h->mb.i_cbp_luma ) + x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i*4+p*16, h->dct.luma8x8[i+p*4], b_intra ); + + MUNGE_8x8_NNZ( RESTORE ) + } + else + { + FOREACH_BIT( i, 0, h->mb.i_cbp_luma ) + x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i] ); + } + } + else + { + for( int p = 0; p < plane_count; p++ ) + FOREACH_BIT( i8x8, 0, h->mb.i_cbp_luma ) + for( int i = 0; i < 4; i++ ) + x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i+i8x8*4+p*16, h->dct.luma4x4[i+i8x8*4+p*16], b_intra ); + } + + if( chroma && h->mb.i_cbp_chroma ) /* Chroma DC residual present */ + { + if( CHROMA_FORMAT == CHROMA_422 ) + { + x264_cabac_block_residual_422_dc_cbf( h, cb, 0, b_intra ); + x264_cabac_block_residual_422_dc_cbf( h, cb, 1, b_intra ); + } + else + { + x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], b_intra ); + x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], b_intra ); + } + + if( h->mb.i_cbp_chroma == 2 ) /* Chroma AC residual present */ + { + int step = 8 << CHROMA_V_SHIFT; + for( int i = 16; i < 3*16; i += step ) + for( int j = i; j < i+4; j++ ) + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, b_intra ); + } + } + } + +#if !RDO_SKIP_BS + h->stat.frame.i_tex_bits += x264_cabac_pos( cb ) - i_mb_pos_tex; +#endif +} + +void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb ) +{ + if( CHROMA444 ) + x264_macroblock_write_cabac_internal( h, cb, 3, 0 ); + else + x264_macroblock_write_cabac_internal( h, cb, 1, 1 ); +} + +#if RDO_SKIP_BS +/***************************************************************************** + * RD only; doesn't generate a valid bitstream + * doesn't write cbp or chroma dc (I don't know how much this matters) + * doesn't write ref (never varies between calls, so no point in doing so) + * only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO + * works on all partition sizes except 16x16 + *****************************************************************************/ +static void x264_partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_pixel ) +{ + const int i_mb_type = h->mb.i_type; + int b_8x16 = h->mb.i_partition == D_8x16; + int plane_count = CHROMA444 ? 3 : 1; + + if( i_mb_type == P_8x8 ) + { + x264_cabac_8x8_mvd( h, cb, i8 ); + x264_cabac_subpartition_p( cb, h->mb.i_sub_partition[i8] ); + } + else if( i_mb_type == P_L0 ) + x264_cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2< B_DIRECT && i_mb_type < B_8x8 ) + { + if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) x264_cabac_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<>b_8x16, 2<mb.i_sub_partition[i8] ] ) + x264_cabac_mvd( h, cb, 0, 4*i8, 2, 2 ); + if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i8] ] ) + x264_cabac_mvd( h, cb, 1, 4*i8, 2, 2 ); + } + + for( int j = (i_pixel < PIXEL_8x8); j >= 0; j-- ) + { + if( h->mb.i_cbp_luma & (1 << i8) ) + { + if( h->mb.b_transform_8x8 ) + { + if( CHROMA444 ) + for( int p = 0; p < 3; p++ ) + x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 0 ); + else + x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] ); + } + else + for( int p = 0; p < plane_count; p++ ) + for( int i4 = 0; i4 < 4; i4++ ) + x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+i8*4+p*16, h->dct.luma4x4[i4+i8*4+p*16], 0 ); + } + + if( h->mb.i_cbp_chroma ) + { + if( CHROMA_FORMAT == CHROMA_422 ) + { + int offset = (5*i8) & 0x09; + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+offset, h->dct.luma4x4[16+offset]+1, 0 ); + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 18+offset, h->dct.luma4x4[18+offset]+1, 0 ); + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+offset, h->dct.luma4x4[32+offset]+1, 0 ); + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 34+offset, h->dct.luma4x4[34+offset]+1, 0 ); + } + else + { + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 16+i8, h->dct.luma4x4[16+i8]+1, 0 ); + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, 32+i8, h->dct.luma4x4[32+i8]+1, 0 ); + } + } + + i8 += x264_pixel_size[i_pixel].h >> 3; + } +} + +static void x264_subpartition_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_pixel ) +{ + int b_8x4 = i_pixel == PIXEL_8x4; + int plane_count = CHROMA444 ? 3 : 1; + if( i_pixel == PIXEL_4x4 ) + x264_cabac_mvd( h, cb, 0, i4, 1, 1 ); + else + x264_cabac_mvd( h, cb, 0, i4, 1+b_8x4, 2-b_8x4 ); + for( int p = 0; p < plane_count; p++ ) + { + x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4, h->dct.luma4x4[p*16+i4], 0 ); + if( i_pixel != PIXEL_4x4 ) + x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], p*16+i4+2-b_8x4, h->dct.luma4x4[p*16+i4+2-b_8x4], 0 ); + } +} + +static void x264_partition_i8x8_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_mode ) +{ + const int i_pred = x264_mb_predict_intra4x4_mode( h, 4*i8 ); + i_mode = x264_mb_pred_mode4x4_fix( i_mode ); + x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode ); + x264_cabac_cbp_luma( h, cb ); + if( h->mb.i_cbp_luma & (1 << i8) ) + { + if( CHROMA444 ) + for( int p = 0; p < 3; p++ ) + x264_cabac_block_residual_8x8_cbf( h, cb, ctx_cat_plane[DCT_LUMA_8x8][p], i8*4+p*16, h->dct.luma8x8[i8+p*4], 1 ); + else + x264_cabac_block_residual_8x8( h, cb, DCT_LUMA_8x8, h->dct.luma8x8[i8] ); + } +} + +static void x264_partition_i4x4_size_cabac( x264_t *h, x264_cabac_t *cb, int i4, int i_mode ) +{ + const int i_pred = x264_mb_predict_intra4x4_mode( h, i4 ); + int plane_count = CHROMA444 ? 3 : 1; + i_mode = x264_mb_pred_mode4x4_fix( i_mode ); + x264_cabac_intra4x4_pred_mode( cb, i_pred, i_mode ); + for( int p = 0; p < plane_count; p++ ) + x264_cabac_block_residual_cbf( h, cb, ctx_cat_plane[DCT_LUMA_4x4][p], i4+p*16, h->dct.luma4x4[i4+p*16], 1 ); +} + +static void x264_chroma_size_cabac( x264_t *h, x264_cabac_t *cb ) +{ + x264_cabac_intra_chroma_pred_mode( h, cb ); + x264_cabac_cbp_chroma( h, cb ); + if( h->mb.i_cbp_chroma ) + { + if( CHROMA_FORMAT == CHROMA_422 ) + { + x264_cabac_block_residual_422_dc_cbf( h, cb, 0, 1 ); + x264_cabac_block_residual_422_dc_cbf( h, cb, 1, 1 ); + } + else + { + x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0], 1 ); + x264_cabac_block_residual_dc_cbf( h, cb, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1], 1 ); + } + + if( h->mb.i_cbp_chroma == 2 ) + { + int step = 8 << CHROMA_V_SHIFT; + for( int i = 16; i < 3*16; i += step ) + for( int j = i; j < i+4; j++ ) + x264_cabac_block_residual_cbf( h, cb, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1, 1 ); + } + } +} +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cavlc.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cavlc.c new file mode 100644 index 00000000..0150b246 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/cavlc.c @@ -0,0 +1,722 @@ +/***************************************************************************** + * cavlc.c: cavlc bitstream writing + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "macroblock.h" + +#ifndef RDO_SKIP_BS +#define RDO_SKIP_BS 0 +#endif + +/* [400,420][inter,intra] */ +static const uint8_t cbp_to_golomb[2][2][48] = +{ + {{ 0, 1, 2, 5, 3, 6, 14, 10, 4, 15, 7, 11, 8, 12, 13, 9 }, + { 1, 10, 11, 6, 12, 7, 14, 2, 13, 15, 8, 3, 9, 4, 5, 0 }}, + {{ 0, 2, 3, 7, 4, 8, 17, 13, 5, 18, 9, 14, 10, 15, 16, 11, + 1, 32, 33, 36, 34, 37, 44, 40, 35, 45, 38, 41, 39, 42, 43, 19, + 6, 24, 25, 20, 26, 21, 46, 28, 27, 47, 22, 29, 23, 30, 31, 12 }, + { 3, 29, 30, 17, 31, 18, 37, 8, 32, 38, 19, 9, 20, 10, 11, 2, + 16, 33, 34, 21, 35, 22, 39, 4, 36, 40, 23, 5, 24, 6, 7, 1, + 41, 42, 43, 25, 44, 26, 46, 12, 45, 47, 27, 13, 28, 14, 15, 0 }} +}; + +static const uint8_t mb_type_b_to_golomb[3][9]= +{ + { 4, 8, 12, 10, 6, 14, 16, 18, 20 }, /* D_16x8 */ + { 5, 9, 13, 11, 7, 15, 17, 19, 21 }, /* D_8x16 */ + { 1, -1, -1, -1, 2, -1, -1, -1, 3 } /* D_16x16 */ +}; + +static const uint8_t subpartition_p_to_golomb[4]= +{ + 3, 1, 2, 0 +}; + +static const uint8_t subpartition_b_to_golomb[13]= +{ + 10, 4, 5, 1, 11, 6, 7, 2, 12, 8, 9, 3, 0 +}; + +#define bs_write_vlc(s,v) bs_write( s, (v).i_size, (v).i_bits ) + +/**************************************************************************** + * x264_cavlc_block_residual: + ****************************************************************************/ +static inline int x264_cavlc_block_residual_escape( x264_t *h, int i_suffix_length, int level ) +{ + bs_t *s = &h->out.bs; + static const uint16_t next_suffix[7] = { 0, 3, 6, 12, 24, 48, 0xffff }; + int i_level_prefix = 15; + int mask = level >> 31; + int abs_level = (level^mask)-mask; + int i_level_code = abs_level*2-mask-2; + if( ( i_level_code >> i_suffix_length ) < 15 ) + { + bs_write( s, (i_level_code >> i_suffix_length) + 1 + i_suffix_length, + (1<= 1<<12 ) + { + if( h->sps->i_profile_idc >= PROFILE_HIGH ) + { + while( i_level_code > 1<<(i_level_prefix-3) ) + { + i_level_code -= 1<<(i_level_prefix-3); + i_level_prefix++; + } + } + else + { +#if RDO_SKIP_BS + /* Weight highly against overflows. */ + s->i_bits_encoded += 2000; +#else + /* We've had an overflow; note it down and re-encode the MB later. */ + h->mb.b_overflow = 1; +#endif + } + } + bs_write( s, i_level_prefix + 1, 1 ); + bs_write( s, i_level_prefix - 3, i_level_code & ((1<<(i_level_prefix-3))-1) ); + } + if( i_suffix_length == 0 ) + i_suffix_length++; + if( abs_level > next_suffix[i_suffix_length] ) + i_suffix_length++; + return i_suffix_length; +} + +static int x264_cavlc_block_residual_internal( x264_t *h, int ctx_block_cat, dctcoef *l, int nC ) +{ + bs_t *s = &h->out.bs; + static const uint8_t ctz_index[8] = {3,0,1,0,2,0,1,0}; + static const uint8_t count_cat[14] = {16, 15, 16, 0, 15, 64, 16, 15, 16, 64, 16, 15, 16, 64}; + x264_run_level_t runlevel; + int i_total, i_trailing, i_total_zero, i_suffix_length; + unsigned int i_sign; + + /* level and run and total */ + i_total = h->quantf.coeff_level_run[ctx_block_cat]( l, &runlevel ); + x264_prefetch( &x264_run_before[runlevel.mask] ); + i_total_zero = runlevel.last + 1 - i_total; + + /* branchless i_trailing calculation */ + runlevel.level[i_total+0] = 2; + runlevel.level[i_total+1] = 2; + i_trailing = ((((runlevel.level[0]+1) | (1-runlevel.level[0])) >> 31) & 1) // abs(runlevel.level[0])>1 + | ((((runlevel.level[1]+1) | (1-runlevel.level[1])) >> 31) & 2) + | ((((runlevel.level[2]+1) | (1-runlevel.level[2])) >> 31) & 4); + i_trailing = ctz_index[i_trailing]; + i_sign = ((runlevel.level[2] >> 31) & 1) + | ((runlevel.level[1] >> 31) & 2) + | ((runlevel.level[0] >> 31) & 4); + i_sign >>= 3-i_trailing; + + /* total/trailing */ + bs_write_vlc( s, x264_coeff_token[nC][i_total-1][i_trailing] ); + + i_suffix_length = i_total > 10 && i_trailing < 3; + bs_write( s, i_trailing, i_sign ); + + if( i_trailing < i_total ) + { + int val = runlevel.level[i_trailing]; + int val_original = runlevel.level[i_trailing]+LEVEL_TABLE_SIZE/2; + val -= ((val>>31)|1) & -(i_trailing < 3); /* as runlevel.level[i] can't be 1 for the first one if i_trailing < 3 */ + val += LEVEL_TABLE_SIZE/2; + + if( (unsigned)val_original < LEVEL_TABLE_SIZE ) + { + bs_write_vlc( s, x264_level_token[i_suffix_length][val] ); + i_suffix_length = x264_level_token[i_suffix_length][val_original].i_next; + } + else + i_suffix_length = x264_cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 ); + for( int i = i_trailing+1; i < i_total; i++ ) + { + val = runlevel.level[i] + LEVEL_TABLE_SIZE/2; + if( (unsigned)val < LEVEL_TABLE_SIZE ) + { + bs_write_vlc( s, x264_level_token[i_suffix_length][val] ); + i_suffix_length = x264_level_token[i_suffix_length][val].i_next; + } + else + i_suffix_length = x264_cavlc_block_residual_escape( h, i_suffix_length, val-LEVEL_TABLE_SIZE/2 ); + } + } + + if( ctx_block_cat == DCT_CHROMA_DC ) + { + if( i_total < 8>>CHROMA_V_SHIFT ) + { + vlc_t total_zeros = CHROMA_FORMAT == CHROMA_420 ? x264_total_zeros_2x2_dc[i_total-1][i_total_zero] + : x264_total_zeros_2x4_dc[i_total-1][i_total_zero]; + bs_write_vlc( s, total_zeros ); + } + } + else if( (uint8_t)i_total < count_cat[ctx_block_cat] ) + bs_write_vlc( s, x264_total_zeros[i_total-1][i_total_zero] ); + + int zero_run_code = x264_run_before[runlevel.mask]; + bs_write( s, zero_run_code&0x1f, zero_run_code>>5 ); + + return i_total; +} + +static const uint8_t ct_index[17] = {0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,3}; + +#define x264_cavlc_block_residual(h,cat,idx,l)\ +{\ + int nC = cat == DCT_CHROMA_DC ? 5 - CHROMA_V_SHIFT\ + : ct_index[x264_mb_predict_non_zero_code( h, cat == DCT_LUMA_DC ? (idx - LUMA_DC)*16 : idx )];\ + uint8_t *nnz = &h->mb.cache.non_zero_count[x264_scan8[idx]];\ + if( !*nnz )\ + bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] );\ + else\ + *nnz = x264_cavlc_block_residual_internal(h,cat,l,nC);\ +} + +static void x264_cavlc_qp_delta( x264_t *h ) +{ + bs_t *s = &h->out.bs; + int i_dqp = h->mb.i_qp - h->mb.i_last_qp; + + /* Avoid writing a delta quant if we have an empty i16x16 block, e.g. in a completely + * flat background area. Don't do this if it would raise the quantizer, since that could + * cause unexpected deblocking artifacts. */ + if( h->mb.i_type == I_16x16 && !(h->mb.i_cbp_luma | h->mb.i_cbp_chroma) + && !h->mb.cache.non_zero_count[x264_scan8[LUMA_DC]] + && !h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+0]] + && !h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+1]] + && h->mb.i_qp > h->mb.i_last_qp ) + { +#if !RDO_SKIP_BS + h->mb.i_qp = h->mb.i_last_qp; +#endif + i_dqp = 0; + } + + if( i_dqp ) + { + if( i_dqp < -(QP_MAX_SPEC+1)/2 ) + i_dqp += QP_MAX_SPEC+1; + else if( i_dqp > QP_MAX_SPEC/2 ) + i_dqp -= QP_MAX_SPEC+1; + } + bs_write_se( s, i_dqp ); +} + +static void x264_cavlc_mvd( x264_t *h, int i_list, int idx, int width ) +{ + bs_t *s = &h->out.bs; + ALIGNED_4( int16_t mvp[2] ); + x264_mb_predict_mv( h, i_list, idx, width, mvp ); + bs_write_se( s, h->mb.cache.mv[i_list][x264_scan8[idx]][0] - mvp[0] ); + bs_write_se( s, h->mb.cache.mv[i_list][x264_scan8[idx]][1] - mvp[1] ); +} + +static inline void x264_cavlc_8x8_mvd( x264_t *h, int i ) +{ + switch( h->mb.i_sub_partition[i] ) + { + case D_L0_8x8: + x264_cavlc_mvd( h, 0, 4*i, 2 ); + break; + case D_L0_8x4: + x264_cavlc_mvd( h, 0, 4*i+0, 2 ); + x264_cavlc_mvd( h, 0, 4*i+2, 2 ); + break; + case D_L0_4x8: + x264_cavlc_mvd( h, 0, 4*i+0, 1 ); + x264_cavlc_mvd( h, 0, 4*i+1, 1 ); + break; + case D_L0_4x4: + x264_cavlc_mvd( h, 0, 4*i+0, 1 ); + x264_cavlc_mvd( h, 0, 4*i+1, 1 ); + x264_cavlc_mvd( h, 0, 4*i+2, 1 ); + x264_cavlc_mvd( h, 0, 4*i+3, 1 ); + break; + } +} + +static ALWAYS_INLINE void x264_cavlc_macroblock_luma_residual( x264_t *h, int plane_count ) +{ + if( h->mb.b_transform_8x8 ) + { + /* shuffle 8x8 dct coeffs into 4x4 lists */ + for( int p = 0; p < plane_count; p++ ) + for( int i8 = 0; i8 < 4; i8++ ) + if( h->mb.cache.non_zero_count[x264_scan8[p*16+i8*4]] ) + h->zigzagf.interleave_8x8_cavlc( h->dct.luma4x4[p*16+i8*4], h->dct.luma8x8[p*4+i8], + &h->mb.cache.non_zero_count[x264_scan8[p*16+i8*4]] ); + } + + for( int p = 0; p < plane_count; p++ ) + FOREACH_BIT( i8, 0, h->mb.i_cbp_luma ) + for( int i4 = 0; i4 < 4; i4++ ) + x264_cavlc_block_residual( h, DCT_LUMA_4x4, i4+i8*4+p*16, h->dct.luma4x4[i4+i8*4+p*16] ); +} + +#if RDO_SKIP_BS +static ALWAYS_INLINE void x264_cavlc_partition_luma_residual( x264_t *h, int i8, int p ) +{ + if( h->mb.b_transform_8x8 && h->mb.cache.non_zero_count[x264_scan8[i8*4]] ) + h->zigzagf.interleave_8x8_cavlc( h->dct.luma4x4[i8*4+p*16], h->dct.luma8x8[i8+p*4], + &h->mb.cache.non_zero_count[x264_scan8[i8*4+p*16]] ); + + if( h->mb.i_cbp_luma & (1 << i8) ) + for( int i4 = 0; i4 < 4; i4++ ) + x264_cavlc_block_residual( h, DCT_LUMA_4x4, i4+i8*4+p*16, h->dct.luma4x4[i4+i8*4+p*16] ); +} +#endif + +static void x264_cavlc_mb_header_i( x264_t *h, int i_mb_type, int i_mb_i_offset, int chroma ) +{ + bs_t *s = &h->out.bs; + if( i_mb_type == I_16x16 ) + { + bs_write_ue( s, i_mb_i_offset + 1 + x264_mb_pred_mode16x16_fix[h->mb.i_intra16x16_pred_mode] + + h->mb.i_cbp_chroma * 4 + ( h->mb.i_cbp_luma == 0 ? 0 : 12 ) ); + } + else //if( i_mb_type == I_4x4 || i_mb_type == I_8x8 ) + { + int di = i_mb_type == I_8x8 ? 4 : 1; + bs_write_ue( s, i_mb_i_offset + 0 ); + if( h->pps->b_transform_8x8_mode ) + bs_write1( s, h->mb.b_transform_8x8 ); + + /* Prediction: Luma */ + for( int i = 0; i < 16; i += di ) + { + int i_pred = x264_mb_predict_intra4x4_mode( h, i ); + int i_mode = x264_mb_pred_mode4x4_fix( h->mb.cache.intra4x4_pred_mode[x264_scan8[i]] ); + + if( i_pred == i_mode ) + bs_write1( s, 1 ); /* b_prev_intra4x4_pred_mode */ + else + bs_write( s, 4, i_mode - (i_mode > i_pred) ); + } + + } + if( chroma ) + bs_write_ue( s, x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode] ); +} + +static ALWAYS_INLINE void x264_cavlc_mb_header_p( x264_t *h, int i_mb_type, int chroma ) +{ + bs_t *s = &h->out.bs; + if( i_mb_type == P_L0 ) + { + if( h->mb.i_partition == D_16x16 ) + { + bs_write1( s, 1 ); + + if( h->mb.pic.i_fref[0] > 1 ) + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] ); + x264_cavlc_mvd( h, 0, 0, 4 ); + } + else if( h->mb.i_partition == D_16x8 ) + { + bs_write_ue( s, 1 ); + if( h->mb.pic.i_fref[0] > 1 ) + { + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] ); + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[8]] ); + } + x264_cavlc_mvd( h, 0, 0, 4 ); + x264_cavlc_mvd( h, 0, 8, 4 ); + } + else if( h->mb.i_partition == D_8x16 ) + { + bs_write_ue( s, 2 ); + if( h->mb.pic.i_fref[0] > 1 ) + { + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] ); + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[4]] ); + } + x264_cavlc_mvd( h, 0, 0, 2 ); + x264_cavlc_mvd( h, 0, 4, 2 ); + } + } + else if( i_mb_type == P_8x8 ) + { + int b_sub_ref; + if( (h->mb.cache.ref[0][x264_scan8[0]] | h->mb.cache.ref[0][x264_scan8[ 4]] | + h->mb.cache.ref[0][x264_scan8[8]] | h->mb.cache.ref[0][x264_scan8[12]]) == 0 ) + { + bs_write_ue( s, 4 ); + b_sub_ref = 0; + } + else + { + bs_write_ue( s, 3 ); + b_sub_ref = 1; + } + + /* sub mb type */ + if( h->param.analyse.inter & X264_ANALYSE_PSUB8x8 ) + for( int i = 0; i < 4; i++ ) + bs_write_ue( s, subpartition_p_to_golomb[ h->mb.i_sub_partition[i] ] ); + else + bs_write( s, 4, 0xf ); + + /* ref0 */ + if( b_sub_ref ) + { + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[0]] ); + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[4]] ); + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[8]] ); + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[12]] ); + } + + for( int i = 0; i < 4; i++ ) + x264_cavlc_8x8_mvd( h, i ); + } + else //if( IS_INTRA( i_mb_type ) ) + x264_cavlc_mb_header_i( h, i_mb_type, 5, chroma ); +} + +static ALWAYS_INLINE void x264_cavlc_mb_header_b( x264_t *h, int i_mb_type, int chroma ) +{ + bs_t *s = &h->out.bs; + if( i_mb_type == B_8x8 ) + { + bs_write_ue( s, 22 ); + + /* sub mb type */ + for( int i = 0; i < 4; i++ ) + bs_write_ue( s, subpartition_b_to_golomb[ h->mb.i_sub_partition[i] ] ); + + /* ref */ + if( h->mb.pic.i_fref[0] > 1 ) + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] ) + bs_write_te( s, h->mb.pic.i_fref[0] - 1, h->mb.cache.ref[0][x264_scan8[i*4]] ); + if( h->mb.pic.i_fref[1] > 1 ) + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] ) + bs_write_te( s, h->mb.pic.i_fref[1] - 1, h->mb.cache.ref[1][x264_scan8[i*4]] ); + + /* mvd */ + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i] ] ) + x264_cavlc_mvd( h, 0, 4*i, 2 ); + for( int i = 0; i < 4; i++ ) + if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i] ] ) + x264_cavlc_mvd( h, 1, 4*i, 2 ); + } + else if( i_mb_type >= B_L0_L0 && i_mb_type <= B_BI_BI ) + { + /* All B mode */ + /* Motion Vector */ + const uint8_t (*b_list)[2] = x264_mb_type_list_table[i_mb_type]; + const int i_ref0_max = h->mb.pic.i_fref[0] - 1; + const int i_ref1_max = h->mb.pic.i_fref[1] - 1; + + bs_write_ue( s, mb_type_b_to_golomb[ h->mb.i_partition - D_16x8 ][ i_mb_type - B_L0_L0 ] ); + if( h->mb.i_partition == D_16x16 ) + { + if( i_ref0_max && b_list[0][0] ) bs_write_te( s, i_ref0_max, h->mb.cache.ref[0][x264_scan8[0]] ); + if( i_ref1_max && b_list[1][0] ) bs_write_te( s, i_ref1_max, h->mb.cache.ref[1][x264_scan8[0]] ); + if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 4 ); + if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 4 ); + } + else + { + if( i_ref0_max && b_list[0][0] ) bs_write_te( s, i_ref0_max, h->mb.cache.ref[0][x264_scan8[ 0]] ); + if( i_ref0_max && b_list[0][1] ) bs_write_te( s, i_ref0_max, h->mb.cache.ref[0][x264_scan8[12]] ); + if( i_ref1_max && b_list[1][0] ) bs_write_te( s, i_ref1_max, h->mb.cache.ref[1][x264_scan8[ 0]] ); + if( i_ref1_max && b_list[1][1] ) bs_write_te( s, i_ref1_max, h->mb.cache.ref[1][x264_scan8[12]] ); + if( h->mb.i_partition == D_16x8 ) + { + if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 4 ); + if( b_list[0][1] ) x264_cavlc_mvd( h, 0, 8, 4 ); + if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 4 ); + if( b_list[1][1] ) x264_cavlc_mvd( h, 1, 8, 4 ); + } + else //if( h->mb.i_partition == D_8x16 ) + { + if( b_list[0][0] ) x264_cavlc_mvd( h, 0, 0, 2 ); + if( b_list[0][1] ) x264_cavlc_mvd( h, 0, 4, 2 ); + if( b_list[1][0] ) x264_cavlc_mvd( h, 1, 0, 2 ); + if( b_list[1][1] ) x264_cavlc_mvd( h, 1, 4, 2 ); + } + } + } + else if( i_mb_type == B_DIRECT ) + bs_write1( s, 1 ); + else //if( IS_INTRA( i_mb_type ) ) + x264_cavlc_mb_header_i( h, i_mb_type, 23, chroma ); +} + +/***************************************************************************** + * x264_macroblock_write: + *****************************************************************************/ +void x264_macroblock_write_cavlc( x264_t *h ) +{ + bs_t *s = &h->out.bs; + const int i_mb_type = h->mb.i_type; + int plane_count = CHROMA444 ? 3 : 1; + int chroma = !CHROMA444; + +#if RDO_SKIP_BS + s->i_bits_encoded = 0; +#else + const int i_mb_pos_start = bs_pos( s ); + int i_mb_pos_tex; +#endif + + if( SLICE_MBAFF + && (!(h->mb.i_mb_y & 1) || IS_SKIP(h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride])) ) + { + bs_write1( s, MB_INTERLACED ); +#if !RDO_SKIP_BS + h->mb.field_decoding_flag = MB_INTERLACED; +#endif + } + +#if !RDO_SKIP_BS + if( i_mb_type == I_PCM ) + { + static const uint8_t i_offsets[3] = {5,23,0}; + uint8_t *p_start = s->p_start; + bs_write_ue( s, i_offsets[h->sh.i_type] + 25 ); + i_mb_pos_tex = bs_pos( s ); + h->stat.frame.i_mv_bits += i_mb_pos_tex - i_mb_pos_start; + + bs_align_0( s ); + + for( int p = 0; p < plane_count; p++ ) + for( int i = 0; i < 256; i++ ) + bs_write( s, BIT_DEPTH, h->mb.pic.p_fenc[p][i] ); + if( chroma ) + for( int ch = 1; ch < 3; ch++ ) + for( int i = 0; i < 16>>CHROMA_V_SHIFT; i++ ) + for( int j = 0; j < 8; j++ ) + bs_write( s, BIT_DEPTH, h->mb.pic.p_fenc[ch][i*FENC_STRIDE+j] ); + + bs_init( s, s->p, s->p_end - s->p ); + s->p_start = p_start; + + h->stat.frame.i_tex_bits += bs_pos(s) - i_mb_pos_tex; + return; + } +#endif + + if( h->sh.i_type == SLICE_TYPE_P ) + x264_cavlc_mb_header_p( h, i_mb_type, chroma ); + else if( h->sh.i_type == SLICE_TYPE_B ) + x264_cavlc_mb_header_b( h, i_mb_type, chroma ); + else //if( h->sh.i_type == SLICE_TYPE_I ) + x264_cavlc_mb_header_i( h, i_mb_type, 0, chroma ); + +#if !RDO_SKIP_BS + i_mb_pos_tex = bs_pos( s ); + h->stat.frame.i_mv_bits += i_mb_pos_tex - i_mb_pos_start; +#endif + + /* Coded block pattern */ + if( i_mb_type != I_16x16 ) + bs_write_ue( s, cbp_to_golomb[chroma][IS_INTRA(i_mb_type)][(h->mb.i_cbp_chroma << 4)|h->mb.i_cbp_luma] ); + + /* transform size 8x8 flag */ + if( x264_mb_transform_8x8_allowed( h ) && h->mb.i_cbp_luma ) + bs_write1( s, h->mb.b_transform_8x8 ); + + if( i_mb_type == I_16x16 ) + { + x264_cavlc_qp_delta( h ); + + /* DC Luma */ + for( int p = 0; p < plane_count; p++ ) + { + x264_cavlc_block_residual( h, DCT_LUMA_DC, LUMA_DC+p, h->dct.luma16x16_dc[p] ); + + /* AC Luma */ + if( h->mb.i_cbp_luma ) + for( int i = p*16; i < p*16+16; i++ ) + x264_cavlc_block_residual( h, DCT_LUMA_AC, i, h->dct.luma4x4[i]+1 ); + } + } + else if( h->mb.i_cbp_luma | h->mb.i_cbp_chroma ) + { + x264_cavlc_qp_delta( h ); + x264_cavlc_macroblock_luma_residual( h, plane_count ); + } + if( h->mb.i_cbp_chroma ) + { + /* Chroma DC residual present */ + x264_cavlc_block_residual( h, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0] ); + x264_cavlc_block_residual( h, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1] ); + if( h->mb.i_cbp_chroma == 2 ) /* Chroma AC residual present */ + { + int step = 8 << CHROMA_V_SHIFT; + for( int i = 16; i < 3*16; i += step ) + for( int j = i; j < i+4; j++ ) + x264_cavlc_block_residual( h, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1 ); + } + } + +#if !RDO_SKIP_BS + h->stat.frame.i_tex_bits += bs_pos(s) - i_mb_pos_tex; +#endif +} + +#if RDO_SKIP_BS +/***************************************************************************** + * RD only; doesn't generate a valid bitstream + * doesn't write cbp or chroma dc (I don't know how much this matters) + * doesn't write ref (never varies between calls, so no point in doing so) + * only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO + * works on all partition sizes except 16x16 + *****************************************************************************/ +static int x264_partition_size_cavlc( x264_t *h, int i8, int i_pixel ) +{ + bs_t *s = &h->out.bs; + const int i_mb_type = h->mb.i_type; + int b_8x16 = h->mb.i_partition == D_8x16; + int plane_count = CHROMA444 ? 3 : 1; + int j; + + h->out.bs.i_bits_encoded = 0; + + if( i_mb_type == P_8x8 ) + { + x264_cavlc_8x8_mvd( h, i8 ); + bs_write_ue( s, subpartition_p_to_golomb[ h->mb.i_sub_partition[i8] ] ); + } + else if( i_mb_type == P_L0 ) + x264_cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 ); + else if( i_mb_type > B_DIRECT && i_mb_type < B_8x8 ) + { + if( x264_mb_type_list_table[ i_mb_type ][0][!!i8] ) x264_cavlc_mvd( h, 0, 4*i8, 4>>b_8x16 ); + if( x264_mb_type_list_table[ i_mb_type ][1][!!i8] ) x264_cavlc_mvd( h, 1, 4*i8, 4>>b_8x16 ); + } + else //if( i_mb_type == B_8x8 ) + { + if( x264_mb_partition_listX_table[0][ h->mb.i_sub_partition[i8] ] ) + x264_cavlc_mvd( h, 0, 4*i8, 2 ); + if( x264_mb_partition_listX_table[1][ h->mb.i_sub_partition[i8] ] ) + x264_cavlc_mvd( h, 1, 4*i8, 2 ); + } + + for( j = (i_pixel < PIXEL_8x8); j >= 0; j-- ) + { + for( int p = 0; p < plane_count; p++ ) + x264_cavlc_partition_luma_residual( h, i8, p ); + if( h->mb.i_cbp_chroma ) + { + if( CHROMA_FORMAT == CHROMA_422 ) + { + int offset = (5*i8) & 0x09; + x264_cavlc_block_residual( h, DCT_CHROMA_AC, 16+offset, h->dct.luma4x4[16+offset]+1 ); + x264_cavlc_block_residual( h, DCT_CHROMA_AC, 18+offset, h->dct.luma4x4[18+offset]+1 ); + x264_cavlc_block_residual( h, DCT_CHROMA_AC, 32+offset, h->dct.luma4x4[32+offset]+1 ); + x264_cavlc_block_residual( h, DCT_CHROMA_AC, 34+offset, h->dct.luma4x4[34+offset]+1 ); + } + else + { + x264_cavlc_block_residual( h, DCT_CHROMA_AC, 16+i8, h->dct.luma4x4[16+i8]+1 ); + x264_cavlc_block_residual( h, DCT_CHROMA_AC, 32+i8, h->dct.luma4x4[32+i8]+1 ); + } + } + i8 += x264_pixel_size[i_pixel].h >> 3; + } + + return h->out.bs.i_bits_encoded; +} + +static int x264_subpartition_size_cavlc( x264_t *h, int i4, int i_pixel ) +{ + int plane_count = CHROMA444 ? 3 : 1; + int b_8x4 = i_pixel == PIXEL_8x4; + h->out.bs.i_bits_encoded = 0; + x264_cavlc_mvd( h, 0, i4, 1+b_8x4 ); + for( int p = 0; p < plane_count; p++ ) + { + x264_cavlc_block_residual( h, DCT_LUMA_4x4, p*16+i4, h->dct.luma4x4[p*16+i4] ); + if( i_pixel != PIXEL_4x4 ) + x264_cavlc_block_residual( h, DCT_LUMA_4x4, p*16+i4+2-b_8x4, h->dct.luma4x4[p*16+i4+2-b_8x4] ); + } + + return h->out.bs.i_bits_encoded; +} + +static int x264_cavlc_intra4x4_pred_size( x264_t *h, int i4, int i_mode ) +{ + if( x264_mb_predict_intra4x4_mode( h, i4 ) == x264_mb_pred_mode4x4_fix( i_mode ) ) + return 1; + else + return 4; +} + +static int x264_partition_i8x8_size_cavlc( x264_t *h, int i8, int i_mode ) +{ + int plane_count = CHROMA444 ? 3 : 1; + h->out.bs.i_bits_encoded = x264_cavlc_intra4x4_pred_size( h, 4*i8, i_mode ); + bs_write_ue( &h->out.bs, cbp_to_golomb[!CHROMA444][1][(h->mb.i_cbp_chroma << 4)|h->mb.i_cbp_luma] ); + for( int p = 0; p < plane_count; p++ ) + x264_cavlc_partition_luma_residual( h, i8, p ); + return h->out.bs.i_bits_encoded; +} + +static int x264_partition_i4x4_size_cavlc( x264_t *h, int i4, int i_mode ) +{ + int plane_count = CHROMA444 ? 3 : 1; + h->out.bs.i_bits_encoded = x264_cavlc_intra4x4_pred_size( h, i4, i_mode ); + for( int p = 0; p < plane_count; p++ ) + x264_cavlc_block_residual( h, DCT_LUMA_4x4, p*16+i4, h->dct.luma4x4[p*16+i4] ); + return h->out.bs.i_bits_encoded; +} + +static int x264_chroma_size_cavlc( x264_t *h ) +{ + h->out.bs.i_bits_encoded = bs_size_ue( x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode] ); + if( h->mb.i_cbp_chroma ) + { + x264_cavlc_block_residual( h, DCT_CHROMA_DC, CHROMA_DC+0, h->dct.chroma_dc[0] ); + x264_cavlc_block_residual( h, DCT_CHROMA_DC, CHROMA_DC+1, h->dct.chroma_dc[1] ); + + if( h->mb.i_cbp_chroma == 2 ) + { + int step = 8 << CHROMA_V_SHIFT; + for( int i = 16; i < 3*16; i += step ) + for( int j = i; j < i+4; j++ ) + x264_cavlc_block_residual( h, DCT_CHROMA_AC, j, h->dct.luma4x4[j]+1 ); + } + } + return h->out.bs.i_bits_encoded; +} +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/encoder.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/encoder.c new file mode 100644 index 00000000..d183460c --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/encoder.c @@ -0,0 +1,4429 @@ +/***************************************************************************** + * encoder.c: top-level encoder functions + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" + +#include "set.h" +#include "analyse.h" +#include "ratecontrol.h" +#include "macroblock.h" +#include "me.h" +#if HAVE_INTEL_DISPATCHER +#include "extras/intel_dispatcher.h" +#endif + +//#define DEBUG_MB_TYPE + +#define bs_write_ue bs_write_ue_big + +static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current, + x264_nal_t **pp_nal, int *pi_nal, + x264_picture_t *pic_out ); + +/**************************************************************************** + * + ******************************* x264 libs ********************************** + * + ****************************************************************************/ +static double x264_psnr( double sqe, double size ) +{ + double mse = sqe / (PIXEL_MAX*PIXEL_MAX * size); + if( mse <= 0.0000000001 ) /* Max 100dB */ + return 100; + + return -10.0 * log10( mse ); +} + +static double x264_ssim( double ssim ) +{ + double inv_ssim = 1 - ssim; + if( inv_ssim <= 0.0000000001 ) /* Max 100dB */ + return 100; + + return -10.0 * log10( inv_ssim ); +} + +static int x264_threadpool_wait_all( x264_t *h ) +{ + for( int i = 0; i < h->param.i_threads; i++ ) + if( h->thread[i]->b_thread_active ) + { + h->thread[i]->b_thread_active = 0; + if( (intptr_t)x264_threadpool_wait( h->threadpool, h->thread[i] ) < 0 ) + return -1; + } + return 0; +} + +static void x264_frame_dump( x264_t *h ) +{ + FILE *f = x264_fopen( h->param.psz_dump_yuv, "r+b" ); + if( !f ) + return; + + /* Wait for the threads to finish deblocking */ + if( h->param.b_sliced_threads ) + x264_threadpool_wait_all( h ); + + /* Write the frame in display order */ + int frame_size = FRAME_SIZE( h->param.i_height * h->param.i_width * sizeof(pixel) ); + if( !fseek( f, (int64_t)h->fdec->i_frame * frame_size, SEEK_SET ) ) + { + for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ ) + for( int y = 0; y < h->param.i_height; y++ ) + fwrite( &h->fdec->plane[p][y*h->fdec->i_stride[p]], sizeof(pixel), h->param.i_width, f ); + if( !CHROMA444 ) + { + int cw = h->param.i_width>>1; + int ch = h->param.i_height>>CHROMA_V_SHIFT; + pixel *planeu = x264_malloc( 2 * (cw*ch*sizeof(pixel) + 32) ); + if( planeu ) + { + pixel *planev = planeu + cw*ch + 32/sizeof(pixel); + h->mc.plane_copy_deinterleave( planeu, cw, planev, cw, h->fdec->plane[1], h->fdec->i_stride[1], cw, ch ); + fwrite( planeu, 1, cw*ch*sizeof(pixel), f ); + fwrite( planev, 1, cw*ch*sizeof(pixel), f ); + x264_free( planeu ); + } + } + } + fclose( f ); +} + +/* Fill "default" values */ +static void x264_slice_header_init( x264_t *h, x264_slice_header_t *sh, + x264_sps_t *sps, x264_pps_t *pps, + int i_idr_pic_id, int i_frame, int i_qp ) +{ + x264_param_t *param = &h->param; + + /* First we fill all fields */ + sh->sps = sps; + sh->pps = pps; + + sh->i_first_mb = 0; + sh->i_last_mb = h->mb.i_mb_count - 1; + sh->i_pps_id = pps->i_id; + + sh->i_frame_num = i_frame; + + sh->b_mbaff = PARAM_INTERLACED; + sh->b_field_pic = 0; /* no field support for now */ + sh->b_bottom_field = 0; /* not yet used */ + + sh->i_idr_pic_id = i_idr_pic_id; + + /* poc stuff, fixed later */ + sh->i_poc = 0; + sh->i_delta_poc_bottom = 0; + sh->i_delta_poc[0] = 0; + sh->i_delta_poc[1] = 0; + + sh->i_redundant_pic_cnt = 0; + + h->mb.b_direct_auto_write = h->param.analyse.i_direct_mv_pred == X264_DIRECT_PRED_AUTO + && h->param.i_bframe + && ( h->param.rc.b_stat_write || !h->param.rc.b_stat_read ); + + if( !h->mb.b_direct_auto_read && sh->i_type == SLICE_TYPE_B ) + { + if( h->fref[1][0]->i_poc_l0ref0 == h->fref[0][0]->i_poc ) + { + if( h->mb.b_direct_auto_write ) + sh->b_direct_spatial_mv_pred = ( h->stat.i_direct_score[1] > h->stat.i_direct_score[0] ); + else + sh->b_direct_spatial_mv_pred = ( param->analyse.i_direct_mv_pred == X264_DIRECT_PRED_SPATIAL ); + } + else + { + h->mb.b_direct_auto_write = 0; + sh->b_direct_spatial_mv_pred = 1; + } + } + /* else b_direct_spatial_mv_pred was read from the 2pass statsfile */ + + sh->b_num_ref_idx_override = 0; + sh->i_num_ref_idx_l0_active = 1; + sh->i_num_ref_idx_l1_active = 1; + + sh->b_ref_pic_list_reordering[0] = h->b_ref_reorder[0]; + sh->b_ref_pic_list_reordering[1] = h->b_ref_reorder[1]; + + /* If the ref list isn't in the default order, construct reordering header */ + for( int list = 0; list < 2; list++ ) + { + if( sh->b_ref_pic_list_reordering[list] ) + { + int pred_frame_num = i_frame; + for( int i = 0; i < h->i_ref[list]; i++ ) + { + int diff = h->fref[list][i]->i_frame_num - pred_frame_num; + sh->ref_pic_list_order[list][i].idc = ( diff > 0 ); + sh->ref_pic_list_order[list][i].arg = (abs(diff) - 1) & ((1 << sps->i_log2_max_frame_num) - 1); + pred_frame_num = h->fref[list][i]->i_frame_num; + } + } + } + + sh->i_cabac_init_idc = param->i_cabac_init_idc; + + sh->i_qp = SPEC_QP(i_qp); + sh->i_qp_delta = sh->i_qp - pps->i_pic_init_qp; + sh->b_sp_for_swidth = 0; + sh->i_qs_delta = 0; + + int deblock_thresh = i_qp + 2 * X264_MIN(param->i_deblocking_filter_alphac0, param->i_deblocking_filter_beta); + /* If effective qp <= 15, deblocking would have no effect anyway */ + if( param->b_deblocking_filter && (h->mb.b_variable_qp || 15 < deblock_thresh ) ) + sh->i_disable_deblocking_filter_idc = param->b_sliced_threads ? 2 : 0; + else + sh->i_disable_deblocking_filter_idc = 1; + sh->i_alpha_c0_offset = param->i_deblocking_filter_alphac0 << 1; + sh->i_beta_offset = param->i_deblocking_filter_beta << 1; +} + +static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal_ref_idc ) +{ + if( sh->b_mbaff ) + { + int first_x = sh->i_first_mb % sh->sps->i_mb_width; + int first_y = sh->i_first_mb / sh->sps->i_mb_width; + assert( (first_y&1) == 0 ); + bs_write_ue( s, (2*first_x + sh->sps->i_mb_width*(first_y&~1) + (first_y&1)) >> 1 ); + } + else + bs_write_ue( s, sh->i_first_mb ); + + bs_write_ue( s, sh->i_type + 5 ); /* same type things */ + bs_write_ue( s, sh->i_pps_id ); + bs_write( s, sh->sps->i_log2_max_frame_num, sh->i_frame_num & ((1<sps->i_log2_max_frame_num)-1) ); + + if( !sh->sps->b_frame_mbs_only ) + { + bs_write1( s, sh->b_field_pic ); + if( sh->b_field_pic ) + bs_write1( s, sh->b_bottom_field ); + } + + if( sh->i_idr_pic_id >= 0 ) /* NAL IDR */ + bs_write_ue( s, sh->i_idr_pic_id ); + + if( sh->sps->i_poc_type == 0 ) + { + bs_write( s, sh->sps->i_log2_max_poc_lsb, sh->i_poc & ((1<sps->i_log2_max_poc_lsb)-1) ); + if( sh->pps->b_pic_order && !sh->b_field_pic ) + bs_write_se( s, sh->i_delta_poc_bottom ); + } + + if( sh->pps->b_redundant_pic_cnt ) + bs_write_ue( s, sh->i_redundant_pic_cnt ); + + if( sh->i_type == SLICE_TYPE_B ) + bs_write1( s, sh->b_direct_spatial_mv_pred ); + + if( sh->i_type == SLICE_TYPE_P || sh->i_type == SLICE_TYPE_B ) + { + bs_write1( s, sh->b_num_ref_idx_override ); + if( sh->b_num_ref_idx_override ) + { + bs_write_ue( s, sh->i_num_ref_idx_l0_active - 1 ); + if( sh->i_type == SLICE_TYPE_B ) + bs_write_ue( s, sh->i_num_ref_idx_l1_active - 1 ); + } + } + + /* ref pic list reordering */ + if( sh->i_type != SLICE_TYPE_I ) + { + bs_write1( s, sh->b_ref_pic_list_reordering[0] ); + if( sh->b_ref_pic_list_reordering[0] ) + { + for( int i = 0; i < sh->i_num_ref_idx_l0_active; i++ ) + { + bs_write_ue( s, sh->ref_pic_list_order[0][i].idc ); + bs_write_ue( s, sh->ref_pic_list_order[0][i].arg ); + } + bs_write_ue( s, 3 ); + } + } + if( sh->i_type == SLICE_TYPE_B ) + { + bs_write1( s, sh->b_ref_pic_list_reordering[1] ); + if( sh->b_ref_pic_list_reordering[1] ) + { + for( int i = 0; i < sh->i_num_ref_idx_l1_active; i++ ) + { + bs_write_ue( s, sh->ref_pic_list_order[1][i].idc ); + bs_write_ue( s, sh->ref_pic_list_order[1][i].arg ); + } + bs_write_ue( s, 3 ); + } + } + + sh->b_weighted_pred = 0; + if( sh->pps->b_weighted_pred && sh->i_type == SLICE_TYPE_P ) + { + sh->b_weighted_pred = sh->weight[0][0].weightfn || sh->weight[0][1].weightfn || sh->weight[0][2].weightfn; + /* pred_weight_table() */ + bs_write_ue( s, sh->weight[0][0].i_denom ); + bs_write_ue( s, sh->weight[0][1].i_denom ); + for( int i = 0; i < sh->i_num_ref_idx_l0_active; i++ ) + { + int luma_weight_l0_flag = !!sh->weight[i][0].weightfn; + int chroma_weight_l0_flag = !!sh->weight[i][1].weightfn || !!sh->weight[i][2].weightfn; + bs_write1( s, luma_weight_l0_flag ); + if( luma_weight_l0_flag ) + { + bs_write_se( s, sh->weight[i][0].i_scale ); + bs_write_se( s, sh->weight[i][0].i_offset ); + } + bs_write1( s, chroma_weight_l0_flag ); + if( chroma_weight_l0_flag ) + { + for( int j = 1; j < 3; j++ ) + { + bs_write_se( s, sh->weight[i][j].i_scale ); + bs_write_se( s, sh->weight[i][j].i_offset ); + } + } + } + } + else if( sh->pps->b_weighted_bipred == 1 && sh->i_type == SLICE_TYPE_B ) + { + /* TODO */ + } + + if( i_nal_ref_idc != 0 ) + { + if( sh->i_idr_pic_id >= 0 ) + { + bs_write1( s, 0 ); /* no output of prior pics flag */ + bs_write1( s, 0 ); /* long term reference flag */ + } + else + { + bs_write1( s, sh->i_mmco_command_count > 0 ); /* adaptive_ref_pic_marking_mode_flag */ + if( sh->i_mmco_command_count > 0 ) + { + for( int i = 0; i < sh->i_mmco_command_count; i++ ) + { + bs_write_ue( s, 1 ); /* mark short term ref as unused */ + bs_write_ue( s, sh->mmco[i].i_difference_of_pic_nums - 1 ); + } + bs_write_ue( s, 0 ); /* end command list */ + } + } + } + + if( sh->pps->b_cabac && sh->i_type != SLICE_TYPE_I ) + bs_write_ue( s, sh->i_cabac_init_idc ); + + bs_write_se( s, sh->i_qp_delta ); /* slice qp delta */ + + if( sh->pps->b_deblocking_filter_control ) + { + bs_write_ue( s, sh->i_disable_deblocking_filter_idc ); + if( sh->i_disable_deblocking_filter_idc != 1 ) + { + bs_write_se( s, sh->i_alpha_c0_offset >> 1 ); + bs_write_se( s, sh->i_beta_offset >> 1 ); + } + } +} + +/* If we are within a reasonable distance of the end of the memory allocated for the bitstream, */ +/* reallocate, adding an arbitrary amount of space. */ +static int x264_bitstream_check_buffer_internal( x264_t *h, int size, int b_cabac, int i_nal ) +{ + if( (b_cabac && (h->cabac.p_end - h->cabac.p < size)) || + (h->out.bs.p_end - h->out.bs.p < size) ) + { + int buf_size = h->out.i_bitstream + size; + uint8_t *buf = x264_malloc( buf_size ); + if( !buf ) + return -1; + int aligned_size = h->out.i_bitstream & ~15; + h->mc.memcpy_aligned( buf, h->out.p_bitstream, aligned_size ); + memcpy( buf + aligned_size, h->out.p_bitstream + aligned_size, h->out.i_bitstream - aligned_size ); + + intptr_t delta = buf - h->out.p_bitstream; + + h->out.bs.p_start += delta; + h->out.bs.p += delta; + h->out.bs.p_end = buf + buf_size; + + h->cabac.p_start += delta; + h->cabac.p += delta; + h->cabac.p_end = buf + buf_size; + + for( int i = 0; i <= i_nal; i++ ) + h->out.nal[i].p_payload += delta; + + x264_free( h->out.p_bitstream ); + h->out.p_bitstream = buf; + h->out.i_bitstream = buf_size; + } + return 0; +} + +static int x264_bitstream_check_buffer( x264_t *h ) +{ + int max_row_size = (2500 << SLICE_MBAFF) * h->mb.i_mb_width; + return x264_bitstream_check_buffer_internal( h, max_row_size, h->param.b_cabac, h->out.i_nal ); +} + +static int x264_bitstream_check_buffer_filler( x264_t *h, int filler ) +{ + filler += 32; // add padding for safety + return x264_bitstream_check_buffer_internal( h, filler, 0, -1 ); +} + +#if HAVE_THREAD +static void x264_encoder_thread_init( x264_t *h ) +{ + if( h->param.i_sync_lookahead ) + x264_lower_thread_priority( 10 ); +} +#endif + +/**************************************************************************** + * + **************************************************************************** + ****************************** External API********************************* + **************************************************************************** + * + ****************************************************************************/ + +static int x264_validate_parameters( x264_t *h, int b_open ) +{ + if( !h->param.pf_log ) + { + x264_log( NULL, X264_LOG_ERROR, "pf_log not set! did you forget to call x264_param_default?\n" ); + return -1; + } + +#if HAVE_MMX + if( b_open ) + { + int cpuflags = x264_cpu_detect(); + int fail = 0; +#ifdef __SSE__ + if( !(cpuflags & X264_CPU_SSE) ) + { + x264_log( h, X264_LOG_ERROR, "your cpu does not support SSE1, but x264 was compiled with asm\n"); + fail = 1; + } +#else + if( !(cpuflags & X264_CPU_MMX2) ) + { + x264_log( h, X264_LOG_ERROR, "your cpu does not support MMXEXT, but x264 was compiled with asm\n"); + fail = 1; + } +#endif + if( fail ) + { + x264_log( h, X264_LOG_ERROR, "to run x264, recompile without asm (configure --disable-asm)\n"); + return -1; + } + } +#endif + +#if HAVE_INTERLACED + h->param.b_interlaced = !!PARAM_INTERLACED; +#else + if( h->param.b_interlaced ) + { + x264_log( h, X264_LOG_ERROR, "not compiled with interlaced support\n" ); + return -1; + } +#endif + + if( h->param.i_width <= 0 || h->param.i_height <= 0 ) + { + x264_log( h, X264_LOG_ERROR, "invalid width x height (%dx%d)\n", + h->param.i_width, h->param.i_height ); + return -1; + } + + int i_csp = h->param.i_csp & X264_CSP_MASK; +#if X264_CHROMA_FORMAT + if( CHROMA_FORMAT != CHROMA_420 && i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 ) + { + x264_log( h, X264_LOG_ERROR, "not compiled with 4:2:0 support\n" ); + return -1; + } + else if( CHROMA_FORMAT != CHROMA_422 && i_csp >= X264_CSP_I422 && i_csp < X264_CSP_I444 ) + { + x264_log( h, X264_LOG_ERROR, "not compiled with 4:2:2 support\n" ); + return -1; + } + else if( CHROMA_FORMAT != CHROMA_444 && i_csp >= X264_CSP_I444 && i_csp <= X264_CSP_RGB ) + { + x264_log( h, X264_LOG_ERROR, "not compiled with 4:4:4 support\n" ); + return -1; + } +#endif + if( i_csp <= X264_CSP_NONE || i_csp >= X264_CSP_MAX ) + { + x264_log( h, X264_LOG_ERROR, "invalid CSP (only I420/YV12/NV12/NV21/I422/YV16/NV16/YUYV/UYVY/" + "I444/YV24/BGR/BGRA/RGB supported)\n" ); + return -1; + } + + int w_mod = i_csp < X264_CSP_I444 ? 2 : 1; + int h_mod = (i_csp < X264_CSP_I422 ? 2 : 1) << PARAM_INTERLACED; + if( h->param.i_width % w_mod ) + { + x264_log( h, X264_LOG_ERROR, "width not divisible by %d (%dx%d)\n", + w_mod, h->param.i_width, h->param.i_height ); + return -1; + } + if( h->param.i_height % h_mod ) + { + x264_log( h, X264_LOG_ERROR, "height not divisible by %d (%dx%d)\n", + h_mod, h->param.i_width, h->param.i_height ); + return -1; + } + + if( h->param.crop_rect.i_left >= h->param.i_width || + h->param.crop_rect.i_right >= h->param.i_width || + h->param.crop_rect.i_top >= h->param.i_height || + h->param.crop_rect.i_bottom >= h->param.i_height || + h->param.crop_rect.i_left + h->param.crop_rect.i_right >= h->param.i_width || + h->param.crop_rect.i_top + h->param.crop_rect.i_bottom >= h->param.i_height ) + { + x264_log( h, X264_LOG_ERROR, "invalid crop-rect %u,%u,%u,%u\n", h->param.crop_rect.i_left, + h->param.crop_rect.i_top, h->param.crop_rect.i_right, h->param.crop_rect.i_bottom ); + return -1; + } + if( h->param.crop_rect.i_left % w_mod || h->param.crop_rect.i_right % w_mod || + h->param.crop_rect.i_top % h_mod || h->param.crop_rect.i_bottom % h_mod ) + { + x264_log( h, X264_LOG_ERROR, "crop-rect %u,%u,%u,%u not divisible by %dx%d\n", h->param.crop_rect.i_left, + h->param.crop_rect.i_top, h->param.crop_rect.i_right, h->param.crop_rect.i_bottom, w_mod, h_mod ); + return -1; + } + + if( h->param.vui.i_sar_width <= 0 || h->param.vui.i_sar_height <= 0 ) + { + h->param.vui.i_sar_width = 0; + h->param.vui.i_sar_height = 0; + } + + if( h->param.i_threads == X264_THREADS_AUTO ) + { + h->param.i_threads = x264_cpu_num_processors() * (h->param.b_sliced_threads?2:3)/2; + /* Avoid too many threads as they don't improve performance and + * complicate VBV. Capped at an arbitrary 2 rows per thread. */ + int max_threads = X264_MAX( 1, (h->param.i_height+15)/16 / 2 ); + h->param.i_threads = X264_MIN( h->param.i_threads, max_threads ); + } + int max_sliced_threads = X264_MAX( 1, (h->param.i_height+15)/16 / 4 ); + if( h->param.i_threads > 1 ) + { +#if !HAVE_THREAD + x264_log( h, X264_LOG_WARNING, "not compiled with thread support!\n"); + h->param.i_threads = 1; +#endif + /* Avoid absurdly small thread slices as they can reduce performance + * and VBV compliance. Capped at an arbitrary 4 rows per thread. */ + if( h->param.b_sliced_threads ) + h->param.i_threads = X264_MIN( h->param.i_threads, max_sliced_threads ); + } + h->param.i_threads = x264_clip3( h->param.i_threads, 1, X264_THREAD_MAX ); + if( h->param.i_threads == 1 ) + { + h->param.b_sliced_threads = 0; + h->param.i_lookahead_threads = 1; + } + h->i_thread_frames = h->param.b_sliced_threads ? 1 : h->param.i_threads; + if( h->i_thread_frames > 1 ) + h->param.nalu_process = NULL; + + if( h->param.b_opencl ) + { +#if !HAVE_OPENCL + x264_log( h, X264_LOG_WARNING, "OpenCL: not compiled with OpenCL support, disabling\n" ); + h->param.b_opencl = 0; +#elif BIT_DEPTH > 8 + x264_log( h, X264_LOG_WARNING, "OpenCL lookahead does not support high bit depth, disabling opencl\n" ); + h->param.b_opencl = 0; +#else + if( h->param.i_width < 32 || h->param.i_height < 32 ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: frame size is too small, disabling opencl\n" ); + h->param.b_opencl = 0; + } +#endif + if( h->param.opencl_device_id && h->param.i_opencl_device ) + { + x264_log( h, X264_LOG_WARNING, "OpenCL: device id and device skip count configured; dropping skip\n" ); + h->param.i_opencl_device = 0; + } + } + + h->param.i_keyint_max = x264_clip3( h->param.i_keyint_max, 1, X264_KEYINT_MAX_INFINITE ); + if( h->param.i_keyint_max == 1 ) + { + h->param.b_intra_refresh = 0; + h->param.analyse.i_weighted_pred = 0; + h->param.i_frame_reference = 1; + h->param.i_dpb_size = 1; + } + + if( h->param.i_frame_packing < -1 || h->param.i_frame_packing > 7 ) + { + x264_log( h, X264_LOG_WARNING, "ignoring unknown frame packing value\n" ); + h->param.i_frame_packing = -1; + } + if( h->param.i_frame_packing == 7 && + ((h->param.i_width - h->param.crop_rect.i_left - h->param.crop_rect.i_right) % 3 || + (h->param.i_height - h->param.crop_rect.i_top - h->param.crop_rect.i_bottom) % 3) ) + { + x264_log( h, X264_LOG_ERROR, "cropped resolution %dx%d not compatible with tile format frame packing\n", + h->param.i_width - h->param.crop_rect.i_left - h->param.crop_rect.i_right, + h->param.i_height - h->param.crop_rect.i_top - h->param.crop_rect.i_bottom ); + return -1; + } + + /* Detect default ffmpeg settings and terminate with an error. */ + if( b_open ) + { + int score = 0; + score += h->param.analyse.i_me_range == 0; + score += h->param.rc.i_qp_step == 3; + score += h->param.i_keyint_max == 12; + score += h->param.rc.i_qp_min == 2; + score += h->param.rc.i_qp_max == 31; + score += h->param.rc.f_qcompress == 0.5; + score += fabs(h->param.rc.f_ip_factor - 1.25) < 0.01; + score += fabs(h->param.rc.f_pb_factor - 1.25) < 0.01; + score += h->param.analyse.inter == 0 && h->param.analyse.i_subpel_refine == 8; + if( score >= 5 ) + { + x264_log( h, X264_LOG_ERROR, "broken ffmpeg default settings detected\n" ); + x264_log( h, X264_LOG_ERROR, "use an encoding preset (e.g. -vpre medium)\n" ); + x264_log( h, X264_LOG_ERROR, "preset usage: -vpre -vpre \n" ); + x264_log( h, X264_LOG_ERROR, "speed presets are listed in x264 --help\n" ); + x264_log( h, X264_LOG_ERROR, "profile is optional; x264 defaults to high\n" ); + return -1; + } + } + + if( h->param.rc.i_rc_method < 0 || h->param.rc.i_rc_method > 2 ) + { + x264_log( h, X264_LOG_ERROR, "no ratecontrol method specified\n" ); + return -1; + } + + if( PARAM_INTERLACED ) + h->param.b_pic_struct = 1; + + if( h->param.i_avcintra_class ) + { + if( BIT_DEPTH != 10 ) + { + x264_log( h, X264_LOG_ERROR, "%2d-bit AVC-Intra is not widely compatible\n", BIT_DEPTH ); + x264_log( h, X264_LOG_ERROR, "10-bit x264 is required to encode AVC-Intra\n" ); + return -1; + } + + int type = h->param.i_avcintra_class == 200 ? 2 : + h->param.i_avcintra_class == 100 ? 1 : + h->param.i_avcintra_class == 50 ? 0 : -1; + if( type < 0 ) + { + x264_log( h, X264_LOG_ERROR, "Invalid AVC-Intra class\n" ); + return -1; + } + + /* [50/100/200][res][fps] */ + static const struct + { + uint16_t fps_num; + uint16_t fps_den; + uint8_t interlaced; + uint16_t frame_size; + const uint8_t *cqm_4ic; + const uint8_t *cqm_8iy; + } avcintra_lut[3][2][7] = + { + {{{ 60000, 1001, 0, 912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 50, 1, 0, 1100, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 30000, 1001, 0, 912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 25, 1, 0, 1100, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 24000, 1001, 0, 912, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }}, + {{ 30000, 1001, 1, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy }, + { 25, 1, 1, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_1080i_8iy }, + { 60000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 30000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 50, 1, 0, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 25, 1, 0, 2196, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }, + { 24000, 1001, 0, 1820, x264_cqm_avci50_4ic, x264_cqm_avci50_p_8iy }}}, + {{{ 60000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }, + { 50, 1, 0, 2224, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }, + { 30000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }, + { 25, 1, 0, 2224, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }, + { 24000, 1001, 0, 1848, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }}, + {{ 30000, 1001, 1, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy }, + { 25, 1, 1, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy }, + { 60000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 30000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 50, 1, 0, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 25, 1, 0, 4444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 24000, 1001, 0, 3692, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}}, + {{{ 60000, 1001, 0, 3724, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }, + { 50, 1, 0, 4472, x264_cqm_avci100_720p_4ic, x264_cqm_avci100_720p_8iy }}, + {{ 30000, 1001, 1, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy }, + { 25, 1, 1, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080i_8iy }, + { 60000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 30000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 50, 1, 0, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 25, 1, 0, 8940, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }, + { 24000, 1001, 0, 7444, x264_cqm_avci100_1080_4ic, x264_cqm_avci100_1080p_8iy }}} + }; + + int res = -1; + if( i_csp >= X264_CSP_I420 && i_csp < X264_CSP_I422 && !type ) + { + if( h->param.i_width == 1440 && h->param.i_height == 1080 ) res = 1; + else if( h->param.i_width == 960 && h->param.i_height == 720 ) res = 0; + } + else if( i_csp >= X264_CSP_I422 && i_csp < X264_CSP_I444 && type ) + { + if( h->param.i_width == 1920 && h->param.i_height == 1080 ) res = 1; + else if( h->param.i_width == 1280 && h->param.i_height == 720 ) res = 0; + } + else + { + x264_log( h, X264_LOG_ERROR, "Invalid colorspace for AVC-Intra %d\n", h->param.i_avcintra_class ); + return -1; + } + + if( res < 0 ) + { + x264_log( h, X264_LOG_ERROR, "Resolution %dx%d invalid for AVC-Intra %d\n", + h->param.i_width, h->param.i_height, h->param.i_avcintra_class ); + return -1; + } + + if( h->param.nalu_process ) + { + x264_log( h, X264_LOG_ERROR, "nalu_process is not supported in AVC-Intra mode\n" ); + return -1; + } + + if( !h->param.b_repeat_headers ) + { + x264_log( h, X264_LOG_ERROR, "Separate headers not supported in AVC-Intra mode\n" ); + return -1; + } + + int i; + uint32_t fps_num = h->param.i_fps_num, fps_den = h->param.i_fps_den; + x264_reduce_fraction( &fps_num, &fps_den ); + for( i = 0; i < 7; i++ ) + { + if( avcintra_lut[type][res][i].fps_num == fps_num && + avcintra_lut[type][res][i].fps_den == fps_den && + avcintra_lut[type][res][i].interlaced == PARAM_INTERLACED ) + { + break; + } + } + if( i == 7 ) + { + x264_log( h, X264_LOG_ERROR, "FPS %d/%d%c not compatible with AVC-Intra\n", + h->param.i_fps_num, h->param.i_fps_den, PARAM_INTERLACED ? 'i' : 'p' ); + return -1; + } + + h->param.i_keyint_max = 1; + h->param.b_intra_refresh = 0; + h->param.analyse.i_weighted_pred = 0; + h->param.i_frame_reference = 1; + h->param.i_dpb_size = 1; + + h->param.b_bluray_compat = 0; + h->param.b_vfr_input = 0; + h->param.b_aud = 1; + h->param.vui.i_chroma_loc = 0; + h->param.i_nal_hrd = X264_NAL_HRD_NONE; + h->param.b_deblocking_filter = 0; + h->param.b_stitchable = 1; + h->param.b_pic_struct = 0; + h->param.analyse.b_transform_8x8 = 1; + h->param.analyse.intra = X264_ANALYSE_I8x8; + h->param.analyse.i_chroma_qp_offset = res && type ? 3 : 4; + h->param.b_cabac = !type; + h->param.rc.i_vbv_buffer_size = avcintra_lut[type][res][i].frame_size; + h->param.rc.i_vbv_max_bitrate = + h->param.rc.i_bitrate = h->param.rc.i_vbv_buffer_size * fps_num / fps_den; + h->param.rc.i_rc_method = X264_RC_ABR; + h->param.rc.f_vbv_buffer_init = 1.0; + h->param.rc.b_filler = 1; + h->param.i_cqm_preset = X264_CQM_CUSTOM; + memcpy( h->param.cqm_4iy, x264_cqm_jvt4i, sizeof(h->param.cqm_4iy) ); + memcpy( h->param.cqm_4ic, avcintra_lut[type][res][i].cqm_4ic, sizeof(h->param.cqm_4ic) ); + memcpy( h->param.cqm_8iy, avcintra_lut[type][res][i].cqm_8iy, sizeof(h->param.cqm_8iy) ); + + /* Need exactly 10 slices of equal MB count... why? $deity knows... */ + h->param.i_slice_max_mbs = ((h->param.i_width + 15) / 16) * ((h->param.i_height + 15) / 16) / 10; + h->param.i_slice_max_size = 0; + /* The slice structure only allows a maximum of 2 threads for 1080i/p + * and 1 or 5 threads for 720p */ + if( h->param.b_sliced_threads ) + { + if( res ) + h->param.i_threads = X264_MIN( 2, h->param.i_threads ); + else + { + h->param.i_threads = X264_MIN( 5, h->param.i_threads ); + if( h->param.i_threads < 5 ) + h->param.i_threads = 1; + } + } + + if( type ) + h->param.vui.i_sar_width = h->param.vui.i_sar_height = 1; + else + { + h->param.vui.i_sar_width = 4; + h->param.vui.i_sar_height = 3; + } + + /* Official encoder doesn't appear to go under 13 + * and Avid cannot handle negative QPs */ + h->param.rc.i_qp_min = X264_MAX( h->param.rc.i_qp_min, QP_BD_OFFSET + 1 ); + } + + h->param.rc.f_rf_constant = x264_clip3f( h->param.rc.f_rf_constant, -QP_BD_OFFSET, 51 ); + h->param.rc.f_rf_constant_max = x264_clip3f( h->param.rc.f_rf_constant_max, -QP_BD_OFFSET, 51 ); + h->param.rc.i_qp_constant = x264_clip3( h->param.rc.i_qp_constant, 0, QP_MAX ); + h->param.analyse.i_subpel_refine = x264_clip3( h->param.analyse.i_subpel_refine, 0, 11 ); + h->param.rc.f_ip_factor = X264_MAX( h->param.rc.f_ip_factor, 0.01f ); + h->param.rc.f_pb_factor = X264_MAX( h->param.rc.f_pb_factor, 0.01f ); + if( h->param.rc.i_rc_method == X264_RC_CRF ) + { + h->param.rc.i_qp_constant = h->param.rc.f_rf_constant + QP_BD_OFFSET; + h->param.rc.i_bitrate = 0; + } + if( b_open && (h->param.rc.i_rc_method == X264_RC_CQP || h->param.rc.i_rc_method == X264_RC_CRF) + && h->param.rc.i_qp_constant == 0 ) + { + h->mb.b_lossless = 1; + h->param.i_cqm_preset = X264_CQM_FLAT; + h->param.psz_cqm_file = NULL; + h->param.rc.i_rc_method = X264_RC_CQP; + h->param.rc.f_ip_factor = 1; + h->param.rc.f_pb_factor = 1; + h->param.analyse.b_psnr = 0; + h->param.analyse.b_ssim = 0; + h->param.analyse.i_chroma_qp_offset = 0; + h->param.analyse.i_trellis = 0; + h->param.analyse.b_fast_pskip = 0; + h->param.analyse.i_noise_reduction = 0; + h->param.analyse.b_psy = 0; + h->param.i_bframe = 0; + /* 8x8dct is not useful without RD in CAVLC lossless */ + if( !h->param.b_cabac && h->param.analyse.i_subpel_refine < 6 ) + h->param.analyse.b_transform_8x8 = 0; + h->param.analyse.inter &= ~X264_ANALYSE_I8x8; + h->param.analyse.intra &= ~X264_ANALYSE_I8x8; + } + if( i_csp >= X264_CSP_I444 && h->param.b_cabac ) + { + /* Disable 8x8dct during 4:4:4+CABAC encoding for compatibility with libavcodec */ + h->param.analyse.b_transform_8x8 = 0; + } + if( h->param.rc.i_rc_method == X264_RC_CQP ) + { + float qp_p = h->param.rc.i_qp_constant; + float qp_i = qp_p - 6*log2f( h->param.rc.f_ip_factor ); + float qp_b = qp_p + 6*log2f( h->param.rc.f_pb_factor ); + h->param.rc.i_qp_min = x264_clip3( (int)(X264_MIN3( qp_p, qp_i, qp_b )), 0, QP_MAX ); + h->param.rc.i_qp_max = x264_clip3( (int)(X264_MAX3( qp_p, qp_i, qp_b ) + .999), 0, QP_MAX ); + h->param.rc.i_aq_mode = 0; + h->param.rc.b_mb_tree = 0; + h->param.rc.i_bitrate = 0; + } + h->param.rc.i_qp_max = x264_clip3( h->param.rc.i_qp_max, 0, QP_MAX ); + h->param.rc.i_qp_min = x264_clip3( h->param.rc.i_qp_min, 0, h->param.rc.i_qp_max ); + h->param.rc.i_qp_step = x264_clip3( h->param.rc.i_qp_step, 2, QP_MAX ); + h->param.rc.i_bitrate = x264_clip3( h->param.rc.i_bitrate, 0, 2000000 ); + if( h->param.rc.i_rc_method == X264_RC_ABR && !h->param.rc.i_bitrate ) + { + x264_log( h, X264_LOG_ERROR, "bitrate not specified\n" ); + return -1; + } + h->param.rc.i_vbv_buffer_size = x264_clip3( h->param.rc.i_vbv_buffer_size, 0, 2000000 ); + h->param.rc.i_vbv_max_bitrate = x264_clip3( h->param.rc.i_vbv_max_bitrate, 0, 2000000 ); + h->param.rc.f_vbv_buffer_init = x264_clip3f( h->param.rc.f_vbv_buffer_init, 0, 2000000 ); + if( h->param.rc.i_vbv_buffer_size ) + { + if( h->param.rc.i_rc_method == X264_RC_CQP ) + { + x264_log( h, X264_LOG_WARNING, "VBV is incompatible with constant QP, ignored.\n" ); + h->param.rc.i_vbv_max_bitrate = 0; + h->param.rc.i_vbv_buffer_size = 0; + } + else if( h->param.rc.i_vbv_max_bitrate == 0 ) + { + if( h->param.rc.i_rc_method == X264_RC_ABR ) + { + x264_log( h, X264_LOG_WARNING, "VBV maxrate unspecified, assuming CBR\n" ); + h->param.rc.i_vbv_max_bitrate = h->param.rc.i_bitrate; + } + else + { + x264_log( h, X264_LOG_WARNING, "VBV bufsize set but maxrate unspecified, ignored\n" ); + h->param.rc.i_vbv_buffer_size = 0; + } + } + else if( h->param.rc.i_vbv_max_bitrate < h->param.rc.i_bitrate && + h->param.rc.i_rc_method == X264_RC_ABR ) + { + x264_log( h, X264_LOG_WARNING, "max bitrate less than average bitrate, assuming CBR\n" ); + h->param.rc.i_bitrate = h->param.rc.i_vbv_max_bitrate; + } + } + else if( h->param.rc.i_vbv_max_bitrate ) + { + x264_log( h, X264_LOG_WARNING, "VBV maxrate specified, but no bufsize, ignored\n" ); + h->param.rc.i_vbv_max_bitrate = 0; + } + + h->param.i_slice_max_size = X264_MAX( h->param.i_slice_max_size, 0 ); + h->param.i_slice_max_mbs = X264_MAX( h->param.i_slice_max_mbs, 0 ); + h->param.i_slice_min_mbs = X264_MAX( h->param.i_slice_min_mbs, 0 ); + if( h->param.i_slice_max_mbs ) + h->param.i_slice_min_mbs = X264_MIN( h->param.i_slice_min_mbs, h->param.i_slice_max_mbs/2 ); + else if( !h->param.i_slice_max_size ) + h->param.i_slice_min_mbs = 0; + if( PARAM_INTERLACED && h->param.i_slice_min_mbs ) + { + x264_log( h, X264_LOG_WARNING, "interlace + slice-min-mbs is not implemented\n" ); + h->param.i_slice_min_mbs = 0; + } + int mb_width = (h->param.i_width+15)/16; + if( h->param.i_slice_min_mbs > mb_width ) + { + x264_log( h, X264_LOG_WARNING, "slice-min-mbs > row mb size (%d) not implemented\n", mb_width ); + h->param.i_slice_min_mbs = mb_width; + } + + int max_slices = (h->param.i_height+((16<param.b_sliced_threads ) + h->param.i_slice_count = x264_clip3( h->param.i_threads, 0, max_slices ); + else + { + h->param.i_slice_count = x264_clip3( h->param.i_slice_count, 0, max_slices ); + if( h->param.i_slice_max_mbs || h->param.i_slice_max_size ) + h->param.i_slice_count = 0; + } + if( h->param.i_slice_count_max > 0 ) + h->param.i_slice_count_max = X264_MAX( h->param.i_slice_count, h->param.i_slice_count_max ); + + if( h->param.b_bluray_compat ) + { + h->param.i_bframe_pyramid = X264_MIN( X264_B_PYRAMID_STRICT, h->param.i_bframe_pyramid ); + h->param.i_bframe = X264_MIN( h->param.i_bframe, 3 ); + h->param.b_aud = 1; + h->param.i_nal_hrd = X264_MAX( h->param.i_nal_hrd, X264_NAL_HRD_VBR ); + h->param.i_slice_max_size = 0; + h->param.i_slice_max_mbs = 0; + h->param.b_intra_refresh = 0; + h->param.i_frame_reference = X264_MIN( h->param.i_frame_reference, 6 ); + h->param.i_dpb_size = X264_MIN( h->param.i_dpb_size, 6 ); + /* Don't use I-frames, because Blu-ray treats them the same as IDR. */ + h->param.i_keyint_min = 1; + /* Due to the proliferation of broken players that don't handle dupes properly. */ + h->param.analyse.i_weighted_pred = X264_MIN( h->param.analyse.i_weighted_pred, X264_WEIGHTP_SIMPLE ); + if( h->param.b_fake_interlaced ) + h->param.b_pic_struct = 1; + } + + h->param.i_frame_reference = x264_clip3( h->param.i_frame_reference, 1, X264_REF_MAX ); + h->param.i_dpb_size = x264_clip3( h->param.i_dpb_size, 1, X264_REF_MAX ); + if( h->param.i_scenecut_threshold < 0 ) + h->param.i_scenecut_threshold = 0; + h->param.analyse.i_direct_mv_pred = x264_clip3( h->param.analyse.i_direct_mv_pred, X264_DIRECT_PRED_NONE, X264_DIRECT_PRED_AUTO ); + if( !h->param.analyse.i_subpel_refine && h->param.analyse.i_direct_mv_pred > X264_DIRECT_PRED_SPATIAL ) + { + x264_log( h, X264_LOG_WARNING, "subme=0 + direct=temporal is not supported\n" ); + h->param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL; + } + h->param.i_bframe = x264_clip3( h->param.i_bframe, 0, X264_MIN( X264_BFRAME_MAX, h->param.i_keyint_max-1 ) ); + h->param.i_bframe_bias = x264_clip3( h->param.i_bframe_bias, -90, 100 ); + if( h->param.i_bframe <= 1 ) + h->param.i_bframe_pyramid = X264_B_PYRAMID_NONE; + h->param.i_bframe_pyramid = x264_clip3( h->param.i_bframe_pyramid, X264_B_PYRAMID_NONE, X264_B_PYRAMID_NORMAL ); + h->param.i_bframe_adaptive = x264_clip3( h->param.i_bframe_adaptive, X264_B_ADAPT_NONE, X264_B_ADAPT_TRELLIS ); + if( !h->param.i_bframe ) + { + h->param.i_bframe_adaptive = X264_B_ADAPT_NONE; + h->param.analyse.i_direct_mv_pred = 0; + h->param.analyse.b_weighted_bipred = 0; + h->param.b_open_gop = 0; + } + if( h->param.b_intra_refresh && h->param.i_bframe_pyramid == X264_B_PYRAMID_NORMAL ) + { + x264_log( h, X264_LOG_WARNING, "b-pyramid normal + intra-refresh is not supported\n" ); + h->param.i_bframe_pyramid = X264_B_PYRAMID_STRICT; + } + if( h->param.b_intra_refresh && (h->param.i_frame_reference > 1 || h->param.i_dpb_size > 1) ) + { + x264_log( h, X264_LOG_WARNING, "ref > 1 + intra-refresh is not supported\n" ); + h->param.i_frame_reference = 1; + h->param.i_dpb_size = 1; + } + if( h->param.b_intra_refresh && h->param.b_open_gop ) + { + x264_log( h, X264_LOG_WARNING, "intra-refresh is not compatible with open-gop\n" ); + h->param.b_open_gop = 0; + } + if( !h->param.i_fps_num || !h->param.i_fps_den ) + { + h->param.i_fps_num = 25; + h->param.i_fps_den = 1; + } + float fps = (float)h->param.i_fps_num / h->param.i_fps_den; + if( h->param.i_keyint_min == X264_KEYINT_MIN_AUTO ) + h->param.i_keyint_min = X264_MIN( h->param.i_keyint_max / 10, (int)fps ); + h->param.i_keyint_min = x264_clip3( h->param.i_keyint_min, 1, h->param.i_keyint_max/2+1 ); + h->param.rc.i_lookahead = x264_clip3( h->param.rc.i_lookahead, 0, X264_LOOKAHEAD_MAX ); + { + int maxrate = X264_MAX( h->param.rc.i_vbv_max_bitrate, h->param.rc.i_bitrate ); + float bufsize = maxrate ? (float)h->param.rc.i_vbv_buffer_size / maxrate : 0; + h->param.rc.i_lookahead = X264_MIN( h->param.rc.i_lookahead, X264_MAX( h->param.i_keyint_max, bufsize*fps ) ); + } + + if( !h->param.i_timebase_num || !h->param.i_timebase_den || !(h->param.b_vfr_input || h->param.b_pulldown) ) + { + h->param.i_timebase_num = h->param.i_fps_den; + h->param.i_timebase_den = h->param.i_fps_num; + } + + h->param.rc.f_qcompress = x264_clip3f( h->param.rc.f_qcompress, 0.0, 1.0 ); + if( h->param.i_keyint_max == 1 || h->param.rc.f_qcompress == 1 ) + h->param.rc.b_mb_tree = 0; + if( (!h->param.b_intra_refresh && h->param.i_keyint_max != X264_KEYINT_MAX_INFINITE) && + !h->param.rc.i_lookahead && h->param.rc.b_mb_tree ) + { + x264_log( h, X264_LOG_WARNING, "lookaheadless mb-tree requires intra refresh or infinite keyint\n" ); + h->param.rc.b_mb_tree = 0; + } + if( b_open && h->param.rc.b_stat_read ) + h->param.rc.i_lookahead = 0; +#if HAVE_THREAD + if( h->param.i_sync_lookahead < 0 ) + h->param.i_sync_lookahead = h->param.i_bframe + 1; + h->param.i_sync_lookahead = X264_MIN( h->param.i_sync_lookahead, X264_LOOKAHEAD_MAX ); + if( h->param.rc.b_stat_read || h->i_thread_frames == 1 ) + h->param.i_sync_lookahead = 0; +#else + h->param.i_sync_lookahead = 0; +#endif + + h->param.i_deblocking_filter_alphac0 = x264_clip3( h->param.i_deblocking_filter_alphac0, -6, 6 ); + h->param.i_deblocking_filter_beta = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 ); + h->param.analyse.i_luma_deadzone[0] = x264_clip3( h->param.analyse.i_luma_deadzone[0], 0, 32 ); + h->param.analyse.i_luma_deadzone[1] = x264_clip3( h->param.analyse.i_luma_deadzone[1], 0, 32 ); + + h->param.i_cabac_init_idc = x264_clip3( h->param.i_cabac_init_idc, 0, 2 ); + + if( h->param.i_cqm_preset < X264_CQM_FLAT || h->param.i_cqm_preset > X264_CQM_CUSTOM ) + h->param.i_cqm_preset = X264_CQM_FLAT; + + if( h->param.analyse.i_me_method < X264_ME_DIA || + h->param.analyse.i_me_method > X264_ME_TESA ) + h->param.analyse.i_me_method = X264_ME_HEX; + h->param.analyse.i_me_range = x264_clip3( h->param.analyse.i_me_range, 4, 1024 ); + if( h->param.analyse.i_me_range > 16 && h->param.analyse.i_me_method <= X264_ME_HEX ) + h->param.analyse.i_me_range = 16; + if( h->param.analyse.i_me_method == X264_ME_TESA && + (h->mb.b_lossless || h->param.analyse.i_subpel_refine <= 1) ) + h->param.analyse.i_me_method = X264_ME_ESA; + h->param.analyse.b_mixed_references = h->param.analyse.b_mixed_references && h->param.i_frame_reference > 1; + h->param.analyse.inter &= X264_ANALYSE_PSUB16x16|X264_ANALYSE_PSUB8x8|X264_ANALYSE_BSUB16x16| + X264_ANALYSE_I4x4|X264_ANALYSE_I8x8; + h->param.analyse.intra &= X264_ANALYSE_I4x4|X264_ANALYSE_I8x8; + if( !(h->param.analyse.inter & X264_ANALYSE_PSUB16x16) ) + h->param.analyse.inter &= ~X264_ANALYSE_PSUB8x8; + if( !h->param.analyse.b_transform_8x8 ) + { + h->param.analyse.inter &= ~X264_ANALYSE_I8x8; + h->param.analyse.intra &= ~X264_ANALYSE_I8x8; + } + h->param.analyse.i_trellis = x264_clip3( h->param.analyse.i_trellis, 0, 2 ); + h->param.rc.i_aq_mode = x264_clip3( h->param.rc.i_aq_mode, 0, 3 ); + h->param.rc.f_aq_strength = x264_clip3f( h->param.rc.f_aq_strength, 0, 3 ); + if( h->param.rc.f_aq_strength == 0 ) + h->param.rc.i_aq_mode = 0; + + if( h->param.i_log_level < X264_LOG_INFO ) + { + h->param.analyse.b_psnr = 0; + h->param.analyse.b_ssim = 0; + } + /* Warn users trying to measure PSNR/SSIM with psy opts on. */ + if( b_open && (h->param.analyse.b_psnr || h->param.analyse.b_ssim) ) + { + char *s = NULL; + + if( h->param.analyse.b_psy ) + { + s = h->param.analyse.b_psnr ? "psnr" : "ssim"; + x264_log( h, X264_LOG_WARNING, "--%s used with psy on: results will be invalid!\n", s ); + } + else if( !h->param.rc.i_aq_mode && h->param.analyse.b_ssim ) + { + x264_log( h, X264_LOG_WARNING, "--ssim used with AQ off: results will be invalid!\n" ); + s = "ssim"; + } + else if( h->param.rc.i_aq_mode && h->param.analyse.b_psnr ) + { + x264_log( h, X264_LOG_WARNING, "--psnr used with AQ on: results will be invalid!\n" ); + s = "psnr"; + } + if( s ) + x264_log( h, X264_LOG_WARNING, "--tune %s should be used if attempting to benchmark %s!\n", s, s ); + } + + if( !h->param.analyse.b_psy ) + { + h->param.analyse.f_psy_rd = 0; + h->param.analyse.f_psy_trellis = 0; + } + h->param.analyse.f_psy_rd = x264_clip3f( h->param.analyse.f_psy_rd, 0, 10 ); + h->param.analyse.f_psy_trellis = x264_clip3f( h->param.analyse.f_psy_trellis, 0, 10 ); + h->mb.i_psy_rd = h->param.analyse.i_subpel_refine >= 6 ? FIX8( h->param.analyse.f_psy_rd ) : 0; + h->mb.i_psy_trellis = h->param.analyse.i_trellis ? FIX8( h->param.analyse.f_psy_trellis / 4 ) : 0; + h->param.analyse.i_chroma_qp_offset = x264_clip3(h->param.analyse.i_chroma_qp_offset, -32, 32); + /* In 4:4:4 mode, chroma gets twice as much resolution, so we can halve its quality. */ + if( b_open && i_csp >= X264_CSP_I444 && i_csp < X264_CSP_BGR && h->param.analyse.b_psy ) + h->param.analyse.i_chroma_qp_offset += 6; + /* Psy RDO increases overall quantizers to improve the quality of luma--this indirectly hurts chroma quality */ + /* so we lower the chroma QP offset to compensate */ + if( b_open && h->mb.i_psy_rd && !h->param.i_avcintra_class ) + h->param.analyse.i_chroma_qp_offset -= h->param.analyse.f_psy_rd < 0.25 ? 1 : 2; + /* Psy trellis has a similar effect. */ + if( b_open && h->mb.i_psy_trellis && !h->param.i_avcintra_class ) + h->param.analyse.i_chroma_qp_offset -= h->param.analyse.f_psy_trellis < 0.25 ? 1 : 2; + h->param.analyse.i_chroma_qp_offset = x264_clip3(h->param.analyse.i_chroma_qp_offset, -12, 12); + /* MB-tree requires AQ to be on, even if the strength is zero. */ + if( !h->param.rc.i_aq_mode && h->param.rc.b_mb_tree ) + { + h->param.rc.i_aq_mode = 1; + h->param.rc.f_aq_strength = 0; + } + h->param.analyse.i_noise_reduction = x264_clip3( h->param.analyse.i_noise_reduction, 0, 1<<16 ); + if( h->param.analyse.i_subpel_refine >= 10 && (h->param.analyse.i_trellis != 2 || !h->param.rc.i_aq_mode) ) + h->param.analyse.i_subpel_refine = 9; + + if( b_open ) + { + const x264_level_t *l = x264_levels; + if( h->param.i_level_idc < 0 ) + { + int maxrate_bak = h->param.rc.i_vbv_max_bitrate; + if( h->param.rc.i_rc_method == X264_RC_ABR && h->param.rc.i_vbv_buffer_size <= 0 ) + h->param.rc.i_vbv_max_bitrate = h->param.rc.i_bitrate * 2; + x264_sps_init( h->sps, h->param.i_sps_id, &h->param ); + do h->param.i_level_idc = l->level_idc; + while( l[1].level_idc && x264_validate_levels( h, 0 ) && l++ ); + h->param.rc.i_vbv_max_bitrate = maxrate_bak; + } + else + { + while( l->level_idc && l->level_idc != h->param.i_level_idc ) + l++; + if( l->level_idc == 0 ) + { + x264_log( h, X264_LOG_ERROR, "invalid level_idc: %d\n", h->param.i_level_idc ); + return -1; + } + } + if( h->param.analyse.i_mv_range <= 0 ) + h->param.analyse.i_mv_range = l->mv_range >> PARAM_INTERLACED; + else + h->param.analyse.i_mv_range = x264_clip3(h->param.analyse.i_mv_range, 32, 8192 >> PARAM_INTERLACED); + } + + h->param.analyse.i_weighted_pred = x264_clip3( h->param.analyse.i_weighted_pred, X264_WEIGHTP_NONE, X264_WEIGHTP_SMART ); + + if( h->param.i_lookahead_threads == X264_THREADS_AUTO ) + { + if( h->param.b_sliced_threads ) + h->param.i_lookahead_threads = h->param.i_threads; + else + { + /* If we're using much slower lookahead settings than encoding settings, it helps a lot to use + * more lookahead threads. This typically happens in the first pass of a two-pass encode, so + * try to guess at this sort of case. + * + * Tuned by a little bit of real encoding with the various presets. */ + int badapt = h->param.i_bframe_adaptive == X264_B_ADAPT_TRELLIS; + int subme = X264_MIN( h->param.analyse.i_subpel_refine / 3, 3 ) + (h->param.analyse.i_subpel_refine > 1); + int bframes = X264_MIN( (h->param.i_bframe - 1) / 3, 3 ); + + /* [b-adapt 0/1 vs 2][quantized subme][quantized bframes] */ + static const uint8_t lookahead_thread_div[2][5][4] = + {{{6,6,6,6}, {3,3,3,3}, {4,4,4,4}, {6,6,6,6}, {12,12,12,12}}, + {{3,2,1,1}, {2,1,1,1}, {4,3,2,1}, {6,4,3,2}, {12, 9, 6, 4}}}; + + h->param.i_lookahead_threads = h->param.i_threads / lookahead_thread_div[badapt][subme][bframes]; + /* Since too many lookahead threads significantly degrades lookahead accuracy, limit auto + * lookahead threads to about 8 macroblock rows high each at worst. This number is chosen + * pretty much arbitrarily. */ + h->param.i_lookahead_threads = X264_MIN( h->param.i_lookahead_threads, h->param.i_height / 128 ); + } + } + h->param.i_lookahead_threads = x264_clip3( h->param.i_lookahead_threads, 1, X264_MIN( max_sliced_threads, X264_LOOKAHEAD_THREAD_MAX ) ); + + if( PARAM_INTERLACED ) + { + if( h->param.analyse.i_me_method >= X264_ME_ESA ) + { + x264_log( h, X264_LOG_WARNING, "interlace + me=esa is not implemented\n" ); + h->param.analyse.i_me_method = X264_ME_UMH; + } + if( h->param.analyse.i_weighted_pred > 0 ) + { + x264_log( h, X264_LOG_WARNING, "interlace + weightp is not implemented\n" ); + h->param.analyse.i_weighted_pred = X264_WEIGHTP_NONE; + } + } + + if( !h->param.analyse.i_weighted_pred && h->param.rc.b_mb_tree && h->param.analyse.b_psy ) + h->param.analyse.i_weighted_pred = X264_WEIGHTP_FAKE; + + if( h->i_thread_frames > 1 ) + { + int r = h->param.analyse.i_mv_range_thread; + int r2; + if( r <= 0 ) + { + // half of the available space is reserved and divided evenly among the threads, + // the rest is allocated to whichever thread is far enough ahead to use it. + // reserving more space increases quality for some videos, but costs more time + // in thread synchronization. + int max_range = (h->param.i_height + X264_THREAD_HEIGHT) / h->i_thread_frames - X264_THREAD_HEIGHT; + r = max_range / 2; + } + r = X264_MAX( r, h->param.analyse.i_me_range ); + r = X264_MIN( r, h->param.analyse.i_mv_range ); + // round up to use the whole mb row + r2 = (r & ~15) + ((-X264_THREAD_HEIGHT) & 15); + if( r2 < r ) + r2 += 16; + x264_log( h, X264_LOG_DEBUG, "using mv_range_thread = %d\n", r2 ); + h->param.analyse.i_mv_range_thread = r2; + } + + if( h->param.rc.f_rate_tolerance < 0 ) + h->param.rc.f_rate_tolerance = 0; + if( h->param.rc.f_qblur < 0 ) + h->param.rc.f_qblur = 0; + if( h->param.rc.f_complexity_blur < 0 ) + h->param.rc.f_complexity_blur = 0; + + h->param.i_sps_id &= 31; + + h->param.i_nal_hrd = x264_clip3( h->param.i_nal_hrd, X264_NAL_HRD_NONE, X264_NAL_HRD_CBR ); + + if( h->param.i_nal_hrd && !h->param.rc.i_vbv_buffer_size ) + { + x264_log( h, X264_LOG_WARNING, "NAL HRD parameters require VBV parameters\n" ); + h->param.i_nal_hrd = X264_NAL_HRD_NONE; + } + + if( h->param.i_nal_hrd == X264_NAL_HRD_CBR && + (h->param.rc.i_bitrate != h->param.rc.i_vbv_max_bitrate || !h->param.rc.i_vbv_max_bitrate) ) + { + x264_log( h, X264_LOG_WARNING, "CBR HRD requires constant bitrate\n" ); + h->param.i_nal_hrd = X264_NAL_HRD_VBR; + } + + if( h->param.i_nal_hrd == X264_NAL_HRD_CBR ) + h->param.rc.b_filler = 1; + + /* ensure the booleans are 0 or 1 so they can be used in math */ +#define BOOLIFY(x) h->param.x = !!h->param.x + BOOLIFY( b_cabac ); + BOOLIFY( b_constrained_intra ); + BOOLIFY( b_deblocking_filter ); + BOOLIFY( b_deterministic ); + BOOLIFY( b_sliced_threads ); + BOOLIFY( b_interlaced ); + BOOLIFY( b_intra_refresh ); + BOOLIFY( b_aud ); + BOOLIFY( b_repeat_headers ); + BOOLIFY( b_annexb ); + BOOLIFY( b_vfr_input ); + BOOLIFY( b_pulldown ); + BOOLIFY( b_tff ); + BOOLIFY( b_pic_struct ); + BOOLIFY( b_fake_interlaced ); + BOOLIFY( b_open_gop ); + BOOLIFY( b_bluray_compat ); + BOOLIFY( b_stitchable ); + BOOLIFY( b_full_recon ); + BOOLIFY( b_opencl ); + BOOLIFY( analyse.b_transform_8x8 ); + BOOLIFY( analyse.b_weighted_bipred ); + BOOLIFY( analyse.b_chroma_me ); + BOOLIFY( analyse.b_mixed_references ); + BOOLIFY( analyse.b_fast_pskip ); + BOOLIFY( analyse.b_dct_decimate ); + BOOLIFY( analyse.b_psy ); + BOOLIFY( analyse.b_psnr ); + BOOLIFY( analyse.b_ssim ); + BOOLIFY( rc.b_stat_write ); + BOOLIFY( rc.b_stat_read ); + BOOLIFY( rc.b_mb_tree ); + BOOLIFY( rc.b_filler ); +#undef BOOLIFY + + return 0; +} + +static void mbcmp_init( x264_t *h ) +{ + int satd = !h->mb.b_lossless && h->param.analyse.i_subpel_refine > 1; + memcpy( h->pixf.mbcmp, satd ? h->pixf.satd : h->pixf.sad_aligned, sizeof(h->pixf.mbcmp) ); + memcpy( h->pixf.mbcmp_unaligned, satd ? h->pixf.satd : h->pixf.sad, sizeof(h->pixf.mbcmp_unaligned) ); + h->pixf.intra_mbcmp_x3_16x16 = satd ? h->pixf.intra_satd_x3_16x16 : h->pixf.intra_sad_x3_16x16; + h->pixf.intra_mbcmp_x3_8x16c = satd ? h->pixf.intra_satd_x3_8x16c : h->pixf.intra_sad_x3_8x16c; + h->pixf.intra_mbcmp_x3_8x8c = satd ? h->pixf.intra_satd_x3_8x8c : h->pixf.intra_sad_x3_8x8c; + h->pixf.intra_mbcmp_x3_8x8 = satd ? h->pixf.intra_sa8d_x3_8x8 : h->pixf.intra_sad_x3_8x8; + h->pixf.intra_mbcmp_x3_4x4 = satd ? h->pixf.intra_satd_x3_4x4 : h->pixf.intra_sad_x3_4x4; + h->pixf.intra_mbcmp_x9_4x4 = h->param.b_cpu_independent || h->mb.b_lossless ? NULL + : satd ? h->pixf.intra_satd_x9_4x4 : h->pixf.intra_sad_x9_4x4; + h->pixf.intra_mbcmp_x9_8x8 = h->param.b_cpu_independent || h->mb.b_lossless ? NULL + : satd ? h->pixf.intra_sa8d_x9_8x8 : h->pixf.intra_sad_x9_8x8; + satd &= h->param.analyse.i_me_method == X264_ME_TESA; + memcpy( h->pixf.fpelcmp, satd ? h->pixf.satd : h->pixf.sad, sizeof(h->pixf.fpelcmp) ); + memcpy( h->pixf.fpelcmp_x3, satd ? h->pixf.satd_x3 : h->pixf.sad_x3, sizeof(h->pixf.fpelcmp_x3) ); + memcpy( h->pixf.fpelcmp_x4, satd ? h->pixf.satd_x4 : h->pixf.sad_x4, sizeof(h->pixf.fpelcmp_x4) ); +} + +static void chroma_dsp_init( x264_t *h ) +{ + memcpy( h->luma2chroma_pixel, x264_luma2chroma_pixel[CHROMA_FORMAT], sizeof(h->luma2chroma_pixel) ); + + switch( CHROMA_FORMAT ) + { + case CHROMA_420: + memcpy( h->predict_chroma, h->predict_8x8c, sizeof(h->predict_chroma) ); + h->mc.prefetch_fenc = h->mc.prefetch_fenc_420; + h->loopf.deblock_chroma[0] = h->loopf.deblock_h_chroma_420; + h->loopf.deblock_chroma_intra[0] = h->loopf.deblock_h_chroma_420_intra; + h->loopf.deblock_chroma_mbaff = h->loopf.deblock_chroma_420_mbaff; + h->loopf.deblock_chroma_intra_mbaff = h->loopf.deblock_chroma_420_intra_mbaff; + h->pixf.intra_mbcmp_x3_chroma = h->pixf.intra_mbcmp_x3_8x8c; + h->quantf.coeff_last[DCT_CHROMA_DC] = h->quantf.coeff_last4; + h->quantf.coeff_level_run[DCT_CHROMA_DC] = h->quantf.coeff_level_run4; + break; + case CHROMA_422: + memcpy( h->predict_chroma, h->predict_8x16c, sizeof(h->predict_chroma) ); + h->mc.prefetch_fenc = h->mc.prefetch_fenc_422; + h->loopf.deblock_chroma[0] = h->loopf.deblock_h_chroma_422; + h->loopf.deblock_chroma_intra[0] = h->loopf.deblock_h_chroma_422_intra; + h->loopf.deblock_chroma_mbaff = h->loopf.deblock_chroma_422_mbaff; + h->loopf.deblock_chroma_intra_mbaff = h->loopf.deblock_chroma_422_intra_mbaff; + h->pixf.intra_mbcmp_x3_chroma = h->pixf.intra_mbcmp_x3_8x16c; + h->quantf.coeff_last[DCT_CHROMA_DC] = h->quantf.coeff_last8; + h->quantf.coeff_level_run[DCT_CHROMA_DC] = h->quantf.coeff_level_run8; + break; + case CHROMA_444: + h->mc.prefetch_fenc = h->mc.prefetch_fenc_422; /* FIXME: doesn't cover V plane */ + h->loopf.deblock_chroma_mbaff = h->loopf.deblock_luma_mbaff; + h->loopf.deblock_chroma_intra_mbaff = h->loopf.deblock_luma_intra_mbaff; + break; + } +} + +static void x264_set_aspect_ratio( x264_t *h, x264_param_t *param, int initial ) +{ + /* VUI */ + if( param->vui.i_sar_width > 0 && param->vui.i_sar_height > 0 ) + { + uint32_t i_w = param->vui.i_sar_width; + uint32_t i_h = param->vui.i_sar_height; + uint32_t old_w = h->param.vui.i_sar_width; + uint32_t old_h = h->param.vui.i_sar_height; + + x264_reduce_fraction( &i_w, &i_h ); + + while( i_w > 65535 || i_h > 65535 ) + { + i_w /= 2; + i_h /= 2; + } + + x264_reduce_fraction( &i_w, &i_h ); + + if( i_w != old_w || i_h != old_h || initial ) + { + h->param.vui.i_sar_width = 0; + h->param.vui.i_sar_height = 0; + if( i_w == 0 || i_h == 0 ) + x264_log( h, X264_LOG_WARNING, "cannot create valid sample aspect ratio\n" ); + else + { + x264_log( h, initial?X264_LOG_INFO:X264_LOG_DEBUG, "using SAR=%d/%d\n", i_w, i_h ); + h->param.vui.i_sar_width = i_w; + h->param.vui.i_sar_height = i_h; + } + } + } +} + +/**************************************************************************** + * x264_encoder_open: + ****************************************************************************/ +x264_t *x264_encoder_open( x264_param_t *param ) +{ + x264_t *h; + char buf[1000], *p; + int i_slicetype_length; + + CHECKED_MALLOCZERO( h, sizeof(x264_t) ); + + /* Create a copy of param */ + memcpy( &h->param, param, sizeof(x264_param_t) ); + + if( param->param_free ) + param->param_free( param ); + +#if HAVE_INTEL_DISPATCHER + x264_intel_dispatcher_override(); +#endif + + if( x264_threading_init() ) + { + x264_log( h, X264_LOG_ERROR, "unable to initialize threading\n" ); + goto fail; + } + + if( x264_validate_parameters( h, 1 ) < 0 ) + goto fail; + + if( h->param.psz_cqm_file ) + if( x264_cqm_parse_file( h, h->param.psz_cqm_file ) < 0 ) + goto fail; + + if( h->param.rc.psz_stat_out ) + h->param.rc.psz_stat_out = strdup( h->param.rc.psz_stat_out ); + if( h->param.rc.psz_stat_in ) + h->param.rc.psz_stat_in = strdup( h->param.rc.psz_stat_in ); + + x264_reduce_fraction( &h->param.i_fps_num, &h->param.i_fps_den ); + x264_reduce_fraction( &h->param.i_timebase_num, &h->param.i_timebase_den ); + + /* Init x264_t */ + h->i_frame = -1; + h->i_frame_num = 0; + + if( h->param.i_avcintra_class ) + h->i_idr_pic_id = 5; + else + h->i_idr_pic_id = 0; + + if( (uint64_t)h->param.i_timebase_den * 2 > UINT32_MAX ) + { + x264_log( h, X264_LOG_ERROR, "Effective timebase denominator %u exceeds H.264 maximum\n", h->param.i_timebase_den ); + goto fail; + } + + x264_set_aspect_ratio( h, &h->param, 1 ); + + x264_sps_init( h->sps, h->param.i_sps_id, &h->param ); + x264_pps_init( h->pps, h->param.i_sps_id, &h->param, h->sps ); + + x264_validate_levels( h, 1 ); + + h->chroma_qp_table = i_chroma_qp_table + 12 + h->pps->i_chroma_qp_index_offset; + + if( x264_cqm_init( h ) < 0 ) + goto fail; + + h->mb.i_mb_width = h->sps->i_mb_width; + h->mb.i_mb_height = h->sps->i_mb_height; + h->mb.i_mb_count = h->mb.i_mb_width * h->mb.i_mb_height; + + h->mb.chroma_h_shift = CHROMA_FORMAT == CHROMA_420 || CHROMA_FORMAT == CHROMA_422; + h->mb.chroma_v_shift = CHROMA_FORMAT == CHROMA_420; + + /* Adaptive MBAFF and subme 0 are not supported as we require halving motion + * vectors during prediction, resulting in hpel mvs. + * The chosen solution is to make MBAFF non-adaptive in this case. */ + h->mb.b_adaptive_mbaff = PARAM_INTERLACED && h->param.analyse.i_subpel_refine; + + /* Init frames. */ + if( h->param.i_bframe_adaptive == X264_B_ADAPT_TRELLIS && !h->param.rc.b_stat_read ) + h->frames.i_delay = X264_MAX(h->param.i_bframe,3)*4; + else + h->frames.i_delay = h->param.i_bframe; + if( h->param.rc.b_mb_tree || h->param.rc.i_vbv_buffer_size ) + h->frames.i_delay = X264_MAX( h->frames.i_delay, h->param.rc.i_lookahead ); + i_slicetype_length = h->frames.i_delay; + h->frames.i_delay += h->i_thread_frames - 1; + h->frames.i_delay += h->param.i_sync_lookahead; + h->frames.i_delay += h->param.b_vfr_input; + h->frames.i_bframe_delay = h->param.i_bframe ? (h->param.i_bframe_pyramid ? 2 : 1) : 0; + + h->frames.i_max_ref0 = h->param.i_frame_reference; + h->frames.i_max_ref1 = X264_MIN( h->sps->vui.i_num_reorder_frames, h->param.i_frame_reference ); + h->frames.i_max_dpb = h->sps->vui.i_max_dec_frame_buffering; + h->frames.b_have_lowres = !h->param.rc.b_stat_read + && ( h->param.rc.i_rc_method == X264_RC_ABR + || h->param.rc.i_rc_method == X264_RC_CRF + || h->param.i_bframe_adaptive + || h->param.i_scenecut_threshold + || h->param.rc.b_mb_tree + || h->param.analyse.i_weighted_pred ); + h->frames.b_have_lowres |= h->param.rc.b_stat_read && h->param.rc.i_vbv_buffer_size > 0; + h->frames.b_have_sub8x8_esa = !!(h->param.analyse.inter & X264_ANALYSE_PSUB8x8); + + h->frames.i_last_idr = + h->frames.i_last_keyframe = - h->param.i_keyint_max; + h->frames.i_input = 0; + h->frames.i_largest_pts = h->frames.i_second_largest_pts = -1; + h->frames.i_poc_last_open_gop = -1; + + CHECKED_MALLOCZERO( h->frames.unused[0], (h->frames.i_delay + 3) * sizeof(x264_frame_t *) ); + /* Allocate room for max refs plus a few extra just in case. */ + CHECKED_MALLOCZERO( h->frames.unused[1], (h->i_thread_frames + X264_REF_MAX + 4) * sizeof(x264_frame_t *) ); + CHECKED_MALLOCZERO( h->frames.current, (h->param.i_sync_lookahead + h->param.i_bframe + + h->i_thread_frames + 3) * sizeof(x264_frame_t *) ); + if( h->param.analyse.i_weighted_pred > 0 ) + CHECKED_MALLOCZERO( h->frames.blank_unused, h->i_thread_frames * 4 * sizeof(x264_frame_t *) ); + h->i_ref[0] = h->i_ref[1] = 0; + h->i_cpb_delay = h->i_coded_fields = h->i_disp_fields = 0; + h->i_prev_duration = ((uint64_t)h->param.i_fps_den * h->sps->vui.i_time_scale) / ((uint64_t)h->param.i_fps_num * h->sps->vui.i_num_units_in_tick); + h->i_disp_fields_last_frame = -1; + x264_rdo_init(); + + /* init CPU functions */ +#if (ARCH_X86 || ARCH_X86_64) && HIGH_BIT_DEPTH + /* FIXME: Only 8-bit has been optimized for AVX-512 so far. The few AVX-512 functions + * enabled in high bit-depth are insignificant and just causes potential issues with + * unnecessary thermal throttling and whatnot, so keep it disabled for now. */ + h->param.cpu &= ~X264_CPU_AVX512; +#endif + x264_predict_16x16_init( h->param.cpu, h->predict_16x16 ); + x264_predict_8x8c_init( h->param.cpu, h->predict_8x8c ); + x264_predict_8x16c_init( h->param.cpu, h->predict_8x16c ); + x264_predict_8x8_init( h->param.cpu, h->predict_8x8, &h->predict_8x8_filter ); + x264_predict_4x4_init( h->param.cpu, h->predict_4x4 ); + x264_pixel_init( h->param.cpu, &h->pixf ); + x264_dct_init( h->param.cpu, &h->dctf ); + x264_zigzag_init( h->param.cpu, &h->zigzagf_progressive, &h->zigzagf_interlaced ); + memcpy( &h->zigzagf, PARAM_INTERLACED ? &h->zigzagf_interlaced : &h->zigzagf_progressive, sizeof(h->zigzagf) ); + x264_mc_init( h->param.cpu, &h->mc, h->param.b_cpu_independent ); + x264_quant_init( h, h->param.cpu, &h->quantf ); + x264_deblock_init( h->param.cpu, &h->loopf, PARAM_INTERLACED ); + x264_bitstream_init( h->param.cpu, &h->bsf ); + if( h->param.b_cabac ) + x264_cabac_init( h ); + else + x264_stack_align( x264_cavlc_init, h ); + + mbcmp_init( h ); + chroma_dsp_init( h ); + + p = buf + sprintf( buf, "using cpu capabilities:" ); + for( int i = 0; x264_cpu_names[i].flags; i++ ) + { + if( !strcmp(x264_cpu_names[i].name, "SSE") + && h->param.cpu & (X264_CPU_SSE2) ) + continue; + if( !strcmp(x264_cpu_names[i].name, "SSE2") + && h->param.cpu & (X264_CPU_SSE2_IS_FAST|X264_CPU_SSE2_IS_SLOW) ) + continue; + if( !strcmp(x264_cpu_names[i].name, "SSE3") + && (h->param.cpu & X264_CPU_SSSE3 || !(h->param.cpu & X264_CPU_CACHELINE_64)) ) + continue; + if( !strcmp(x264_cpu_names[i].name, "SSE4.1") + && (h->param.cpu & X264_CPU_SSE42) ) + continue; + if( !strcmp(x264_cpu_names[i].name, "LZCNT") + && (h->param.cpu & X264_CPU_BMI1) ) + continue; + if( !strcmp(x264_cpu_names[i].name, "BMI1") + && (h->param.cpu & X264_CPU_BMI2) ) + continue; + if( !strcmp(x264_cpu_names[i].name, "FMA4") + && (h->param.cpu & X264_CPU_FMA3) ) + continue; + if( (h->param.cpu & x264_cpu_names[i].flags) == x264_cpu_names[i].flags + && (!i || x264_cpu_names[i].flags != x264_cpu_names[i-1].flags) ) + p += sprintf( p, " %s", x264_cpu_names[i].name ); + } + if( !h->param.cpu ) + p += sprintf( p, " none!" ); + x264_log( h, X264_LOG_INFO, "%s\n", buf ); + + if( x264_analyse_init_costs( h ) ) + goto fail; + + /* Must be volatile or else GCC will optimize it out. */ + volatile int temp = 392; + if( x264_clz( temp ) != 23 ) + { + x264_log( h, X264_LOG_ERROR, "CLZ test failed: x264 has been miscompiled!\n" ); +#if ARCH_X86 || ARCH_X86_64 + x264_log( h, X264_LOG_ERROR, "Are you attempting to run an SSE4a/LZCNT-targeted build on a CPU that\n" ); + x264_log( h, X264_LOG_ERROR, "doesn't support it?\n" ); +#endif + goto fail; + } + + h->out.i_nal = 0; + h->out.i_bitstream = X264_MAX( 1000000, h->param.i_width * h->param.i_height * 4 + * ( h->param.rc.i_rc_method == X264_RC_ABR ? pow( 0.95, h->param.rc.i_qp_min ) + : pow( 0.95, h->param.rc.i_qp_constant ) * X264_MAX( 1, h->param.rc.f_ip_factor ))); + + h->nal_buffer_size = h->out.i_bitstream * 3/2 + 4 + 64; /* +4 for startcode, +64 for nal_escape assembly padding */ + CHECKED_MALLOC( h->nal_buffer, h->nal_buffer_size ); + + CHECKED_MALLOC( h->reconfig_h, sizeof(x264_t) ); + + if( h->param.i_threads > 1 && + x264_threadpool_init( &h->threadpool, h->param.i_threads, (void*)x264_encoder_thread_init, h ) ) + goto fail; + if( h->param.i_lookahead_threads > 1 && + x264_threadpool_init( &h->lookaheadpool, h->param.i_lookahead_threads, NULL, NULL ) ) + goto fail; + +#if HAVE_OPENCL + if( h->param.b_opencl ) + { + h->opencl.ocl = x264_opencl_load_library(); + if( !h->opencl.ocl ) + { + x264_log( h, X264_LOG_WARNING, "failed to load OpenCL\n" ); + h->param.b_opencl = 0; + } + } +#endif + + h->thread[0] = h; + for( int i = 1; i < h->param.i_threads + !!h->param.i_sync_lookahead; i++ ) + CHECKED_MALLOC( h->thread[i], sizeof(x264_t) ); + if( h->param.i_lookahead_threads > 1 ) + for( int i = 0; i < h->param.i_lookahead_threads; i++ ) + { + CHECKED_MALLOC( h->lookahead_thread[i], sizeof(x264_t) ); + *h->lookahead_thread[i] = *h; + } + *h->reconfig_h = *h; + + for( int i = 0; i < h->param.i_threads; i++ ) + { + int init_nal_count = h->param.i_slice_count + 3; + int allocate_threadlocal_data = !h->param.b_sliced_threads || !i; + if( i > 0 ) + *h->thread[i] = *h; + + if( x264_pthread_mutex_init( &h->thread[i]->mutex, NULL ) ) + goto fail; + if( x264_pthread_cond_init( &h->thread[i]->cv, NULL ) ) + goto fail; + + if( allocate_threadlocal_data ) + { + h->thread[i]->fdec = x264_frame_pop_unused( h, 1 ); + if( !h->thread[i]->fdec ) + goto fail; + } + else + h->thread[i]->fdec = h->thread[0]->fdec; + + CHECKED_MALLOC( h->thread[i]->out.p_bitstream, h->out.i_bitstream ); + /* Start each thread with room for init_nal_count NAL units; it'll realloc later if needed. */ + CHECKED_MALLOC( h->thread[i]->out.nal, init_nal_count*sizeof(x264_nal_t) ); + h->thread[i]->out.i_nals_allocated = init_nal_count; + + if( allocate_threadlocal_data && x264_macroblock_cache_allocate( h->thread[i] ) < 0 ) + goto fail; + } + +#if HAVE_OPENCL + if( h->param.b_opencl && x264_opencl_lookahead_init( h ) < 0 ) + h->param.b_opencl = 0; +#endif + + if( x264_lookahead_init( h, i_slicetype_length ) ) + goto fail; + + for( int i = 0; i < h->param.i_threads; i++ ) + if( x264_macroblock_thread_allocate( h->thread[i], 0 ) < 0 ) + goto fail; + + if( x264_ratecontrol_new( h ) < 0 ) + goto fail; + + if( h->param.i_nal_hrd ) + { + x264_log( h, X264_LOG_DEBUG, "HRD bitrate: %i bits/sec\n", h->sps->vui.hrd.i_bit_rate_unscaled ); + x264_log( h, X264_LOG_DEBUG, "CPB size: %i bits\n", h->sps->vui.hrd.i_cpb_size_unscaled ); + } + + if( h->param.psz_dump_yuv ) + { + /* create or truncate the reconstructed video file */ + FILE *f = x264_fopen( h->param.psz_dump_yuv, "w" ); + if( !f ) + { + x264_log( h, X264_LOG_ERROR, "dump_yuv: can't write to %s\n", h->param.psz_dump_yuv ); + goto fail; + } + else if( !x264_is_regular_file( f ) ) + { + x264_log( h, X264_LOG_ERROR, "dump_yuv: incompatible with non-regular file %s\n", h->param.psz_dump_yuv ); + fclose( f ); + goto fail; + } + fclose( f ); + } + + const char *profile = h->sps->i_profile_idc == PROFILE_BASELINE ? "Constrained Baseline" : + h->sps->i_profile_idc == PROFILE_MAIN ? "Main" : + h->sps->i_profile_idc == PROFILE_HIGH ? "High" : + h->sps->i_profile_idc == PROFILE_HIGH10 ? (h->sps->b_constraint_set3 == 1 ? "High 10 Intra" : "High 10") : + h->sps->i_profile_idc == PROFILE_HIGH422 ? (h->sps->b_constraint_set3 == 1 ? "High 4:2:2 Intra" : "High 4:2:2") : + h->sps->b_constraint_set3 == 1 ? "High 4:4:4 Intra" : "High 4:4:4 Predictive"; + char level[4]; + snprintf( level, sizeof(level), "%d.%d", h->sps->i_level_idc/10, h->sps->i_level_idc%10 ); + if( h->sps->i_level_idc == 9 || ( h->sps->i_level_idc == 11 && h->sps->b_constraint_set3 && + (h->sps->i_profile_idc == PROFILE_BASELINE || h->sps->i_profile_idc == PROFILE_MAIN) ) ) + strcpy( level, "1b" ); + + if( h->sps->i_profile_idc < PROFILE_HIGH10 ) + { + x264_log( h, X264_LOG_INFO, "profile %s, level %s\n", + profile, level ); + } + else + { + static const char * const subsampling[4] = { "4:0:0", "4:2:0", "4:2:2", "4:4:4" }; + x264_log( h, X264_LOG_INFO, "profile %s, level %s, %s %d-bit\n", + profile, level, subsampling[CHROMA_FORMAT], BIT_DEPTH ); + } + + return h; +fail: + x264_free( h ); + return NULL; +} + +/****************************************************************************/ +static int x264_encoder_try_reconfig( x264_t *h, x264_param_t *param, int *rc_reconfig ) +{ + *rc_reconfig = 0; + x264_set_aspect_ratio( h, param, 0 ); +#define COPY(var) h->param.var = param->var + COPY( i_frame_reference ); // but never uses more refs than initially specified + COPY( i_bframe_bias ); + if( h->param.i_scenecut_threshold ) + COPY( i_scenecut_threshold ); // can't turn it on or off, only vary the threshold + COPY( b_deblocking_filter ); + COPY( i_deblocking_filter_alphac0 ); + COPY( i_deblocking_filter_beta ); + COPY( i_frame_packing ); + COPY( analyse.inter ); + COPY( analyse.intra ); + COPY( analyse.i_direct_mv_pred ); + /* Scratch buffer prevents me_range from being increased for esa/tesa */ + if( h->param.analyse.i_me_method < X264_ME_ESA || param->analyse.i_me_range < h->param.analyse.i_me_range ) + COPY( analyse.i_me_range ); + COPY( analyse.i_noise_reduction ); + /* We can't switch out of subme=0 during encoding. */ + if( h->param.analyse.i_subpel_refine ) + COPY( analyse.i_subpel_refine ); + COPY( analyse.i_trellis ); + COPY( analyse.b_chroma_me ); + COPY( analyse.b_dct_decimate ); + COPY( analyse.b_fast_pskip ); + COPY( analyse.b_mixed_references ); + COPY( analyse.f_psy_rd ); + COPY( analyse.f_psy_trellis ); + COPY( crop_rect ); + // can only twiddle these if they were enabled to begin with: + if( h->param.analyse.i_me_method >= X264_ME_ESA || param->analyse.i_me_method < X264_ME_ESA ) + COPY( analyse.i_me_method ); + if( h->param.analyse.i_me_method >= X264_ME_ESA && !h->frames.b_have_sub8x8_esa ) + h->param.analyse.inter &= ~X264_ANALYSE_PSUB8x8; + if( h->pps->b_transform_8x8_mode ) + COPY( analyse.b_transform_8x8 ); + if( h->frames.i_max_ref1 > 1 ) + COPY( i_bframe_pyramid ); + COPY( i_slice_max_size ); + COPY( i_slice_max_mbs ); + COPY( i_slice_min_mbs ); + COPY( i_slice_count ); + COPY( i_slice_count_max ); + COPY( b_tff ); + + /* VBV can't be turned on if it wasn't on to begin with */ + if( h->param.rc.i_vbv_max_bitrate > 0 && h->param.rc.i_vbv_buffer_size > 0 && + param->rc.i_vbv_max_bitrate > 0 && param->rc.i_vbv_buffer_size > 0 ) + { + *rc_reconfig |= h->param.rc.i_vbv_max_bitrate != param->rc.i_vbv_max_bitrate; + *rc_reconfig |= h->param.rc.i_vbv_buffer_size != param->rc.i_vbv_buffer_size; + *rc_reconfig |= h->param.rc.i_bitrate != param->rc.i_bitrate; + COPY( rc.i_vbv_max_bitrate ); + COPY( rc.i_vbv_buffer_size ); + COPY( rc.i_bitrate ); + } + *rc_reconfig |= h->param.rc.f_rf_constant != param->rc.f_rf_constant; + *rc_reconfig |= h->param.rc.f_rf_constant_max != param->rc.f_rf_constant_max; + COPY( rc.f_rf_constant ); + COPY( rc.f_rf_constant_max ); +#undef COPY + + return x264_validate_parameters( h, 0 ); +} + +int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param ) +{ + int rc_reconfig; + int ret = x264_encoder_try_reconfig( h, param, &rc_reconfig ); + + mbcmp_init( h ); + if( !ret ) + x264_sps_init_reconfigurable( h->sps, &h->param ); + + /* Supported reconfiguration options (1-pass only): + * vbv-maxrate + * vbv-bufsize + * crf + * bitrate (CBR only) */ + if( !ret && rc_reconfig ) + x264_ratecontrol_init_reconfigurable( h, 0 ); + + return ret; +} + +/**************************************************************************** + * x264_encoder_reconfig: + ****************************************************************************/ +int x264_encoder_reconfig( x264_t *h, x264_param_t *param ) +{ + h = h->thread[h->thread[0]->i_thread_phase]; + x264_param_t param_save = h->reconfig_h->param; + h->reconfig_h->param = h->param; + + int rc_reconfig; + int ret = x264_encoder_try_reconfig( h->reconfig_h, param, &rc_reconfig ); + if( !ret ) + h->reconfig = 1; + else + h->reconfig_h->param = param_save; + + return ret; +} + +/**************************************************************************** + * x264_encoder_parameters: + ****************************************************************************/ +void x264_encoder_parameters( x264_t *h, x264_param_t *param ) +{ + memcpy( param, &h->thread[h->i_thread_phase]->param, sizeof(x264_param_t) ); +} + +/* internal usage */ +static void x264_nal_start( x264_t *h, int i_type, int i_ref_idc ) +{ + x264_nal_t *nal = &h->out.nal[h->out.i_nal]; + + nal->i_ref_idc = i_ref_idc; + nal->i_type = i_type; + nal->b_long_startcode = 1; + + nal->i_payload= 0; + nal->p_payload= &h->out.p_bitstream[bs_pos( &h->out.bs ) / 8]; + nal->i_padding= 0; +} + +/* if number of allocated nals is not enough, re-allocate a larger one. */ +static int x264_nal_check_buffer( x264_t *h ) +{ + if( h->out.i_nal >= h->out.i_nals_allocated ) + { + x264_nal_t *new_out = x264_malloc( sizeof(x264_nal_t) * (h->out.i_nals_allocated*2) ); + if( !new_out ) + return -1; + memcpy( new_out, h->out.nal, sizeof(x264_nal_t) * (h->out.i_nals_allocated) ); + x264_free( h->out.nal ); + h->out.nal = new_out; + h->out.i_nals_allocated *= 2; + } + return 0; +} + +static int x264_nal_end( x264_t *h ) +{ + x264_nal_t *nal = &h->out.nal[h->out.i_nal]; + uint8_t *end = &h->out.p_bitstream[bs_pos( &h->out.bs ) / 8]; + nal->i_payload = end - nal->p_payload; + /* Assembly implementation of nal_escape reads past the end of the input. + * While undefined padding wouldn't actually affect the output, it makes valgrind unhappy. */ + memset( end, 0xff, 64 ); + if( h->param.nalu_process ) + h->param.nalu_process( h, nal, h->fenc->opaque ); + h->out.i_nal++; + + return x264_nal_check_buffer( h ); +} + +static int x264_check_encapsulated_buffer( x264_t *h, x264_t *h0, int start, + int previous_nal_size, int necessary_size ) +{ + if( h0->nal_buffer_size < necessary_size ) + { + necessary_size *= 2; + uint8_t *buf = x264_malloc( necessary_size ); + if( !buf ) + return -1; + if( previous_nal_size ) + memcpy( buf, h0->nal_buffer, previous_nal_size ); + + intptr_t delta = buf - h0->nal_buffer; + for( int i = 0; i < start; i++ ) + h->out.nal[i].p_payload += delta; + + x264_free( h0->nal_buffer ); + h0->nal_buffer = buf; + h0->nal_buffer_size = necessary_size; + } + + return 0; +} + +static int x264_encoder_encapsulate_nals( x264_t *h, int start ) +{ + x264_t *h0 = h->thread[0]; + int nal_size = 0, previous_nal_size = 0; + + if( h->param.nalu_process ) + { + for( int i = start; i < h->out.i_nal; i++ ) + nal_size += h->out.nal[i].i_payload; + return nal_size; + } + + for( int i = 0; i < start; i++ ) + previous_nal_size += h->out.nal[i].i_payload; + + for( int i = start; i < h->out.i_nal; i++ ) + nal_size += h->out.nal[i].i_payload; + + /* Worst-case NAL unit escaping: reallocate the buffer if it's too small. */ + int necessary_size = previous_nal_size + nal_size * 3/2 + h->out.i_nal * 4 + 4 + 64; + for( int i = start; i < h->out.i_nal; i++ ) + necessary_size += h->out.nal[i].i_padding; + if( x264_check_encapsulated_buffer( h, h0, start, previous_nal_size, necessary_size ) ) + return -1; + + uint8_t *nal_buffer = h0->nal_buffer + previous_nal_size; + + for( int i = start; i < h->out.i_nal; i++ ) + { + h->out.nal[i].b_long_startcode = !i || h->out.nal[i].i_type == NAL_SPS || h->out.nal[i].i_type == NAL_PPS || + h->param.i_avcintra_class; + x264_nal_encode( h, nal_buffer, &h->out.nal[i] ); + nal_buffer += h->out.nal[i].i_payload; + } + + x264_emms(); + + return nal_buffer - (h0->nal_buffer + previous_nal_size); +} + +/**************************************************************************** + * x264_encoder_headers: + ****************************************************************************/ +int x264_encoder_headers( x264_t *h, x264_nal_t **pp_nal, int *pi_nal ) +{ + int frame_size = 0; + /* init bitstream context */ + h->out.i_nal = 0; + bs_init( &h->out.bs, h->out.p_bitstream, h->out.i_bitstream ); + + /* Write SEI, SPS and PPS. */ + + /* generate sequence parameters */ + x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST ); + x264_sps_write( &h->out.bs, h->sps ); + if( x264_nal_end( h ) ) + return -1; + + /* generate picture parameters */ + x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST ); + x264_pps_write( &h->out.bs, h->sps, h->pps ); + if( x264_nal_end( h ) ) + return -1; + + /* identify ourselves */ + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + if( x264_sei_version_write( h, &h->out.bs ) ) + return -1; + if( x264_nal_end( h ) ) + return -1; + + frame_size = x264_encoder_encapsulate_nals( h, 0 ); + if( frame_size < 0 ) + return -1; + + /* now set output*/ + *pi_nal = h->out.i_nal; + *pp_nal = &h->out.nal[0]; + h->out.i_nal = 0; + + return frame_size; +} + +/* Check to see whether we have chosen a reference list ordering different + * from the standard's default. */ +static inline void x264_reference_check_reorder( x264_t *h ) +{ + /* The reorder check doesn't check for missing frames, so just + * force a reorder if one of the reference list is corrupt. */ + for( int i = 0; h->frames.reference[i]; i++ ) + if( h->frames.reference[i]->b_corrupt ) + { + h->b_ref_reorder[0] = 1; + return; + } + for( int list = 0; list <= (h->sh.i_type == SLICE_TYPE_B); list++ ) + for( int i = 0; i < h->i_ref[list] - 1; i++ ) + { + int framenum_diff = h->fref[list][i+1]->i_frame_num - h->fref[list][i]->i_frame_num; + int poc_diff = h->fref[list][i+1]->i_poc - h->fref[list][i]->i_poc; + /* P and B-frames use different default orders. */ + if( h->sh.i_type == SLICE_TYPE_P ? framenum_diff > 0 : list == 1 ? poc_diff < 0 : poc_diff > 0 ) + { + h->b_ref_reorder[list] = 1; + return; + } + } +} + +/* return -1 on failure, else return the index of the new reference frame */ +static int x264_weighted_reference_duplicate( x264_t *h, int i_ref, const x264_weight_t *w ) +{ + int i = h->i_ref[0]; + int j = 1; + x264_frame_t *newframe; + if( i <= 1 ) /* empty list, definitely can't duplicate frame */ + return -1; + + //Duplication is only used in X264_WEIGHTP_SMART + if( h->param.analyse.i_weighted_pred != X264_WEIGHTP_SMART ) + return -1; + + /* Duplication is a hack to compensate for crappy rounding in motion compensation. + * With high bit depth, it's not worth doing, so turn it off except in the case of + * unweighted dupes. */ + if( BIT_DEPTH > 8 && w != x264_weight_none ) + return -1; + + newframe = x264_frame_pop_blank_unused( h ); + if( !newframe ) + return -1; + + //FIXME: probably don't need to copy everything + *newframe = *h->fref[0][i_ref]; + newframe->i_reference_count = 1; + newframe->orig = h->fref[0][i_ref]; + newframe->b_duplicate = 1; + memcpy( h->fenc->weight[j], w, sizeof(h->fenc->weight[i]) ); + + /* shift the frames to make space for the dupe. */ + h->b_ref_reorder[0] = 1; + if( h->i_ref[0] < X264_REF_MAX ) + ++h->i_ref[0]; + h->fref[0][X264_REF_MAX-1] = NULL; + x264_frame_unshift( &h->fref[0][j], newframe ); + + return j; +} + +static void x264_weighted_pred_init( x264_t *h ) +{ + /* for now no analysis and set all weights to nothing */ + for( int i_ref = 0; i_ref < h->i_ref[0]; i_ref++ ) + h->fenc->weighted[i_ref] = h->fref[0][i_ref]->filtered[0][0]; + + // FIXME: This only supports weighting of one reference frame + // and duplicates of that frame. + h->fenc->i_lines_weighted = 0; + + for( int i_ref = 0; i_ref < (h->i_ref[0] << SLICE_MBAFF); i_ref++ ) + for( int i = 0; i < 3; i++ ) + h->sh.weight[i_ref][i].weightfn = NULL; + + + if( h->sh.i_type != SLICE_TYPE_P || h->param.analyse.i_weighted_pred <= 0 ) + return; + + int i_padv = PADV << PARAM_INTERLACED; + int denom = -1; + int weightplane[2] = { 0, 0 }; + int buffer_next = 0; + for( int i = 0; i < 3; i++ ) + { + for( int j = 0; j < h->i_ref[0]; j++ ) + { + if( h->fenc->weight[j][i].weightfn ) + { + h->sh.weight[j][i] = h->fenc->weight[j][i]; + // if weight is useless, don't write it to stream + if( h->sh.weight[j][i].i_scale == 1<sh.weight[j][i].i_denom && h->sh.weight[j][i].i_offset == 0 ) + h->sh.weight[j][i].weightfn = NULL; + else + { + if( !weightplane[!!i] ) + { + weightplane[!!i] = 1; + h->sh.weight[0][!!i].i_denom = denom = h->sh.weight[j][i].i_denom; + assert( x264_clip3( denom, 0, 7 ) == denom ); + } + + assert( h->sh.weight[j][i].i_denom == denom ); + if( !i ) + { + h->fenc->weighted[j] = h->mb.p_weight_buf[buffer_next++] + h->fenc->i_stride[0] * i_padv + PADH; + //scale full resolution frame + if( h->param.i_threads == 1 ) + { + pixel *src = h->fref[0][j]->filtered[0][0] - h->fref[0][j]->i_stride[0]*i_padv - PADH; + pixel *dst = h->fenc->weighted[j] - h->fenc->i_stride[0]*i_padv - PADH; + int stride = h->fenc->i_stride[0]; + int width = h->fenc->i_width[0] + PADH*2; + int height = h->fenc->i_lines[0] + i_padv*2; + x264_weight_scale_plane( h, dst, stride, src, stride, width, height, &h->sh.weight[j][0] ); + h->fenc->i_lines_weighted = height; + } + } + } + } + } + } + + if( weightplane[1] ) + for( int i = 0; i < h->i_ref[0]; i++ ) + { + if( h->sh.weight[i][1].weightfn && !h->sh.weight[i][2].weightfn ) + { + h->sh.weight[i][2].i_scale = 1 << h->sh.weight[0][1].i_denom; + h->sh.weight[i][2].i_offset = 0; + } + else if( h->sh.weight[i][2].weightfn && !h->sh.weight[i][1].weightfn ) + { + h->sh.weight[i][1].i_scale = 1 << h->sh.weight[0][1].i_denom; + h->sh.weight[i][1].i_offset = 0; + } + } + + if( !weightplane[0] ) + h->sh.weight[0][0].i_denom = 0; + if( !weightplane[1] ) + h->sh.weight[0][1].i_denom = 0; + h->sh.weight[0][2].i_denom = h->sh.weight[0][1].i_denom; +} + +static inline int x264_reference_distance( x264_t *h, x264_frame_t *frame ) +{ + if( h->param.i_frame_packing == 5 ) + return abs((h->fenc->i_frame&~1) - (frame->i_frame&~1)) + + ((h->fenc->i_frame&1) != (frame->i_frame&1)); + else + return abs(h->fenc->i_frame - frame->i_frame); +} + +static inline void x264_reference_build_list( x264_t *h, int i_poc ) +{ + int b_ok; + + /* build ref list 0/1 */ + h->mb.pic.i_fref[0] = h->i_ref[0] = 0; + h->mb.pic.i_fref[1] = h->i_ref[1] = 0; + if( h->sh.i_type == SLICE_TYPE_I ) + return; + + for( int i = 0; h->frames.reference[i]; i++ ) + { + if( h->frames.reference[i]->b_corrupt ) + continue; + if( h->frames.reference[i]->i_poc < i_poc ) + h->fref[0][h->i_ref[0]++] = h->frames.reference[i]; + else if( h->frames.reference[i]->i_poc > i_poc ) + h->fref[1][h->i_ref[1]++] = h->frames.reference[i]; + } + + if( h->sh.i_mmco_remove_from_end ) + { + /* Order ref0 for MMCO remove */ + do + { + b_ok = 1; + for( int i = 0; i < h->i_ref[0] - 1; i++ ) + { + if( h->fref[0][i]->i_frame < h->fref[0][i+1]->i_frame ) + { + XCHG( x264_frame_t*, h->fref[0][i], h->fref[0][i+1] ); + b_ok = 0; + break; + } + } + } while( !b_ok ); + + for( int i = h->i_ref[0]-1; i >= h->i_ref[0] - h->sh.i_mmco_remove_from_end; i-- ) + { + int diff = h->i_frame_num - h->fref[0][i]->i_frame_num; + h->sh.mmco[h->sh.i_mmco_command_count].i_poc = h->fref[0][i]->i_poc; + h->sh.mmco[h->sh.i_mmco_command_count++].i_difference_of_pic_nums = diff; + } + } + + /* Order reference lists by distance from the current frame. */ + for( int list = 0; list < 2; list++ ) + { + h->fref_nearest[list] = h->fref[list][0]; + do + { + b_ok = 1; + for( int i = 0; i < h->i_ref[list] - 1; i++ ) + { + if( list ? h->fref[list][i+1]->i_poc < h->fref_nearest[list]->i_poc + : h->fref[list][i+1]->i_poc > h->fref_nearest[list]->i_poc ) + h->fref_nearest[list] = h->fref[list][i+1]; + if( x264_reference_distance( h, h->fref[list][i] ) > x264_reference_distance( h, h->fref[list][i+1] ) ) + { + XCHG( x264_frame_t*, h->fref[list][i], h->fref[list][i+1] ); + b_ok = 0; + break; + } + } + } while( !b_ok ); + } + + x264_reference_check_reorder( h ); + + h->i_ref[1] = X264_MIN( h->i_ref[1], h->frames.i_max_ref1 ); + h->i_ref[0] = X264_MIN( h->i_ref[0], h->frames.i_max_ref0 ); + h->i_ref[0] = X264_MIN( h->i_ref[0], h->param.i_frame_reference ); // if reconfig() has lowered the limit + + /* For Blu-ray compliance, don't reference frames outside of the minigop. */ + if( IS_X264_TYPE_B( h->fenc->i_type ) && h->param.b_bluray_compat ) + h->i_ref[0] = X264_MIN( h->i_ref[0], IS_X264_TYPE_B( h->fref[0][0]->i_type ) + 1 ); + + /* add duplicates */ + if( h->fenc->i_type == X264_TYPE_P ) + { + int idx = -1; + if( h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE ) + { + x264_weight_t w[3]; + w[1].weightfn = w[2].weightfn = NULL; + if( h->param.rc.b_stat_read ) + x264_ratecontrol_set_weights( h, h->fenc ); + + if( !h->fenc->weight[0][0].weightfn ) + { + h->fenc->weight[0][0].i_denom = 0; + SET_WEIGHT( w[0], 1, 1, 0, -1 ); + idx = x264_weighted_reference_duplicate( h, 0, w ); + } + else + { + if( h->fenc->weight[0][0].i_scale == 1<fenc->weight[0][0].i_denom ) + { + SET_WEIGHT( h->fenc->weight[0][0], 1, 1, 0, h->fenc->weight[0][0].i_offset ); + } + x264_weighted_reference_duplicate( h, 0, x264_weight_none ); + if( h->fenc->weight[0][0].i_offset > -128 ) + { + w[0] = h->fenc->weight[0][0]; + w[0].i_offset--; + h->mc.weight_cache( h, &w[0] ); + idx = x264_weighted_reference_duplicate( h, 0, w ); + } + } + } + h->mb.ref_blind_dupe = idx; + } + + assert( h->i_ref[0] + h->i_ref[1] <= X264_REF_MAX ); + h->mb.pic.i_fref[0] = h->i_ref[0]; + h->mb.pic.i_fref[1] = h->i_ref[1]; +} + +static void x264_fdec_filter_row( x264_t *h, int mb_y, int pass ) +{ + /* mb_y is the mb to be encoded next, not the mb to be filtered here */ + int b_hpel = h->fdec->b_kept_as_ref; + int b_deblock = h->sh.i_disable_deblocking_filter_idc != 1; + int b_end = mb_y == h->i_threadslice_end; + int b_measure_quality = 1; + int min_y = mb_y - (1 << SLICE_MBAFF); + int b_start = min_y == h->i_threadslice_start; + /* Even in interlaced mode, deblocking never modifies more than 4 pixels + * above each MB, as bS=4 doesn't happen for the top of interlaced mbpairs. */ + int minpix_y = min_y*16 - 4 * !b_start; + int maxpix_y = mb_y*16 - 4 * !b_end; + b_deblock &= b_hpel || h->param.b_full_recon || h->param.psz_dump_yuv; + if( h->param.b_sliced_threads ) + { + switch( pass ) + { + /* During encode: only do deblock if asked for */ + default: + case 0: + b_deblock &= h->param.b_full_recon; + b_hpel = 0; + break; + /* During post-encode pass: do deblock if not done yet, do hpel for all + * rows except those between slices. */ + case 1: + b_deblock &= !h->param.b_full_recon; + b_hpel &= !(b_start && min_y > 0); + b_measure_quality = 0; + break; + /* Final pass: do the rows between slices in sequence. */ + case 2: + b_deblock = 0; + b_measure_quality = 0; + break; + } + } + if( mb_y & SLICE_MBAFF ) + return; + if( min_y < h->i_threadslice_start ) + return; + + if( b_deblock ) + for( int y = min_y; y < mb_y; y += (1 << SLICE_MBAFF) ) + x264_frame_deblock_row( h, y ); + + /* FIXME: Prediction requires different borders for interlaced/progressive mc, + * but the actual image data is equivalent. For now, maintain this + * consistency by copying deblocked pixels between planes. */ + if( PARAM_INTERLACED && (!h->param.b_sliced_threads || pass == 1) ) + for( int p = 0; p < h->fdec->i_plane; p++ ) + for( int i = minpix_y>>(CHROMA_V_SHIFT && p); i < maxpix_y>>(CHROMA_V_SHIFT && p); i++ ) + memcpy( h->fdec->plane_fld[p] + i*h->fdec->i_stride[p], + h->fdec->plane[p] + i*h->fdec->i_stride[p], + h->mb.i_mb_width*16*sizeof(pixel) ); + + if( h->fdec->b_kept_as_ref && (!h->param.b_sliced_threads || pass == 1) ) + x264_frame_expand_border( h, h->fdec, min_y ); + if( b_hpel ) + { + int end = mb_y == h->mb.i_mb_height; + /* Can't do hpel until the previous slice is done encoding. */ + if( h->param.analyse.i_subpel_refine ) + { + x264_frame_filter( h, h->fdec, min_y, end ); + x264_frame_expand_border_filtered( h, h->fdec, min_y, end ); + } + } + + if( SLICE_MBAFF && pass == 0 ) + for( int i = 0; i < 3; i++ ) + { + XCHG( pixel *, h->intra_border_backup[0][i], h->intra_border_backup[3][i] ); + XCHG( pixel *, h->intra_border_backup[1][i], h->intra_border_backup[4][i] ); + } + + if( h->i_thread_frames > 1 && h->fdec->b_kept_as_ref ) + x264_frame_cond_broadcast( h->fdec, mb_y*16 + (b_end ? 10000 : -(X264_THREAD_HEIGHT << SLICE_MBAFF)) ); + + if( b_measure_quality ) + { + maxpix_y = X264_MIN( maxpix_y, h->param.i_height ); + if( h->param.analyse.b_psnr ) + { + for( int p = 0; p < (CHROMA444 ? 3 : 1); p++ ) + h->stat.frame.i_ssd[p] += x264_pixel_ssd_wxh( &h->pixf, + h->fdec->plane[p] + minpix_y * h->fdec->i_stride[p], h->fdec->i_stride[p], + h->fenc->plane[p] + minpix_y * h->fenc->i_stride[p], h->fenc->i_stride[p], + h->param.i_width, maxpix_y-minpix_y ); + if( !CHROMA444 ) + { + uint64_t ssd_u, ssd_v; + int v_shift = CHROMA_V_SHIFT; + x264_pixel_ssd_nv12( &h->pixf, + h->fdec->plane[1] + (minpix_y>>v_shift) * h->fdec->i_stride[1], h->fdec->i_stride[1], + h->fenc->plane[1] + (minpix_y>>v_shift) * h->fenc->i_stride[1], h->fenc->i_stride[1], + h->param.i_width>>1, (maxpix_y-minpix_y)>>v_shift, &ssd_u, &ssd_v ); + h->stat.frame.i_ssd[1] += ssd_u; + h->stat.frame.i_ssd[2] += ssd_v; + } + } + + if( h->param.analyse.b_ssim ) + { + int ssim_cnt; + x264_emms(); + /* offset by 2 pixels to avoid alignment of ssim blocks with dct blocks, + * and overlap by 4 */ + minpix_y += b_start ? 2 : -6; + h->stat.frame.f_ssim += + x264_pixel_ssim_wxh( &h->pixf, + h->fdec->plane[0] + 2+minpix_y*h->fdec->i_stride[0], h->fdec->i_stride[0], + h->fenc->plane[0] + 2+minpix_y*h->fenc->i_stride[0], h->fenc->i_stride[0], + h->param.i_width-2, maxpix_y-minpix_y, h->scratch_buffer, &ssim_cnt ); + h->stat.frame.i_ssim_cnt += ssim_cnt; + } + } +} + +static inline int x264_reference_update( x264_t *h ) +{ + if( !h->fdec->b_kept_as_ref ) + { + if( h->i_thread_frames > 1 ) + { + x264_frame_push_unused( h, h->fdec ); + h->fdec = x264_frame_pop_unused( h, 1 ); + if( !h->fdec ) + return -1; + } + return 0; + } + + /* apply mmco from previous frame. */ + for( int i = 0; i < h->sh.i_mmco_command_count; i++ ) + for( int j = 0; h->frames.reference[j]; j++ ) + if( h->frames.reference[j]->i_poc == h->sh.mmco[i].i_poc ) + x264_frame_push_unused( h, x264_frame_shift( &h->frames.reference[j] ) ); + + /* move frame in the buffer */ + x264_frame_push( h->frames.reference, h->fdec ); + if( h->frames.reference[h->sps->i_num_ref_frames] ) + x264_frame_push_unused( h, x264_frame_shift( h->frames.reference ) ); + h->fdec = x264_frame_pop_unused( h, 1 ); + if( !h->fdec ) + return -1; + return 0; +} + +static inline void x264_reference_reset( x264_t *h ) +{ + while( h->frames.reference[0] ) + x264_frame_push_unused( h, x264_frame_pop( h->frames.reference ) ); + h->fdec->i_poc = + h->fenc->i_poc = 0; +} + +static inline void x264_reference_hierarchy_reset( x264_t *h ) +{ + int ref; + int b_hasdelayframe = 0; + + /* look for delay frames -- chain must only contain frames that are disposable */ + for( int i = 0; h->frames.current[i] && IS_DISPOSABLE( h->frames.current[i]->i_type ); i++ ) + b_hasdelayframe |= h->frames.current[i]->i_coded + != h->frames.current[i]->i_frame + h->sps->vui.i_num_reorder_frames; + + /* This function must handle b-pyramid and clear frames for open-gop */ + if( h->param.i_bframe_pyramid != X264_B_PYRAMID_STRICT && !b_hasdelayframe && h->frames.i_poc_last_open_gop == -1 ) + return; + + /* Remove last BREF. There will never be old BREFs in the + * dpb during a BREF decode when pyramid == STRICT */ + for( ref = 0; h->frames.reference[ref]; ref++ ) + { + if( ( h->param.i_bframe_pyramid == X264_B_PYRAMID_STRICT + && h->frames.reference[ref]->i_type == X264_TYPE_BREF ) + || ( h->frames.reference[ref]->i_poc < h->frames.i_poc_last_open_gop + && h->sh.i_type != SLICE_TYPE_B ) ) + { + int diff = h->i_frame_num - h->frames.reference[ref]->i_frame_num; + h->sh.mmco[h->sh.i_mmco_command_count].i_difference_of_pic_nums = diff; + h->sh.mmco[h->sh.i_mmco_command_count++].i_poc = h->frames.reference[ref]->i_poc; + x264_frame_push_unused( h, x264_frame_shift( &h->frames.reference[ref] ) ); + h->b_ref_reorder[0] = 1; + ref--; + } + } + + /* Prepare room in the dpb for the delayed display time of the later b-frame's */ + if( h->param.i_bframe_pyramid ) + h->sh.i_mmco_remove_from_end = X264_MAX( ref + 2 - h->frames.i_max_dpb, 0 ); +} + +static inline void x264_slice_init( x264_t *h, int i_nal_type, int i_global_qp ) +{ + /* ------------------------ Create slice header ----------------------- */ + if( i_nal_type == NAL_SLICE_IDR ) + { + x264_slice_header_init( h, &h->sh, h->sps, h->pps, h->i_idr_pic_id, h->i_frame_num, i_global_qp ); + + /* alternate id */ + if( h->param.i_avcintra_class ) + { + switch( h->i_idr_pic_id ) + { + case 5: + h->i_idr_pic_id = 3; + break; + case 3: + h->i_idr_pic_id = 4; + break; + case 4: + default: + h->i_idr_pic_id = 5; + break; + } + } + else + h->i_idr_pic_id ^= 1; + } + else + { + x264_slice_header_init( h, &h->sh, h->sps, h->pps, -1, h->i_frame_num, i_global_qp ); + + h->sh.i_num_ref_idx_l0_active = h->i_ref[0] <= 0 ? 1 : h->i_ref[0]; + h->sh.i_num_ref_idx_l1_active = h->i_ref[1] <= 0 ? 1 : h->i_ref[1]; + if( h->sh.i_num_ref_idx_l0_active != h->pps->i_num_ref_idx_l0_default_active || + (h->sh.i_type == SLICE_TYPE_B && h->sh.i_num_ref_idx_l1_active != h->pps->i_num_ref_idx_l1_default_active) ) + { + h->sh.b_num_ref_idx_override = 1; + } + } + + if( h->fenc->i_type == X264_TYPE_BREF && h->param.b_bluray_compat && h->sh.i_mmco_command_count ) + { + h->b_sh_backup = 1; + h->sh_backup = h->sh; + } + + h->fdec->i_frame_num = h->sh.i_frame_num; + + if( h->sps->i_poc_type == 0 ) + { + h->sh.i_poc = h->fdec->i_poc; + if( PARAM_INTERLACED ) + { + h->sh.i_delta_poc_bottom = h->param.b_tff ? 1 : -1; + h->sh.i_poc += h->sh.i_delta_poc_bottom == -1; + } + else + h->sh.i_delta_poc_bottom = 0; + h->fdec->i_delta_poc[0] = h->sh.i_delta_poc_bottom == -1; + h->fdec->i_delta_poc[1] = h->sh.i_delta_poc_bottom == 1; + } + else + { + /* Nothing to do ? */ + } + + x264_macroblock_slice_init( h ); +} + +typedef struct +{ + int skip; + uint8_t cabac_prevbyte; + bs_t bs; + x264_cabac_t cabac; + x264_frame_stat_t stat; + int last_qp; + int last_dqp; + int field_decoding_flag; +} x264_bs_bak_t; + +static ALWAYS_INLINE void x264_bitstream_backup( x264_t *h, x264_bs_bak_t *bak, int i_skip, int full ) +{ + if( full ) + { + bak->stat = h->stat.frame; + bak->last_qp = h->mb.i_last_qp; + bak->last_dqp = h->mb.i_last_dqp; + bak->field_decoding_flag = h->mb.field_decoding_flag; + } + else + { + bak->stat.i_mv_bits = h->stat.frame.i_mv_bits; + bak->stat.i_tex_bits = h->stat.frame.i_tex_bits; + } + /* In the per-MB backup, we don't need the contexts because flushing the CABAC + * encoder has no context dependency and in this case, a slice is ended (and + * thus the content of all contexts are thrown away). */ + if( h->param.b_cabac ) + { + if( full ) + memcpy( &bak->cabac, &h->cabac, sizeof(x264_cabac_t) ); + else + memcpy( &bak->cabac, &h->cabac, offsetof(x264_cabac_t, f8_bits_encoded) ); + /* x264's CABAC writer modifies the previous byte during carry, so it has to be + * backed up. */ + bak->cabac_prevbyte = h->cabac.p[-1]; + } + else + { + bak->bs = h->out.bs; + bak->skip = i_skip; + } +} + +static ALWAYS_INLINE void x264_bitstream_restore( x264_t *h, x264_bs_bak_t *bak, int *skip, int full ) +{ + if( full ) + { + h->stat.frame = bak->stat; + h->mb.i_last_qp = bak->last_qp; + h->mb.i_last_dqp = bak->last_dqp; + h->mb.field_decoding_flag = bak->field_decoding_flag; + } + else + { + h->stat.frame.i_mv_bits = bak->stat.i_mv_bits; + h->stat.frame.i_tex_bits = bak->stat.i_tex_bits; + } + if( h->param.b_cabac ) + { + if( full ) + memcpy( &h->cabac, &bak->cabac, sizeof(x264_cabac_t) ); + else + memcpy( &h->cabac, &bak->cabac, offsetof(x264_cabac_t, f8_bits_encoded) ); + h->cabac.p[-1] = bak->cabac_prevbyte; + } + else + { + h->out.bs = bak->bs; + *skip = bak->skip; + } +} + +static intptr_t x264_slice_write( x264_t *h ) +{ + int i_skip; + int mb_xy, i_mb_x, i_mb_y; + /* NALUs other than the first use a 3-byte startcode. + * Add one extra byte for the rbsp, and one more for the final CABAC putbyte. + * Then add an extra 5 bytes just in case, to account for random NAL escapes and + * other inaccuracies. */ + int overhead_guess = (NALU_OVERHEAD - (h->param.b_annexb && h->out.i_nal)) + 1 + h->param.b_cabac + 5; + int slice_max_size = h->param.i_slice_max_size > 0 ? (h->param.i_slice_max_size-overhead_guess)*8 : 0; + int back_up_bitstream_cavlc = !h->param.b_cabac && h->sps->i_profile_idc < PROFILE_HIGH; + int back_up_bitstream = slice_max_size || back_up_bitstream_cavlc; + int starting_bits = bs_pos(&h->out.bs); + int b_deblock = h->sh.i_disable_deblocking_filter_idc != 1; + int b_hpel = h->fdec->b_kept_as_ref; + int orig_last_mb = h->sh.i_last_mb; + int thread_last_mb = h->i_threadslice_end * h->mb.i_mb_width - 1; + uint8_t *last_emu_check; +#define BS_BAK_SLICE_MAX_SIZE 0 +#define BS_BAK_CAVLC_OVERFLOW 1 +#define BS_BAK_SLICE_MIN_MBS 2 +#define BS_BAK_ROW_VBV 3 + x264_bs_bak_t bs_bak[4]; + b_deblock &= b_hpel || h->param.b_full_recon || h->param.psz_dump_yuv; + bs_realign( &h->out.bs ); + + /* Slice */ + x264_nal_start( h, h->i_nal_type, h->i_nal_ref_idc ); + h->out.nal[h->out.i_nal].i_first_mb = h->sh.i_first_mb; + + /* Slice header */ + x264_macroblock_thread_init( h ); + + /* Set the QP equal to the first QP in the slice for more accurate CABAC initialization. */ + h->mb.i_mb_xy = h->sh.i_first_mb; + h->sh.i_qp = x264_ratecontrol_mb_qp( h ); + h->sh.i_qp = SPEC_QP( h->sh.i_qp ); + h->sh.i_qp_delta = h->sh.i_qp - h->pps->i_pic_init_qp; + + x264_slice_header_write( &h->out.bs, &h->sh, h->i_nal_ref_idc ); + if( h->param.b_cabac ) + { + /* alignment needed */ + bs_align_1( &h->out.bs ); + + /* init cabac */ + x264_cabac_context_init( h, &h->cabac, h->sh.i_type, x264_clip3( h->sh.i_qp-QP_BD_OFFSET, 0, 51 ), h->sh.i_cabac_init_idc ); + x264_cabac_encode_init ( &h->cabac, h->out.bs.p, h->out.bs.p_end ); + last_emu_check = h->cabac.p; + } + else + last_emu_check = h->out.bs.p; + h->mb.i_last_qp = h->sh.i_qp; + h->mb.i_last_dqp = 0; + h->mb.field_decoding_flag = 0; + + i_mb_y = h->sh.i_first_mb / h->mb.i_mb_width; + i_mb_x = h->sh.i_first_mb % h->mb.i_mb_width; + i_skip = 0; + + while( 1 ) + { + mb_xy = i_mb_x + i_mb_y * h->mb.i_mb_width; + int mb_spos = bs_pos(&h->out.bs) + x264_cabac_pos(&h->cabac); + + if( i_mb_x == 0 ) + { + if( x264_bitstream_check_buffer( h ) ) + return -1; + if( !(i_mb_y & SLICE_MBAFF) && h->param.rc.i_vbv_buffer_size ) + x264_bitstream_backup( h, &bs_bak[BS_BAK_ROW_VBV], i_skip, 1 ); + if( !h->mb.b_reencode_mb ) + x264_fdec_filter_row( h, i_mb_y, 0 ); + } + + if( back_up_bitstream ) + { + if( back_up_bitstream_cavlc ) + x264_bitstream_backup( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], i_skip, 0 ); + if( slice_max_size && !(i_mb_y & SLICE_MBAFF) ) + { + x264_bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], i_skip, 0 ); + if( (thread_last_mb+1-mb_xy) == h->param.i_slice_min_mbs ) + x264_bitstream_backup( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], i_skip, 0 ); + } + } + + if( PARAM_INTERLACED ) + { + if( h->mb.b_adaptive_mbaff ) + { + if( !(i_mb_y&1) ) + { + /* FIXME: VSAD is fast but fairly poor at choosing the best interlace type. */ + h->mb.b_interlaced = x264_field_vsad( h, i_mb_x, i_mb_y ); + memcpy( &h->zigzagf, MB_INTERLACED ? &h->zigzagf_interlaced : &h->zigzagf_progressive, sizeof(h->zigzagf) ); + if( !MB_INTERLACED && (i_mb_y+2) == h->mb.i_mb_height ) + x264_expand_border_mbpair( h, i_mb_x, i_mb_y ); + } + } + h->mb.field[mb_xy] = MB_INTERLACED; + } + + /* load cache */ + if( SLICE_MBAFF ) + x264_macroblock_cache_load_interlaced( h, i_mb_x, i_mb_y ); + else + x264_macroblock_cache_load_progressive( h, i_mb_x, i_mb_y ); + + x264_macroblock_analyse( h ); + + /* encode this macroblock -> be careful it can change the mb type to P_SKIP if needed */ +reencode: + x264_macroblock_encode( h ); + + if( h->param.b_cabac ) + { + if( mb_xy > h->sh.i_first_mb && !(SLICE_MBAFF && (i_mb_y&1)) ) + x264_cabac_encode_terminal( &h->cabac ); + + if( IS_SKIP( h->mb.i_type ) ) + x264_cabac_mb_skip( h, 1 ); + else + { + if( h->sh.i_type != SLICE_TYPE_I ) + x264_cabac_mb_skip( h, 0 ); + x264_macroblock_write_cabac( h, &h->cabac ); + } + } + else + { + if( IS_SKIP( h->mb.i_type ) ) + i_skip++; + else + { + if( h->sh.i_type != SLICE_TYPE_I ) + { + bs_write_ue( &h->out.bs, i_skip ); /* skip run */ + i_skip = 0; + } + x264_macroblock_write_cavlc( h ); + /* If there was a CAVLC level code overflow, try again at a higher QP. */ + if( h->mb.b_overflow ) + { + h->mb.i_chroma_qp = h->chroma_qp_table[++h->mb.i_qp]; + h->mb.i_skip_intra = 0; + h->mb.b_skip_mc = 0; + h->mb.b_overflow = 0; + x264_bitstream_restore( h, &bs_bak[BS_BAK_CAVLC_OVERFLOW], &i_skip, 0 ); + goto reencode; + } + } + } + + int total_bits = bs_pos(&h->out.bs) + x264_cabac_pos(&h->cabac); + int mb_size = total_bits - mb_spos; + + if( slice_max_size && (!SLICE_MBAFF || (i_mb_y&1)) ) + { + /* Count the skip run, just in case. */ + if( !h->param.b_cabac ) + total_bits += bs_size_ue_big( i_skip ); + /* Check for escape bytes. */ + uint8_t *end = h->param.b_cabac ? h->cabac.p : h->out.bs.p; + for( ; last_emu_check < end - 2; last_emu_check++ ) + if( last_emu_check[0] == 0 && last_emu_check[1] == 0 && last_emu_check[2] <= 3 ) + { + slice_max_size -= 8; + last_emu_check++; + } + /* We'll just re-encode this last macroblock if we go over the max slice size. */ + if( total_bits - starting_bits > slice_max_size && !h->mb.b_reencode_mb ) + { + if( !x264_frame_new_slice( h, h->fdec ) ) + { + /* Handle the most obnoxious slice-min-mbs edge case: we need to end the slice + * because it's gone over the maximum size, but doing so would violate slice-min-mbs. + * If possible, roll back to the last checkpoint and try again. + * We could try raising QP, but that would break in the case where a slice spans multiple + * rows, which the re-encoding infrastructure can't currently handle. */ + if( mb_xy <= thread_last_mb && (thread_last_mb+1-mb_xy) < h->param.i_slice_min_mbs ) + { + if( thread_last_mb-h->param.i_slice_min_mbs < h->sh.i_first_mb+h->param.i_slice_min_mbs ) + { + x264_log( h, X264_LOG_WARNING, "slice-max-size violated (frame %d, cause: slice-min-mbs)\n", h->i_frame ); + slice_max_size = 0; + goto cont; + } + x264_bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MIN_MBS], &i_skip, 0 ); + h->mb.b_reencode_mb = 1; + h->sh.i_last_mb = thread_last_mb-h->param.i_slice_min_mbs; + break; + } + if( mb_xy-SLICE_MBAFF*h->mb.i_mb_stride != h->sh.i_first_mb ) + { + x264_bitstream_restore( h, &bs_bak[BS_BAK_SLICE_MAX_SIZE], &i_skip, 0 ); + h->mb.b_reencode_mb = 1; + if( SLICE_MBAFF ) + { + // set to bottom of previous mbpair + if( i_mb_x ) + h->sh.i_last_mb = mb_xy-1+h->mb.i_mb_stride*(!(i_mb_y&1)); + else + h->sh.i_last_mb = (i_mb_y-2+!(i_mb_y&1))*h->mb.i_mb_stride + h->mb.i_mb_width - 1; + } + else + h->sh.i_last_mb = mb_xy-1; + break; + } + else + h->sh.i_last_mb = mb_xy; + } + else + slice_max_size = 0; + } + } +cont: + h->mb.b_reencode_mb = 0; + + /* save cache */ + x264_macroblock_cache_save( h ); + + if( x264_ratecontrol_mb( h, mb_size ) < 0 ) + { + x264_bitstream_restore( h, &bs_bak[BS_BAK_ROW_VBV], &i_skip, 1 ); + h->mb.b_reencode_mb = 1; + i_mb_x = 0; + i_mb_y = i_mb_y - SLICE_MBAFF; + h->mb.i_mb_prev_xy = i_mb_y * h->mb.i_mb_stride - 1; + h->sh.i_last_mb = orig_last_mb; + continue; + } + + /* accumulate mb stats */ + h->stat.frame.i_mb_count[h->mb.i_type]++; + + int b_intra = IS_INTRA( h->mb.i_type ); + int b_skip = IS_SKIP( h->mb.i_type ); + if( h->param.i_log_level >= X264_LOG_INFO || h->param.rc.b_stat_write ) + { + if( !b_intra && !b_skip && !IS_DIRECT( h->mb.i_type ) ) + { + if( h->mb.i_partition != D_8x8 ) + h->stat.frame.i_mb_partition[h->mb.i_partition] += 4; + else + for( int i = 0; i < 4; i++ ) + h->stat.frame.i_mb_partition[h->mb.i_sub_partition[i]] ++; + if( h->param.i_frame_reference > 1 ) + for( int i_list = 0; i_list <= (h->sh.i_type == SLICE_TYPE_B); i_list++ ) + for( int i = 0; i < 4; i++ ) + { + int i_ref = h->mb.cache.ref[i_list][ x264_scan8[4*i] ]; + if( i_ref >= 0 ) + h->stat.frame.i_mb_count_ref[i_list][i_ref] ++; + } + } + } + + if( h->param.i_log_level >= X264_LOG_INFO ) + { + if( h->mb.i_cbp_luma | h->mb.i_cbp_chroma ) + { + if( CHROMA444 ) + { + for( int i = 0; i < 4; i++ ) + if( h->mb.i_cbp_luma & (1 << i) ) + for( int p = 0; p < 3; p++ ) + { + int s8 = i*4+p*16; + int nnz8x8 = M16( &h->mb.cache.non_zero_count[x264_scan8[s8]+0] ) + | M16( &h->mb.cache.non_zero_count[x264_scan8[s8]+8] ); + h->stat.frame.i_mb_cbp[!b_intra + p*2] += !!nnz8x8; + } + } + else + { + int cbpsum = (h->mb.i_cbp_luma&1) + ((h->mb.i_cbp_luma>>1)&1) + + ((h->mb.i_cbp_luma>>2)&1) + (h->mb.i_cbp_luma>>3); + h->stat.frame.i_mb_cbp[!b_intra + 0] += cbpsum; + h->stat.frame.i_mb_cbp[!b_intra + 2] += !!h->mb.i_cbp_chroma; + h->stat.frame.i_mb_cbp[!b_intra + 4] += h->mb.i_cbp_chroma >> 1; + } + } + if( h->mb.i_cbp_luma && !b_intra ) + { + h->stat.frame.i_mb_count_8x8dct[0] ++; + h->stat.frame.i_mb_count_8x8dct[1] += h->mb.b_transform_8x8; + } + if( b_intra && h->mb.i_type != I_PCM ) + { + if( h->mb.i_type == I_16x16 ) + h->stat.frame.i_mb_pred_mode[0][h->mb.i_intra16x16_pred_mode]++; + else if( h->mb.i_type == I_8x8 ) + for( int i = 0; i < 16; i += 4 ) + h->stat.frame.i_mb_pred_mode[1][h->mb.cache.intra4x4_pred_mode[x264_scan8[i]]]++; + else //if( h->mb.i_type == I_4x4 ) + for( int i = 0; i < 16; i++ ) + h->stat.frame.i_mb_pred_mode[2][h->mb.cache.intra4x4_pred_mode[x264_scan8[i]]]++; + h->stat.frame.i_mb_pred_mode[3][x264_mb_chroma_pred_mode_fix[h->mb.i_chroma_pred_mode]]++; + } + h->stat.frame.i_mb_field[b_intra?0:b_skip?2:1] += MB_INTERLACED; + } + + /* calculate deblock strength values (actual deblocking is done per-row along with hpel) */ + if( b_deblock ) + x264_macroblock_deblock_strength( h ); + + if( mb_xy == h->sh.i_last_mb ) + break; + + if( SLICE_MBAFF ) + { + i_mb_x += i_mb_y & 1; + i_mb_y ^= i_mb_x < h->mb.i_mb_width; + } + else + i_mb_x++; + if( i_mb_x == h->mb.i_mb_width ) + { + i_mb_y++; + i_mb_x = 0; + } + } + if( h->sh.i_last_mb < h->sh.i_first_mb ) + return 0; + + h->out.nal[h->out.i_nal].i_last_mb = h->sh.i_last_mb; + + if( h->param.b_cabac ) + { + x264_cabac_encode_flush( h, &h->cabac ); + h->out.bs.p = h->cabac.p; + } + else + { + if( i_skip > 0 ) + bs_write_ue( &h->out.bs, i_skip ); /* last skip run */ + /* rbsp_slice_trailing_bits */ + bs_rbsp_trailing( &h->out.bs ); + bs_flush( &h->out.bs ); + } + if( x264_nal_end( h ) ) + return -1; + + if( h->sh.i_last_mb == (h->i_threadslice_end * h->mb.i_mb_width - 1) ) + { + h->stat.frame.i_misc_bits = bs_pos( &h->out.bs ) + + (h->out.i_nal*NALU_OVERHEAD * 8) + - h->stat.frame.i_tex_bits + - h->stat.frame.i_mv_bits; + x264_fdec_filter_row( h, h->i_threadslice_end, 0 ); + + if( h->param.b_sliced_threads ) + { + /* Tell the main thread we're done. */ + x264_threadslice_cond_broadcast( h, 1 ); + /* Do hpel now */ + for( int mb_y = h->i_threadslice_start; mb_y <= h->i_threadslice_end; mb_y++ ) + x264_fdec_filter_row( h, mb_y, 1 ); + x264_threadslice_cond_broadcast( h, 2 ); + /* Do the first row of hpel, now that the previous slice is done */ + if( h->i_thread_idx > 0 ) + { + x264_threadslice_cond_wait( h->thread[h->i_thread_idx-1], 2 ); + x264_fdec_filter_row( h, h->i_threadslice_start + (1 << SLICE_MBAFF), 2 ); + } + } + + /* Free mb info after the last thread's done using it */ + if( h->fdec->mb_info_free && (!h->param.b_sliced_threads || h->i_thread_idx == (h->param.i_threads-1)) ) + { + h->fdec->mb_info_free( h->fdec->mb_info ); + h->fdec->mb_info = NULL; + h->fdec->mb_info_free = NULL; + } + } + + return 0; +} + +static void x264_thread_sync_context( x264_t *dst, x264_t *src ) +{ + if( dst == src ) + return; + + // reference counting + for( x264_frame_t **f = src->frames.reference; *f; f++ ) + (*f)->i_reference_count++; + for( x264_frame_t **f = dst->frames.reference; *f; f++ ) + x264_frame_push_unused( src, *f ); + src->fdec->i_reference_count++; + x264_frame_push_unused( src, dst->fdec ); + + // copy everything except the per-thread pointers and the constants. + memcpy( &dst->i_frame, &src->i_frame, offsetof(x264_t, mb.base) - offsetof(x264_t, i_frame) ); + dst->param = src->param; + dst->stat = src->stat; + dst->pixf = src->pixf; + dst->reconfig = src->reconfig; +} + +static void x264_thread_sync_stat( x264_t *dst, x264_t *src ) +{ + if( dst != src ) + memcpy( &dst->stat, &src->stat, offsetof(x264_t, stat.frame) - offsetof(x264_t, stat) ); +} + +static void *x264_slices_write( x264_t *h ) +{ + int i_slice_num = 0; + int last_thread_mb = h->sh.i_last_mb; + + /* init stats */ + memset( &h->stat.frame, 0, sizeof(h->stat.frame) ); + h->mb.b_reencode_mb = 0; + while( h->sh.i_first_mb + SLICE_MBAFF*h->mb.i_mb_stride <= last_thread_mb ) + { + h->sh.i_last_mb = last_thread_mb; + if( !i_slice_num || !x264_frame_new_slice( h, h->fdec ) ) + { + if( h->param.i_slice_max_mbs ) + { + if( SLICE_MBAFF ) + { + // convert first to mbaff form, add slice-max-mbs, then convert back to normal form + int last_mbaff = 2*(h->sh.i_first_mb % h->mb.i_mb_width) + + h->mb.i_mb_width*(h->sh.i_first_mb / h->mb.i_mb_width) + + h->param.i_slice_max_mbs - 1; + int last_x = (last_mbaff % (2*h->mb.i_mb_width))/2; + int last_y = (last_mbaff / (2*h->mb.i_mb_width))*2 + 1; + h->sh.i_last_mb = last_x + h->mb.i_mb_stride*last_y; + } + else + { + h->sh.i_last_mb = h->sh.i_first_mb + h->param.i_slice_max_mbs - 1; + if( h->sh.i_last_mb < last_thread_mb && last_thread_mb - h->sh.i_last_mb < h->param.i_slice_min_mbs ) + h->sh.i_last_mb = last_thread_mb - h->param.i_slice_min_mbs; + } + i_slice_num++; + } + else if( h->param.i_slice_count && !h->param.b_sliced_threads ) + { + int height = h->mb.i_mb_height >> PARAM_INTERLACED; + int width = h->mb.i_mb_width << PARAM_INTERLACED; + i_slice_num++; + h->sh.i_last_mb = (height * i_slice_num + h->param.i_slice_count/2) / h->param.i_slice_count * width - 1; + } + } + h->sh.i_last_mb = X264_MIN( h->sh.i_last_mb, last_thread_mb ); + if( x264_stack_align( x264_slice_write, h ) ) + goto fail; + h->sh.i_first_mb = h->sh.i_last_mb + 1; + // if i_first_mb is not the last mb in a row then go to the next mb in MBAFF order + if( SLICE_MBAFF && h->sh.i_first_mb % h->mb.i_mb_width ) + h->sh.i_first_mb -= h->mb.i_mb_stride; + } + + return (void *)0; + +fail: + /* Tell other threads we're done, so they wouldn't wait for it */ + if( h->param.b_sliced_threads ) + x264_threadslice_cond_broadcast( h, 2 ); + return (void *)-1; +} + +static int x264_threaded_slices_write( x264_t *h ) +{ + /* set first/last mb and sync contexts */ + for( int i = 0; i < h->param.i_threads; i++ ) + { + x264_t *t = h->thread[i]; + if( i ) + { + t->param = h->param; + memcpy( &t->i_frame, &h->i_frame, offsetof(x264_t, rc) - offsetof(x264_t, i_frame) ); + } + int height = h->mb.i_mb_height >> PARAM_INTERLACED; + t->i_threadslice_start = ((height * i + h->param.i_slice_count/2) / h->param.i_threads) << PARAM_INTERLACED; + t->i_threadslice_end = ((height * (i+1) + h->param.i_slice_count/2) / h->param.i_threads) << PARAM_INTERLACED; + t->sh.i_first_mb = t->i_threadslice_start * h->mb.i_mb_width; + t->sh.i_last_mb = t->i_threadslice_end * h->mb.i_mb_width - 1; + } + + x264_stack_align( x264_analyse_weight_frame, h, h->mb.i_mb_height*16 + 16 ); + + x264_threads_distribute_ratecontrol( h ); + + /* setup */ + for( int i = 0; i < h->param.i_threads; i++ ) + { + h->thread[i]->i_thread_idx = i; + h->thread[i]->b_thread_active = 1; + x264_threadslice_cond_broadcast( h->thread[i], 0 ); + } + /* dispatch */ + for( int i = 0; i < h->param.i_threads; i++ ) + x264_threadpool_run( h->threadpool, (void*)x264_slices_write, h->thread[i] ); + /* wait */ + for( int i = 0; i < h->param.i_threads; i++ ) + x264_threadslice_cond_wait( h->thread[i], 1 ); + + x264_threads_merge_ratecontrol( h ); + + for( int i = 1; i < h->param.i_threads; i++ ) + { + x264_t *t = h->thread[i]; + for( int j = 0; j < t->out.i_nal; j++ ) + { + h->out.nal[h->out.i_nal] = t->out.nal[j]; + h->out.i_nal++; + x264_nal_check_buffer( h ); + } + /* All entries in stat.frame are ints except for ssd/ssim. */ + for( int j = 0; j < (offsetof(x264_t,stat.frame.i_ssd) - offsetof(x264_t,stat.frame.i_mv_bits)) / sizeof(int); j++ ) + ((int*)&h->stat.frame)[j] += ((int*)&t->stat.frame)[j]; + for( int j = 0; j < 3; j++ ) + h->stat.frame.i_ssd[j] += t->stat.frame.i_ssd[j]; + h->stat.frame.f_ssim += t->stat.frame.f_ssim; + h->stat.frame.i_ssim_cnt += t->stat.frame.i_ssim_cnt; + } + + return 0; +} + +void x264_encoder_intra_refresh( x264_t *h ) +{ + h = h->thread[h->i_thread_phase]; + h->b_queued_intra_refresh = 1; +} + +int x264_encoder_invalidate_reference( x264_t *h, int64_t pts ) +{ + if( h->param.i_bframe ) + { + x264_log( h, X264_LOG_ERROR, "x264_encoder_invalidate_reference is not supported with B-frames enabled\n" ); + return -1; + } + if( h->param.b_intra_refresh ) + { + x264_log( h, X264_LOG_ERROR, "x264_encoder_invalidate_reference is not supported with intra refresh enabled\n" ); + return -1; + } + h = h->thread[h->i_thread_phase]; + if( pts >= h->i_last_idr_pts ) + { + for( int i = 0; h->frames.reference[i]; i++ ) + if( pts <= h->frames.reference[i]->i_pts ) + h->frames.reference[i]->b_corrupt = 1; + if( pts <= h->fdec->i_pts ) + h->fdec->b_corrupt = 1; + } + return 0; +} + +/**************************************************************************** + * x264_encoder_encode: + * XXX: i_poc : is the poc of the current given picture + * i_frame : is the number of the frame being coded + * ex: type frame poc + * I 0 2*0 + * P 1 2*3 + * B 2 2*1 + * B 3 2*2 + * P 4 2*6 + * B 5 2*4 + * B 6 2*5 + ****************************************************************************/ +int x264_encoder_encode( x264_t *h, + x264_nal_t **pp_nal, int *pi_nal, + x264_picture_t *pic_in, + x264_picture_t *pic_out ) +{ + x264_t *thread_current, *thread_prev, *thread_oldest; + int i_nal_type, i_nal_ref_idc, i_global_qp; + int overhead = NALU_OVERHEAD; + +#if HAVE_OPENCL + if( h->opencl.b_fatal_error ) + return -1; +#endif + + if( h->i_thread_frames > 1 ) + { + thread_prev = h->thread[ h->i_thread_phase ]; + h->i_thread_phase = (h->i_thread_phase + 1) % h->i_thread_frames; + thread_current = h->thread[ h->i_thread_phase ]; + thread_oldest = h->thread[ (h->i_thread_phase + 1) % h->i_thread_frames ]; + x264_thread_sync_context( thread_current, thread_prev ); + x264_thread_sync_ratecontrol( thread_current, thread_prev, thread_oldest ); + h = thread_current; + } + else + { + thread_current = + thread_oldest = h; + } + h->i_cpb_delay_pir_offset = h->i_cpb_delay_pir_offset_next; + + /* no data out */ + *pi_nal = 0; + *pp_nal = NULL; + + /* ------------------- Setup new frame from picture -------------------- */ + if( pic_in != NULL ) + { + if( h->lookahead->b_exit_thread ) + { + x264_log( h, X264_LOG_ERROR, "lookahead thread is already stopped\n" ); + return -1; + } + + /* 1: Copy the picture to a frame and move it to a buffer */ + x264_frame_t *fenc = x264_frame_pop_unused( h, 0 ); + if( !fenc ) + return -1; + + if( x264_frame_copy_picture( h, fenc, pic_in ) < 0 ) + return -1; + + if( h->param.i_width != 16 * h->mb.i_mb_width || + h->param.i_height != 16 * h->mb.i_mb_height ) + x264_frame_expand_border_mod16( h, fenc ); + + fenc->i_frame = h->frames.i_input++; + + if( fenc->i_frame == 0 ) + h->frames.i_first_pts = fenc->i_pts; + if( h->frames.i_bframe_delay && fenc->i_frame == h->frames.i_bframe_delay ) + h->frames.i_bframe_delay_time = fenc->i_pts - h->frames.i_first_pts; + + if( h->param.b_vfr_input && fenc->i_pts <= h->frames.i_largest_pts ) + x264_log( h, X264_LOG_WARNING, "non-strictly-monotonic PTS\n" ); + + h->frames.i_second_largest_pts = h->frames.i_largest_pts; + h->frames.i_largest_pts = fenc->i_pts; + + if( (fenc->i_pic_struct < PIC_STRUCT_AUTO) || (fenc->i_pic_struct > PIC_STRUCT_TRIPLE) ) + fenc->i_pic_struct = PIC_STRUCT_AUTO; + + if( fenc->i_pic_struct == PIC_STRUCT_AUTO ) + { +#if HAVE_INTERLACED + int b_interlaced = fenc->param ? fenc->param->b_interlaced : h->param.b_interlaced; +#else + int b_interlaced = 0; +#endif + if( b_interlaced ) + { + int b_tff = fenc->param ? fenc->param->b_tff : h->param.b_tff; + fenc->i_pic_struct = b_tff ? PIC_STRUCT_TOP_BOTTOM : PIC_STRUCT_BOTTOM_TOP; + } + else + fenc->i_pic_struct = PIC_STRUCT_PROGRESSIVE; + } + + if( h->param.rc.b_mb_tree && h->param.rc.b_stat_read ) + { + if( x264_macroblock_tree_read( h, fenc, pic_in->prop.quant_offsets ) ) + return -1; + } + else + x264_stack_align( x264_adaptive_quant_frame, h, fenc, pic_in->prop.quant_offsets ); + + if( pic_in->prop.quant_offsets_free ) + pic_in->prop.quant_offsets_free( pic_in->prop.quant_offsets ); + + if( h->frames.b_have_lowres ) + x264_frame_init_lowres( h, fenc ); + + /* 2: Place the frame into the queue for its slice type decision */ + x264_lookahead_put_frame( h, fenc ); + + if( h->frames.i_input <= h->frames.i_delay + 1 - h->i_thread_frames ) + { + /* Nothing yet to encode, waiting for filling of buffers */ + pic_out->i_type = X264_TYPE_AUTO; + return 0; + } + } + else + { + /* signal kills for lookahead thread */ + x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex ); + h->lookahead->b_exit_thread = 1; + x264_pthread_cond_broadcast( &h->lookahead->ifbuf.cv_fill ); + x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex ); + } + + h->i_frame++; + /* 3: The picture is analyzed in the lookahead */ + if( !h->frames.current[0] ) + x264_lookahead_get_frames( h ); + + if( !h->frames.current[0] && x264_lookahead_is_empty( h ) ) + return x264_encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out ); + + /* ------------------- Get frame to be encoded ------------------------- */ + /* 4: get picture to encode */ + h->fenc = x264_frame_shift( h->frames.current ); + + /* If applicable, wait for previous frame reconstruction to finish */ + if( h->param.b_sliced_threads ) + if( x264_threadpool_wait_all( h ) < 0 ) + return -1; + + if( h->i_frame == 0 ) + h->i_reordered_pts_delay = h->fenc->i_reordered_pts; + if( h->reconfig ) + { + x264_encoder_reconfig_apply( h, &h->reconfig_h->param ); + h->reconfig = 0; + } + if( h->fenc->param ) + { + x264_encoder_reconfig_apply( h, h->fenc->param ); + if( h->fenc->param->param_free ) + { + h->fenc->param->param_free( h->fenc->param ); + h->fenc->param = NULL; + } + } + x264_ratecontrol_zone_init( h ); + + // ok to call this before encoding any frames, since the initial values of fdec have b_kept_as_ref=0 + if( x264_reference_update( h ) ) + return -1; + h->fdec->i_lines_completed = -1; + + if( !IS_X264_TYPE_I( h->fenc->i_type ) ) + { + int valid_refs_left = 0; + for( int i = 0; h->frames.reference[i]; i++ ) + if( !h->frames.reference[i]->b_corrupt ) + valid_refs_left++; + /* No valid reference frames left: force an IDR. */ + if( !valid_refs_left ) + { + h->fenc->b_keyframe = 1; + h->fenc->i_type = X264_TYPE_IDR; + } + } + + if( h->fenc->b_keyframe ) + { + h->frames.i_last_keyframe = h->fenc->i_frame; + if( h->fenc->i_type == X264_TYPE_IDR ) + { + h->i_frame_num = 0; + h->frames.i_last_idr = h->fenc->i_frame; + } + } + h->sh.i_mmco_command_count = + h->sh.i_mmco_remove_from_end = 0; + h->b_ref_reorder[0] = + h->b_ref_reorder[1] = 0; + h->fdec->i_poc = + h->fenc->i_poc = 2 * ( h->fenc->i_frame - X264_MAX( h->frames.i_last_idr, 0 ) ); + + /* ------------------- Setup frame context ----------------------------- */ + /* 5: Init data dependent of frame type */ + if( h->fenc->i_type == X264_TYPE_IDR ) + { + /* reset ref pictures */ + i_nal_type = NAL_SLICE_IDR; + i_nal_ref_idc = NAL_PRIORITY_HIGHEST; + h->sh.i_type = SLICE_TYPE_I; + x264_reference_reset( h ); + h->frames.i_poc_last_open_gop = -1; + } + else if( h->fenc->i_type == X264_TYPE_I ) + { + i_nal_type = NAL_SLICE; + i_nal_ref_idc = NAL_PRIORITY_HIGH; /* Not completely true but for now it is (as all I/P are kept as ref)*/ + h->sh.i_type = SLICE_TYPE_I; + x264_reference_hierarchy_reset( h ); + if( h->param.b_open_gop ) + h->frames.i_poc_last_open_gop = h->fenc->b_keyframe ? h->fenc->i_poc : -1; + } + else if( h->fenc->i_type == X264_TYPE_P ) + { + i_nal_type = NAL_SLICE; + i_nal_ref_idc = NAL_PRIORITY_HIGH; /* Not completely true but for now it is (as all I/P are kept as ref)*/ + h->sh.i_type = SLICE_TYPE_P; + x264_reference_hierarchy_reset( h ); + h->frames.i_poc_last_open_gop = -1; + } + else if( h->fenc->i_type == X264_TYPE_BREF ) + { + i_nal_type = NAL_SLICE; + i_nal_ref_idc = h->param.i_bframe_pyramid == X264_B_PYRAMID_STRICT ? NAL_PRIORITY_LOW : NAL_PRIORITY_HIGH; + h->sh.i_type = SLICE_TYPE_B; + x264_reference_hierarchy_reset( h ); + } + else /* B frame */ + { + i_nal_type = NAL_SLICE; + i_nal_ref_idc = NAL_PRIORITY_DISPOSABLE; + h->sh.i_type = SLICE_TYPE_B; + } + + h->fdec->i_type = h->fenc->i_type; + h->fdec->i_frame = h->fenc->i_frame; + h->fenc->b_kept_as_ref = + h->fdec->b_kept_as_ref = i_nal_ref_idc != NAL_PRIORITY_DISPOSABLE && h->param.i_keyint_max > 1; + + h->fdec->mb_info = h->fenc->mb_info; + h->fdec->mb_info_free = h->fenc->mb_info_free; + h->fenc->mb_info = NULL; + h->fenc->mb_info_free = NULL; + + h->fdec->i_pts = h->fenc->i_pts; + if( h->frames.i_bframe_delay ) + { + int64_t *prev_reordered_pts = thread_current->frames.i_prev_reordered_pts; + h->fdec->i_dts = h->i_frame > h->frames.i_bframe_delay + ? prev_reordered_pts[ (h->i_frame - h->frames.i_bframe_delay) % h->frames.i_bframe_delay ] + : h->fenc->i_reordered_pts - h->frames.i_bframe_delay_time; + prev_reordered_pts[ h->i_frame % h->frames.i_bframe_delay ] = h->fenc->i_reordered_pts; + } + else + h->fdec->i_dts = h->fenc->i_reordered_pts; + if( h->fenc->i_type == X264_TYPE_IDR ) + h->i_last_idr_pts = h->fdec->i_pts; + + /* ------------------- Init ----------------------------- */ + /* build ref list 0/1 */ + x264_reference_build_list( h, h->fdec->i_poc ); + + /* ---------------------- Write the bitstream -------------------------- */ + /* Init bitstream context */ + if( h->param.b_sliced_threads ) + { + for( int i = 0; i < h->param.i_threads; i++ ) + { + bs_init( &h->thread[i]->out.bs, h->thread[i]->out.p_bitstream, h->thread[i]->out.i_bitstream ); + h->thread[i]->out.i_nal = 0; + } + } + else + { + bs_init( &h->out.bs, h->out.p_bitstream, h->out.i_bitstream ); + h->out.i_nal = 0; + } + + if( h->param.b_aud ) + { + int pic_type; + + if( h->sh.i_type == SLICE_TYPE_I ) + pic_type = 0; + else if( h->sh.i_type == SLICE_TYPE_P ) + pic_type = 1; + else if( h->sh.i_type == SLICE_TYPE_B ) + pic_type = 2; + else + pic_type = 7; + + x264_nal_start( h, NAL_AUD, NAL_PRIORITY_DISPOSABLE ); + bs_write( &h->out.bs, 3, pic_type ); + bs_rbsp_trailing( &h->out.bs ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD; + } + + h->i_nal_type = i_nal_type; + h->i_nal_ref_idc = i_nal_ref_idc; + + if( h->param.b_intra_refresh ) + { + if( IS_X264_TYPE_I( h->fenc->i_type ) ) + { + h->fdec->i_frames_since_pir = 0; + h->b_queued_intra_refresh = 0; + /* PIR is currently only supported with ref == 1, so any intra frame effectively refreshes + * the whole frame and counts as an intra refresh. */ + h->fdec->f_pir_position = h->mb.i_mb_width; + } + else if( h->fenc->i_type == X264_TYPE_P ) + { + int pocdiff = (h->fdec->i_poc - h->fref[0][0]->i_poc)/2; + float increment = X264_MAX( ((float)h->mb.i_mb_width-1) / h->param.i_keyint_max, 1 ); + h->fdec->f_pir_position = h->fref[0][0]->f_pir_position; + h->fdec->i_frames_since_pir = h->fref[0][0]->i_frames_since_pir + pocdiff; + if( h->fdec->i_frames_since_pir >= h->param.i_keyint_max || + (h->b_queued_intra_refresh && h->fdec->f_pir_position + 0.5 >= h->mb.i_mb_width) ) + { + h->fdec->f_pir_position = 0; + h->fdec->i_frames_since_pir = 0; + h->b_queued_intra_refresh = 0; + h->fenc->b_keyframe = 1; + } + h->fdec->i_pir_start_col = h->fdec->f_pir_position+0.5; + h->fdec->f_pir_position += increment * pocdiff; + h->fdec->i_pir_end_col = h->fdec->f_pir_position+0.5; + /* If our intra refresh has reached the right side of the frame, we're done. */ + if( h->fdec->i_pir_end_col >= h->mb.i_mb_width - 1 ) + { + h->fdec->f_pir_position = h->mb.i_mb_width; + h->fdec->i_pir_end_col = h->mb.i_mb_width - 1; + } + } + } + + if( h->fenc->b_keyframe ) + { + /* Write SPS and PPS */ + if( h->param.b_repeat_headers ) + { + /* generate sequence parameters */ + x264_nal_start( h, NAL_SPS, NAL_PRIORITY_HIGHEST ); + x264_sps_write( &h->out.bs, h->sps ); + if( x264_nal_end( h ) ) + return -1; + /* Pad AUD/SPS to 256 bytes like Panasonic */ + if( h->param.i_avcintra_class ) + h->out.nal[h->out.i_nal-1].i_padding = 256 - bs_pos( &h->out.bs ) / 8 - 2*NALU_OVERHEAD; + overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + NALU_OVERHEAD; + + /* generate picture parameters */ + x264_nal_start( h, NAL_PPS, NAL_PRIORITY_HIGHEST ); + x264_pps_write( &h->out.bs, h->sps, h->pps ); + if( x264_nal_end( h ) ) + return -1; + if( h->param.i_avcintra_class ) + h->out.nal[h->out.i_nal-1].i_padding = 256 - h->out.nal[h->out.i_nal-1].i_payload - NALU_OVERHEAD; + overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + NALU_OVERHEAD; + } + + /* when frame threading is used, buffering period sei is written in x264_encoder_frame_end */ + if( h->i_thread_frames == 1 && h->sps->vui.b_nal_hrd_parameters_present ) + { + x264_hrd_fullness( h ); + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + x264_sei_buffering_period_write( h, &h->out.bs ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + } + } + + /* write extra sei */ + for( int i = 0; i < h->fenc->extra_sei.num_payloads; i++ ) + { + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + x264_sei_write( &h->out.bs, h->fenc->extra_sei.payloads[i].payload, h->fenc->extra_sei.payloads[i].payload_size, + h->fenc->extra_sei.payloads[i].payload_type ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + if( h->fenc->extra_sei.sei_free ) + { + h->fenc->extra_sei.sei_free( h->fenc->extra_sei.payloads[i].payload ); + h->fenc->extra_sei.payloads[i].payload = NULL; + } + } + + if( h->fenc->extra_sei.sei_free ) + { + h->fenc->extra_sei.sei_free( h->fenc->extra_sei.payloads ); + h->fenc->extra_sei.payloads = NULL; + h->fenc->extra_sei.sei_free = NULL; + } + + if( h->fenc->b_keyframe ) + { + /* Avid's decoder strictly wants two SEIs for AVC-Intra so we can't insert the x264 SEI */ + if( h->param.b_repeat_headers && h->fenc->i_frame == 0 && !h->param.i_avcintra_class ) + { + /* identify ourself */ + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + if( x264_sei_version_write( h, &h->out.bs ) ) + return -1; + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + } + + if( h->fenc->i_type != X264_TYPE_IDR ) + { + int time_to_recovery = h->param.b_open_gop ? 0 : X264_MIN( h->mb.i_mb_width - 1, h->param.i_keyint_max ) + h->param.i_bframe - 1; + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + x264_sei_recovery_point_write( h, &h->out.bs, time_to_recovery ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + } + } + + if( h->param.i_frame_packing >= 0 && (h->fenc->b_keyframe || h->param.i_frame_packing == 5) ) + { + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + x264_sei_frame_packing_write( h, &h->out.bs ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + } + + /* generate sei pic timing */ + if( h->sps->vui.b_pic_struct_present || h->sps->vui.b_nal_hrd_parameters_present ) + { + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + x264_sei_pic_timing_write( h, &h->out.bs ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + } + + /* As required by Blu-ray. */ + if( !IS_X264_TYPE_B( h->fenc->i_type ) && h->b_sh_backup ) + { + h->b_sh_backup = 0; + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + x264_sei_dec_ref_pic_marking_write( h, &h->out.bs ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + } + + if( h->fenc->b_keyframe && h->param.b_intra_refresh ) + h->i_cpb_delay_pir_offset_next = h->fenc->i_cpb_delay; + + /* Filler space: 10 or 18 SEIs' worth of space, depending on resolution */ + if( h->param.i_avcintra_class ) + { + /* Write an empty filler NAL to mimic the AUD in the P2 format*/ + x264_nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE ); + x264_filler_write( h, &h->out.bs, 0 ); + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + NALU_OVERHEAD; + + /* All lengths are magic lengths that decoders expect to see */ + /* "UMID" SEI */ + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + if( x264_sei_avcintra_umid_write( h, &h->out.bs ) < 0 ) + return -1; + if( x264_nal_end( h ) ) + return -1; + overhead += h->out.nal[h->out.i_nal-1].i_payload + SEI_OVERHEAD; + + int unpadded_len; + int total_len; + if( h->param.i_height == 1080 ) + { + unpadded_len = 5780; + total_len = 17*512; + } + else + { + unpadded_len = 2900; + total_len = 9*512; + } + /* "VANC" SEI */ + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + if( x264_sei_avcintra_vanc_write( h, &h->out.bs, unpadded_len ) < 0 ) + return -1; + if( x264_nal_end( h ) ) + return -1; + + h->out.nal[h->out.i_nal-1].i_padding = total_len - h->out.nal[h->out.i_nal-1].i_payload - SEI_OVERHEAD; + overhead += h->out.nal[h->out.i_nal-1].i_payload + h->out.nal[h->out.i_nal-1].i_padding + SEI_OVERHEAD; + } + + /* Init the rate control */ + /* FIXME: Include slice header bit cost. */ + x264_ratecontrol_start( h, h->fenc->i_qpplus1, overhead*8 ); + i_global_qp = x264_ratecontrol_qp( h ); + + pic_out->i_qpplus1 = + h->fdec->i_qpplus1 = i_global_qp + 1; + + if( h->param.rc.b_stat_read && h->sh.i_type != SLICE_TYPE_I ) + { + x264_reference_build_list_optimal( h ); + x264_reference_check_reorder( h ); + } + + if( h->i_ref[0] ) + h->fdec->i_poc_l0ref0 = h->fref[0][0]->i_poc; + + /* ------------------------ Create slice header ----------------------- */ + x264_slice_init( h, i_nal_type, i_global_qp ); + + /*------------------------- Weights -------------------------------------*/ + if( h->sh.i_type == SLICE_TYPE_B ) + x264_macroblock_bipred_init( h ); + + x264_weighted_pred_init( h ); + + if( i_nal_ref_idc != NAL_PRIORITY_DISPOSABLE ) + h->i_frame_num++; + + /* Write frame */ + h->i_threadslice_start = 0; + h->i_threadslice_end = h->mb.i_mb_height; + if( h->i_thread_frames > 1 ) + { + x264_threadpool_run( h->threadpool, (void*)x264_slices_write, h ); + h->b_thread_active = 1; + } + else if( h->param.b_sliced_threads ) + { + if( x264_threaded_slices_write( h ) ) + return -1; + } + else + if( (intptr_t)x264_slices_write( h ) ) + return -1; + + return x264_encoder_frame_end( thread_oldest, thread_current, pp_nal, pi_nal, pic_out ); +} + +static int x264_encoder_frame_end( x264_t *h, x264_t *thread_current, + x264_nal_t **pp_nal, int *pi_nal, + x264_picture_t *pic_out ) +{ + char psz_message[80]; + + if( !h->param.b_sliced_threads && h->b_thread_active ) + { + h->b_thread_active = 0; + if( (intptr_t)x264_threadpool_wait( h->threadpool, h ) ) + return -1; + } + if( !h->out.i_nal ) + { + pic_out->i_type = X264_TYPE_AUTO; + return 0; + } + + x264_emms(); + + /* generate buffering period sei and insert it into place */ + if( h->i_thread_frames > 1 && h->fenc->b_keyframe && h->sps->vui.b_nal_hrd_parameters_present ) + { + x264_hrd_fullness( h ); + x264_nal_start( h, NAL_SEI, NAL_PRIORITY_DISPOSABLE ); + x264_sei_buffering_period_write( h, &h->out.bs ); + if( x264_nal_end( h ) ) + return -1; + /* buffering period sei must follow AUD, SPS and PPS and precede all other SEIs */ + int idx = 0; + while( h->out.nal[idx].i_type == NAL_AUD || + h->out.nal[idx].i_type == NAL_SPS || + h->out.nal[idx].i_type == NAL_PPS ) + idx++; + x264_nal_t nal_tmp = h->out.nal[h->out.i_nal-1]; + memmove( &h->out.nal[idx+1], &h->out.nal[idx], (h->out.i_nal-idx-1)*sizeof(x264_nal_t) ); + h->out.nal[idx] = nal_tmp; + } + + int frame_size = x264_encoder_encapsulate_nals( h, 0 ); + if( frame_size < 0 ) + return -1; + + /* Set output picture properties */ + pic_out->i_type = h->fenc->i_type; + + pic_out->b_keyframe = h->fenc->b_keyframe; + pic_out->i_pic_struct = h->fenc->i_pic_struct; + + pic_out->i_pts = h->fdec->i_pts; + pic_out->i_dts = h->fdec->i_dts; + + if( pic_out->i_pts < pic_out->i_dts ) + x264_log( h, X264_LOG_WARNING, "invalid DTS: PTS is less than DTS\n" ); + + pic_out->opaque = h->fenc->opaque; + + pic_out->img.i_csp = h->fdec->i_csp; +#if HIGH_BIT_DEPTH + pic_out->img.i_csp |= X264_CSP_HIGH_DEPTH; +#endif + pic_out->img.i_plane = h->fdec->i_plane; + for( int i = 0; i < pic_out->img.i_plane; i++ ) + { + pic_out->img.i_stride[i] = h->fdec->i_stride[i] * sizeof(pixel); + pic_out->img.plane[i] = (uint8_t*)h->fdec->plane[i]; + } + + x264_frame_push_unused( thread_current, h->fenc ); + + /* ---------------------- Update encoder state ------------------------- */ + + /* update rc */ + int filler = 0; + if( x264_ratecontrol_end( h, frame_size * 8, &filler ) < 0 ) + return -1; + + pic_out->hrd_timing = h->fenc->hrd_timing; + pic_out->prop.f_crf_avg = h->fdec->f_crf_avg; + + /* Filler in AVC-Intra mode is written as zero bytes to the last slice + * We don't know the size of the last slice until encapsulation so we add filler to the encapsulated NAL */ + if( h->param.i_avcintra_class ) + { + if( x264_check_encapsulated_buffer( h, h->thread[0], h->out.i_nal, frame_size, frame_size + filler ) < 0 ) + return -1; + + x264_nal_t *nal = &h->out.nal[h->out.i_nal-1]; + memset( nal->p_payload + nal->i_payload, 0, filler ); + nal->i_payload += filler; + nal->i_padding = filler; + frame_size += filler; + + /* Fix up the size header for mp4/etc */ + if( !h->param.b_annexb ) + { + /* Size doesn't include the size of the header we're writing now. */ + uint8_t *nal_data = nal->p_payload; + int chunk_size = nal->i_payload - 4; + nal_data[0] = chunk_size >> 24; + nal_data[1] = chunk_size >> 16; + nal_data[2] = chunk_size >> 8; + nal_data[3] = chunk_size >> 0; + } + } + else + { + while( filler > 0 ) + { + int f, overhead = FILLER_OVERHEAD - h->param.b_annexb; + if( h->param.i_slice_max_size && filler > h->param.i_slice_max_size ) + { + int next_size = filler - h->param.i_slice_max_size; + int overflow = X264_MAX( overhead - next_size, 0 ); + f = h->param.i_slice_max_size - overhead - overflow; + } + else + f = X264_MAX( 0, filler - overhead ); + + if( x264_bitstream_check_buffer_filler( h, f ) ) + return -1; + x264_nal_start( h, NAL_FILLER, NAL_PRIORITY_DISPOSABLE ); + x264_filler_write( h, &h->out.bs, f ); + if( x264_nal_end( h ) ) + return -1; + int total_size = x264_encoder_encapsulate_nals( h, h->out.i_nal-1 ); + if( total_size < 0 ) + return -1; + frame_size += total_size; + filler -= total_size; + } + } + + /* End bitstream, set output */ + *pi_nal = h->out.i_nal; + *pp_nal = h->out.nal; + + h->out.i_nal = 0; + + x264_noise_reduction_update( h ); + + /* ---------------------- Compute/Print statistics --------------------- */ + x264_thread_sync_stat( h, h->thread[0] ); + + /* Slice stat */ + h->stat.i_frame_count[h->sh.i_type]++; + h->stat.i_frame_size[h->sh.i_type] += frame_size; + h->stat.f_frame_qp[h->sh.i_type] += h->fdec->f_qp_avg_aq; + + for( int i = 0; i < X264_MBTYPE_MAX; i++ ) + h->stat.i_mb_count[h->sh.i_type][i] += h->stat.frame.i_mb_count[i]; + for( int i = 0; i < X264_PARTTYPE_MAX; i++ ) + h->stat.i_mb_partition[h->sh.i_type][i] += h->stat.frame.i_mb_partition[i]; + for( int i = 0; i < 2; i++ ) + h->stat.i_mb_count_8x8dct[i] += h->stat.frame.i_mb_count_8x8dct[i]; + for( int i = 0; i < 6; i++ ) + h->stat.i_mb_cbp[i] += h->stat.frame.i_mb_cbp[i]; + for( int i = 0; i < 4; i++ ) + for( int j = 0; j < 13; j++ ) + h->stat.i_mb_pred_mode[i][j] += h->stat.frame.i_mb_pred_mode[i][j]; + if( h->sh.i_type != SLICE_TYPE_I ) + for( int i_list = 0; i_list < 2; i_list++ ) + for( int i = 0; i < X264_REF_MAX*2; i++ ) + h->stat.i_mb_count_ref[h->sh.i_type][i_list][i] += h->stat.frame.i_mb_count_ref[i_list][i]; + for( int i = 0; i < 3; i++ ) + h->stat.i_mb_field[i] += h->stat.frame.i_mb_field[i]; + if( h->sh.i_type == SLICE_TYPE_P && h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE ) + { + h->stat.i_wpred[0] += !!h->sh.weight[0][0].weightfn; + h->stat.i_wpred[1] += !!h->sh.weight[0][1].weightfn || !!h->sh.weight[0][2].weightfn; + } + if( h->sh.i_type == SLICE_TYPE_B ) + { + h->stat.i_direct_frames[ h->sh.b_direct_spatial_mv_pred ] ++; + if( h->mb.b_direct_auto_write ) + { + //FIXME somewhat arbitrary time constants + if( h->stat.i_direct_score[0] + h->stat.i_direct_score[1] > h->mb.i_mb_count ) + for( int i = 0; i < 2; i++ ) + h->stat.i_direct_score[i] = h->stat.i_direct_score[i] * 9/10; + for( int i = 0; i < 2; i++ ) + h->stat.i_direct_score[i] += h->stat.frame.i_direct_score[i]; + } + } + else + h->stat.i_consecutive_bframes[h->fenc->i_bframes]++; + + psz_message[0] = '\0'; + double dur = h->fenc->f_duration; + h->stat.f_frame_duration[h->sh.i_type] += dur; + if( h->param.analyse.b_psnr ) + { + int64_t ssd[3] = + { + h->stat.frame.i_ssd[0], + h->stat.frame.i_ssd[1], + h->stat.frame.i_ssd[2], + }; + int luma_size = h->param.i_width * h->param.i_height; + int chroma_size = CHROMA_SIZE( luma_size ); + pic_out->prop.f_psnr[0] = x264_psnr( ssd[0], luma_size ); + pic_out->prop.f_psnr[1] = x264_psnr( ssd[1], chroma_size ); + pic_out->prop.f_psnr[2] = x264_psnr( ssd[2], chroma_size ); + pic_out->prop.f_psnr_avg = x264_psnr( ssd[0] + ssd[1] + ssd[2], luma_size + chroma_size*2 ); + + h->stat.f_ssd_global[h->sh.i_type] += dur * (ssd[0] + ssd[1] + ssd[2]); + h->stat.f_psnr_average[h->sh.i_type] += dur * pic_out->prop.f_psnr_avg; + h->stat.f_psnr_mean_y[h->sh.i_type] += dur * pic_out->prop.f_psnr[0]; + h->stat.f_psnr_mean_u[h->sh.i_type] += dur * pic_out->prop.f_psnr[1]; + h->stat.f_psnr_mean_v[h->sh.i_type] += dur * pic_out->prop.f_psnr[2]; + + snprintf( psz_message, 80, " PSNR Y:%5.2f U:%5.2f V:%5.2f", pic_out->prop.f_psnr[0], + pic_out->prop.f_psnr[1], + pic_out->prop.f_psnr[2] ); + } + + if( h->param.analyse.b_ssim ) + { + pic_out->prop.f_ssim = h->stat.frame.f_ssim / h->stat.frame.i_ssim_cnt; + h->stat.f_ssim_mean_y[h->sh.i_type] += pic_out->prop.f_ssim * dur; + int msg_len = strlen(psz_message); + snprintf( psz_message + msg_len, 80 - msg_len, " SSIM Y:%.5f", pic_out->prop.f_ssim ); + } + psz_message[79] = '\0'; + + x264_log( h, X264_LOG_DEBUG, + "frame=%4d QP=%.2f NAL=%d Slice:%c Poc:%-3d I:%-4d P:%-4d SKIP:%-4d size=%d bytes%s\n", + h->i_frame, + h->fdec->f_qp_avg_aq, + h->i_nal_ref_idc, + h->sh.i_type == SLICE_TYPE_I ? 'I' : (h->sh.i_type == SLICE_TYPE_P ? 'P' : 'B' ), + h->fdec->i_poc, + h->stat.frame.i_mb_count_i, + h->stat.frame.i_mb_count_p, + h->stat.frame.i_mb_count_skip, + frame_size, + psz_message ); + + // keep stats all in one place + x264_thread_sync_stat( h->thread[0], h ); + // for the use of the next frame + x264_thread_sync_stat( thread_current, h ); + +#ifdef DEBUG_MB_TYPE +{ + static const char mb_chars[] = { 'i', 'i', 'I', 'C', 'P', '8', 'S', + 'D', '<', 'X', 'B', 'X', '>', 'B', 'B', 'B', 'B', '8', 'S' }; + for( int mb_xy = 0; mb_xy < h->mb.i_mb_width * h->mb.i_mb_height; mb_xy++ ) + { + if( h->mb.type[mb_xy] < X264_MBTYPE_MAX && h->mb.type[mb_xy] >= 0 ) + fprintf( stderr, "%c ", mb_chars[ h->mb.type[mb_xy] ] ); + else + fprintf( stderr, "? " ); + + if( (mb_xy+1) % h->mb.i_mb_width == 0 ) + fprintf( stderr, "\n" ); + } +} +#endif + + /* Remove duplicates, must be done near the end as breaks h->fref0 array + * by freeing some of its pointers. */ + for( int i = 0; i < h->i_ref[0]; i++ ) + if( h->fref[0][i] && h->fref[0][i]->b_duplicate ) + { + x264_frame_push_blank_unused( h, h->fref[0][i] ); + h->fref[0][i] = 0; + } + + if( h->param.psz_dump_yuv ) + x264_frame_dump( h ); + x264_emms(); + + return frame_size; +} + +static void x264_print_intra( int64_t *i_mb_count, double i_count, int b_print_pcm, char *intra ) +{ + intra += sprintf( intra, "I16..4%s: %4.1f%% %4.1f%% %4.1f%%", + b_print_pcm ? "..PCM" : "", + i_mb_count[I_16x16]/ i_count, + i_mb_count[I_8x8] / i_count, + i_mb_count[I_4x4] / i_count ); + if( b_print_pcm ) + sprintf( intra, " %4.1f%%", i_mb_count[I_PCM] / i_count ); +} + +/**************************************************************************** + * x264_encoder_close: + ****************************************************************************/ +void x264_encoder_close ( x264_t *h ) +{ + int64_t i_yuv_size = FRAME_SIZE( h->param.i_width * h->param.i_height ); + int64_t i_mb_count_size[2][7] = {{0}}; + char buf[200]; + int b_print_pcm = h->stat.i_mb_count[SLICE_TYPE_I][I_PCM] + || h->stat.i_mb_count[SLICE_TYPE_P][I_PCM] + || h->stat.i_mb_count[SLICE_TYPE_B][I_PCM]; + + x264_lookahead_delete( h ); + +#if HAVE_OPENCL + x264_opencl_lookahead_delete( h ); + x264_opencl_function_t *ocl = h->opencl.ocl; +#endif + + if( h->param.b_sliced_threads ) + x264_threadpool_wait_all( h ); + if( h->param.i_threads > 1 ) + x264_threadpool_delete( h->threadpool ); + if( h->param.i_lookahead_threads > 1 ) + x264_threadpool_delete( h->lookaheadpool ); + if( h->i_thread_frames > 1 ) + { + for( int i = 0; i < h->i_thread_frames; i++ ) + if( h->thread[i]->b_thread_active ) + { + assert( h->thread[i]->fenc->i_reference_count == 1 ); + x264_frame_delete( h->thread[i]->fenc ); + } + + x264_t *thread_prev = h->thread[h->i_thread_phase]; + x264_thread_sync_ratecontrol( h, thread_prev, h ); + x264_thread_sync_ratecontrol( thread_prev, thread_prev, h ); + h->i_frame = thread_prev->i_frame + 1 - h->i_thread_frames; + } + h->i_frame++; + + /* Slices used and PSNR */ + for( int i = 0; i < 3; i++ ) + { + static const uint8_t slice_order[] = { SLICE_TYPE_I, SLICE_TYPE_P, SLICE_TYPE_B }; + int i_slice = slice_order[i]; + + if( h->stat.i_frame_count[i_slice] > 0 ) + { + int i_count = h->stat.i_frame_count[i_slice]; + double dur = h->stat.f_frame_duration[i_slice]; + if( h->param.analyse.b_psnr ) + { + x264_log( h, X264_LOG_INFO, + "frame %c:%-5d Avg QP:%5.2f size:%6.0f PSNR Mean Y:%5.2f U:%5.2f V:%5.2f Avg:%5.2f Global:%5.2f\n", + slice_type_to_char[i_slice], + i_count, + h->stat.f_frame_qp[i_slice] / i_count, + (double)h->stat.i_frame_size[i_slice] / i_count, + h->stat.f_psnr_mean_y[i_slice] / dur, h->stat.f_psnr_mean_u[i_slice] / dur, h->stat.f_psnr_mean_v[i_slice] / dur, + h->stat.f_psnr_average[i_slice] / dur, + x264_psnr( h->stat.f_ssd_global[i_slice], dur * i_yuv_size ) ); + } + else + { + x264_log( h, X264_LOG_INFO, + "frame %c:%-5d Avg QP:%5.2f size:%6.0f\n", + slice_type_to_char[i_slice], + i_count, + h->stat.f_frame_qp[i_slice] / i_count, + (double)h->stat.i_frame_size[i_slice] / i_count ); + } + } + } + if( h->param.i_bframe && h->stat.i_frame_count[SLICE_TYPE_B] ) + { + char *p = buf; + int den = 0; + // weight by number of frames (including the I/P-frames) that are in a sequence of N B-frames + for( int i = 0; i <= h->param.i_bframe; i++ ) + den += (i+1) * h->stat.i_consecutive_bframes[i]; + for( int i = 0; i <= h->param.i_bframe; i++ ) + p += sprintf( p, " %4.1f%%", 100. * (i+1) * h->stat.i_consecutive_bframes[i] / den ); + x264_log( h, X264_LOG_INFO, "consecutive B-frames:%s\n", buf ); + } + + for( int i_type = 0; i_type < 2; i_type++ ) + for( int i = 0; i < X264_PARTTYPE_MAX; i++ ) + { + if( i == D_DIRECT_8x8 ) continue; /* direct is counted as its own type */ + i_mb_count_size[i_type][x264_mb_partition_pixel_table[i]] += h->stat.i_mb_partition[i_type][i]; + } + + /* MB types used */ + if( h->stat.i_frame_count[SLICE_TYPE_I] > 0 ) + { + int64_t *i_mb_count = h->stat.i_mb_count[SLICE_TYPE_I]; + double i_count = (double)h->stat.i_frame_count[SLICE_TYPE_I] * h->mb.i_mb_count / 100.0; + x264_print_intra( i_mb_count, i_count, b_print_pcm, buf ); + x264_log( h, X264_LOG_INFO, "mb I %s\n", buf ); + } + if( h->stat.i_frame_count[SLICE_TYPE_P] > 0 ) + { + int64_t *i_mb_count = h->stat.i_mb_count[SLICE_TYPE_P]; + double i_count = (double)h->stat.i_frame_count[SLICE_TYPE_P] * h->mb.i_mb_count / 100.0; + int64_t *i_mb_size = i_mb_count_size[SLICE_TYPE_P]; + x264_print_intra( i_mb_count, i_count, b_print_pcm, buf ); + x264_log( h, X264_LOG_INFO, + "mb P %s P16..4: %4.1f%% %4.1f%% %4.1f%% %4.1f%% %4.1f%% skip:%4.1f%%\n", + buf, + i_mb_size[PIXEL_16x16] / (i_count*4), + (i_mb_size[PIXEL_16x8] + i_mb_size[PIXEL_8x16]) / (i_count*4), + i_mb_size[PIXEL_8x8] / (i_count*4), + (i_mb_size[PIXEL_8x4] + i_mb_size[PIXEL_4x8]) / (i_count*4), + i_mb_size[PIXEL_4x4] / (i_count*4), + i_mb_count[P_SKIP] / i_count ); + } + if( h->stat.i_frame_count[SLICE_TYPE_B] > 0 ) + { + int64_t *i_mb_count = h->stat.i_mb_count[SLICE_TYPE_B]; + double i_count = (double)h->stat.i_frame_count[SLICE_TYPE_B] * h->mb.i_mb_count / 100.0; + double i_mb_list_count; + int64_t *i_mb_size = i_mb_count_size[SLICE_TYPE_B]; + int64_t list_count[3] = {0}; /* 0 == L0, 1 == L1, 2 == BI */ + x264_print_intra( i_mb_count, i_count, b_print_pcm, buf ); + for( int i = 0; i < X264_PARTTYPE_MAX; i++ ) + for( int j = 0; j < 2; j++ ) + { + int l0 = x264_mb_type_list_table[i][0][j]; + int l1 = x264_mb_type_list_table[i][1][j]; + if( l0 || l1 ) + list_count[l1+l0*l1] += h->stat.i_mb_count[SLICE_TYPE_B][i] * 2; + } + list_count[0] += h->stat.i_mb_partition[SLICE_TYPE_B][D_L0_8x8]; + list_count[1] += h->stat.i_mb_partition[SLICE_TYPE_B][D_L1_8x8]; + list_count[2] += h->stat.i_mb_partition[SLICE_TYPE_B][D_BI_8x8]; + i_mb_count[B_DIRECT] += (h->stat.i_mb_partition[SLICE_TYPE_B][D_DIRECT_8x8]+2)/4; + i_mb_list_count = (list_count[0] + list_count[1] + list_count[2]) / 100.0; + sprintf( buf + strlen(buf), " B16..8: %4.1f%% %4.1f%% %4.1f%% direct:%4.1f%% skip:%4.1f%%", + i_mb_size[PIXEL_16x16] / (i_count*4), + (i_mb_size[PIXEL_16x8] + i_mb_size[PIXEL_8x16]) / (i_count*4), + i_mb_size[PIXEL_8x8] / (i_count*4), + i_mb_count[B_DIRECT] / i_count, + i_mb_count[B_SKIP] / i_count ); + if( i_mb_list_count != 0 ) + sprintf( buf + strlen(buf), " L0:%4.1f%% L1:%4.1f%% BI:%4.1f%%", + list_count[0] / i_mb_list_count, + list_count[1] / i_mb_list_count, + list_count[2] / i_mb_list_count ); + x264_log( h, X264_LOG_INFO, "mb B %s\n", buf ); + } + + x264_ratecontrol_summary( h ); + + if( h->stat.i_frame_count[SLICE_TYPE_I] + h->stat.i_frame_count[SLICE_TYPE_P] + h->stat.i_frame_count[SLICE_TYPE_B] > 0 ) + { +#define SUM3(p) (p[SLICE_TYPE_I] + p[SLICE_TYPE_P] + p[SLICE_TYPE_B]) +#define SUM3b(p,o) (p[SLICE_TYPE_I][o] + p[SLICE_TYPE_P][o] + p[SLICE_TYPE_B][o]) + int64_t i_i8x8 = SUM3b( h->stat.i_mb_count, I_8x8 ); + int64_t i_intra = i_i8x8 + SUM3b( h->stat.i_mb_count, I_4x4 ) + + SUM3b( h->stat.i_mb_count, I_16x16 ); + int64_t i_all_intra = i_intra + SUM3b( h->stat.i_mb_count, I_PCM); + int64_t i_skip = SUM3b( h->stat.i_mb_count, P_SKIP ) + + SUM3b( h->stat.i_mb_count, B_SKIP ); + const int i_count = h->stat.i_frame_count[SLICE_TYPE_I] + + h->stat.i_frame_count[SLICE_TYPE_P] + + h->stat.i_frame_count[SLICE_TYPE_B]; + int64_t i_mb_count = (int64_t)i_count * h->mb.i_mb_count; + int64_t i_inter = i_mb_count - i_skip - i_intra; + const double duration = h->stat.f_frame_duration[SLICE_TYPE_I] + + h->stat.f_frame_duration[SLICE_TYPE_P] + + h->stat.f_frame_duration[SLICE_TYPE_B]; + float f_bitrate = SUM3(h->stat.i_frame_size) / duration / 125; + + if( PARAM_INTERLACED ) + { + char *fieldstats = buf; + fieldstats[0] = 0; + if( i_inter ) + fieldstats += sprintf( fieldstats, " inter:%.1f%%", h->stat.i_mb_field[1] * 100.0 / i_inter ); + if( i_skip ) + fieldstats += sprintf( fieldstats, " skip:%.1f%%", h->stat.i_mb_field[2] * 100.0 / i_skip ); + x264_log( h, X264_LOG_INFO, "field mbs: intra: %.1f%%%s\n", + h->stat.i_mb_field[0] * 100.0 / i_intra, buf ); + } + + if( h->pps->b_transform_8x8_mode ) + { + buf[0] = 0; + if( h->stat.i_mb_count_8x8dct[0] ) + sprintf( buf, " inter:%.1f%%", 100. * h->stat.i_mb_count_8x8dct[1] / h->stat.i_mb_count_8x8dct[0] ); + x264_log( h, X264_LOG_INFO, "8x8 transform intra:%.1f%%%s\n", 100. * i_i8x8 / i_intra, buf ); + } + + if( (h->param.analyse.i_direct_mv_pred == X264_DIRECT_PRED_AUTO || + (h->stat.i_direct_frames[0] && h->stat.i_direct_frames[1])) + && h->stat.i_frame_count[SLICE_TYPE_B] ) + { + x264_log( h, X264_LOG_INFO, "direct mvs spatial:%.1f%% temporal:%.1f%%\n", + h->stat.i_direct_frames[1] * 100. / h->stat.i_frame_count[SLICE_TYPE_B], + h->stat.i_direct_frames[0] * 100. / h->stat.i_frame_count[SLICE_TYPE_B] ); + } + + buf[0] = 0; + int csize = CHROMA444 ? 4 : 1; + if( i_mb_count != i_all_intra ) + sprintf( buf, " inter: %.1f%% %.1f%% %.1f%%", + h->stat.i_mb_cbp[1] * 100.0 / ((i_mb_count - i_all_intra)*4), + h->stat.i_mb_cbp[3] * 100.0 / ((i_mb_count - i_all_intra)*csize), + h->stat.i_mb_cbp[5] * 100.0 / ((i_mb_count - i_all_intra)*csize) ); + x264_log( h, X264_LOG_INFO, "coded y,%s,%s intra: %.1f%% %.1f%% %.1f%%%s\n", + CHROMA444?"u":"uvDC", CHROMA444?"v":"uvAC", + h->stat.i_mb_cbp[0] * 100.0 / (i_all_intra*4), + h->stat.i_mb_cbp[2] * 100.0 / (i_all_intra*csize), + h->stat.i_mb_cbp[4] * 100.0 / (i_all_intra*csize), buf ); + + int64_t fixed_pred_modes[4][9] = {{0}}; + int64_t sum_pred_modes[4] = {0}; + for( int i = 0; i <= I_PRED_16x16_DC_128; i++ ) + { + fixed_pred_modes[0][x264_mb_pred_mode16x16_fix[i]] += h->stat.i_mb_pred_mode[0][i]; + sum_pred_modes[0] += h->stat.i_mb_pred_mode[0][i]; + } + if( sum_pred_modes[0] ) + x264_log( h, X264_LOG_INFO, "i16 v,h,dc,p: %2.0f%% %2.0f%% %2.0f%% %2.0f%%\n", + fixed_pred_modes[0][0] * 100.0 / sum_pred_modes[0], + fixed_pred_modes[0][1] * 100.0 / sum_pred_modes[0], + fixed_pred_modes[0][2] * 100.0 / sum_pred_modes[0], + fixed_pred_modes[0][3] * 100.0 / sum_pred_modes[0] ); + for( int i = 1; i <= 2; i++ ) + { + for( int j = 0; j <= I_PRED_8x8_DC_128; j++ ) + { + fixed_pred_modes[i][x264_mb_pred_mode4x4_fix(j)] += h->stat.i_mb_pred_mode[i][j]; + sum_pred_modes[i] += h->stat.i_mb_pred_mode[i][j]; + } + if( sum_pred_modes[i] ) + x264_log( h, X264_LOG_INFO, "i%d v,h,dc,ddl,ddr,vr,hd,vl,hu: %2.0f%% %2.0f%% %2.0f%% %2.0f%% %2.0f%% %2.0f%% %2.0f%% %2.0f%% %2.0f%%\n", (3-i)*4, + fixed_pred_modes[i][0] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][1] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][2] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][3] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][4] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][5] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][6] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][7] * 100.0 / sum_pred_modes[i], + fixed_pred_modes[i][8] * 100.0 / sum_pred_modes[i] ); + } + for( int i = 0; i <= I_PRED_CHROMA_DC_128; i++ ) + { + fixed_pred_modes[3][x264_mb_chroma_pred_mode_fix[i]] += h->stat.i_mb_pred_mode[3][i]; + sum_pred_modes[3] += h->stat.i_mb_pred_mode[3][i]; + } + if( sum_pred_modes[3] && !CHROMA444 ) + x264_log( h, X264_LOG_INFO, "i8c dc,h,v,p: %2.0f%% %2.0f%% %2.0f%% %2.0f%%\n", + fixed_pred_modes[3][0] * 100.0 / sum_pred_modes[3], + fixed_pred_modes[3][1] * 100.0 / sum_pred_modes[3], + fixed_pred_modes[3][2] * 100.0 / sum_pred_modes[3], + fixed_pred_modes[3][3] * 100.0 / sum_pred_modes[3] ); + + if( h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE && h->stat.i_frame_count[SLICE_TYPE_P] > 0 ) + x264_log( h, X264_LOG_INFO, "Weighted P-Frames: Y:%.1f%% UV:%.1f%%\n", + h->stat.i_wpred[0] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P], + h->stat.i_wpred[1] * 100.0 / h->stat.i_frame_count[SLICE_TYPE_P] ); + + for( int i_list = 0; i_list < 2; i_list++ ) + for( int i_slice = 0; i_slice < 2; i_slice++ ) + { + char *p = buf; + int64_t i_den = 0; + int i_max = 0; + for( int i = 0; i < X264_REF_MAX*2; i++ ) + if( h->stat.i_mb_count_ref[i_slice][i_list][i] ) + { + i_den += h->stat.i_mb_count_ref[i_slice][i_list][i]; + i_max = i; + } + if( i_max == 0 ) + continue; + for( int i = 0; i <= i_max; i++ ) + p += sprintf( p, " %4.1f%%", 100. * h->stat.i_mb_count_ref[i_slice][i_list][i] / i_den ); + x264_log( h, X264_LOG_INFO, "ref %c L%d:%s\n", "PB"[i_slice], i_list, buf ); + } + + if( h->param.analyse.b_ssim ) + { + float ssim = SUM3( h->stat.f_ssim_mean_y ) / duration; + x264_log( h, X264_LOG_INFO, "SSIM Mean Y:%.7f (%6.3fdb)\n", ssim, x264_ssim( ssim ) ); + } + if( h->param.analyse.b_psnr ) + { + x264_log( h, X264_LOG_INFO, + "PSNR Mean Y:%6.3f U:%6.3f V:%6.3f Avg:%6.3f Global:%6.3f kb/s:%.2f\n", + SUM3( h->stat.f_psnr_mean_y ) / duration, + SUM3( h->stat.f_psnr_mean_u ) / duration, + SUM3( h->stat.f_psnr_mean_v ) / duration, + SUM3( h->stat.f_psnr_average ) / duration, + x264_psnr( SUM3( h->stat.f_ssd_global ), duration * i_yuv_size ), + f_bitrate ); + } + else + x264_log( h, X264_LOG_INFO, "kb/s:%.2f\n", f_bitrate ); + } + + /* rc */ + x264_ratecontrol_delete( h ); + + /* param */ + if( h->param.rc.psz_stat_out ) + free( h->param.rc.psz_stat_out ); + if( h->param.rc.psz_stat_in ) + free( h->param.rc.psz_stat_in ); + + x264_cqm_delete( h ); + x264_free( h->nal_buffer ); + x264_free( h->reconfig_h ); + x264_analyse_free_costs( h ); + + if( h->i_thread_frames > 1 ) + h = h->thread[h->i_thread_phase]; + + /* frames */ + x264_frame_delete_list( h->frames.unused[0] ); + x264_frame_delete_list( h->frames.unused[1] ); + x264_frame_delete_list( h->frames.current ); + x264_frame_delete_list( h->frames.blank_unused ); + + h = h->thread[0]; + + for( int i = 0; i < h->i_thread_frames; i++ ) + if( h->thread[i]->b_thread_active ) + for( int j = 0; j < h->thread[i]->i_ref[0]; j++ ) + if( h->thread[i]->fref[0][j] && h->thread[i]->fref[0][j]->b_duplicate ) + x264_frame_delete( h->thread[i]->fref[0][j] ); + + if( h->param.i_lookahead_threads > 1 ) + for( int i = 0; i < h->param.i_lookahead_threads; i++ ) + x264_free( h->lookahead_thread[i] ); + + for( int i = h->param.i_threads - 1; i >= 0; i-- ) + { + x264_frame_t **frame; + + if( !h->param.b_sliced_threads || i == 0 ) + { + for( frame = h->thread[i]->frames.reference; *frame; frame++ ) + { + assert( (*frame)->i_reference_count > 0 ); + (*frame)->i_reference_count--; + if( (*frame)->i_reference_count == 0 ) + x264_frame_delete( *frame ); + } + frame = &h->thread[i]->fdec; + if( *frame ) + { + assert( (*frame)->i_reference_count > 0 ); + (*frame)->i_reference_count--; + if( (*frame)->i_reference_count == 0 ) + x264_frame_delete( *frame ); + } + x264_macroblock_cache_free( h->thread[i] ); + } + x264_macroblock_thread_free( h->thread[i], 0 ); + x264_free( h->thread[i]->out.p_bitstream ); + x264_free( h->thread[i]->out.nal ); + x264_pthread_mutex_destroy( &h->thread[i]->mutex ); + x264_pthread_cond_destroy( &h->thread[i]->cv ); + x264_free( h->thread[i] ); + } +#if HAVE_OPENCL + x264_opencl_close_library( ocl ); +#endif +} + +int x264_encoder_delayed_frames( x264_t *h ) +{ + int delayed_frames = 0; + if( h->i_thread_frames > 1 ) + { + for( int i = 0; i < h->i_thread_frames; i++ ) + delayed_frames += h->thread[i]->b_thread_active; + h = h->thread[h->i_thread_phase]; + } + for( int i = 0; h->frames.current[i]; i++ ) + delayed_frames++; + x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex ); + x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex ); + x264_pthread_mutex_lock( &h->lookahead->next.mutex ); + delayed_frames += h->lookahead->ifbuf.i_size + h->lookahead->next.i_size + h->lookahead->ofbuf.i_size; + x264_pthread_mutex_unlock( &h->lookahead->next.mutex ); + x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex ); + x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex ); + return delayed_frames; +} + +int x264_encoder_maximum_delayed_frames( x264_t *h ) +{ + return h->frames.i_delay; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/lookahead.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/lookahead.c new file mode 100644 index 00000000..2080c461 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/lookahead.c @@ -0,0 +1,244 @@ +/***************************************************************************** + * lookahead.c: high-level lookahead functions + ***************************************************************************** + * Copyright (C) 2010-2017 Avail Media and x264 project + * + * Authors: Michael Kazmier + * Alex Giladi + * Steven Walters + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +/* LOOKAHEAD (threaded and non-threaded mode) + * + * Lookahead types: + * [1] Slice type / scene cut; + * + * In non-threaded mode, we run the existing slicetype decision code as it was. + * In threaded mode, we run in a separate thread, that lives between the calls + * to x264_encoder_open() and x264_encoder_close(), and performs lookahead for + * the number of frames specified in rc_lookahead. Recommended setting is + * # of bframes + # of threads. + */ +#include "common/common.h" +#include "analyse.h" + +static void x264_lookahead_shift( x264_sync_frame_list_t *dst, x264_sync_frame_list_t *src, int count ) +{ + int i = count; + while( i-- ) + { + assert( dst->i_size < dst->i_max_size ); + assert( src->i_size ); + dst->list[ dst->i_size++ ] = x264_frame_shift( src->list ); + src->i_size--; + } + if( count ) + { + x264_pthread_cond_broadcast( &dst->cv_fill ); + x264_pthread_cond_broadcast( &src->cv_empty ); + } +} + +static void x264_lookahead_update_last_nonb( x264_t *h, x264_frame_t *new_nonb ) +{ + if( h->lookahead->last_nonb ) + x264_frame_push_unused( h, h->lookahead->last_nonb ); + h->lookahead->last_nonb = new_nonb; + new_nonb->i_reference_count++; +} + +#if HAVE_THREAD +static void x264_lookahead_slicetype_decide( x264_t *h ) +{ + x264_stack_align( x264_slicetype_decide, h ); + + x264_lookahead_update_last_nonb( h, h->lookahead->next.list[0] ); + int shift_frames = h->lookahead->next.list[0]->i_bframes + 1; + + x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex ); + while( h->lookahead->ofbuf.i_size == h->lookahead->ofbuf.i_max_size ) + x264_pthread_cond_wait( &h->lookahead->ofbuf.cv_empty, &h->lookahead->ofbuf.mutex ); + + x264_pthread_mutex_lock( &h->lookahead->next.mutex ); + x264_lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames ); + x264_pthread_mutex_unlock( &h->lookahead->next.mutex ); + + /* For MB-tree and VBV lookahead, we have to perform propagation analysis on I-frames too. */ + if( h->lookahead->b_analyse_keyframe && IS_X264_TYPE_I( h->lookahead->last_nonb->i_type ) ) + x264_stack_align( x264_slicetype_analyse, h, shift_frames ); + + x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex ); +} + +static void *x264_lookahead_thread( x264_t *h ) +{ + while( !h->lookahead->b_exit_thread ) + { + x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex ); + x264_pthread_mutex_lock( &h->lookahead->next.mutex ); + int shift = X264_MIN( h->lookahead->next.i_max_size - h->lookahead->next.i_size, h->lookahead->ifbuf.i_size ); + x264_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, shift ); + x264_pthread_mutex_unlock( &h->lookahead->next.mutex ); + if( h->lookahead->next.i_size <= h->lookahead->i_slicetype_length + h->param.b_vfr_input ) + { + while( !h->lookahead->ifbuf.i_size && !h->lookahead->b_exit_thread ) + x264_pthread_cond_wait( &h->lookahead->ifbuf.cv_fill, &h->lookahead->ifbuf.mutex ); + x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex ); + } + else + { + x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex ); + x264_lookahead_slicetype_decide( h ); + } + } /* end of input frames */ + x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex ); + x264_pthread_mutex_lock( &h->lookahead->next.mutex ); + x264_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, h->lookahead->ifbuf.i_size ); + x264_pthread_mutex_unlock( &h->lookahead->next.mutex ); + x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex ); + while( h->lookahead->next.i_size ) + x264_lookahead_slicetype_decide( h ); + x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex ); + h->lookahead->b_thread_active = 0; + x264_pthread_cond_broadcast( &h->lookahead->ofbuf.cv_fill ); + x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex ); + return NULL; +} +#endif + +int x264_lookahead_init( x264_t *h, int i_slicetype_length ) +{ + x264_lookahead_t *look; + CHECKED_MALLOCZERO( look, sizeof(x264_lookahead_t) ); + for( int i = 0; i < h->param.i_threads; i++ ) + h->thread[i]->lookahead = look; + + look->i_last_keyframe = - h->param.i_keyint_max; + look->b_analyse_keyframe = (h->param.rc.b_mb_tree || (h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead)) + && !h->param.rc.b_stat_read; + look->i_slicetype_length = i_slicetype_length; + + /* init frame lists */ + if( x264_sync_frame_list_init( &look->ifbuf, h->param.i_sync_lookahead+3 ) || + x264_sync_frame_list_init( &look->next, h->frames.i_delay+3 ) || + x264_sync_frame_list_init( &look->ofbuf, h->frames.i_delay+3 ) ) + goto fail; + + if( !h->param.i_sync_lookahead ) + return 0; + + x264_t *look_h = h->thread[h->param.i_threads]; + *look_h = *h; + if( x264_macroblock_cache_allocate( look_h ) ) + goto fail; + + if( x264_macroblock_thread_allocate( look_h, 1 ) < 0 ) + goto fail; + + if( x264_pthread_create( &look->thread_handle, NULL, (void*)x264_lookahead_thread, look_h ) ) + goto fail; + look->b_thread_active = 1; + + return 0; +fail: + x264_free( look ); + return -1; +} + +void x264_lookahead_delete( x264_t *h ) +{ + if( h->param.i_sync_lookahead ) + { + x264_pthread_mutex_lock( &h->lookahead->ifbuf.mutex ); + h->lookahead->b_exit_thread = 1; + x264_pthread_cond_broadcast( &h->lookahead->ifbuf.cv_fill ); + x264_pthread_mutex_unlock( &h->lookahead->ifbuf.mutex ); + x264_pthread_join( h->lookahead->thread_handle, NULL ); + x264_macroblock_cache_free( h->thread[h->param.i_threads] ); + x264_macroblock_thread_free( h->thread[h->param.i_threads], 1 ); + x264_free( h->thread[h->param.i_threads] ); + } + x264_sync_frame_list_delete( &h->lookahead->ifbuf ); + x264_sync_frame_list_delete( &h->lookahead->next ); + if( h->lookahead->last_nonb ) + x264_frame_push_unused( h, h->lookahead->last_nonb ); + x264_sync_frame_list_delete( &h->lookahead->ofbuf ); + x264_free( h->lookahead ); +} + +void x264_lookahead_put_frame( x264_t *h, x264_frame_t *frame ) +{ + if( h->param.i_sync_lookahead ) + x264_sync_frame_list_push( &h->lookahead->ifbuf, frame ); + else + x264_sync_frame_list_push( &h->lookahead->next, frame ); +} + +int x264_lookahead_is_empty( x264_t *h ) +{ + x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex ); + x264_pthread_mutex_lock( &h->lookahead->next.mutex ); + int b_empty = !h->lookahead->next.i_size && !h->lookahead->ofbuf.i_size; + x264_pthread_mutex_unlock( &h->lookahead->next.mutex ); + x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex ); + return b_empty; +} + +static void x264_lookahead_encoder_shift( x264_t *h ) +{ + if( !h->lookahead->ofbuf.i_size ) + return; + int i_frames = h->lookahead->ofbuf.list[0]->i_bframes + 1; + while( i_frames-- ) + { + x264_frame_push( h->frames.current, x264_frame_shift( h->lookahead->ofbuf.list ) ); + h->lookahead->ofbuf.i_size--; + } + x264_pthread_cond_broadcast( &h->lookahead->ofbuf.cv_empty ); +} + +void x264_lookahead_get_frames( x264_t *h ) +{ + if( h->param.i_sync_lookahead ) + { /* We have a lookahead thread, so get frames from there */ + x264_pthread_mutex_lock( &h->lookahead->ofbuf.mutex ); + while( !h->lookahead->ofbuf.i_size && h->lookahead->b_thread_active ) + x264_pthread_cond_wait( &h->lookahead->ofbuf.cv_fill, &h->lookahead->ofbuf.mutex ); + x264_lookahead_encoder_shift( h ); + x264_pthread_mutex_unlock( &h->lookahead->ofbuf.mutex ); + } + else + { /* We are not running a lookahead thread, so perform all the slicetype decide on the fly */ + + if( h->frames.current[0] || !h->lookahead->next.i_size ) + return; + + x264_stack_align( x264_slicetype_decide, h ); + x264_lookahead_update_last_nonb( h, h->lookahead->next.list[0] ); + int shift_frames = h->lookahead->next.list[0]->i_bframes + 1; + x264_lookahead_shift( &h->lookahead->ofbuf, &h->lookahead->next, shift_frames ); + + /* For MB-tree and VBV lookahead, we have to perform propagation analysis on I-frames too. */ + if( h->lookahead->b_analyse_keyframe && IS_X264_TYPE_I( h->lookahead->last_nonb->i_type ) ) + x264_stack_align( x264_slicetype_analyse, h, shift_frames ); + + x264_lookahead_encoder_shift( h ); + } +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.c new file mode 100644 index 00000000..929fcc8e --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.c @@ -0,0 +1,1419 @@ +/***************************************************************************** + * macroblock.c: macroblock encoding + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * Henrik Gramner + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "macroblock.h" + +/* These chroma DC functions don't have assembly versions and are only used here. */ + +#define ZIG(i,y,x) level[i] = dct[x*2+y]; +static inline void zigzag_scan_2x2_dc( dctcoef level[4], dctcoef dct[4] ) +{ + ZIG(0,0,0) + ZIG(1,0,1) + ZIG(2,1,0) + ZIG(3,1,1) +} +#undef ZIG + +static inline void zigzag_scan_2x4_dc( dctcoef level[8], dctcoef dct[8] ) +{ + level[0] = dct[0]; + level[1] = dct[2]; + level[2] = dct[1]; + level[3] = dct[4]; + level[4] = dct[6]; + level[5] = dct[3]; + level[6] = dct[5]; + level[7] = dct[7]; +} + +#define IDCT_DEQUANT_2X2_START \ + int d0 = dct[0] + dct[1]; \ + int d1 = dct[2] + dct[3]; \ + int d2 = dct[0] - dct[1]; \ + int d3 = dct[2] - dct[3]; \ + int dmf = dequant_mf[i_qp%6][0] << i_qp/6; + +static inline void idct_dequant_2x2_dc( dctcoef dct[4], dctcoef dct4x4[4][16], int dequant_mf[6][16], int i_qp ) +{ + IDCT_DEQUANT_2X2_START + dct4x4[0][0] = (d0 + d1) * dmf >> 5; + dct4x4[1][0] = (d0 - d1) * dmf >> 5; + dct4x4[2][0] = (d2 + d3) * dmf >> 5; + dct4x4[3][0] = (d2 - d3) * dmf >> 5; +} + +static inline void idct_dequant_2x2_dconly( dctcoef dct[4], int dequant_mf[6][16], int i_qp ) +{ + IDCT_DEQUANT_2X2_START + dct[0] = (d0 + d1) * dmf >> 5; + dct[1] = (d0 - d1) * dmf >> 5; + dct[2] = (d2 + d3) * dmf >> 5; + dct[3] = (d2 - d3) * dmf >> 5; +} +#undef IDCT_2X2_DEQUANT_START + +static inline void dct2x2dc( dctcoef d[4], dctcoef dct4x4[4][16] ) +{ + int d0 = dct4x4[0][0] + dct4x4[1][0]; + int d1 = dct4x4[2][0] + dct4x4[3][0]; + int d2 = dct4x4[0][0] - dct4x4[1][0]; + int d3 = dct4x4[2][0] - dct4x4[3][0]; + d[0] = d0 + d1; + d[2] = d2 + d3; + d[1] = d0 - d1; + d[3] = d2 - d3; + dct4x4[0][0] = 0; + dct4x4[1][0] = 0; + dct4x4[2][0] = 0; + dct4x4[3][0] = 0; +} + +static ALWAYS_INLINE int array_non_zero( dctcoef *v, int i_count ) +{ + if( WORD_SIZE == 8 ) + { + for( int i = 0; i < i_count; i += 8/sizeof(dctcoef) ) + if( M64( &v[i] ) ) + return 1; + } + else + { + for( int i = 0; i < i_count; i += 4/sizeof(dctcoef) ) + if( M32( &v[i] ) ) + return 1; + } + return 0; +} + +/* All encoding functions must output the correct CBP and NNZ values. + * The entropy coding functions will check CBP first, then NNZ, before + * actually reading the DCT coefficients. NNZ still must be correct even + * if CBP is zero because of the use of NNZ values for context selection. + * "NNZ" need only be 0 or 1 rather than the exact coefficient count because + * that is only needed in CAVLC, and will be calculated by CAVLC's residual + * coding and stored as necessary. */ + +/* This means that decimation can be done merely by adjusting the CBP and NNZ + * rather than memsetting the coefficients. */ + +static void x264_mb_encode_i16x16( x264_t *h, int p, int i_qp ) +{ + pixel *p_src = h->mb.pic.p_fenc[p]; + pixel *p_dst = h->mb.pic.p_fdec[p]; + + ALIGNED_ARRAY_64( dctcoef, dct4x4,[16],[16] ); + ALIGNED_ARRAY_64( dctcoef, dct_dc4x4,[16] ); + + int nz, block_cbp = 0; + int decimate_score = h->mb.b_dct_decimate ? 0 : 9; + int i_quant_cat = p ? CQM_4IC : CQM_4IY; + int i_mode = h->mb.i_intra16x16_pred_mode; + + if( h->mb.b_lossless ) + x264_predict_lossless_16x16( h, p, i_mode ); + else + h->predict_16x16[i_mode]( h->mb.pic.p_fdec[p] ); + + if( h->mb.b_lossless ) + { + for( int i = 0; i < 16; i++ ) + { + int oe = block_idx_xy_fenc[i]; + int od = block_idx_xy_fdec[i]; + nz = h->zigzagf.sub_4x4ac( h->dct.luma4x4[16*p+i], p_src+oe, p_dst+od, &dct_dc4x4[block_idx_yx_1d[i]] ); + h->mb.cache.non_zero_count[x264_scan8[16*p+i]] = nz; + block_cbp |= nz; + } + h->mb.i_cbp_luma |= block_cbp * 0xf; + h->mb.cache.non_zero_count[x264_scan8[LUMA_DC+p]] = array_non_zero( dct_dc4x4, 16 ); + h->zigzagf.scan_4x4( h->dct.luma16x16_dc[p], dct_dc4x4 ); + return; + } + + CLEAR_16x16_NNZ( p ); + + h->dctf.sub16x16_dct( dct4x4, p_src, p_dst ); + + if( h->mb.b_noise_reduction ) + for( int idx = 0; idx < 16; idx++ ) + h->quantf.denoise_dct( dct4x4[idx], h->nr_residual_sum[0], h->nr_offset[0], 16 ); + + for( int idx = 0; idx < 16; idx++ ) + { + dct_dc4x4[block_idx_xy_1d[idx]] = dct4x4[idx][0]; + dct4x4[idx][0] = 0; + } + + if( h->mb.b_trellis ) + { + for( int idx = 0; idx < 16; idx++ ) + if( x264_quant_4x4_trellis( h, dct4x4[idx], i_quant_cat, i_qp, ctx_cat_plane[DCT_LUMA_AC][p], 1, !!p, idx ) ) + { + block_cbp = 0xf; + h->zigzagf.scan_4x4( h->dct.luma4x4[16*p+idx], dct4x4[idx] ); + h->quantf.dequant_4x4( dct4x4[idx], h->dequant4_mf[i_quant_cat], i_qp ); + if( decimate_score < 6 ) decimate_score += h->quantf.decimate_score15( h->dct.luma4x4[16*p+idx] ); + h->mb.cache.non_zero_count[x264_scan8[16*p+idx]] = 1; + } + } + else + { + for( int i8x8 = 0; i8x8 < 4; i8x8++ ) + { + nz = h->quantf.quant_4x4x4( &dct4x4[i8x8*4], h->quant4_mf[i_quant_cat][i_qp], h->quant4_bias[i_quant_cat][i_qp] ); + if( nz ) + { + block_cbp = 0xf; + FOREACH_BIT( idx, i8x8*4, nz ) + { + h->zigzagf.scan_4x4( h->dct.luma4x4[16*p+idx], dct4x4[idx] ); + h->quantf.dequant_4x4( dct4x4[idx], h->dequant4_mf[i_quant_cat], i_qp ); + if( decimate_score < 6 ) decimate_score += h->quantf.decimate_score15( h->dct.luma4x4[16*p+idx] ); + h->mb.cache.non_zero_count[x264_scan8[16*p+idx]] = 1; + } + } + } + } + + /* Writing the 16 CBFs in an i16x16 block is quite costly, so decimation can save many bits. */ + /* More useful with CAVLC, but still useful with CABAC. */ + if( decimate_score < 6 ) + { + CLEAR_16x16_NNZ( p ); + block_cbp = 0; + } + else + h->mb.i_cbp_luma |= block_cbp; + + h->dctf.dct4x4dc( dct_dc4x4 ); + if( h->mb.b_trellis ) + nz = x264_quant_luma_dc_trellis( h, dct_dc4x4, i_quant_cat, i_qp, ctx_cat_plane[DCT_LUMA_DC][p], 1, LUMA_DC+p ); + else + nz = h->quantf.quant_4x4_dc( dct_dc4x4, h->quant4_mf[i_quant_cat][i_qp][0]>>1, h->quant4_bias[i_quant_cat][i_qp][0]<<1 ); + + h->mb.cache.non_zero_count[x264_scan8[LUMA_DC+p]] = nz; + if( nz ) + { + h->zigzagf.scan_4x4( h->dct.luma16x16_dc[p], dct_dc4x4 ); + + /* output samples to fdec */ + h->dctf.idct4x4dc( dct_dc4x4 ); + h->quantf.dequant_4x4_dc( dct_dc4x4, h->dequant4_mf[i_quant_cat], i_qp ); /* XXX not inversed */ + if( block_cbp ) + for( int i = 0; i < 16; i++ ) + dct4x4[i][0] = dct_dc4x4[block_idx_xy_1d[i]]; + } + + /* put pixels to fdec */ + if( block_cbp ) + h->dctf.add16x16_idct( p_dst, dct4x4 ); + else if( nz ) + h->dctf.add16x16_idct_dc( p_dst, dct_dc4x4 ); +} + +/* Round down coefficients losslessly in DC-only chroma blocks. + * Unlike luma blocks, this can't be done with a lookup table or + * other shortcut technique because of the interdependencies + * between the coefficients due to the chroma DC transform. */ +static ALWAYS_INLINE int x264_mb_optimize_chroma_dc( x264_t *h, dctcoef *dct_dc, int dequant_mf[6][16], int i_qp, int chroma422 ) +{ + int dmf = dequant_mf[i_qp%6][0] << i_qp/6; + + /* If the QP is too high, there's no benefit to rounding optimization. */ + if( dmf > 32*64 ) + return 1; + + if( chroma422 ) + return h->quantf.optimize_chroma_2x4_dc( dct_dc, dmf ); + else + return h->quantf.optimize_chroma_2x2_dc( dct_dc, dmf ); +} + +static ALWAYS_INLINE void x264_mb_encode_chroma_internal( x264_t *h, int b_inter, int i_qp, int chroma422 ) +{ + int nz, nz_dc; + int b_decimate = b_inter && h->mb.b_dct_decimate; + int (*dequant_mf)[16] = h->dequant4_mf[CQM_4IC + b_inter]; + ALIGNED_ARRAY_16( dctcoef, dct_dc,[8] ); + h->mb.i_cbp_chroma = 0; + h->nr_count[2] += h->mb.b_noise_reduction * 4; + + M16( &h->mb.cache.non_zero_count[x264_scan8[16]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[18]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[32]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[34]] ) = 0; + if( chroma422 ) + { + M16( &h->mb.cache.non_zero_count[x264_scan8[24]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[26]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[40]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[42]] ) = 0; + } + + /* Early termination: check variance of chroma residual before encoding. + * Don't bother trying early termination at low QPs. + * Values are experimentally derived. */ + if( b_decimate && i_qp >= (h->mb.b_trellis ? 12 : 18) && !h->mb.b_noise_reduction ) + { + int thresh = chroma422 ? (x264_lambda2_tab[i_qp] + 16) >> 5 : (x264_lambda2_tab[i_qp] + 32) >> 6; + ALIGNED_ARRAY_8( int, ssd,[2] ); + int chromapix = chroma422 ? PIXEL_8x16 : PIXEL_8x8; + + if( h->pixf.var2[chromapix]( h->mb.pic.p_fenc[1], h->mb.pic.p_fdec[1], ssd ) < thresh*4 ) + { + h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+0]] = 0; + h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+1]] = 0; + + for( int ch = 0; ch < 2; ch++ ) + { + if( ssd[ch] > thresh ) + { + pixel *p_src = h->mb.pic.p_fenc[1+ch]; + pixel *p_dst = h->mb.pic.p_fdec[1+ch]; + + if( chroma422 ) + /* Cannot be replaced by two calls to sub8x8_dct_dc since the hadamard transform is different */ + h->dctf.sub8x16_dct_dc( dct_dc, p_src, p_dst ); + else + h->dctf.sub8x8_dct_dc( dct_dc, p_src, p_dst ); + + if( h->mb.b_trellis ) + nz_dc = x264_quant_chroma_dc_trellis( h, dct_dc, i_qp+3*chroma422, !b_inter, CHROMA_DC+ch ); + else + { + nz_dc = 0; + for( int i = 0; i <= chroma422; i++ ) + nz_dc |= h->quantf.quant_2x2_dc( &dct_dc[4*i], h->quant4_mf[CQM_4IC+b_inter][i_qp+3*chroma422][0] >> 1, + h->quant4_bias[CQM_4IC+b_inter][i_qp+3*chroma422][0] << 1 ); + } + + if( nz_dc ) + { + if( !x264_mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) ) + continue; + h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = 1; + if( chroma422 ) + { + zigzag_scan_2x4_dc( h->dct.chroma_dc[ch], dct_dc ); + h->quantf.idct_dequant_2x4_dconly( dct_dc, dequant_mf, i_qp+3 ); + } + else + { + zigzag_scan_2x2_dc( h->dct.chroma_dc[ch], dct_dc ); + idct_dequant_2x2_dconly( dct_dc, dequant_mf, i_qp ); + } + + for( int i = 0; i <= chroma422; i++ ) + h->dctf.add8x8_idct_dc( p_dst + 8*i*FDEC_STRIDE, &dct_dc[4*i] ); + h->mb.i_cbp_chroma = 1; + } + } + } + return; + } + } + + for( int ch = 0; ch < 2; ch++ ) + { + pixel *p_src = h->mb.pic.p_fenc[1+ch]; + pixel *p_dst = h->mb.pic.p_fdec[1+ch]; + int i_decimate_score = b_decimate ? 0 : 7; + int nz_ac = 0; + + ALIGNED_ARRAY_64( dctcoef, dct4x4,[8],[16] ); + + if( h->mb.b_lossless ) + { + static const uint8_t chroma422_scan[8] = { 0, 2, 1, 5, 3, 6, 4, 7 }; + + for( int i = 0; i < (chroma422?8:4); i++ ) + { + int oe = 4*(i&1) + 4*(i>>1)*FENC_STRIDE; + int od = 4*(i&1) + 4*(i>>1)*FDEC_STRIDE; + nz = h->zigzagf.sub_4x4ac( h->dct.luma4x4[16+i+(chroma422?i&4:0)+ch*16], p_src+oe, p_dst+od, + &h->dct.chroma_dc[ch][chroma422?chroma422_scan[i]:i] ); + h->mb.cache.non_zero_count[x264_scan8[16+i+(chroma422?i&4:0)+ch*16]] = nz; + h->mb.i_cbp_chroma |= nz; + } + h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = array_non_zero( h->dct.chroma_dc[ch], chroma422?8:4 ); + continue; + } + + for( int i = 0; i <= chroma422; i++ ) + h->dctf.sub8x8_dct( &dct4x4[4*i], p_src + 8*i*FENC_STRIDE, p_dst + 8*i*FDEC_STRIDE ); + + if( h->mb.b_noise_reduction ) + for( int i = 0; i < (chroma422?8:4); i++ ) + h->quantf.denoise_dct( dct4x4[i], h->nr_residual_sum[2], h->nr_offset[2], 16 ); + + if( chroma422 ) + h->dctf.dct2x4dc( dct_dc, dct4x4 ); + else + dct2x2dc( dct_dc, dct4x4 ); + + /* calculate dct coeffs */ + for( int i8x8 = 0; i8x8 < (chroma422?2:1); i8x8++ ) + { + if( h->mb.b_trellis ) + { + for( int i4x4 = 0; i4x4 < 4; i4x4++ ) + { + if( x264_quant_4x4_trellis( h, dct4x4[i8x8*4+i4x4], CQM_4IC+b_inter, i_qp, DCT_CHROMA_AC, !b_inter, 1, 0 ) ) + { + int idx = 16+ch*16+i8x8*8+i4x4; + h->zigzagf.scan_4x4( h->dct.luma4x4[idx], dct4x4[i8x8*4+i4x4] ); + h->quantf.dequant_4x4( dct4x4[i8x8*4+i4x4], dequant_mf, i_qp ); + if( i_decimate_score < 7 ) + i_decimate_score += h->quantf.decimate_score15( h->dct.luma4x4[idx] ); + h->mb.cache.non_zero_count[x264_scan8[idx]] = 1; + nz_ac = 1; + } + } + } + else + { + nz = h->quantf.quant_4x4x4( &dct4x4[i8x8*4], h->quant4_mf[CQM_4IC+b_inter][i_qp], + h->quant4_bias[CQM_4IC+b_inter][i_qp] ); + nz_ac |= nz; + + FOREACH_BIT( i4x4, 0, nz ) + { + int idx = 16+ch*16+i8x8*8+i4x4; + + h->zigzagf.scan_4x4( h->dct.luma4x4[idx], dct4x4[i8x8*4+i4x4] ); + h->quantf.dequant_4x4( dct4x4[i8x8*4+i4x4], dequant_mf, i_qp ); + if( i_decimate_score < 7 ) + i_decimate_score += h->quantf.decimate_score15( h->dct.luma4x4[idx] ); + h->mb.cache.non_zero_count[x264_scan8[idx]] = 1; + } + } + } + + if( h->mb.b_trellis ) + nz_dc = x264_quant_chroma_dc_trellis( h, dct_dc, i_qp+3*chroma422, !b_inter, CHROMA_DC+ch ); + else + { + nz_dc = 0; + for( int i = 0; i <= chroma422; i++ ) + nz_dc |= h->quantf.quant_2x2_dc( &dct_dc[4*i], h->quant4_mf[CQM_4IC+b_inter][i_qp+3*chroma422][0] >> 1, + h->quant4_bias[CQM_4IC+b_inter][i_qp+3*chroma422][0] << 1 ); + } + + h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = nz_dc; + + if( i_decimate_score < 7 || !nz_ac ) + { + /* Decimate the block */ + M16( &h->mb.cache.non_zero_count[x264_scan8[16+16*ch]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[18+16*ch]] ) = 0; + if( chroma422 ) + { + M16( &h->mb.cache.non_zero_count[x264_scan8[24+16*ch]] ) = 0; + M16( &h->mb.cache.non_zero_count[x264_scan8[26+16*ch]] ) = 0; + } + + if( !nz_dc ) /* Whole block is empty */ + continue; + if( !x264_mb_optimize_chroma_dc( h, dct_dc, dequant_mf, i_qp+3*chroma422, chroma422 ) ) + { + h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+ch]] = 0; + continue; + } + /* DC-only */ + if( chroma422 ) + { + zigzag_scan_2x4_dc( h->dct.chroma_dc[ch], dct_dc ); + h->quantf.idct_dequant_2x4_dconly( dct_dc, dequant_mf, i_qp+3 ); + } + else + { + zigzag_scan_2x2_dc( h->dct.chroma_dc[ch], dct_dc ); + idct_dequant_2x2_dconly( dct_dc, dequant_mf, i_qp ); + } + + for( int i = 0; i <= chroma422; i++ ) + h->dctf.add8x8_idct_dc( p_dst + 8*i*FDEC_STRIDE, &dct_dc[4*i] ); + } + else + { + h->mb.i_cbp_chroma = 1; + + if( nz_dc ) + { + if( chroma422 ) + { + zigzag_scan_2x4_dc( h->dct.chroma_dc[ch], dct_dc ); + h->quantf.idct_dequant_2x4_dc( dct_dc, dct4x4, dequant_mf, i_qp+3 ); + } + else + { + zigzag_scan_2x2_dc( h->dct.chroma_dc[ch], dct_dc ); + idct_dequant_2x2_dc( dct_dc, dct4x4, dequant_mf, i_qp ); + } + } + + for( int i = 0; i <= chroma422; i++ ) + h->dctf.add8x8_idct( p_dst + 8*i*FDEC_STRIDE, &dct4x4[4*i] ); + } + } + + /* 0 = none, 1 = DC only, 2 = DC+AC */ + h->mb.i_cbp_chroma += (h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+0]] | + h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+1]] | h->mb.i_cbp_chroma); +} + +void x264_mb_encode_chroma( x264_t *h, int b_inter, int i_qp ) +{ + if( CHROMA_FORMAT == CHROMA_420 ) + x264_mb_encode_chroma_internal( h, b_inter, i_qp, 0 ); + else + x264_mb_encode_chroma_internal( h, b_inter, i_qp, 1 ); +} + +static void x264_macroblock_encode_skip( x264_t *h ) +{ + M32( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[ 8]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[10]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[16+ 0]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[16+ 2]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[32+ 0]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[32+ 2]] ) = 0; + if( CHROMA_FORMAT >= CHROMA_422 ) + { + M32( &h->mb.cache.non_zero_count[x264_scan8[16+ 8]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[16+10]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[32+ 8]] ) = 0; + M32( &h->mb.cache.non_zero_count[x264_scan8[32+10]] ) = 0; + } + h->mb.i_cbp_luma = 0; + h->mb.i_cbp_chroma = 0; + h->mb.cbp[h->mb.i_mb_xy] = 0; +} + +/***************************************************************************** + * Intra prediction for predictive lossless mode. + *****************************************************************************/ + +void x264_predict_lossless_chroma( x264_t *h, int i_mode ) +{ + int height = 16 >> CHROMA_V_SHIFT; + if( i_mode == I_PRED_CHROMA_V ) + { + h->mc.copy[PIXEL_8x8]( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1]-FENC_STRIDE, FENC_STRIDE, height ); + h->mc.copy[PIXEL_8x8]( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2]-FENC_STRIDE, FENC_STRIDE, height ); + memcpy( h->mb.pic.p_fdec[1], h->mb.pic.p_fdec[1]-FDEC_STRIDE, 8*sizeof(pixel) ); + memcpy( h->mb.pic.p_fdec[2], h->mb.pic.p_fdec[2]-FDEC_STRIDE, 8*sizeof(pixel) ); + } + else if( i_mode == I_PRED_CHROMA_H ) + { + h->mc.copy[PIXEL_8x8]( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1]-1, FENC_STRIDE, height ); + h->mc.copy[PIXEL_8x8]( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2]-1, FENC_STRIDE, height ); + x264_copy_column8( h->mb.pic.p_fdec[1]+4*FDEC_STRIDE, h->mb.pic.p_fdec[1]+4*FDEC_STRIDE-1 ); + x264_copy_column8( h->mb.pic.p_fdec[2]+4*FDEC_STRIDE, h->mb.pic.p_fdec[2]+4*FDEC_STRIDE-1 ); + if( CHROMA_FORMAT == CHROMA_422 ) + { + x264_copy_column8( h->mb.pic.p_fdec[1]+12*FDEC_STRIDE, h->mb.pic.p_fdec[1]+12*FDEC_STRIDE-1 ); + x264_copy_column8( h->mb.pic.p_fdec[2]+12*FDEC_STRIDE, h->mb.pic.p_fdec[2]+12*FDEC_STRIDE-1 ); + } + } + else + { + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[1] ); + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[2] ); + } +} + +void x264_predict_lossless_4x4( x264_t *h, pixel *p_dst, int p, int idx, int i_mode ) +{ + int stride = h->fenc->i_stride[p] << MB_INTERLACED; + pixel *p_src = h->mb.pic.p_fenc_plane[p] + block_idx_x[idx]*4 + block_idx_y[idx]*4 * stride; + + if( i_mode == I_PRED_4x4_V ) + { + h->mc.copy[PIXEL_4x4]( p_dst, FDEC_STRIDE, p_src-stride, stride, 4 ); + memcpy( p_dst, p_dst-FDEC_STRIDE, 4*sizeof(pixel) ); + } + else if( i_mode == I_PRED_4x4_H ) + { + h->mc.copy[PIXEL_4x4]( p_dst, FDEC_STRIDE, p_src-1, stride, 4 ); + for( int i = 0; i < 4; i++ ) + p_dst[i*FDEC_STRIDE] = p_dst[i*FDEC_STRIDE-1]; + } + else + h->predict_4x4[i_mode]( p_dst ); +} + +void x264_predict_lossless_8x8( x264_t *h, pixel *p_dst, int p, int idx, int i_mode, pixel edge[36] ) +{ + int stride = h->fenc->i_stride[p] << MB_INTERLACED; + pixel *p_src = h->mb.pic.p_fenc_plane[p] + (idx&1)*8 + (idx>>1)*8*stride; + + if( i_mode == I_PRED_8x8_V ) + { + h->mc.copy[PIXEL_8x8]( p_dst, FDEC_STRIDE, p_src-stride, stride, 8 ); + memcpy( p_dst, &edge[16], 8*sizeof(pixel) ); + } + else if( i_mode == I_PRED_8x8_H ) + { + h->mc.copy[PIXEL_8x8]( p_dst, FDEC_STRIDE, p_src-1, stride, 8 ); + for( int i = 0; i < 8; i++ ) + p_dst[i*FDEC_STRIDE] = edge[14-i]; + } + else + h->predict_8x8[i_mode]( p_dst, edge ); +} + +void x264_predict_lossless_16x16( x264_t *h, int p, int i_mode ) +{ + int stride = h->fenc->i_stride[p] << MB_INTERLACED; + pixel *p_dst = h->mb.pic.p_fdec[p]; + + if( i_mode == I_PRED_16x16_V ) + { + h->mc.copy[PIXEL_16x16]( p_dst, FDEC_STRIDE, h->mb.pic.p_fenc_plane[p]-stride, stride, 16 ); + memcpy( p_dst, p_dst-FDEC_STRIDE, 16*sizeof(pixel) ); + } + else if( i_mode == I_PRED_16x16_H ) + { + h->mc.copy_16x16_unaligned( p_dst, FDEC_STRIDE, h->mb.pic.p_fenc_plane[p]-1, stride, 16 ); + for( int i = 0; i < 16; i++ ) + p_dst[i*FDEC_STRIDE] = p_dst[i*FDEC_STRIDE-1]; + } + else + h->predict_16x16[i_mode]( p_dst ); +} + +/***************************************************************************** + * x264_macroblock_encode: + *****************************************************************************/ +static ALWAYS_INLINE void x264_macroblock_encode_internal( x264_t *h, int plane_count, int chroma ) +{ + int i_qp = h->mb.i_qp; + int b_decimate = h->mb.b_dct_decimate; + int b_force_no_skip = 0; + int nz; + h->mb.i_cbp_luma = 0; + for( int p = 0; p < plane_count; p++ ) + h->mb.cache.non_zero_count[x264_scan8[LUMA_DC+p]] = 0; + + if( h->mb.i_type == I_PCM ) + { + /* if PCM is chosen, we need to store reconstructed frame data */ + for( int p = 0; p < plane_count; p++ ) + h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fdec[p], FDEC_STRIDE, h->mb.pic.p_fenc[p], FENC_STRIDE, 16 ); + if( chroma ) + { + int height = 16 >> CHROMA_V_SHIFT; + h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fdec[1], FDEC_STRIDE, h->mb.pic.p_fenc[1], FENC_STRIDE, height ); + h->mc.copy[PIXEL_8x8] ( h->mb.pic.p_fdec[2], FDEC_STRIDE, h->mb.pic.p_fenc[2], FENC_STRIDE, height ); + } + return; + } + + if( !h->mb.b_allow_skip ) + { + b_force_no_skip = 1; + if( IS_SKIP(h->mb.i_type) ) + { + if( h->mb.i_type == P_SKIP ) + h->mb.i_type = P_L0; + else if( h->mb.i_type == B_SKIP ) + h->mb.i_type = B_DIRECT; + } + } + + if( h->mb.i_type == P_SKIP ) + { + /* don't do pskip motion compensation if it was already done in macroblock_analyse */ + if( !h->mb.b_skip_mc ) + { + int mvx = x264_clip3( h->mb.cache.mv[0][x264_scan8[0]][0], + h->mb.mv_min[0], h->mb.mv_max[0] ); + int mvy = x264_clip3( h->mb.cache.mv[0][x264_scan8[0]][1], + h->mb.mv_min[1], h->mb.mv_max[1] ); + + for( int p = 0; p < plane_count; p++ ) + h->mc.mc_luma( h->mb.pic.p_fdec[p], FDEC_STRIDE, + &h->mb.pic.p_fref[0][0][p*4], h->mb.pic.i_stride[p], + mvx, mvy, 16, 16, &h->sh.weight[0][p] ); + + if( chroma ) + { + int v_shift = CHROMA_V_SHIFT; + int height = 16 >> v_shift; + + /* Special case for mv0, which is (of course) very common in P-skip mode. */ + if( mvx | mvy ) + h->mc.mc_chroma( h->mb.pic.p_fdec[1], h->mb.pic.p_fdec[2], FDEC_STRIDE, + h->mb.pic.p_fref[0][0][4], h->mb.pic.i_stride[1], + mvx, 2*mvy>>v_shift, 8, height ); + else + h->mc.load_deinterleave_chroma_fdec( h->mb.pic.p_fdec[1], h->mb.pic.p_fref[0][0][4], + h->mb.pic.i_stride[1], height ); + + if( h->sh.weight[0][1].weightfn ) + h->sh.weight[0][1].weightfn[8>>2]( h->mb.pic.p_fdec[1], FDEC_STRIDE, + h->mb.pic.p_fdec[1], FDEC_STRIDE, + &h->sh.weight[0][1], height ); + if( h->sh.weight[0][2].weightfn ) + h->sh.weight[0][2].weightfn[8>>2]( h->mb.pic.p_fdec[2], FDEC_STRIDE, + h->mb.pic.p_fdec[2], FDEC_STRIDE, + &h->sh.weight[0][2], height ); + } + } + + x264_macroblock_encode_skip( h ); + return; + } + if( h->mb.i_type == B_SKIP ) + { + /* don't do bskip motion compensation if it was already done in macroblock_analyse */ + if( !h->mb.b_skip_mc ) + x264_mb_mc( h ); + x264_macroblock_encode_skip( h ); + return; + } + + if( h->mb.i_type == I_16x16 ) + { + h->mb.b_transform_8x8 = 0; + + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + x264_mb_encode_i16x16( h, p, i_qp ); + } + else if( h->mb.i_type == I_8x8 ) + { + h->mb.b_transform_8x8 = 1; + /* If we already encoded 3 of the 4 i8x8 blocks, we don't have to do them again. */ + if( h->mb.i_skip_intra ) + { + h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fdec[0], FDEC_STRIDE, h->mb.pic.i8x8_fdec_buf, 16, 16 ); + M32( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ) = h->mb.pic.i8x8_nnz_buf[0]; + M32( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ) = h->mb.pic.i8x8_nnz_buf[1]; + M32( &h->mb.cache.non_zero_count[x264_scan8[ 8]] ) = h->mb.pic.i8x8_nnz_buf[2]; + M32( &h->mb.cache.non_zero_count[x264_scan8[10]] ) = h->mb.pic.i8x8_nnz_buf[3]; + h->mb.i_cbp_luma = h->mb.pic.i8x8_cbp; + /* In RD mode, restore the now-overwritten DCT data. */ + if( h->mb.i_skip_intra == 2 ) + h->mc.memcpy_aligned( h->dct.luma8x8, h->mb.pic.i8x8_dct_buf, sizeof(h->mb.pic.i8x8_dct_buf) ); + } + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + for( int i = (p == 0 && h->mb.i_skip_intra) ? 3 : 0; i < 4; i++ ) + { + int i_mode = h->mb.cache.intra4x4_pred_mode[x264_scan8[4*i]]; + x264_mb_encode_i8x8( h, p, i, i_qp, i_mode, NULL, 1 ); + } + } + } + else if( h->mb.i_type == I_4x4 ) + { + h->mb.b_transform_8x8 = 0; + /* If we already encoded 15 of the 16 i4x4 blocks, we don't have to do them again. */ + if( h->mb.i_skip_intra ) + { + h->mc.copy[PIXEL_16x16]( h->mb.pic.p_fdec[0], FDEC_STRIDE, h->mb.pic.i4x4_fdec_buf, 16, 16 ); + M32( &h->mb.cache.non_zero_count[x264_scan8[ 0]] ) = h->mb.pic.i4x4_nnz_buf[0]; + M32( &h->mb.cache.non_zero_count[x264_scan8[ 2]] ) = h->mb.pic.i4x4_nnz_buf[1]; + M32( &h->mb.cache.non_zero_count[x264_scan8[ 8]] ) = h->mb.pic.i4x4_nnz_buf[2]; + M32( &h->mb.cache.non_zero_count[x264_scan8[10]] ) = h->mb.pic.i4x4_nnz_buf[3]; + h->mb.i_cbp_luma = h->mb.pic.i4x4_cbp; + /* In RD mode, restore the now-overwritten DCT data. */ + if( h->mb.i_skip_intra == 2 ) + h->mc.memcpy_aligned( h->dct.luma4x4, h->mb.pic.i4x4_dct_buf, sizeof(h->mb.pic.i4x4_dct_buf) ); + } + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + for( int i = (p == 0 && h->mb.i_skip_intra) ? 15 : 0; i < 16; i++ ) + { + pixel *p_dst = &h->mb.pic.p_fdec[p][block_idx_xy_fdec[i]]; + int i_mode = h->mb.cache.intra4x4_pred_mode[x264_scan8[i]]; + + if( (h->mb.i_neighbour4[i] & (MB_TOPRIGHT|MB_TOP)) == MB_TOP ) + /* emulate missing topright samples */ + MPIXEL_X4( &p_dst[4-FDEC_STRIDE] ) = PIXEL_SPLAT_X4( p_dst[3-FDEC_STRIDE] ); + + x264_mb_encode_i4x4( h, p, i, i_qp, i_mode, 1 ); + } + } + } + else /* Inter MB */ + { + int i_decimate_mb = 0; + + /* Don't repeat motion compensation if it was already done in non-RD transform analysis */ + if( !h->mb.b_skip_mc ) + x264_mb_mc( h ); + + if( h->mb.b_lossless ) + { + if( h->mb.b_transform_8x8 ) + for( int p = 0; p < plane_count; p++ ) + for( int i8x8 = 0; i8x8 < 4; i8x8++ ) + { + int x = i8x8&1; + int y = i8x8>>1; + nz = h->zigzagf.sub_8x8( h->dct.luma8x8[p*4+i8x8], h->mb.pic.p_fenc[p] + 8*x + 8*y*FENC_STRIDE, + h->mb.pic.p_fdec[p] + 8*x + 8*y*FDEC_STRIDE ); + STORE_8x8_NNZ( p, i8x8, nz ); + h->mb.i_cbp_luma |= nz << i8x8; + } + else + for( int p = 0; p < plane_count; p++ ) + for( int i4x4 = 0; i4x4 < 16; i4x4++ ) + { + nz = h->zigzagf.sub_4x4( h->dct.luma4x4[p*16+i4x4], + h->mb.pic.p_fenc[p]+block_idx_xy_fenc[i4x4], + h->mb.pic.p_fdec[p]+block_idx_xy_fdec[i4x4] ); + h->mb.cache.non_zero_count[x264_scan8[p*16+i4x4]] = nz; + h->mb.i_cbp_luma |= nz << (i4x4>>2); + } + } + else if( h->mb.b_transform_8x8 ) + { + ALIGNED_ARRAY_64( dctcoef, dct8x8,[4],[64] ); + b_decimate &= !h->mb.b_trellis || !h->param.b_cabac; // 8x8 trellis is inherently optimal decimation for CABAC + + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + int quant_cat = p ? CQM_8PC : CQM_8PY; + CLEAR_16x16_NNZ( p ); + h->dctf.sub16x16_dct8( dct8x8, h->mb.pic.p_fenc[p], h->mb.pic.p_fdec[p] ); + h->nr_count[1+!!p*2] += h->mb.b_noise_reduction * 4; + + int plane_cbp = 0; + for( int idx = 0; idx < 4; idx++ ) + { + nz = x264_quant_8x8( h, dct8x8[idx], i_qp, ctx_cat_plane[DCT_LUMA_8x8][p], 0, p, idx ); + + if( nz ) + { + h->zigzagf.scan_8x8( h->dct.luma8x8[p*4+idx], dct8x8[idx] ); + if( b_decimate ) + { + int i_decimate_8x8 = h->quantf.decimate_score64( h->dct.luma8x8[p*4+idx] ); + i_decimate_mb += i_decimate_8x8; + if( i_decimate_8x8 >= 4 ) + plane_cbp |= 1<= 6 || !b_decimate ) + { + h->mb.i_cbp_luma |= plane_cbp; + FOREACH_BIT( idx, 0, plane_cbp ) + { + h->quantf.dequant_8x8( dct8x8[idx], h->dequant8_mf[quant_cat], i_qp ); + h->dctf.add8x8_idct8( &h->mb.pic.p_fdec[p][8*(idx&1) + 8*(idx>>1)*FDEC_STRIDE], dct8x8[idx] ); + STORE_8x8_NNZ( p, idx, 1 ); + } + } + } + } + else + { + ALIGNED_ARRAY_64( dctcoef, dct4x4,[16],[16] ); + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + int quant_cat = p ? CQM_4PC : CQM_4PY; + CLEAR_16x16_NNZ( p ); + h->dctf.sub16x16_dct( dct4x4, h->mb.pic.p_fenc[p], h->mb.pic.p_fdec[p] ); + + if( h->mb.b_noise_reduction ) + { + h->nr_count[0+!!p*2] += 16; + for( int idx = 0; idx < 16; idx++ ) + h->quantf.denoise_dct( dct4x4[idx], h->nr_residual_sum[0+!!p*2], h->nr_offset[0+!!p*2], 16 ); + } + + int plane_cbp = 0; + for( int i8x8 = 0; i8x8 < 4; i8x8++ ) + { + int i_decimate_8x8 = b_decimate ? 0 : 6; + int nnz8x8 = 0; + if( h->mb.b_trellis ) + { + for( int i4x4 = 0; i4x4 < 4; i4x4++ ) + { + int idx = i8x8*4+i4x4; + if( x264_quant_4x4_trellis( h, dct4x4[idx], quant_cat, i_qp, ctx_cat_plane[DCT_LUMA_4x4][p], 0, !!p, p*16+idx ) ) + { + h->zigzagf.scan_4x4( h->dct.luma4x4[p*16+idx], dct4x4[idx] ); + h->quantf.dequant_4x4( dct4x4[idx], h->dequant4_mf[quant_cat], i_qp ); + if( i_decimate_8x8 < 6 ) + i_decimate_8x8 += h->quantf.decimate_score16( h->dct.luma4x4[p*16+idx] ); + h->mb.cache.non_zero_count[x264_scan8[p*16+idx]] = 1; + nnz8x8 = 1; + } + } + } + else + { + nnz8x8 = nz = h->quantf.quant_4x4x4( &dct4x4[i8x8*4], h->quant4_mf[quant_cat][i_qp], h->quant4_bias[quant_cat][i_qp] ); + if( nz ) + { + FOREACH_BIT( idx, i8x8*4, nz ) + { + h->zigzagf.scan_4x4( h->dct.luma4x4[p*16+idx], dct4x4[idx] ); + h->quantf.dequant_4x4( dct4x4[idx], h->dequant4_mf[quant_cat], i_qp ); + if( i_decimate_8x8 < 6 ) + i_decimate_8x8 += h->quantf.decimate_score16( h->dct.luma4x4[p*16+idx] ); + h->mb.cache.non_zero_count[x264_scan8[p*16+idx]] = 1; + } + } + } + if( nnz8x8 ) + { + i_decimate_mb += i_decimate_8x8; + if( i_decimate_8x8 < 4 ) + STORE_8x8_NNZ( p, i8x8, 0 ); + else + plane_cbp |= 1<mb.i_cbp_luma |= plane_cbp; + FOREACH_BIT( i8x8, 0, plane_cbp ) + { + h->dctf.add8x8_idct( &h->mb.pic.p_fdec[p][(i8x8&1)*8 + (i8x8>>1)*8*FDEC_STRIDE], &dct4x4[i8x8*4] ); + } + } + } + } + } + + /* encode chroma */ + if( chroma ) + { + if( IS_INTRA( h->mb.i_type ) ) + { + int i_mode = h->mb.i_chroma_pred_mode; + if( h->mb.b_lossless ) + x264_predict_lossless_chroma( h, i_mode ); + else + { + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[1] ); + h->predict_chroma[i_mode]( h->mb.pic.p_fdec[2] ); + } + } + + /* encode the 8x8 blocks */ + x264_mb_encode_chroma( h, !IS_INTRA( h->mb.i_type ), h->mb.i_chroma_qp ); + } + else + h->mb.i_cbp_chroma = 0; + + /* store cbp */ + int cbp = h->mb.i_cbp_chroma << 4 | h->mb.i_cbp_luma; + if( h->param.b_cabac ) + cbp |= h->mb.cache.non_zero_count[x264_scan8[LUMA_DC ]] << 8 + | h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+0]] << 9 + | h->mb.cache.non_zero_count[x264_scan8[CHROMA_DC+1]] << 10; + h->mb.cbp[h->mb.i_mb_xy] = cbp; + + /* Check for P_SKIP + * XXX: in the me perhaps we should take x264_mb_predict_mv_pskip into account + * (if multiple mv give same result)*/ + if( !b_force_no_skip ) + { + if( h->mb.i_type == P_L0 && h->mb.i_partition == D_16x16 && + !(h->mb.i_cbp_luma | h->mb.i_cbp_chroma) && + M32( h->mb.cache.mv[0][x264_scan8[0]] ) == M32( h->mb.cache.pskip_mv ) + && h->mb.cache.ref[0][x264_scan8[0]] == 0 ) + { + h->mb.i_type = P_SKIP; + } + + /* Check for B_SKIP */ + if( h->mb.i_type == B_DIRECT && !(h->mb.i_cbp_luma | h->mb.i_cbp_chroma) ) + { + h->mb.i_type = B_SKIP; + } + } +} + +void x264_macroblock_encode( x264_t *h ) +{ + if( CHROMA444 ) + x264_macroblock_encode_internal( h, 3, 0 ); + else + x264_macroblock_encode_internal( h, 1, 1 ); +} + +/***************************************************************************** + * x264_macroblock_probe_skip: + * Check if the current MB could be encoded as a [PB]_SKIP + *****************************************************************************/ +static ALWAYS_INLINE int x264_macroblock_probe_skip_internal( x264_t *h, int b_bidir, int plane_count, int chroma ) +{ + ALIGNED_ARRAY_64( dctcoef, dct4x4,[8],[16] ); + ALIGNED_ARRAY_64( dctcoef, dctscan,[16] ); + ALIGNED_4( int16_t mvp[2] ); + int i_qp = h->mb.i_qp; + + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + int quant_cat = p ? CQM_4PC : CQM_4PY; + if( !b_bidir ) + { + /* Get the MV */ + mvp[0] = x264_clip3( h->mb.cache.pskip_mv[0], h->mb.mv_min[0], h->mb.mv_max[0] ); + mvp[1] = x264_clip3( h->mb.cache.pskip_mv[1], h->mb.mv_min[1], h->mb.mv_max[1] ); + + /* Motion compensation */ + h->mc.mc_luma( h->mb.pic.p_fdec[p], FDEC_STRIDE, + &h->mb.pic.p_fref[0][0][p*4], h->mb.pic.i_stride[p], + mvp[0], mvp[1], 16, 16, &h->sh.weight[0][p] ); + } + + for( int i8x8 = 0, i_decimate_mb = 0; i8x8 < 4; i8x8++ ) + { + int fenc_offset = (i8x8&1) * 8 + (i8x8>>1) * FENC_STRIDE * 8; + int fdec_offset = (i8x8&1) * 8 + (i8x8>>1) * FDEC_STRIDE * 8; + + h->dctf.sub8x8_dct( dct4x4, h->mb.pic.p_fenc[p] + fenc_offset, + h->mb.pic.p_fdec[p] + fdec_offset ); + + if( h->mb.b_noise_reduction ) + for( int i4x4 = 0; i4x4 < 4; i4x4++ ) + h->quantf.denoise_dct( dct4x4[i4x4], h->nr_residual_sum[0+!!p*2], h->nr_offset[0+!!p*2], 16 ); + + int nz = h->quantf.quant_4x4x4( dct4x4, h->quant4_mf[quant_cat][i_qp], h->quant4_bias[quant_cat][i_qp] ); + FOREACH_BIT( idx, 0, nz ) + { + h->zigzagf.scan_4x4( dctscan, dct4x4[idx] ); + i_decimate_mb += h->quantf.decimate_score16( dctscan ); + if( i_decimate_mb >= 6 ) + return 0; + } + } + } + + if( chroma == CHROMA_420 || chroma == CHROMA_422 ) + { + i_qp = h->mb.i_chroma_qp; + int chroma422 = chroma == CHROMA_422; + int thresh = chroma422 ? (x264_lambda2_tab[i_qp] + 16) >> 5 : (x264_lambda2_tab[i_qp] + 32) >> 6; + int ssd; + ALIGNED_ARRAY_16( dctcoef, dct_dc,[8] ); + + if( !b_bidir ) + { + /* Special case for mv0, which is (of course) very common in P-skip mode. */ + if( M32( mvp ) ) + h->mc.mc_chroma( h->mb.pic.p_fdec[1], h->mb.pic.p_fdec[2], FDEC_STRIDE, + h->mb.pic.p_fref[0][0][4], h->mb.pic.i_stride[1], + mvp[0], mvp[1]<mc.load_deinterleave_chroma_fdec( h->mb.pic.p_fdec[1], h->mb.pic.p_fref[0][0][4], + h->mb.pic.i_stride[1], chroma422?16:8 ); + } + + for( int ch = 0; ch < 2; ch++ ) + { + pixel *p_src = h->mb.pic.p_fenc[1+ch]; + pixel *p_dst = h->mb.pic.p_fdec[1+ch]; + + if( !b_bidir && h->sh.weight[0][1+ch].weightfn ) + h->sh.weight[0][1+ch].weightfn[8>>2]( h->mb.pic.p_fdec[1+ch], FDEC_STRIDE, + h->mb.pic.p_fdec[1+ch], FDEC_STRIDE, + &h->sh.weight[0][1+ch], chroma422?16:8 ); + + /* there is almost never a termination during chroma, but we can't avoid the check entirely */ + /* so instead we check SSD and skip the actual check if the score is low enough. */ + ssd = h->pixf.ssd[chroma422?PIXEL_8x16:PIXEL_8x8]( p_dst, FDEC_STRIDE, p_src, FENC_STRIDE ); + if( ssd < thresh ) + continue; + + /* The vast majority of chroma checks will terminate during the DC check or the higher + * threshold check, so we can save time by doing a DC-only DCT. */ + if( h->mb.b_noise_reduction ) + { + for( int i = 0; i <= chroma422; i++ ) + h->dctf.sub8x8_dct( &dct4x4[4*i], p_src + 8*i*FENC_STRIDE, p_dst + 8*i*FDEC_STRIDE ); + + for( int i4x4 = 0; i4x4 < (chroma422?8:4); i4x4++ ) + { + h->quantf.denoise_dct( dct4x4[i4x4], h->nr_residual_sum[2], h->nr_offset[2], 16 ); + dct_dc[i4x4] = dct4x4[i4x4][0]; + dct4x4[i4x4][0] = 0; + } + } + else + { + if( chroma422 ) + h->dctf.sub8x16_dct_dc( dct_dc, p_src, p_dst ); + else + h->dctf.sub8x8_dct_dc( dct_dc, p_src, p_dst ); + } + + for( int i = 0; i <= chroma422; i++ ) + if( h->quantf.quant_2x2_dc( &dct_dc[4*i], h->quant4_mf[CQM_4PC][i_qp+3*chroma422][0] >> 1, + h->quant4_bias[CQM_4PC][i_qp+3*chroma422][0] << 1 ) ) + return 0; + + /* If there wasn't a termination in DC, we can check against a much higher threshold. */ + if( ssd < thresh*4 ) + continue; + + if( !h->mb.b_noise_reduction ) + for( int i = 0; i <= chroma422; i++ ) + { + h->dctf.sub8x8_dct( &dct4x4[4*i], p_src + 8*i*FENC_STRIDE, p_dst + 8*i*FDEC_STRIDE ); + dct4x4[i*4+0][0] = 0; + dct4x4[i*4+1][0] = 0; + dct4x4[i*4+2][0] = 0; + dct4x4[i*4+3][0] = 0; + } + + /* calculate dct coeffs */ + for( int i8x8 = 0, i_decimate_mb = 0; i8x8 < (chroma422?2:1); i8x8++ ) + { + int nz = h->quantf.quant_4x4x4( &dct4x4[i8x8*4], h->quant4_mf[CQM_4PC][i_qp], h->quant4_bias[CQM_4PC][i_qp] ); + FOREACH_BIT( idx, i8x8*4, nz ) + { + h->zigzagf.scan_4x4( dctscan, dct4x4[idx] ); + i_decimate_mb += h->quantf.decimate_score15( dctscan ); + if( i_decimate_mb >= 7 ) + return 0; + } + } + } + } + + h->mb.b_skip_mc = 1; + return 1; +} + +int x264_macroblock_probe_skip( x264_t *h, int b_bidir ) +{ + if( CHROMA_FORMAT == CHROMA_444 ) + return x264_macroblock_probe_skip_internal( h, b_bidir, 3, CHROMA_444 ); + else if( CHROMA_FORMAT == CHROMA_422 ) + return x264_macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_422 ); + else + return x264_macroblock_probe_skip_internal( h, b_bidir, 1, CHROMA_420 ); +} + +/**************************************************************************** + * DCT-domain noise reduction / adaptive deadzone + * from libavcodec + ****************************************************************************/ + +void x264_noise_reduction_update( x264_t *h ) +{ + h->nr_offset = h->nr_offset_denoise; + h->nr_residual_sum = h->nr_residual_sum_buf[0]; + h->nr_count = h->nr_count_buf[0]; + for( int cat = 0; cat < 3 + CHROMA444; cat++ ) + { + int dct8x8 = cat&1; + int size = dct8x8 ? 64 : 16; + const uint32_t *weight = dct8x8 ? x264_dct8_weight2_tab : x264_dct4_weight2_tab; + + if( h->nr_count[cat] > (dct8x8 ? (1<<16) : (1<<18)) ) + { + for( int i = 0; i < size; i++ ) + h->nr_residual_sum[cat][i] >>= 1; + h->nr_count[cat] >>= 1; + } + + for( int i = 0; i < size; i++ ) + h->nr_offset[cat][i] = + ((uint64_t)h->param.analyse.i_noise_reduction * h->nr_count[cat] + + h->nr_residual_sum[cat][i]/2) + / ((uint64_t)h->nr_residual_sum[cat][i] * weight[i]/256 + 1); + + /* Don't denoise DC coefficients */ + h->nr_offset[cat][0] = 0; + } +} + +/***************************************************************************** + * RD only; 4 calls to this do not make up for one macroblock_encode. + * doesn't transform chroma dc. + *****************************************************************************/ +static ALWAYS_INLINE void x264_macroblock_encode_p8x8_internal( x264_t *h, int i8, int plane_count, int chroma ) +{ + int b_decimate = h->mb.b_dct_decimate; + int i_qp = h->mb.i_qp; + int x = i8&1; + int y = i8>>1; + int nz; + int chroma422 = chroma == CHROMA_422; + + h->mb.i_cbp_chroma = 0; + h->mb.i_cbp_luma &= ~(1 << i8); + + if( !h->mb.b_skip_mc ) + x264_mb_mc_8x8( h, i8 ); + + if( h->mb.b_lossless ) + { + for( int p = 0; p < plane_count; p++ ) + { + pixel *p_fenc = h->mb.pic.p_fenc[p] + 8*x + 8*y*FENC_STRIDE; + pixel *p_fdec = h->mb.pic.p_fdec[p] + 8*x + 8*y*FDEC_STRIDE; + int nnz8x8 = 0; + if( h->mb.b_transform_8x8 ) + { + nnz8x8 = h->zigzagf.sub_8x8( h->dct.luma8x8[4*p+i8], p_fenc, p_fdec ); + STORE_8x8_NNZ( p, i8, nnz8x8 ); + } + else + { + for( int i4 = i8*4; i4 < i8*4+4; i4++ ) + { + nz = h->zigzagf.sub_4x4( h->dct.luma4x4[16*p+i4], + h->mb.pic.p_fenc[p]+block_idx_xy_fenc[i4], + h->mb.pic.p_fdec[p]+block_idx_xy_fdec[i4] ); + h->mb.cache.non_zero_count[x264_scan8[16*p+i4]] = nz; + nnz8x8 |= nz; + } + } + h->mb.i_cbp_luma |= nnz8x8 << i8; + } + if( chroma == CHROMA_420 || chroma == CHROMA_422 ) + { + for( int ch = 0; ch < 2; ch++ ) + { + dctcoef dc; + pixel *p_fenc = h->mb.pic.p_fenc[1+ch] + 4*x + (chroma422?8:4)*y*FENC_STRIDE; + pixel *p_fdec = h->mb.pic.p_fdec[1+ch] + 4*x + (chroma422?8:4)*y*FDEC_STRIDE; + + for( int i4x4 = 0; i4x4 <= chroma422; i4x4++ ) + { + int offset = chroma422 ? 8*y + 2*i4x4 + x : i8; + nz = h->zigzagf.sub_4x4ac( h->dct.luma4x4[16+offset+ch*16], p_fenc+4*i4x4*FENC_STRIDE, p_fdec+4*i4x4*FDEC_STRIDE, &dc ); + h->mb.cache.non_zero_count[x264_scan8[16+offset+ch*16]] = nz; + } + } + h->mb.i_cbp_chroma = 0x02; + } + } + else + { + if( h->mb.b_transform_8x8 ) + { + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + int quant_cat = p ? CQM_8PC : CQM_8PY; + pixel *p_fenc = h->mb.pic.p_fenc[p] + 8*x + 8*y*FENC_STRIDE; + pixel *p_fdec = h->mb.pic.p_fdec[p] + 8*x + 8*y*FDEC_STRIDE; + ALIGNED_ARRAY_64( dctcoef, dct8x8,[64] ); + + h->dctf.sub8x8_dct8( dct8x8, p_fenc, p_fdec ); + int nnz8x8 = x264_quant_8x8( h, dct8x8, i_qp, ctx_cat_plane[DCT_LUMA_8x8][p], 0, p, i8 ); + if( nnz8x8 ) + { + h->zigzagf.scan_8x8( h->dct.luma8x8[4*p+i8], dct8x8 ); + + if( b_decimate && !h->mb.b_trellis ) + nnz8x8 = 4 <= h->quantf.decimate_score64( h->dct.luma8x8[4*p+i8] ); + + if( nnz8x8 ) + { + h->quantf.dequant_8x8( dct8x8, h->dequant8_mf[quant_cat], i_qp ); + h->dctf.add8x8_idct8( p_fdec, dct8x8 ); + STORE_8x8_NNZ( p, i8, 1 ); + h->mb.i_cbp_luma |= 1 << i8; + } + else + STORE_8x8_NNZ( p, i8, 0 ); + } + else + STORE_8x8_NNZ( p, i8, 0 ); + } + } + else + { + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + int quant_cat = p ? CQM_4PC : CQM_4PY; + pixel *p_fenc = h->mb.pic.p_fenc[p] + 8*x + 8*y*FENC_STRIDE; + pixel *p_fdec = h->mb.pic.p_fdec[p] + 8*x + 8*y*FDEC_STRIDE; + int i_decimate_8x8 = b_decimate ? 0 : 4; + ALIGNED_ARRAY_64( dctcoef, dct4x4,[4],[16] ); + int nnz8x8 = 0; + + h->dctf.sub8x8_dct( dct4x4, p_fenc, p_fdec ); + STORE_8x8_NNZ( p, i8, 0 ); + + if( h->mb.b_noise_reduction ) + for( int idx = 0; idx < 4; idx++ ) + h->quantf.denoise_dct( dct4x4[idx], h->nr_residual_sum[0+!!p*2], h->nr_offset[0+!!p*2], 16 ); + + if( h->mb.b_trellis ) + { + for( int i4x4 = 0; i4x4 < 4; i4x4++ ) + { + if( x264_quant_4x4_trellis( h, dct4x4[i4x4], quant_cat, i_qp, ctx_cat_plane[DCT_LUMA_4x4][p], 0, !!p, i8*4+i4x4+p*16 ) ) + { + h->zigzagf.scan_4x4( h->dct.luma4x4[p*16+i8*4+i4x4], dct4x4[i4x4] ); + h->quantf.dequant_4x4( dct4x4[i4x4], h->dequant4_mf[quant_cat], i_qp ); + if( i_decimate_8x8 < 4 ) + i_decimate_8x8 += h->quantf.decimate_score16( h->dct.luma4x4[p*16+i8*4+i4x4] ); + h->mb.cache.non_zero_count[x264_scan8[p*16+i8*4+i4x4]] = 1; + nnz8x8 = 1; + } + } + } + else + { + nnz8x8 = nz = h->quantf.quant_4x4x4( dct4x4, h->quant4_mf[quant_cat][i_qp], h->quant4_bias[quant_cat][i_qp] ); + if( nz ) + { + FOREACH_BIT( i4x4, 0, nz ) + { + h->zigzagf.scan_4x4( h->dct.luma4x4[p*16+i8*4+i4x4], dct4x4[i4x4] ); + h->quantf.dequant_4x4( dct4x4[i4x4], h->dequant4_mf[quant_cat], i_qp ); + if( i_decimate_8x8 < 4 ) + i_decimate_8x8 += h->quantf.decimate_score16( h->dct.luma4x4[p*16+i8*4+i4x4] ); + h->mb.cache.non_zero_count[x264_scan8[p*16+i8*4+i4x4]] = 1; + } + } + } + if( nnz8x8 ) + { + /* decimate this 8x8 block */ + if( i_decimate_8x8 < 4 ) + STORE_8x8_NNZ( p, i8, 0 ); + else + { + h->dctf.add8x8_idct( p_fdec, dct4x4 ); + h->mb.i_cbp_luma |= 1 << i8; + } + } + } + } + + if( chroma == CHROMA_420 || chroma == CHROMA_422 ) + { + i_qp = h->mb.i_chroma_qp; + for( int ch = 0; ch < 2; ch++ ) + { + ALIGNED_ARRAY_64( dctcoef, dct4x4,[2],[16] ); + pixel *p_fenc = h->mb.pic.p_fenc[1+ch] + 4*x + (chroma422?8:4)*y*FENC_STRIDE; + pixel *p_fdec = h->mb.pic.p_fdec[1+ch] + 4*x + (chroma422?8:4)*y*FDEC_STRIDE; + + for( int i4x4 = 0; i4x4 <= chroma422; i4x4++ ) + { + h->dctf.sub4x4_dct( dct4x4[i4x4], p_fenc + 4*i4x4*FENC_STRIDE, p_fdec + 4*i4x4*FDEC_STRIDE ); + + if( h->mb.b_noise_reduction ) + h->quantf.denoise_dct( dct4x4[i4x4], h->nr_residual_sum[2], h->nr_offset[2], 16 ); + dct4x4[i4x4][0] = 0; + + if( h->mb.b_trellis ) + nz = x264_quant_4x4_trellis( h, dct4x4[i4x4], CQM_4PC, i_qp, DCT_CHROMA_AC, 0, 1, 0 ); + else + nz = h->quantf.quant_4x4( dct4x4[i4x4], h->quant4_mf[CQM_4PC][i_qp], h->quant4_bias[CQM_4PC][i_qp] ); + + int offset = chroma422 ? ((5*i8) & 0x09) + 2*i4x4 : i8; + h->mb.cache.non_zero_count[x264_scan8[16+offset+ch*16]] = nz; + if( nz ) + { + h->zigzagf.scan_4x4( h->dct.luma4x4[16+offset+ch*16], dct4x4[i4x4] ); + h->quantf.dequant_4x4( dct4x4[i4x4], h->dequant4_mf[CQM_4PC], i_qp ); + h->dctf.add4x4_idct( p_fdec + 4*i4x4*FDEC_STRIDE, dct4x4[i4x4] ); + } + } + } + h->mb.i_cbp_chroma = 0x02; + } + } +} + +void x264_macroblock_encode_p8x8( x264_t *h, int i8 ) +{ + if( CHROMA444 ) + x264_macroblock_encode_p8x8_internal( h, i8, 3, CHROMA_444 ); + else if( CHROMA_FORMAT == CHROMA_422 ) + x264_macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_422 ); + else + x264_macroblock_encode_p8x8_internal( h, i8, 1, CHROMA_420 ); +} + +/***************************************************************************** + * RD only, luma only (for 4:2:0) + *****************************************************************************/ +static ALWAYS_INLINE void x264_macroblock_encode_p4x4_internal( x264_t *h, int i4, int plane_count ) +{ + int i_qp = h->mb.i_qp; + + for( int p = 0; p < plane_count; p++, i_qp = h->mb.i_chroma_qp ) + { + int quant_cat = p ? CQM_4PC : CQM_4PY; + pixel *p_fenc = &h->mb.pic.p_fenc[p][block_idx_xy_fenc[i4]]; + pixel *p_fdec = &h->mb.pic.p_fdec[p][block_idx_xy_fdec[i4]]; + int nz; + + /* Don't need motion compensation as this function is only used in qpel-RD, which caches pixel data. */ + + if( h->mb.b_lossless ) + { + nz = h->zigzagf.sub_4x4( h->dct.luma4x4[p*16+i4], p_fenc, p_fdec ); + h->mb.cache.non_zero_count[x264_scan8[p*16+i4]] = nz; + } + else + { + ALIGNED_ARRAY_64( dctcoef, dct4x4,[16] ); + h->dctf.sub4x4_dct( dct4x4, p_fenc, p_fdec ); + nz = x264_quant_4x4( h, dct4x4, i_qp, ctx_cat_plane[DCT_LUMA_4x4][p], 0, p, i4 ); + h->mb.cache.non_zero_count[x264_scan8[p*16+i4]] = nz; + if( nz ) + { + h->zigzagf.scan_4x4( h->dct.luma4x4[p*16+i4], dct4x4 ); + h->quantf.dequant_4x4( dct4x4, h->dequant4_mf[quant_cat], i_qp ); + h->dctf.add4x4_idct( p_fdec, dct4x4 ); + } + } + } +} + +void x264_macroblock_encode_p4x4( x264_t *h, int i8 ) +{ + if( CHROMA444 ) + x264_macroblock_encode_p4x4_internal( h, i8, 3 ); + else + x264_macroblock_encode_p4x4_internal( h, i8, 1 ); +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.h new file mode 100644 index 00000000..1c901a89 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/macroblock.h @@ -0,0 +1,198 @@ +/***************************************************************************** + * macroblock.h: macroblock encoding + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ENCODER_MACROBLOCK_H +#define X264_ENCODER_MACROBLOCK_H + +#include "common/macroblock.h" + +extern const int x264_lambda2_tab[QP_MAX_MAX+1]; +extern const uint16_t x264_lambda_tab[QP_MAX_MAX+1]; + +void x264_rdo_init( void ); + +int x264_macroblock_probe_skip( x264_t *h, int b_bidir ); + +#define x264_macroblock_probe_pskip( h )\ + x264_macroblock_probe_skip( h, 0 ) +#define x264_macroblock_probe_bskip( h )\ + x264_macroblock_probe_skip( h, 1 ) + +void x264_predict_lossless_4x4( x264_t *h, pixel *p_dst, int p, int idx, int i_mode ); +void x264_predict_lossless_8x8( x264_t *h, pixel *p_dst, int p, int idx, int i_mode, pixel edge[36] ); +void x264_predict_lossless_16x16( x264_t *h, int p, int i_mode ); +void x264_predict_lossless_chroma( x264_t *h, int i_mode ); + +void x264_macroblock_encode ( x264_t *h ); +void x264_macroblock_write_cabac ( x264_t *h, x264_cabac_t *cb ); +void x264_macroblock_write_cavlc ( x264_t *h ); + +void x264_macroblock_encode_p8x8( x264_t *h, int i8 ); +void x264_macroblock_encode_p4x4( x264_t *h, int i4 ); +void x264_mb_encode_chroma( x264_t *h, int b_inter, int i_qp ); + +void x264_cabac_mb_skip( x264_t *h, int b_skip ); +void x264_cabac_block_residual_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ); +void x264_cabac_block_residual_8x8_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ); +void x264_cabac_block_residual_rd_c( x264_t *h, x264_cabac_t *cb, int ctx_block_cat, dctcoef *l ); + +int x264_quant_luma_dc_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, int i_qp, + int ctx_block_cat, int b_intra, int idx ); +int x264_quant_chroma_dc_trellis( x264_t *h, dctcoef *dct, int i_qp, int b_intra, int idx ); +int x264_quant_4x4_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, + int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx ); +int x264_quant_8x8_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, + int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx ); + +void x264_noise_reduction_update( x264_t *h ); + +static ALWAYS_INLINE int x264_quant_4x4( x264_t *h, dctcoef dct[16], int i_qp, int ctx_block_cat, int b_intra, int p, int idx ) +{ + int i_quant_cat = b_intra ? (p?CQM_4IC:CQM_4IY) : (p?CQM_4PC:CQM_4PY); + if( h->mb.b_noise_reduction ) + h->quantf.denoise_dct( dct, h->nr_residual_sum[0+!!p*2], h->nr_offset[0+!!p*2], 16 ); + if( h->mb.b_trellis ) + return x264_quant_4x4_trellis( h, dct, i_quant_cat, i_qp, ctx_block_cat, b_intra, !!p, idx+p*16 ); + else + return h->quantf.quant_4x4( dct, h->quant4_mf[i_quant_cat][i_qp], h->quant4_bias[i_quant_cat][i_qp] ); +} + +static ALWAYS_INLINE int x264_quant_8x8( x264_t *h, dctcoef dct[64], int i_qp, int ctx_block_cat, int b_intra, int p, int idx ) +{ + int i_quant_cat = b_intra ? (p?CQM_8IC:CQM_8IY) : (p?CQM_8PC:CQM_8PY); + if( h->mb.b_noise_reduction ) + h->quantf.denoise_dct( dct, h->nr_residual_sum[1+!!p*2], h->nr_offset[1+!!p*2], 64 ); + if( h->mb.b_trellis ) + return x264_quant_8x8_trellis( h, dct, i_quant_cat, i_qp, ctx_block_cat, b_intra, !!p, idx+p*4 ); + else + return h->quantf.quant_8x8( dct, h->quant8_mf[i_quant_cat][i_qp], h->quant8_bias[i_quant_cat][i_qp] ); +} + +#define STORE_8x8_NNZ( p, idx, nz )\ +do\ +{\ + M16( &h->mb.cache.non_zero_count[x264_scan8[p*16+idx*4]+0] ) = (nz) * 0x0101;\ + M16( &h->mb.cache.non_zero_count[x264_scan8[p*16+idx*4]+8] ) = (nz) * 0x0101;\ +} while( 0 ) + +#define CLEAR_16x16_NNZ( p ) \ +do\ +{\ + M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 0*8] ) = 0;\ + M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 1*8] ) = 0;\ + M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 2*8] ) = 0;\ + M32( &h->mb.cache.non_zero_count[x264_scan8[16*p] + 3*8] ) = 0;\ +} while( 0 ) + +/* A special for loop that iterates branchlessly over each set + * bit in a 4-bit input. */ +#define FOREACH_BIT(idx,start,mask) for( int idx = start, msk = mask, skip; msk && (skip = x264_ctz_4bit(msk), idx += skip, msk >>= skip+1, 1); idx++ ) + +static ALWAYS_INLINE void x264_mb_encode_i4x4( x264_t *h, int p, int idx, int i_qp, int i_mode, int b_predict ) +{ + int nz; + pixel *p_src = &h->mb.pic.p_fenc[p][block_idx_xy_fenc[idx]]; + pixel *p_dst = &h->mb.pic.p_fdec[p][block_idx_xy_fdec[idx]]; + ALIGNED_ARRAY_64( dctcoef, dct4x4,[16] ); + + if( b_predict ) + { + if( h->mb.b_lossless ) + x264_predict_lossless_4x4( h, p_dst, p, idx, i_mode ); + else + h->predict_4x4[i_mode]( p_dst ); + } + + if( h->mb.b_lossless ) + { + nz = h->zigzagf.sub_4x4( h->dct.luma4x4[p*16+idx], p_src, p_dst ); + h->mb.cache.non_zero_count[x264_scan8[p*16+idx]] = nz; + h->mb.i_cbp_luma |= nz<<(idx>>2); + return; + } + + h->dctf.sub4x4_dct( dct4x4, p_src, p_dst ); + + nz = x264_quant_4x4( h, dct4x4, i_qp, ctx_cat_plane[DCT_LUMA_4x4][p], 1, p, idx ); + h->mb.cache.non_zero_count[x264_scan8[p*16+idx]] = nz; + if( nz ) + { + h->mb.i_cbp_luma |= 1<<(idx>>2); + h->zigzagf.scan_4x4( h->dct.luma4x4[p*16+idx], dct4x4 ); + h->quantf.dequant_4x4( dct4x4, h->dequant4_mf[p?CQM_4IC:CQM_4IY], i_qp ); + h->dctf.add4x4_idct( p_dst, dct4x4 ); + } +} + +static ALWAYS_INLINE void x264_mb_encode_i8x8( x264_t *h, int p, int idx, int i_qp, int i_mode, pixel *edge, int b_predict ) +{ + int x = idx&1; + int y = idx>>1; + int nz; + pixel *p_src = &h->mb.pic.p_fenc[p][8*x + 8*y*FENC_STRIDE]; + pixel *p_dst = &h->mb.pic.p_fdec[p][8*x + 8*y*FDEC_STRIDE]; + ALIGNED_ARRAY_64( dctcoef, dct8x8,[64] ); + ALIGNED_ARRAY_32( pixel, edge_buf,[36] ); + + if( b_predict ) + { + if( !edge ) + { + h->predict_8x8_filter( p_dst, edge_buf, h->mb.i_neighbour8[idx], x264_pred_i4x4_neighbors[i_mode] ); + edge = edge_buf; + } + + if( h->mb.b_lossless ) + x264_predict_lossless_8x8( h, p_dst, p, idx, i_mode, edge ); + else + h->predict_8x8[i_mode]( p_dst, edge ); + } + + if( h->mb.b_lossless ) + { + nz = h->zigzagf.sub_8x8( h->dct.luma8x8[p*4+idx], p_src, p_dst ); + STORE_8x8_NNZ( p, idx, nz ); + h->mb.i_cbp_luma |= nz<dctf.sub8x8_dct8( dct8x8, p_src, p_dst ); + + nz = x264_quant_8x8( h, dct8x8, i_qp, ctx_cat_plane[DCT_LUMA_8x8][p], 1, p, idx ); + if( nz ) + { + h->mb.i_cbp_luma |= 1<zigzagf.scan_8x8( h->dct.luma8x8[p*4+idx], dct8x8 ); + h->quantf.dequant_8x8( dct8x8, h->dequant8_mf[p?CQM_8IC:CQM_8IY], i_qp ); + h->dctf.add8x8_idct8( p_dst, dct8x8 ); + STORE_8x8_NNZ( p, idx, 1 ); + } + else + STORE_8x8_NNZ( p, idx, 0 ); +} + +#endif + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.c new file mode 100644 index 00000000..094fc5da --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.c @@ -0,0 +1,1350 @@ +/***************************************************************************** + * me.c: motion estimation + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "macroblock.h" +#include "me.h" + +/* presets selected from good points on the speed-vs-quality curve of several test videos + * subpel_iters[i_subpel_refine] = { refine_hpel, refine_qpel, me_hpel, me_qpel } + * where me_* are the number of EPZS iterations run on all candidate block types, + * and refine_* are run only on the winner. + * the subme=8,9 values are much higher because any amount of satd search makes + * up its time by reducing the number of qpel-rd iterations. */ +static const uint8_t subpel_iterations[][4] = + {{0,0,0,0}, + {1,1,0,0}, + {0,1,1,0}, + {0,2,1,0}, + {0,2,1,1}, + {0,2,1,2}, + {0,0,2,2}, + {0,0,2,2}, + {0,0,4,10}, + {0,0,4,10}, + {0,0,4,10}, + {0,0,4,10}}; + +/* (x-1)%6 */ +static const uint8_t mod6m1[8] = {5,0,1,2,3,4,5,0}; +/* radius 2 hexagon. repeated entries are to avoid having to compute mod6 every time. */ +static const int8_t hex2[8][2] = {{-1,-2}, {-2,0}, {-1,2}, {1,2}, {2,0}, {1,-2}, {-1,-2}, {-2,0}}; +static const int8_t square1[9][2] = {{0,0}, {0,-1}, {0,1}, {-1,0}, {1,0}, {-1,-1}, {-1,1}, {1,-1}, {1,1}}; + +static void refine_subpel( x264_t *h, x264_me_t *m, int hpel_iters, int qpel_iters, int *p_halfpel_thresh, int b_refine_qpel ); + +#define BITS_MVD( mx, my )\ + (p_cost_mvx[(mx)<<2] + p_cost_mvy[(my)<<2]) + +#define COST_MV( mx, my )\ +do\ +{\ + int cost = h->pixf.fpelcmp[i_pixel]( p_fenc, FENC_STRIDE,\ + &p_fref_w[(my)*stride+(mx)], stride )\ + + BITS_MVD(mx,my);\ + COPY3_IF_LT( bcost, cost, bmx, mx, bmy, my );\ +} while( 0 ) + +#define COST_MV_HPEL( mx, my, cost )\ +do\ +{\ + intptr_t stride2 = 16;\ + pixel *src = h->mc.get_ref( pix, &stride2, m->p_fref, stride, mx, my, bw, bh, &m->weight[0] );\ + cost = h->pixf.fpelcmp[i_pixel]( p_fenc, FENC_STRIDE, src, stride2 )\ + + p_cost_mvx[ mx ] + p_cost_mvy[ my ];\ +} while( 0 ) + +#define COST_MV_X3_DIR( m0x, m0y, m1x, m1y, m2x, m2y, costs )\ +{\ + pixel *pix_base = p_fref_w + bmx + bmy*stride;\ + h->pixf.fpelcmp_x3[i_pixel]( p_fenc,\ + pix_base + (m0x) + (m0y)*stride,\ + pix_base + (m1x) + (m1y)*stride,\ + pix_base + (m2x) + (m2y)*stride,\ + stride, costs );\ + (costs)[0] += BITS_MVD( bmx+(m0x), bmy+(m0y) );\ + (costs)[1] += BITS_MVD( bmx+(m1x), bmy+(m1y) );\ + (costs)[2] += BITS_MVD( bmx+(m2x), bmy+(m2y) );\ +} + +#define COST_MV_X4_DIR( m0x, m0y, m1x, m1y, m2x, m2y, m3x, m3y, costs )\ +{\ + pixel *pix_base = p_fref_w + bmx + bmy*stride;\ + h->pixf.fpelcmp_x4[i_pixel]( p_fenc,\ + pix_base + (m0x) + (m0y)*stride,\ + pix_base + (m1x) + (m1y)*stride,\ + pix_base + (m2x) + (m2y)*stride,\ + pix_base + (m3x) + (m3y)*stride,\ + stride, costs );\ + (costs)[0] += BITS_MVD( bmx+(m0x), bmy+(m0y) );\ + (costs)[1] += BITS_MVD( bmx+(m1x), bmy+(m1y) );\ + (costs)[2] += BITS_MVD( bmx+(m2x), bmy+(m2y) );\ + (costs)[3] += BITS_MVD( bmx+(m3x), bmy+(m3y) );\ +} + +#define COST_MV_X4( m0x, m0y, m1x, m1y, m2x, m2y, m3x, m3y )\ +{\ + pixel *pix_base = p_fref_w + omx + omy*stride;\ + h->pixf.fpelcmp_x4[i_pixel]( p_fenc,\ + pix_base + (m0x) + (m0y)*stride,\ + pix_base + (m1x) + (m1y)*stride,\ + pix_base + (m2x) + (m2y)*stride,\ + pix_base + (m3x) + (m3y)*stride,\ + stride, costs );\ + costs[0] += BITS_MVD( omx+(m0x), omy+(m0y) );\ + costs[1] += BITS_MVD( omx+(m1x), omy+(m1y) );\ + costs[2] += BITS_MVD( omx+(m2x), omy+(m2y) );\ + costs[3] += BITS_MVD( omx+(m3x), omy+(m3y) );\ + COPY3_IF_LT( bcost, costs[0], bmx, omx+(m0x), bmy, omy+(m0y) );\ + COPY3_IF_LT( bcost, costs[1], bmx, omx+(m1x), bmy, omy+(m1y) );\ + COPY3_IF_LT( bcost, costs[2], bmx, omx+(m2x), bmy, omy+(m2y) );\ + COPY3_IF_LT( bcost, costs[3], bmx, omx+(m3x), bmy, omy+(m3y) );\ +} + +#define COST_MV_X3_ABS( m0x, m0y, m1x, m1y, m2x, m2y )\ +{\ + h->pixf.fpelcmp_x3[i_pixel]( p_fenc,\ + p_fref_w + (m0x) + (m0y)*stride,\ + p_fref_w + (m1x) + (m1y)*stride,\ + p_fref_w + (m2x) + (m2y)*stride,\ + stride, costs );\ + costs[0] += p_cost_mvx[(m0x)<<2]; /* no cost_mvy */\ + costs[1] += p_cost_mvx[(m1x)<<2];\ + costs[2] += p_cost_mvx[(m2x)<<2];\ + COPY3_IF_LT( bcost, costs[0], bmx, m0x, bmy, m0y );\ + COPY3_IF_LT( bcost, costs[1], bmx, m1x, bmy, m1y );\ + COPY3_IF_LT( bcost, costs[2], bmx, m2x, bmy, m2y );\ +} + +/* 1 */ +/* 101 */ +/* 1 */ +#define DIA1_ITER( mx, my )\ +{\ + omx = mx; omy = my;\ + COST_MV_X4( 0,-1, 0,1, -1,0, 1,0 );\ +} + +#define CROSS( start, x_max, y_max )\ +{\ + int i = start;\ + if( (x_max) <= X264_MIN(mv_x_max-omx, omx-mv_x_min) )\ + for( ; i < (x_max)-2; i+=4 )\ + COST_MV_X4( i,0, -i,0, i+2,0, -i-2,0 );\ + for( ; i < (x_max); i+=2 )\ + {\ + if( omx+i <= mv_x_max )\ + COST_MV( omx+i, omy );\ + if( omx-i >= mv_x_min )\ + COST_MV( omx-i, omy );\ + }\ + i = start;\ + if( (y_max) <= X264_MIN(mv_y_max-omy, omy-mv_y_min) )\ + for( ; i < (y_max)-2; i+=4 )\ + COST_MV_X4( 0,i, 0,-i, 0,i+2, 0,-i-2 );\ + for( ; i < (y_max); i+=2 )\ + {\ + if( omy+i <= mv_y_max )\ + COST_MV( omx, omy+i );\ + if( omy-i >= mv_y_min )\ + COST_MV( omx, omy-i );\ + }\ +} + +#define FPEL(mv) (((mv)+2)>>2) /* Convert subpel MV to fullpel with rounding... */ +#define SPEL(mv) ((mv)<<2) /* ... and the reverse. */ +#define SPELx2(mv) (SPEL(mv)&0xFFFCFFFC) /* for two packed MVs */ + +void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_halfpel_thresh ) +{ + const int bw = x264_pixel_size[m->i_pixel].w; + const int bh = x264_pixel_size[m->i_pixel].h; + const int i_pixel = m->i_pixel; + const int stride = m->i_stride[0]; + int i_me_range = h->param.analyse.i_me_range; + int bmx, bmy, bcost = COST_MAX; + int bpred_cost = COST_MAX; + int omx, omy, pmx, pmy; + pixel *p_fenc = m->p_fenc[0]; + pixel *p_fref_w = m->p_fref_w; + ALIGNED_ARRAY_32( pixel, pix,[16*16] ); + ALIGNED_ARRAY_8( int16_t, mvc_temp,[16],[2] ); + + ALIGNED_ARRAY_16( int, costs,[16] ); + + int mv_x_min = h->mb.mv_limit_fpel[0][0]; + int mv_y_min = h->mb.mv_limit_fpel[0][1]; + int mv_x_max = h->mb.mv_limit_fpel[1][0]; + int mv_y_max = h->mb.mv_limit_fpel[1][1]; +/* Special version of pack to allow shortcuts in CHECK_MVRANGE */ +#define pack16to32_mask2(mx,my) ((mx<<16)|(my&0x7FFF)) + uint32_t mv_min = pack16to32_mask2( -mv_x_min, -mv_y_min ); + uint32_t mv_max = pack16to32_mask2( mv_x_max, mv_y_max )|0x8000; + uint32_t pmv, bpred_mv = 0; + +#define CHECK_MVRANGE(mx,my) (!(((pack16to32_mask2(mx,my) + mv_min) | (mv_max - pack16to32_mask2(mx,my))) & 0x80004000)) + + const uint16_t *p_cost_mvx = m->p_cost_mv - m->mvp[0]; + const uint16_t *p_cost_mvy = m->p_cost_mv - m->mvp[1]; + + /* Try extra predictors if provided. If subme >= 3, check subpel predictors, + * otherwise round them to fullpel. */ + if( h->mb.i_subpel_refine >= 3 ) + { + /* Calculate and check the MVP first */ + int bpred_mx = x264_clip3( m->mvp[0], SPEL(mv_x_min), SPEL(mv_x_max) ); + int bpred_my = x264_clip3( m->mvp[1], SPEL(mv_y_min), SPEL(mv_y_max) ); + pmv = pack16to32_mask( bpred_mx, bpred_my ); + pmx = FPEL( bpred_mx ); + pmy = FPEL( bpred_my ); + + COST_MV_HPEL( bpred_mx, bpred_my, bpred_cost ); + int pmv_cost = bpred_cost; + + if( i_mvc > 0 ) + { + /* Clip MV candidates and eliminate those equal to zero and pmv. */ + int valid_mvcs = x264_predictor_clip( mvc_temp+2, mvc, i_mvc, h->mb.mv_limit_fpel, pmv ); + if( valid_mvcs > 0 ) + { + int i = 1, cost; + /* We stuff pmv here to branchlessly pick between pmv and the various + * MV candidates. [0] gets skipped in order to maintain alignment for + * x264_predictor_clip. */ + M32( mvc_temp[1] ) = pmv; + bpred_cost <<= 4; + do + { + int mx = mvc_temp[i+1][0]; + int my = mvc_temp[i+1][1]; + COST_MV_HPEL( mx, my, cost ); + COPY1_IF_LT( bpred_cost, (cost << 4) + i ); + } while( ++i <= valid_mvcs ); + bpred_mx = mvc_temp[(bpred_cost&15)+1][0]; + bpred_my = mvc_temp[(bpred_cost&15)+1][1]; + bpred_cost >>= 4; + } + } + + /* Round the best predictor back to fullpel and get the cost, since this is where + * we'll be starting the fullpel motion search. */ + bmx = FPEL( bpred_mx ); + bmy = FPEL( bpred_my ); + bpred_mv = pack16to32_mask(bpred_mx, bpred_my); + if( bpred_mv&0x00030003 ) /* Only test if the tested predictor is actually subpel... */ + COST_MV( bmx, bmy ); + else /* Otherwise just copy the cost (we already know it) */ + bcost = bpred_cost; + + /* Test the zero vector if it hasn't been tested yet. */ + if( pmv ) + { + if( bmx|bmy ) COST_MV( 0, 0 ); + } + /* If a subpel mv candidate was better than the zero vector, the previous + * fullpel check won't have gotten it even if the pmv was zero. So handle + * that possibility here. */ + else + { + COPY3_IF_LT( bcost, pmv_cost, bmx, 0, bmy, 0 ); + } + } + else + { + /* Calculate and check the fullpel MVP first */ + bmx = pmx = x264_clip3( FPEL(m->mvp[0]), mv_x_min, mv_x_max ); + bmy = pmy = x264_clip3( FPEL(m->mvp[1]), mv_y_min, mv_y_max ); + pmv = pack16to32_mask( bmx, bmy ); + + /* Because we are rounding the predicted motion vector to fullpel, there will be + * an extra MV cost in 15 out of 16 cases. However, when the predicted MV is + * chosen as the best predictor, it is often the case that the subpel search will + * result in a vector at or next to the predicted motion vector. Therefore, we omit + * the cost of the MV from the rounded MVP to avoid unfairly biasing against use of + * the predicted motion vector. + * + * Disclaimer: this is a post-hoc rationalization for why this hack works. */ + bcost = h->pixf.fpelcmp[i_pixel]( p_fenc, FENC_STRIDE, &p_fref_w[bmy*stride+bmx], stride ); + + if( i_mvc > 0 ) + { + /* Like in subme>=3, except we also round the candidates to fullpel. */ + int valid_mvcs = x264_predictor_roundclip( mvc_temp+2, mvc, i_mvc, h->mb.mv_limit_fpel, pmv ); + if( valid_mvcs > 0 ) + { + int i = 1, cost; + M32( mvc_temp[1] ) = pmv; + bcost <<= 4; + do + { + int mx = mvc_temp[i+1][0]; + int my = mvc_temp[i+1][1]; + cost = h->pixf.fpelcmp[i_pixel]( p_fenc, FENC_STRIDE, &p_fref_w[my*stride+mx], stride ) + BITS_MVD( mx, my ); + COPY1_IF_LT( bcost, (cost << 4) + i ); + } while( ++i <= valid_mvcs ); + bmx = mvc_temp[(bcost&15)+1][0]; + bmy = mvc_temp[(bcost&15)+1][1]; + bcost >>= 4; + } + } + + /* Same as above, except the condition is simpler. */ + if( pmv ) + COST_MV( 0, 0 ); + } + + switch( h->mb.i_me_method ) + { + case X264_ME_DIA: + { + /* diamond search, radius 1 */ + bcost <<= 4; + int i = i_me_range; + do + { + COST_MV_X4_DIR( 0,-1, 0,1, -1,0, 1,0, costs ); + COPY1_IF_LT( bcost, (costs[0]<<4)+1 ); + COPY1_IF_LT( bcost, (costs[1]<<4)+3 ); + COPY1_IF_LT( bcost, (costs[2]<<4)+4 ); + COPY1_IF_LT( bcost, (costs[3]<<4)+12 ); + if( !(bcost&15) ) + break; + bmx -= (bcost<<28)>>30; + bmy -= (bcost<<30)>>30; + bcost &= ~15; + } while( --i && CHECK_MVRANGE(bmx, bmy) ); + bcost >>= 4; + break; + } + + case X264_ME_HEX: + { + me_hex2: + /* hexagon search, radius 2 */ + #if 0 + for( int i = 0; i < i_me_range/2; i++ ) + { + omx = bmx; omy = bmy; + COST_MV( omx-2, omy ); + COST_MV( omx-1, omy+2 ); + COST_MV( omx+1, omy+2 ); + COST_MV( omx+2, omy ); + COST_MV( omx+1, omy-2 ); + COST_MV( omx-1, omy-2 ); + if( bmx == omx && bmy == omy ) + break; + if( !CHECK_MVRANGE(bmx, bmy) ) + break; + } + #else + /* equivalent to the above, but eliminates duplicate candidates */ + + /* hexagon */ + COST_MV_X3_DIR( -2,0, -1, 2, 1, 2, costs ); + COST_MV_X3_DIR( 2,0, 1,-2, -1,-2, costs+4 ); /* +4 for 16-byte alignment */ + bcost <<= 3; + COPY1_IF_LT( bcost, (costs[0]<<3)+2 ); + COPY1_IF_LT( bcost, (costs[1]<<3)+3 ); + COPY1_IF_LT( bcost, (costs[2]<<3)+4 ); + COPY1_IF_LT( bcost, (costs[4]<<3)+5 ); + COPY1_IF_LT( bcost, (costs[5]<<3)+6 ); + COPY1_IF_LT( bcost, (costs[6]<<3)+7 ); + + if( bcost&7 ) + { + int dir = (bcost&7)-2; + bmx += hex2[dir+1][0]; + bmy += hex2[dir+1][1]; + + /* half hexagon, not overlapping the previous iteration */ + for( int i = (i_me_range>>1) - 1; i > 0 && CHECK_MVRANGE(bmx, bmy); i-- ) + { + COST_MV_X3_DIR( hex2[dir+0][0], hex2[dir+0][1], + hex2[dir+1][0], hex2[dir+1][1], + hex2[dir+2][0], hex2[dir+2][1], + costs ); + bcost &= ~7; + COPY1_IF_LT( bcost, (costs[0]<<3)+1 ); + COPY1_IF_LT( bcost, (costs[1]<<3)+2 ); + COPY1_IF_LT( bcost, (costs[2]<<3)+3 ); + if( !(bcost&7) ) + break; + dir += (bcost&7)-2; + dir = mod6m1[dir+1]; + bmx += hex2[dir+1][0]; + bmy += hex2[dir+1][1]; + } + } + bcost >>= 3; + #endif + /* square refine */ + bcost <<= 4; + COST_MV_X4_DIR( 0,-1, 0,1, -1,0, 1,0, costs ); + COPY1_IF_LT( bcost, (costs[0]<<4)+1 ); + COPY1_IF_LT( bcost, (costs[1]<<4)+2 ); + COPY1_IF_LT( bcost, (costs[2]<<4)+3 ); + COPY1_IF_LT( bcost, (costs[3]<<4)+4 ); + COST_MV_X4_DIR( -1,-1, -1,1, 1,-1, 1,1, costs ); + COPY1_IF_LT( bcost, (costs[0]<<4)+5 ); + COPY1_IF_LT( bcost, (costs[1]<<4)+6 ); + COPY1_IF_LT( bcost, (costs[2]<<4)+7 ); + COPY1_IF_LT( bcost, (costs[3]<<4)+8 ); + bmx += square1[bcost&15][0]; + bmy += square1[bcost&15][1]; + bcost >>= 4; + break; + } + + case X264_ME_UMH: + { + /* Uneven-cross Multi-Hexagon-grid Search + * as in JM, except with different early termination */ + + static const uint8_t x264_pixel_size_shift[7] = { 0, 1, 1, 2, 3, 3, 4 }; + + int ucost1, ucost2; + int cross_start = 1; + + /* refine predictors */ + ucost1 = bcost; + DIA1_ITER( pmx, pmy ); + if( pmx | pmy ) + DIA1_ITER( 0, 0 ); + + if( i_pixel == PIXEL_4x4 ) + goto me_hex2; + + ucost2 = bcost; + if( (bmx | bmy) && ((bmx-pmx) | (bmy-pmy)) ) + DIA1_ITER( bmx, bmy ); + if( bcost == ucost2 ) + cross_start = 3; + omx = bmx; omy = bmy; + + /* early termination */ +#define SAD_THRESH(v) ( bcost < ( v >> x264_pixel_size_shift[i_pixel] ) ) + if( bcost == ucost2 && SAD_THRESH(2000) ) + { + COST_MV_X4( 0,-2, -1,-1, 1,-1, -2,0 ); + COST_MV_X4( 2, 0, -1, 1, 1, 1, 0,2 ); + if( bcost == ucost1 && SAD_THRESH(500) ) + break; + if( bcost == ucost2 ) + { + int range = (i_me_range>>1) | 1; + CROSS( 3, range, range ); + COST_MV_X4( -1,-2, 1,-2, -2,-1, 2,-1 ); + COST_MV_X4( -2, 1, 2, 1, -1, 2, 1, 2 ); + if( bcost == ucost2 ) + break; + cross_start = range + 2; + } + } + + /* adaptive search range */ + if( i_mvc ) + { + /* range multipliers based on casual inspection of some statistics of + * average distance between current predictor and final mv found by ESA. + * these have not been tuned much by actual encoding. */ + static const uint8_t range_mul[4][4] = + { + { 3, 3, 4, 4 }, + { 3, 4, 4, 4 }, + { 4, 4, 4, 5 }, + { 4, 4, 5, 6 }, + }; + int mvd; + int sad_ctx, mvd_ctx; + int denom = 1; + + if( i_mvc == 1 ) + { + if( i_pixel == PIXEL_16x16 ) + /* mvc is probably the same as mvp, so the difference isn't meaningful. + * but prediction usually isn't too bad, so just use medium range */ + mvd = 25; + else + mvd = abs( m->mvp[0] - mvc[0][0] ) + + abs( m->mvp[1] - mvc[0][1] ); + } + else + { + /* calculate the degree of agreement between predictors. */ + /* in 16x16, mvc includes all the neighbors used to make mvp, + * so don't count mvp separately. */ + denom = i_mvc - 1; + mvd = 0; + if( i_pixel != PIXEL_16x16 ) + { + mvd = abs( m->mvp[0] - mvc[0][0] ) + + abs( m->mvp[1] - mvc[0][1] ); + denom++; + } + mvd += x264_predictor_difference( mvc, i_mvc ); + } + + sad_ctx = SAD_THRESH(1000) ? 0 + : SAD_THRESH(2000) ? 1 + : SAD_THRESH(4000) ? 2 : 3; + mvd_ctx = mvd < 10*denom ? 0 + : mvd < 20*denom ? 1 + : mvd < 40*denom ? 2 : 3; + + i_me_range = i_me_range * range_mul[mvd_ctx][sad_ctx] >> 2; + } + + /* FIXME if the above DIA2/OCT2/CROSS found a new mv, it has not updated omx/omy. + * we are still centered on the same place as the DIA2. is this desirable? */ + CROSS( cross_start, i_me_range, i_me_range>>1 ); + + COST_MV_X4( -2,-2, -2,2, 2,-2, 2,2 ); + + /* hexagon grid */ + omx = bmx; omy = bmy; + const uint16_t *p_cost_omvx = p_cost_mvx + omx*4; + const uint16_t *p_cost_omvy = p_cost_mvy + omy*4; + int i = 1; + do + { + static const int8_t hex4[16][2] = { + { 0,-4}, { 0, 4}, {-2,-3}, { 2,-3}, + {-4,-2}, { 4,-2}, {-4,-1}, { 4,-1}, + {-4, 0}, { 4, 0}, {-4, 1}, { 4, 1}, + {-4, 2}, { 4, 2}, {-2, 3}, { 2, 3}, + }; + + if( 4*i > X264_MIN4( mv_x_max-omx, omx-mv_x_min, + mv_y_max-omy, omy-mv_y_min ) ) + { + for( int j = 0; j < 16; j++ ) + { + int mx = omx + hex4[j][0]*i; + int my = omy + hex4[j][1]*i; + if( CHECK_MVRANGE(mx, my) ) + COST_MV( mx, my ); + } + } + else + { + int dir = 0; + pixel *pix_base = p_fref_w + omx + (omy-4*i)*stride; + int dy = i*stride; +#define SADS(k,x0,y0,x1,y1,x2,y2,x3,y3)\ + h->pixf.fpelcmp_x4[i_pixel]( p_fenc,\ + pix_base x0*i+(y0-2*k+4)*dy,\ + pix_base x1*i+(y1-2*k+4)*dy,\ + pix_base x2*i+(y2-2*k+4)*dy,\ + pix_base x3*i+(y3-2*k+4)*dy,\ + stride, costs+4*k );\ + pix_base += 2*dy; +#define ADD_MVCOST(k,x,y) costs[k] += p_cost_omvx[x*4*i] + p_cost_omvy[y*4*i] +#define MIN_MV(k,x,y) COPY2_IF_LT( bcost, costs[k], dir, x*16+(y&15) ) + SADS( 0, +0,-4, +0,+4, -2,-3, +2,-3 ); + SADS( 1, -4,-2, +4,-2, -4,-1, +4,-1 ); + SADS( 2, -4,+0, +4,+0, -4,+1, +4,+1 ); + SADS( 3, -4,+2, +4,+2, -2,+3, +2,+3 ); + ADD_MVCOST( 0, 0,-4 ); + ADD_MVCOST( 1, 0, 4 ); + ADD_MVCOST( 2,-2,-3 ); + ADD_MVCOST( 3, 2,-3 ); + ADD_MVCOST( 4,-4,-2 ); + ADD_MVCOST( 5, 4,-2 ); + ADD_MVCOST( 6,-4,-1 ); + ADD_MVCOST( 7, 4,-1 ); + ADD_MVCOST( 8,-4, 0 ); + ADD_MVCOST( 9, 4, 0 ); + ADD_MVCOST( 10,-4, 1 ); + ADD_MVCOST( 11, 4, 1 ); + ADD_MVCOST( 12,-4, 2 ); + ADD_MVCOST( 13, 4, 2 ); + ADD_MVCOST( 14,-2, 3 ); + ADD_MVCOST( 15, 2, 3 ); + MIN_MV( 0, 0,-4 ); + MIN_MV( 1, 0, 4 ); + MIN_MV( 2,-2,-3 ); + MIN_MV( 3, 2,-3 ); + MIN_MV( 4,-4,-2 ); + MIN_MV( 5, 4,-2 ); + MIN_MV( 6,-4,-1 ); + MIN_MV( 7, 4,-1 ); + MIN_MV( 8,-4, 0 ); + MIN_MV( 9, 4, 0 ); + MIN_MV( 10,-4, 1 ); + MIN_MV( 11, 4, 1 ); + MIN_MV( 12,-4, 2 ); + MIN_MV( 13, 4, 2 ); + MIN_MV( 14,-2, 3 ); + MIN_MV( 15, 2, 3 ); +#undef SADS +#undef ADD_MVCOST +#undef MIN_MV + if( dir ) + { + bmx = omx + i*(dir>>4); + bmy = omy + i*((dir<<28)>>28); + } + } + } while( ++i <= i_me_range>>2 ); + if( bmy <= mv_y_max && bmy >= mv_y_min && bmx <= mv_x_max && bmx >= mv_x_min ) + goto me_hex2; + break; + } + + case X264_ME_ESA: + case X264_ME_TESA: + { + const int min_x = X264_MAX( bmx - i_me_range, mv_x_min ); + const int min_y = X264_MAX( bmy - i_me_range, mv_y_min ); + const int max_x = X264_MIN( bmx + i_me_range, mv_x_max ); + const int max_y = X264_MIN( bmy + i_me_range, mv_y_max ); + /* SEA is fastest in multiples of 4 */ + const int width = (max_x - min_x + 3) & ~3; +#if 0 + /* plain old exhaustive search */ + for( int my = min_y; my <= max_y; my++ ) + for( int mx = min_x; mx < min_x + width; mx++ ) + COST_MV( mx, my ); +#else + /* successive elimination by comparing DC before a full SAD, + * because sum(abs(diff)) >= abs(diff(sum)). */ + uint16_t *sums_base = m->integral; + ALIGNED_16( static pixel zero[8*FENC_STRIDE] ) = {0}; + ALIGNED_ARRAY_16( int, enc_dc,[4] ); + int sad_size = i_pixel <= PIXEL_8x8 ? PIXEL_8x8 : PIXEL_4x4; + int delta = x264_pixel_size[sad_size].w; + int16_t *xs = h->scratch_buffer; + int xn; + uint16_t *cost_fpel_mvx = h->cost_mv_fpel[h->mb.i_qp][-m->mvp[0]&3] + (-m->mvp[0]>>2); + + h->pixf.sad_x4[sad_size]( zero, p_fenc, p_fenc+delta, + p_fenc+delta*FENC_STRIDE, p_fenc+delta+delta*FENC_STRIDE, + FENC_STRIDE, enc_dc ); + if( delta == 4 ) + sums_base += stride * (h->fenc->i_lines[0] + PADV*2); + if( i_pixel == PIXEL_16x16 || i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 ) + delta *= stride; + if( i_pixel == PIXEL_8x16 || i_pixel == PIXEL_4x8 ) + enc_dc[1] = enc_dc[2]; + + if( h->mb.i_me_method == X264_ME_TESA ) + { + // ADS threshold, then SAD threshold, then keep the best few SADs, then SATD + mvsad_t *mvsads = (mvsad_t *)(xs + ((width+31)&~31) + 4); + int nmvsad = 0, limit; + int sad_thresh = i_me_range <= 16 ? 10 : i_me_range <= 24 ? 11 : 12; + int bsad = h->pixf.sad[i_pixel]( p_fenc, FENC_STRIDE, p_fref_w+bmy*stride+bmx, stride ) + + BITS_MVD( bmx, bmy ); + for( int my = min_y; my <= max_y; my++ ) + { + int i; + int ycost = p_cost_mvy[my<<2]; + if( bsad <= ycost ) + continue; + bsad -= ycost; + xn = h->pixf.ads[i_pixel]( enc_dc, sums_base + min_x + my * stride, delta, + cost_fpel_mvx+min_x, xs, width, bsad * 17 >> 4 ); + for( i = 0; i < xn-2; i += 3 ) + { + pixel *ref = p_fref_w+min_x+my*stride; + ALIGNED_ARRAY_16( int, sads,[4] ); /* padded to [4] for asm */ + h->pixf.sad_x3[i_pixel]( p_fenc, ref+xs[i], ref+xs[i+1], ref+xs[i+2], stride, sads ); + for( int j = 0; j < 3; j++ ) + { + int sad = sads[j] + cost_fpel_mvx[xs[i+j]]; + if( sad < bsad*sad_thresh>>3 ) + { + COPY1_IF_LT( bsad, sad ); + mvsads[nmvsad].sad = sad + ycost; + mvsads[nmvsad].mv[0] = min_x+xs[i+j]; + mvsads[nmvsad].mv[1] = my; + nmvsad++; + } + } + } + for( ; i < xn; i++ ) + { + int mx = min_x+xs[i]; + int sad = h->pixf.sad[i_pixel]( p_fenc, FENC_STRIDE, p_fref_w+mx+my*stride, stride ) + + cost_fpel_mvx[xs[i]]; + if( sad < bsad*sad_thresh>>3 ) + { + COPY1_IF_LT( bsad, sad ); + mvsads[nmvsad].sad = sad + ycost; + mvsads[nmvsad].mv[0] = mx; + mvsads[nmvsad].mv[1] = my; + nmvsad++; + } + } + bsad += ycost; + } + + limit = i_me_range >> 1; + sad_thresh = bsad*sad_thresh>>3; + while( nmvsad > limit*2 && sad_thresh > bsad ) + { + int i = 0; + // halve the range if the domain is too large... eh, close enough + sad_thresh = (sad_thresh + bsad) >> 1; + while( i < nmvsad && mvsads[i].sad <= sad_thresh ) + i++; + for( int j = i; j < nmvsad; j++ ) + { + uint32_t sad; + if( WORD_SIZE == 8 && sizeof(mvsad_t) == 8 ) + { + uint64_t mvsad = M64( &mvsads[i] ) = M64( &mvsads[j] ); +#if WORDS_BIGENDIAN + mvsad >>= 32; +#endif + sad = mvsad; + } + else + { + sad = mvsads[j].sad; + CP32( mvsads[i].mv, mvsads[j].mv ); + mvsads[i].sad = sad; + } + i += (sad - (sad_thresh+1)) >> 31; + } + nmvsad = i; + } + while( nmvsad > limit ) + { + int bi = 0; + for( int i = 1; i < nmvsad; i++ ) + if( mvsads[i].sad > mvsads[bi].sad ) + bi = i; + nmvsad--; + if( sizeof( mvsad_t ) == sizeof( uint64_t ) ) + CP64( &mvsads[bi], &mvsads[nmvsad] ); + else + mvsads[bi] = mvsads[nmvsad]; + } + for( int i = 0; i < nmvsad; i++ ) + COST_MV( mvsads[i].mv[0], mvsads[i].mv[1] ); + } + else + { + // just ADS and SAD + for( int my = min_y; my <= max_y; my++ ) + { + int i; + int ycost = p_cost_mvy[my<<2]; + if( bcost <= ycost ) + continue; + bcost -= ycost; + xn = h->pixf.ads[i_pixel]( enc_dc, sums_base + min_x + my * stride, delta, + cost_fpel_mvx+min_x, xs, width, bcost ); + for( i = 0; i < xn-2; i += 3 ) + COST_MV_X3_ABS( min_x+xs[i],my, min_x+xs[i+1],my, min_x+xs[i+2],my ); + bcost += ycost; + for( ; i < xn; i++ ) + COST_MV( min_x+xs[i], my ); + } + } +#endif + } + break; + } + + /* -> qpel mv */ + uint32_t bmv = pack16to32_mask(bmx,bmy); + uint32_t bmv_spel = SPELx2(bmv); + if( h->mb.i_subpel_refine < 3 ) + { + m->cost_mv = p_cost_mvx[bmx<<2] + p_cost_mvy[bmy<<2]; + m->cost = bcost; + /* compute the real cost */ + if( bmv == pmv ) m->cost += m->cost_mv; + M32( m->mv ) = bmv_spel; + } + else + { + M32(m->mv) = bpred_cost < bcost ? bpred_mv : bmv_spel; + m->cost = X264_MIN( bpred_cost, bcost ); + } + + /* subpel refine */ + if( h->mb.i_subpel_refine >= 2 ) + { + int hpel = subpel_iterations[h->mb.i_subpel_refine][2]; + int qpel = subpel_iterations[h->mb.i_subpel_refine][3]; + refine_subpel( h, m, hpel, qpel, p_halfpel_thresh, 0 ); + } +} +#undef COST_MV + +void x264_me_refine_qpel( x264_t *h, x264_me_t *m ) +{ + int hpel = subpel_iterations[h->mb.i_subpel_refine][0]; + int qpel = subpel_iterations[h->mb.i_subpel_refine][1]; + + if( m->i_pixel <= PIXEL_8x8 ) + m->cost -= m->i_ref_cost; + + refine_subpel( h, m, hpel, qpel, NULL, 1 ); +} + +void x264_me_refine_qpel_refdupe( x264_t *h, x264_me_t *m, int *p_halfpel_thresh ) +{ + refine_subpel( h, m, 0, X264_MIN( 2, subpel_iterations[h->mb.i_subpel_refine][3] ), p_halfpel_thresh, 0 ); +} + +#define COST_MV_SAD( mx, my ) \ +{ \ + intptr_t stride = 16; \ + pixel *src = h->mc.get_ref( pix, &stride, m->p_fref, m->i_stride[0], mx, my, bw, bh, &m->weight[0] ); \ + int cost = h->pixf.fpelcmp[i_pixel]( m->p_fenc[0], FENC_STRIDE, src, stride ) \ + + p_cost_mvx[ mx ] + p_cost_mvy[ my ]; \ + COPY3_IF_LT( bcost, cost, bmx, mx, bmy, my ); \ +} + +#define COST_MV_SATD( mx, my, dir ) \ +if( b_refine_qpel || (dir^1) != odir ) \ +{ \ + intptr_t stride = 16; \ + pixel *src = h->mc.get_ref( pix, &stride, &m->p_fref[0], m->i_stride[0], mx, my, bw, bh, &m->weight[0] ); \ + int cost = h->pixf.mbcmp_unaligned[i_pixel]( m->p_fenc[0], FENC_STRIDE, src, stride ) \ + + p_cost_mvx[ mx ] + p_cost_mvy[ my ]; \ + if( b_chroma_me && cost < bcost ) \ + { \ + if( CHROMA444 ) \ + { \ + stride = 16; \ + src = h->mc.get_ref( pix, &stride, &m->p_fref[4], m->i_stride[1], mx, my, bw, bh, &m->weight[1] ); \ + cost += h->pixf.mbcmp_unaligned[i_pixel]( m->p_fenc[1], FENC_STRIDE, src, stride ); \ + if( cost < bcost ) \ + { \ + stride = 16; \ + src = h->mc.get_ref( pix, &stride, &m->p_fref[8], m->i_stride[2], mx, my, bw, bh, &m->weight[2] ); \ + cost += h->pixf.mbcmp_unaligned[i_pixel]( m->p_fenc[2], FENC_STRIDE, src, stride ); \ + } \ + } \ + else \ + { \ + h->mc.mc_chroma( pix, pix+8, 16, m->p_fref[4], m->i_stride[1], \ + mx, 2*(my+mvy_offset)>>chroma_v_shift, bw>>1, bh>>chroma_v_shift ); \ + if( m->weight[1].weightfn ) \ + m->weight[1].weightfn[bw>>3]( pix, 16, pix, 16, &m->weight[1], bh>>chroma_v_shift ); \ + cost += h->pixf.mbcmp[chromapix]( m->p_fenc[1], FENC_STRIDE, pix, 16 ); \ + if( cost < bcost ) \ + { \ + if( m->weight[2].weightfn ) \ + m->weight[2].weightfn[bw>>3]( pix+8, 16, pix+8, 16, &m->weight[2], bh>>chroma_v_shift ); \ + cost += h->pixf.mbcmp[chromapix]( m->p_fenc[2], FENC_STRIDE, pix+8, 16 ); \ + } \ + } \ + } \ + COPY4_IF_LT( bcost, cost, bmx, mx, bmy, my, bdir, dir ); \ +} + +static void refine_subpel( x264_t *h, x264_me_t *m, int hpel_iters, int qpel_iters, int *p_halfpel_thresh, int b_refine_qpel ) +{ + const int bw = x264_pixel_size[m->i_pixel].w; + const int bh = x264_pixel_size[m->i_pixel].h; + const uint16_t *p_cost_mvx = m->p_cost_mv - m->mvp[0]; + const uint16_t *p_cost_mvy = m->p_cost_mv - m->mvp[1]; + const int i_pixel = m->i_pixel; + const int b_chroma_me = h->mb.b_chroma_me && (i_pixel <= PIXEL_8x8 || CHROMA444); + int chromapix = h->luma2chroma_pixel[i_pixel]; + int chroma_v_shift = CHROMA_V_SHIFT; + int mvy_offset = chroma_v_shift & MB_INTERLACED & m->i_ref ? (h->mb.i_mb_y & 1)*4 - 2 : 0; + + ALIGNED_ARRAY_32( pixel, pix,[64*18] ); // really 17x17x2, but round up for alignment + ALIGNED_ARRAY_16( int, costs,[4] ); + + int bmx = m->mv[0]; + int bmy = m->mv[1]; + int bcost = m->cost; + int odir = -1, bdir; + + /* halfpel diamond search */ + if( hpel_iters ) + { + /* try the subpel component of the predicted mv */ + if( h->mb.i_subpel_refine < 3 ) + { + int mx = x264_clip3( m->mvp[0], h->mb.mv_min_spel[0]+2, h->mb.mv_max_spel[0]-2 ); + int my = x264_clip3( m->mvp[1], h->mb.mv_min_spel[1]+2, h->mb.mv_max_spel[1]-2 ); + if( (mx-bmx)|(my-bmy) ) + COST_MV_SAD( mx, my ); + } + + bcost <<= 6; + for( int i = hpel_iters; i > 0; i-- ) + { + int omx = bmx, omy = bmy; + intptr_t stride = 64; // candidates are either all hpel or all qpel, so one stride is enough + pixel *src0, *src1, *src2, *src3; + src0 = h->mc.get_ref( pix, &stride, m->p_fref, m->i_stride[0], omx, omy-2, bw, bh+1, &m->weight[0] ); + src2 = h->mc.get_ref( pix+32, &stride, m->p_fref, m->i_stride[0], omx-2, omy, bw+4, bh, &m->weight[0] ); + src1 = src0 + stride; + src3 = src2 + 1; + h->pixf.fpelcmp_x4[i_pixel]( m->p_fenc[0], src0, src1, src2, src3, stride, costs ); + costs[0] += p_cost_mvx[omx ] + p_cost_mvy[omy-2]; + costs[1] += p_cost_mvx[omx ] + p_cost_mvy[omy+2]; + costs[2] += p_cost_mvx[omx-2] + p_cost_mvy[omy ]; + costs[3] += p_cost_mvx[omx+2] + p_cost_mvy[omy ]; + COPY1_IF_LT( bcost, (costs[0]<<6)+2 ); + COPY1_IF_LT( bcost, (costs[1]<<6)+6 ); + COPY1_IF_LT( bcost, (costs[2]<<6)+16 ); + COPY1_IF_LT( bcost, (costs[3]<<6)+48 ); + if( !(bcost&63) ) + break; + bmx -= (bcost<<26)>>29; + bmy -= (bcost<<29)>>29; + bcost &= ~63; + } + bcost >>= 6; + } + + if( !b_refine_qpel && (h->pixf.mbcmp_unaligned[0] != h->pixf.fpelcmp[0] || b_chroma_me) ) + { + bcost = COST_MAX; + COST_MV_SATD( bmx, bmy, -1 ); + } + + /* early termination when examining multiple reference frames */ + if( p_halfpel_thresh ) + { + if( (bcost*7)>>3 > *p_halfpel_thresh ) + { + m->cost = bcost; + m->mv[0] = bmx; + m->mv[1] = bmy; + // don't need cost_mv + return; + } + else if( bcost < *p_halfpel_thresh ) + *p_halfpel_thresh = bcost; + } + + /* quarterpel diamond search */ + if( h->mb.i_subpel_refine != 1 ) + { + bdir = -1; + for( int i = qpel_iters; i > 0; i-- ) + { + if( bmy <= h->mb.mv_min_spel[1] || bmy >= h->mb.mv_max_spel[1] || bmx <= h->mb.mv_min_spel[0] || bmx >= h->mb.mv_max_spel[0] ) + break; + odir = bdir; + int omx = bmx, omy = bmy; + COST_MV_SATD( omx, omy - 1, 0 ); + COST_MV_SATD( omx, omy + 1, 1 ); + COST_MV_SATD( omx - 1, omy, 2 ); + COST_MV_SATD( omx + 1, omy, 3 ); + if( (bmx == omx) & (bmy == omy) ) + break; + } + } + /* Special simplified case for subme=1 */ + else if( bmy > h->mb.mv_min_spel[1] && bmy < h->mb.mv_max_spel[1] && bmx > h->mb.mv_min_spel[0] && bmx < h->mb.mv_max_spel[0] ) + { + int omx = bmx, omy = bmy; + /* We have to use mc_luma because all strides must be the same to use fpelcmp_x4 */ + h->mc.mc_luma( pix , 64, m->p_fref, m->i_stride[0], omx, omy-1, bw, bh, &m->weight[0] ); + h->mc.mc_luma( pix+16, 64, m->p_fref, m->i_stride[0], omx, omy+1, bw, bh, &m->weight[0] ); + h->mc.mc_luma( pix+32, 64, m->p_fref, m->i_stride[0], omx-1, omy, bw, bh, &m->weight[0] ); + h->mc.mc_luma( pix+48, 64, m->p_fref, m->i_stride[0], omx+1, omy, bw, bh, &m->weight[0] ); + h->pixf.fpelcmp_x4[i_pixel]( m->p_fenc[0], pix, pix+16, pix+32, pix+48, 64, costs ); + costs[0] += p_cost_mvx[omx ] + p_cost_mvy[omy-1]; + costs[1] += p_cost_mvx[omx ] + p_cost_mvy[omy+1]; + costs[2] += p_cost_mvx[omx-1] + p_cost_mvy[omy ]; + costs[3] += p_cost_mvx[omx+1] + p_cost_mvy[omy ]; + bcost <<= 4; + COPY1_IF_LT( bcost, (costs[0]<<4)+1 ); + COPY1_IF_LT( bcost, (costs[1]<<4)+3 ); + COPY1_IF_LT( bcost, (costs[2]<<4)+4 ); + COPY1_IF_LT( bcost, (costs[3]<<4)+12 ); + bmx -= (bcost<<28)>>30; + bmy -= (bcost<<30)>>30; + bcost >>= 4; + } + + m->cost = bcost; + m->mv[0] = bmx; + m->mv[1] = bmy; + m->cost_mv = p_cost_mvx[bmx] + p_cost_mvy[bmy]; +} + +#define BIME_CACHE( dx, dy, list )\ +{\ + x264_me_t *m = m##list;\ + int i = 4 + 3*dx + dy;\ + int mvx = bm##list##x+dx;\ + int mvy = bm##list##y+dy;\ + stride[0][list][i] = bw;\ + src[0][list][i] = h->mc.get_ref( pixy_buf[list][i], &stride[0][list][i], &m->p_fref[0],\ + m->i_stride[0], mvx, mvy, bw, bh, x264_weight_none );\ + if( rd )\ + {\ + if( CHROMA444 )\ + {\ + stride[1][list][i] = bw;\ + src[1][list][i] = h->mc.get_ref( pixu_buf[list][i], &stride[1][list][i], &m->p_fref[4],\ + m->i_stride[1], mvx, mvy, bw, bh, x264_weight_none );\ + stride[2][list][i] = bw;\ + src[2][list][i] = h->mc.get_ref( pixv_buf[list][i], &stride[2][list][i], &m->p_fref[8],\ + m->i_stride[2], mvx, mvy, bw, bh, x264_weight_none );\ + }\ + else\ + h->mc.mc_chroma( pixu_buf[list][i], pixv_buf[list][i], 8, m->p_fref[4], m->i_stride[1],\ + mvx, 2*(mvy+mv##list##y_offset)>>chroma_v_shift, bw>>1, bh>>chroma_v_shift );\ + }\ +} + +#define SATD_THRESH(cost) (cost+(cost>>4)) + +/* Don't unroll the BIME_CACHE loop. I couldn't find any way to force this + * other than making its iteration count not a compile-time constant. */ +int x264_iter_kludge = 0; + +static void ALWAYS_INLINE x264_me_refine_bidir( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2, int rd ) +{ + int x = i8&1; + int y = i8>>1; + int s8 = X264_SCAN8_0 + 2*x + 16*y; + int16_t *cache0_mv = h->mb.cache.mv[0][s8]; + int16_t *cache1_mv = h->mb.cache.mv[1][s8]; + const int i_pixel = m0->i_pixel; + const int bw = x264_pixel_size[i_pixel].w; + const int bh = x264_pixel_size[i_pixel].h; + ALIGNED_ARRAY_32( pixel, pixy_buf,[2],[9][16*16] ); + ALIGNED_ARRAY_32( pixel, pixu_buf,[2],[9][16*16] ); + ALIGNED_ARRAY_32( pixel, pixv_buf,[2],[9][16*16] ); + pixel *src[3][2][9]; + int chromapix = h->luma2chroma_pixel[i_pixel]; + int chroma_v_shift = CHROMA_V_SHIFT; + int chroma_x = (8 >> CHROMA_H_SHIFT) * x; + int chroma_y = (8 >> chroma_v_shift) * y; + pixel *pix = &h->mb.pic.p_fdec[0][8*x + 8*y*FDEC_STRIDE]; + pixel *pixu = &h->mb.pic.p_fdec[1][chroma_x + chroma_y*FDEC_STRIDE]; + pixel *pixv = &h->mb.pic.p_fdec[2][chroma_x + chroma_y*FDEC_STRIDE]; + int ref0 = h->mb.cache.ref[0][s8]; + int ref1 = h->mb.cache.ref[1][s8]; + const int mv0y_offset = chroma_v_shift & MB_INTERLACED & ref0 ? (h->mb.i_mb_y & 1)*4 - 2 : 0; + const int mv1y_offset = chroma_v_shift & MB_INTERLACED & ref1 ? (h->mb.i_mb_y & 1)*4 - 2 : 0; + intptr_t stride[3][2][9]; + int bm0x = m0->mv[0]; + int bm0y = m0->mv[1]; + int bm1x = m1->mv[0]; + int bm1y = m1->mv[1]; + int bcost = COST_MAX; + int mc_list0 = 1, mc_list1 = 1; + uint64_t bcostrd = COST_MAX64; + uint16_t amvd; + /* each byte of visited represents 8 possible m1y positions, so a 4D array isn't needed */ + ALIGNED_ARRAY_64( uint8_t, visited,[8],[8][8] ); + /* all permutations of an offset in up to 2 of the dimensions */ + ALIGNED_4( static const int8_t dia4d[33][4] ) = + { + {0,0,0,0}, + {0,0,0,1}, {0,0,0,-1}, {0,0,1,0}, {0,0,-1,0}, + {0,1,0,0}, {0,-1,0,0}, {1,0,0,0}, {-1,0,0,0}, + {0,0,1,1}, {0,0,-1,-1},{0,1,1,0}, {0,-1,-1,0}, + {1,1,0,0}, {-1,-1,0,0},{1,0,0,1}, {-1,0,0,-1}, + {0,1,0,1}, {0,-1,0,-1},{1,0,1,0}, {-1,0,-1,0}, + {0,0,-1,1},{0,0,1,-1}, {0,-1,1,0},{0,1,-1,0}, + {-1,1,0,0},{1,-1,0,0}, {1,0,0,-1},{-1,0,0,1}, + {0,-1,0,1},{0,1,0,-1}, {-1,0,1,0},{1,0,-1,0}, + }; + + if( bm0y < h->mb.mv_min_spel[1] + 8 || bm1y < h->mb.mv_min_spel[1] + 8 || + bm0y > h->mb.mv_max_spel[1] - 8 || bm1y > h->mb.mv_max_spel[1] - 8 || + bm0x < h->mb.mv_min_spel[0] + 8 || bm1x < h->mb.mv_min_spel[0] + 8 || + bm0x > h->mb.mv_max_spel[0] - 8 || bm1x > h->mb.mv_max_spel[0] - 8 ) + return; + + if( rd && m0->i_pixel != PIXEL_16x16 && i8 != 0 ) + { + x264_mb_predict_mv( h, 0, i8<<2, bw>>2, m0->mvp ); + x264_mb_predict_mv( h, 1, i8<<2, bw>>2, m1->mvp ); + } + + const uint16_t *p_cost_m0x = m0->p_cost_mv - m0->mvp[0]; + const uint16_t *p_cost_m0y = m0->p_cost_mv - m0->mvp[1]; + const uint16_t *p_cost_m1x = m1->p_cost_mv - m1->mvp[0]; + const uint16_t *p_cost_m1y = m1->p_cost_mv - m1->mvp[1]; + + h->mc.memzero_aligned( visited, sizeof(uint8_t[8][8][8]) ); + + for( int pass = 0; pass < 8; pass++ ) + { + int bestj = 0; + /* check all mv pairs that differ in at most 2 components from the current mvs. */ + /* doesn't do chroma ME. this probably doesn't matter, as the gains + * from bidir ME are the same with and without chroma ME. */ + + if( mc_list0 ) + for( int j = x264_iter_kludge; j < 9; j++ ) + BIME_CACHE( square1[j][0], square1[j][1], 0 ); + + if( mc_list1 ) + for( int j = x264_iter_kludge; j < 9; j++ ) + BIME_CACHE( square1[j][0], square1[j][1], 1 ); + + for( int j = !!pass; j < 33; j++ ) + { + int m0x = dia4d[j][0] + bm0x; + int m0y = dia4d[j][1] + bm0y; + int m1x = dia4d[j][2] + bm1x; + int m1y = dia4d[j][3] + bm1y; + if( !pass || !((visited[(m0x)&7][(m0y)&7][(m1x)&7] & (1<<((m1y)&7)))) ) + { + int i0 = 4 + 3*dia4d[j][0] + dia4d[j][1]; + int i1 = 4 + 3*dia4d[j][2] + dia4d[j][3]; + visited[(m0x)&7][(m0y)&7][(m1x)&7] |= (1<<((m1y)&7)); + h->mc.avg[i_pixel]( pix, FDEC_STRIDE, src[0][0][i0], stride[0][0][i0], src[0][1][i1], stride[0][1][i1], i_weight ); + int cost = h->pixf.mbcmp[i_pixel]( m0->p_fenc[0], FENC_STRIDE, pix, FDEC_STRIDE ) + + p_cost_m0x[m0x] + p_cost_m0y[m0y] + p_cost_m1x[m1x] + p_cost_m1y[m1y]; + if( rd ) + { + if( cost < SATD_THRESH(bcost) ) + { + bcost = X264_MIN( cost, bcost ); + M32( cache0_mv ) = pack16to32_mask(m0x,m0y); + M32( cache1_mv ) = pack16to32_mask(m1x,m1y); + if( CHROMA444 ) + { + h->mc.avg[i_pixel]( pixu, FDEC_STRIDE, src[1][0][i0], stride[1][0][i0], src[1][1][i1], stride[1][1][i1], i_weight ); + h->mc.avg[i_pixel]( pixv, FDEC_STRIDE, src[2][0][i0], stride[2][0][i0], src[2][1][i1], stride[2][1][i1], i_weight ); + } + else + { + h->mc.avg[chromapix]( pixu, FDEC_STRIDE, pixu_buf[0][i0], 8, pixu_buf[1][i1], 8, i_weight ); + h->mc.avg[chromapix]( pixv, FDEC_STRIDE, pixv_buf[0][i0], 8, pixv_buf[1][i1], 8, i_weight ); + } + uint64_t costrd = x264_rd_cost_part( h, i_lambda2, i8*4, m0->i_pixel ); + COPY2_IF_LT( bcostrd, costrd, bestj, j ); + } + } + else + COPY2_IF_LT( bcost, cost, bestj, j ); + } + } + + if( !bestj ) + break; + + bm0x += dia4d[bestj][0]; + bm0y += dia4d[bestj][1]; + bm1x += dia4d[bestj][2]; + bm1y += dia4d[bestj][3]; + + mc_list0 = M16( &dia4d[bestj][0] ); + mc_list1 = M16( &dia4d[bestj][2] ); + } + + if( rd ) + { + x264_macroblock_cache_mv ( h, 2*x, 2*y, bw>>2, bh>>2, 0, pack16to32_mask(bm0x, bm0y) ); + amvd = pack8to16( X264_MIN(abs(bm0x - m0->mvp[0]),33), X264_MIN(abs(bm0y - m0->mvp[1]),33) ); + x264_macroblock_cache_mvd( h, 2*x, 2*y, bw>>2, bh>>2, 0, amvd ); + + x264_macroblock_cache_mv ( h, 2*x, 2*y, bw>>2, bh>>2, 1, pack16to32_mask(bm1x, bm1y) ); + amvd = pack8to16( X264_MIN(abs(bm1x - m1->mvp[0]),33), X264_MIN(abs(bm1y - m1->mvp[1]),33) ); + x264_macroblock_cache_mvd( h, 2*x, 2*y, bw>>2, bh>>2, 1, amvd ); + } + + m0->mv[0] = bm0x; + m0->mv[1] = bm0y; + m1->mv[0] = bm1x; + m1->mv[1] = bm1y; +} + +void x264_me_refine_bidir_satd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight ) +{ + x264_me_refine_bidir( h, m0, m1, i_weight, 0, 0, 0 ); +} + +void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2 ) +{ + /* Motion compensation is done as part of bidir_rd; don't repeat + * it in encoding. */ + h->mb.b_skip_mc = 1; + x264_me_refine_bidir( h, m0, m1, i_weight, i8, i_lambda2, 1 ); + h->mb.b_skip_mc = 0; +} + +#undef COST_MV_SATD +#define COST_MV_SATD( mx, my, dst, avoid_mvp ) \ +{ \ + if( !avoid_mvp || !(mx == pmx && my == pmy) ) \ + { \ + h->mc.mc_luma( pix, FDEC_STRIDE, m->p_fref, m->i_stride[0], mx, my, bw, bh, &m->weight[0] ); \ + dst = h->pixf.mbcmp[i_pixel]( m->p_fenc[0], FENC_STRIDE, pix, FDEC_STRIDE ) \ + + p_cost_mvx[mx] + p_cost_mvy[my]; \ + COPY1_IF_LT( bsatd, dst ); \ + } \ + else \ + dst = COST_MAX; \ +} + +#define COST_MV_RD( mx, my, satd, do_dir, mdir ) \ +{ \ + if( satd <= SATD_THRESH(bsatd) ) \ + { \ + uint64_t cost; \ + M32( cache_mv ) = pack16to32_mask(mx,my); \ + if( CHROMA444 ) \ + { \ + h->mc.mc_luma( pixu, FDEC_STRIDE, &m->p_fref[4], m->i_stride[1], mx, my, bw, bh, &m->weight[1] ); \ + h->mc.mc_luma( pixv, FDEC_STRIDE, &m->p_fref[8], m->i_stride[2], mx, my, bw, bh, &m->weight[2] ); \ + } \ + else if( m->i_pixel <= PIXEL_8x8 ) \ + { \ + h->mc.mc_chroma( pixu, pixv, FDEC_STRIDE, m->p_fref[4], m->i_stride[1], \ + mx, 2*(my+mvy_offset)>>chroma_v_shift, bw>>1, bh>>chroma_v_shift ); \ + if( m->weight[1].weightfn ) \ + m->weight[1].weightfn[bw>>3]( pixu, FDEC_STRIDE, pixu, FDEC_STRIDE, &m->weight[1], bh>>chroma_v_shift ); \ + if( m->weight[2].weightfn ) \ + m->weight[2].weightfn[bw>>3]( pixv, FDEC_STRIDE, pixv, FDEC_STRIDE, &m->weight[2], bh>>chroma_v_shift ); \ + } \ + cost = x264_rd_cost_part( h, i_lambda2, i4, m->i_pixel ); \ + COPY4_IF_LT( bcost, cost, bmx, mx, bmy, my, dir, do_dir?mdir:dir ); \ + } \ +} + +void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int i_list ) +{ + int16_t *cache_mv = h->mb.cache.mv[i_list][x264_scan8[i4]]; + const uint16_t *p_cost_mvx, *p_cost_mvy; + const int bw = x264_pixel_size[m->i_pixel].w; + const int bh = x264_pixel_size[m->i_pixel].h; + const int i_pixel = m->i_pixel; + int chroma_v_shift = CHROMA_V_SHIFT; + int mvy_offset = chroma_v_shift & MB_INTERLACED & m->i_ref ? (h->mb.i_mb_y & 1)*4 - 2 : 0; + + uint64_t bcost = COST_MAX64; + int bmx = m->mv[0]; + int bmy = m->mv[1]; + int omx, omy, pmx, pmy; + int satd, bsatd; + int dir = -2; + int i8 = i4>>2; + uint16_t amvd; + + pixel *pix = &h->mb.pic.p_fdec[0][block_idx_xy_fdec[i4]]; + pixel *pixu, *pixv; + if( CHROMA444 ) + { + pixu = &h->mb.pic.p_fdec[1][block_idx_xy_fdec[i4]]; + pixv = &h->mb.pic.p_fdec[2][block_idx_xy_fdec[i4]]; + } + else + { + pixu = &h->mb.pic.p_fdec[1][(i8>>1)*(8*FDEC_STRIDE>>chroma_v_shift)+(i8&1)*4]; + pixv = &h->mb.pic.p_fdec[2][(i8>>1)*(8*FDEC_STRIDE>>chroma_v_shift)+(i8&1)*4]; + } + + h->mb.b_skip_mc = 1; + + if( m->i_pixel != PIXEL_16x16 && i4 != 0 ) + x264_mb_predict_mv( h, i_list, i4, bw>>2, m->mvp ); + pmx = m->mvp[0]; + pmy = m->mvp[1]; + p_cost_mvx = m->p_cost_mv - pmx; + p_cost_mvy = m->p_cost_mv - pmy; + COST_MV_SATD( bmx, bmy, bsatd, 0 ); + if( m->i_pixel != PIXEL_16x16 ) + COST_MV_RD( bmx, bmy, 0, 0, 0 ) + else + bcost = m->cost; + + /* check the predicted mv */ + if( (bmx != pmx || bmy != pmy) + && pmx >= h->mb.mv_min_spel[0] && pmx <= h->mb.mv_max_spel[0] + && pmy >= h->mb.mv_min_spel[1] && pmy <= h->mb.mv_max_spel[1] ) + { + COST_MV_SATD( pmx, pmy, satd, 0 ); + COST_MV_RD ( pmx, pmy, satd, 0, 0 ); + /* The hex motion search is guaranteed to not repeat the center candidate, + * so if pmv is chosen, set the "MV to avoid checking" to bmv instead. */ + if( bmx == pmx && bmy == pmy ) + { + pmx = m->mv[0]; + pmy = m->mv[1]; + } + } + + if( bmy < h->mb.mv_min_spel[1] + 3 || bmy > h->mb.mv_max_spel[1] - 3 || + bmx < h->mb.mv_min_spel[0] + 3 || bmx > h->mb.mv_max_spel[0] - 3 ) + { + h->mb.b_skip_mc = 0; + return; + } + + /* subpel hex search, same pattern as ME HEX. */ + dir = -2; + omx = bmx; + omy = bmy; + for( int j = 0; j < 6; j++ ) + { + COST_MV_SATD( omx + hex2[j+1][0], omy + hex2[j+1][1], satd, 1 ); + COST_MV_RD ( omx + hex2[j+1][0], omy + hex2[j+1][1], satd, 1, j ); + } + + if( dir != -2 ) + { + /* half hexagon, not overlapping the previous iteration */ + for( int i = 1; i < 10; i++ ) + { + const int odir = mod6m1[dir+1]; + if( bmy < h->mb.mv_min_spel[1] + 3 || + bmy > h->mb.mv_max_spel[1] - 3 ) + break; + dir = -2; + omx = bmx; + omy = bmy; + for( int j = 0; j < 3; j++ ) + { + COST_MV_SATD( omx + hex2[odir+j][0], omy + hex2[odir+j][1], satd, 1 ); + COST_MV_RD ( omx + hex2[odir+j][0], omy + hex2[odir+j][1], satd, 1, odir-1+j ); + } + if( dir == -2 ) + break; + } + } + + /* square refine, same pattern as ME HEX. */ + omx = bmx; + omy = bmy; + for( int i = 0; i < 8; i++ ) + { + COST_MV_SATD( omx + square1[i+1][0], omy + square1[i+1][1], satd, 1 ); + COST_MV_RD ( omx + square1[i+1][0], omy + square1[i+1][1], satd, 0, 0 ); + } + + m->cost = bcost; + m->mv[0] = bmx; + m->mv[1] = bmy; + x264_macroblock_cache_mv ( h, block_idx_x[i4], block_idx_y[i4], bw>>2, bh>>2, i_list, pack16to32_mask(bmx, bmy) ); + amvd = pack8to16( X264_MIN(abs(bmx - m->mvp[0]),66), X264_MIN(abs(bmy - m->mvp[1]),66) ); + x264_macroblock_cache_mvd( h, block_idx_x[i4], block_idx_y[i4], bw>>2, bh>>2, i_list, amvd ); + h->mb.b_skip_mc = 0; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.h new file mode 100644 index 00000000..505e3ce1 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/me.h @@ -0,0 +1,104 @@ +/***************************************************************************** + * me.h: motion estimation + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ME_H +#define X264_ME_H + +#define COST_MAX (1<<28) +#define COST_MAX64 (1ULL<<60) + +typedef struct +{ + /* aligning the first member is a gcc hack to force the struct to be aligned, + * as well as force sizeof(struct) to be a multiple of the alignment. */ + /* input */ + ALIGNED_64( int i_pixel ); /* PIXEL_WxH */ + uint16_t *p_cost_mv; /* lambda * nbits for each possible mv */ + int i_ref_cost; + int i_ref; + const x264_weight_t *weight; + + pixel *p_fref[12]; + pixel *p_fref_w; + pixel *p_fenc[3]; + uint16_t *integral; + int i_stride[3]; + + ALIGNED_4( int16_t mvp[2] ); + + /* output */ + int cost_mv; /* lambda * nbits for the chosen mv */ + int cost; /* satd + lambda * nbits */ + ALIGNED_4( int16_t mv[2] ); +} ALIGNED_64( x264_me_t ); + +void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_fullpel_thresh ); +#define x264_me_search( h, m, mvc, i_mvc )\ + x264_me_search_ref( h, m, mvc, i_mvc, NULL ) + +void x264_me_refine_qpel( x264_t *h, x264_me_t *m ); +void x264_me_refine_qpel_refdupe( x264_t *h, x264_me_t *m, int *p_halfpel_thresh ); +void x264_me_refine_qpel_rd( x264_t *h, x264_me_t *m, int i_lambda2, int i4, int i_list ); +void x264_me_refine_bidir_rd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight, int i8, int i_lambda2 ); +void x264_me_refine_bidir_satd( x264_t *h, x264_me_t *m0, x264_me_t *m1, int i_weight ); +uint64_t x264_rd_cost_part( x264_t *h, int i_lambda2, int i8, int i_pixel ); + +#define COPY1_IF_LT(x,y)\ +if( (y) < (x) )\ + (x) = (y); + +#define COPY2_IF_LT(x,y,a,b)\ +if( (y) < (x) )\ +{\ + (x) = (y);\ + (a) = (b);\ +} + +#define COPY3_IF_LT(x,y,a,b,c,d)\ +if( (y) < (x) )\ +{\ + (x) = (y);\ + (a) = (b);\ + (c) = (d);\ +} + +#define COPY4_IF_LT(x,y,a,b,c,d,e,f)\ +if( (y) < (x) )\ +{\ + (x) = (y);\ + (a) = (b);\ + (c) = (d);\ + (e) = (f);\ +} + +#define COPY2_IF_GT(x,y,a,b)\ +if( (y) > (x) )\ +{\ + (x) = (y);\ + (a) = (b);\ +} + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.c new file mode 100644 index 00000000..5289316b --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.c @@ -0,0 +1,3104 @@ +/***************************************************************************** + * ratecontrol.c: ratecontrol + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Loren Merritt + * Michael Niedermayer + * Gabriel Bouvigne + * Fiona Glaser + * Måns Rullgård + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#undef NDEBUG // always check asserts, the speed effect is far too small to disable them + +#include "common/common.h" +#include "ratecontrol.h" +#include "me.h" + +typedef struct +{ + int pict_type; + int frame_type; + int kept_as_ref; + double qscale; + int mv_bits; + int tex_bits; + int misc_bits; + double expected_bits; /* total expected bits up to the current frame (current one excluded) */ + double expected_vbv; + double new_qscale; + float new_qp; + int i_count; + int p_count; + int s_count; + float blurred_complexity; + char direct_mode; + int16_t weight[3][2]; + int16_t i_weight_denom[2]; + int refcount[16]; + int refs; + int64_t i_duration; + int64_t i_cpb_duration; + int out_num; +} ratecontrol_entry_t; + +typedef struct +{ + float coeff_min; + float coeff; + float count; + float decay; + float offset; +} predictor_t; + +struct x264_ratecontrol_t +{ + /* constants */ + int b_abr; + int b_2pass; + int b_vbv; + int b_vbv_min_rate; + double fps; + double bitrate; + double rate_tolerance; + double qcompress; + int nmb; /* number of macroblocks in a frame */ + int qp_constant[3]; + + /* current frame */ + ratecontrol_entry_t *rce; + float qpm; /* qp for current macroblock: precise float for AQ */ + float qpa_rc; /* average of macroblocks' qp before aq */ + float qpa_rc_prev; + int qpa_aq; /* average of macroblocks' qp after aq */ + int qpa_aq_prev; + float qp_novbv; /* QP for the current frame if 1-pass VBV was disabled. */ + + /* VBV stuff */ + double buffer_size; + int64_t buffer_fill_final; + int64_t buffer_fill_final_min; + double buffer_fill; /* planned buffer, if all in-progress frames hit their bit budget */ + double buffer_rate; /* # of bits added to buffer_fill after each frame */ + double vbv_max_rate; /* # of bits added to buffer_fill per second */ + predictor_t *pred; /* predict frame size from satd */ + int single_frame_vbv; + float rate_factor_max_increment; /* Don't allow RF above (CRF + this value). */ + + /* ABR stuff */ + int last_satd; + double last_rceq; + double cplxr_sum; /* sum of bits*qscale/rceq */ + double expected_bits_sum; /* sum of qscale2bits after rceq, ratefactor, and overflow, only includes finished frames */ + int64_t filler_bits_sum; /* sum in bits of finished frames' filler data */ + double wanted_bits_window; /* target bitrate * window */ + double cbr_decay; + double short_term_cplxsum; + double short_term_cplxcount; + double rate_factor_constant; + double ip_offset; + double pb_offset; + + /* 2pass stuff */ + FILE *p_stat_file_out; + char *psz_stat_file_tmpname; + FILE *p_mbtree_stat_file_out; + char *psz_mbtree_stat_file_tmpname; + char *psz_mbtree_stat_file_name; + FILE *p_mbtree_stat_file_in; + + int num_entries; /* number of ratecontrol_entry_ts */ + ratecontrol_entry_t *entry; /* FIXME: copy needed data and free this once init is done */ + ratecontrol_entry_t **entry_out; + double last_qscale; + double last_qscale_for[3]; /* last qscale for a specific pict type, used for max_diff & ipb factor stuff */ + int last_non_b_pict_type; + double accum_p_qp; /* for determining I-frame quant */ + double accum_p_norm; + double last_accum_p_norm; + double lmin[3]; /* min qscale by frame type */ + double lmax[3]; + double lstep; /* max change (multiply) in qscale per frame */ + struct + { + uint16_t *qp_buffer[2]; /* Global buffers for converting MB-tree quantizer data. */ + int qpbuf_pos; /* In order to handle pyramid reordering, QP buffer acts as a stack. + * This value is the current position (0 or 1). */ + int src_mb_count; + + /* For rescaling */ + int rescale_enabled; + float *scale_buffer[2]; /* Intermediate buffers */ + int filtersize[2]; /* filter size (H/V) */ + float *coeffs[2]; + int *pos[2]; + int srcdim[2]; /* Source dimensions (W/H) */ + } mbtree; + + /* MBRC stuff */ + float frame_size_estimated; /* Access to this variable must be atomic: double is + * not atomic on all arches we care about */ + double frame_size_maximum; /* Maximum frame size due to MinCR */ + double frame_size_planned; + double slice_size_planned; + predictor_t *row_pred; + predictor_t row_preds[3][2]; + predictor_t *pred_b_from_p; /* predict B-frame size from P-frame satd */ + int bframes; /* # consecutive B-frames before this P-frame */ + int bframe_bits; /* total cost of those frames */ + + int i_zones; + x264_zone_t *zones; + x264_zone_t *prev_zone; + + /* hrd stuff */ + int initial_cpb_removal_delay; + int initial_cpb_removal_delay_offset; + double nrt_first_access_unit; /* nominal removal time */ + double previous_cpb_final_arrival_time; + uint64_t hrd_multiply_denom; +}; + + +static int parse_zones( x264_t *h ); +static int init_pass2(x264_t *); +static float rate_estimate_qscale( x264_t *h ); +static int update_vbv( x264_t *h, int bits ); +static void update_vbv_plan( x264_t *h, int overhead ); +static float predict_size( predictor_t *p, float q, float var ); +static void update_predictor( predictor_t *p, float q, float var, float bits ); + +#define CMP_OPT_FIRST_PASS( opt, param_val )\ +{\ + if( ( p = strstr( opts, opt "=" ) ) && sscanf( p, opt "=%d" , &i ) && param_val != i )\ + {\ + x264_log( h, X264_LOG_ERROR, "different " opt " setting than first pass (%d vs %d)\n", param_val, i );\ + return -1;\ + }\ +} + +/* Terminology: + * qp = h.264's quantizer + * qscale = linearized quantizer = Lagrange multiplier + */ +static inline float qp2qscale( float qp ) +{ + return 0.85f * powf( 2.0f, ( qp - (12.0f + QP_BD_OFFSET) ) / 6.0f ); +} +static inline float qscale2qp( float qscale ) +{ + return (12.0f + QP_BD_OFFSET) + 6.0f * log2f( qscale/0.85f ); +} + +/* Texture bitrate is not quite inversely proportional to qscale, + * probably due the the changing number of SKIP blocks. + * MV bits level off at about qp<=12, because the lambda used + * for motion estimation is constant there. */ +static inline double qscale2bits( ratecontrol_entry_t *rce, double qscale ) +{ + if( qscale<0.1 ) + qscale = 0.1; + return (rce->tex_bits + .1) * pow( rce->qscale / qscale, 1.1 ) + + rce->mv_bits * pow( X264_MAX(rce->qscale, 1) / X264_MAX(qscale, 1), 0.5 ) + + rce->misc_bits; +} + +static ALWAYS_INLINE uint32_t ac_energy_var( uint64_t sum_ssd, int shift, x264_frame_t *frame, int i, int b_store ) +{ + uint32_t sum = sum_ssd; + uint32_t ssd = sum_ssd >> 32; + if( b_store ) + { + frame->i_pixel_sum[i] += sum; + frame->i_pixel_ssd[i] += ssd; + } + return ssd - ((uint64_t)sum * sum >> shift); +} + +static ALWAYS_INLINE uint32_t ac_energy_plane( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame, int i, int b_chroma, int b_field, int b_store ) +{ + int height = b_chroma ? 16>>CHROMA_V_SHIFT : 16; + int stride = frame->i_stride[i]; + int offset = b_field + ? 16 * mb_x + height * (mb_y&~1) * stride + (mb_y&1) * stride + : 16 * mb_x + height * mb_y * stride; + stride <<= b_field; + if( b_chroma ) + { + ALIGNED_ARRAY_32( pixel, pix,[FENC_STRIDE*16] ); + int chromapix = h->luma2chroma_pixel[PIXEL_16x16]; + int shift = 7 - CHROMA_V_SHIFT; + + h->mc.load_deinterleave_chroma_fenc( pix, frame->plane[1] + offset, stride, height ); + return ac_energy_var( h->pixf.var[chromapix]( pix, FENC_STRIDE ), shift, frame, 1, b_store ) + + ac_energy_var( h->pixf.var[chromapix]( pix+FENC_STRIDE/2, FENC_STRIDE ), shift, frame, 2, b_store ); + } + else + return ac_energy_var( h->pixf.var[PIXEL_16x16]( frame->plane[i] + offset, stride ), 8, frame, i, b_store ); +} + +// Find the total AC energy of the block in all planes. +static NOINLINE uint32_t x264_ac_energy_mb( x264_t *h, int mb_x, int mb_y, x264_frame_t *frame ) +{ + /* This function contains annoying hacks because GCC has a habit of reordering emms + * and putting it after floating point ops. As a result, we put the emms at the end of the + * function and make sure that its always called before the float math. Noinline makes + * sure no reordering goes on. */ + uint32_t var; + x264_prefetch_fenc( h, frame, mb_x, mb_y ); + if( h->mb.b_adaptive_mbaff ) + { + /* We don't know the super-MB mode we're going to pick yet, so + * simply try both and pick the lower of the two. */ + uint32_t var_interlaced, var_progressive; + var_interlaced = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, 1, 1 ); + var_progressive = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, 0, 0 ); + if( CHROMA444 ) + { + var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, 1, 1 ); + var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, 0, 0 ); + var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 1, 1 ); + var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, 0, 0 ); + } + else + { + var_interlaced += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 1, 1 ); + var_progressive += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, 0, 0 ); + } + var = X264_MIN( var_interlaced, var_progressive ); + } + else + { + var = ac_energy_plane( h, mb_x, mb_y, frame, 0, 0, PARAM_INTERLACED, 1 ); + if( CHROMA444 ) + { + var += ac_energy_plane( h, mb_x, mb_y, frame, 1, 0, PARAM_INTERLACED, 1 ); + var += ac_energy_plane( h, mb_x, mb_y, frame, 2, 0, PARAM_INTERLACED, 1 ); + } + else + var += ac_energy_plane( h, mb_x, mb_y, frame, 1, 1, PARAM_INTERLACED, 1 ); + } + x264_emms(); + return var; +} + +void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets ) +{ + /* Initialize frame stats */ + for( int i = 0; i < 3; i++ ) + { + frame->i_pixel_sum[i] = 0; + frame->i_pixel_ssd[i] = 0; + } + + /* Degenerate cases */ + if( h->param.rc.i_aq_mode == X264_AQ_NONE || h->param.rc.f_aq_strength == 0 ) + { + /* Need to init it anyways for MB tree */ + if( h->param.rc.i_aq_mode && h->param.rc.f_aq_strength == 0 ) + { + if( quant_offsets ) + { + for( int mb_xy = 0; mb_xy < h->mb.i_mb_count; mb_xy++ ) + frame->f_qp_offset[mb_xy] = frame->f_qp_offset_aq[mb_xy] = quant_offsets[mb_xy]; + if( h->frames.b_have_lowres ) + for( int mb_xy = 0; mb_xy < h->mb.i_mb_count; mb_xy++ ) + frame->i_inv_qscale_factor[mb_xy] = x264_exp2fix8( frame->f_qp_offset[mb_xy] ); + } + else + { + memset( frame->f_qp_offset, 0, h->mb.i_mb_count * sizeof(float) ); + memset( frame->f_qp_offset_aq, 0, h->mb.i_mb_count * sizeof(float) ); + if( h->frames.b_have_lowres ) + for( int mb_xy = 0; mb_xy < h->mb.i_mb_count; mb_xy++ ) + frame->i_inv_qscale_factor[mb_xy] = 256; + } + } + /* Need variance data for weighted prediction */ + if( h->param.analyse.i_weighted_pred ) + { + for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ ) + for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ ) + x264_ac_energy_mb( h, mb_x, mb_y, frame ); + } + else + return; + } + /* Actual adaptive quantization */ + else + { + /* constants chosen to result in approximately the same overall bitrate as without AQ. + * FIXME: while they're written in 5 significant digits, they're only tuned to 2. */ + float strength; + float avg_adj = 0.f; + float bias_strength = 0.f; + + if( h->param.rc.i_aq_mode == X264_AQ_AUTOVARIANCE || h->param.rc.i_aq_mode == X264_AQ_AUTOVARIANCE_BIASED ) + { + float bit_depth_correction = 1.f / (1 << (2*(BIT_DEPTH-8))); + float avg_adj_pow2 = 0.f; + for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ ) + for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ ) + { + uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame ); + float qp_adj = powf( energy * bit_depth_correction + 1, 0.125f ); + frame->f_qp_offset[mb_x + mb_y*h->mb.i_mb_stride] = qp_adj; + avg_adj += qp_adj; + avg_adj_pow2 += qp_adj * qp_adj; + } + avg_adj /= h->mb.i_mb_count; + avg_adj_pow2 /= h->mb.i_mb_count; + strength = h->param.rc.f_aq_strength * avg_adj; + avg_adj = avg_adj - 0.5f * (avg_adj_pow2 - 14.f) / avg_adj; + bias_strength = h->param.rc.f_aq_strength; + } + else + strength = h->param.rc.f_aq_strength * 1.0397f; + + for( int mb_y = 0; mb_y < h->mb.i_mb_height; mb_y++ ) + for( int mb_x = 0; mb_x < h->mb.i_mb_width; mb_x++ ) + { + float qp_adj; + int mb_xy = mb_x + mb_y*h->mb.i_mb_stride; + if( h->param.rc.i_aq_mode == X264_AQ_AUTOVARIANCE_BIASED ) + { + qp_adj = frame->f_qp_offset[mb_xy]; + qp_adj = strength * (qp_adj - avg_adj) + bias_strength * (1.f - 14.f / (qp_adj * qp_adj)); + } + else if( h->param.rc.i_aq_mode == X264_AQ_AUTOVARIANCE ) + { + qp_adj = frame->f_qp_offset[mb_xy]; + qp_adj = strength * (qp_adj - avg_adj); + } + else + { + uint32_t energy = x264_ac_energy_mb( h, mb_x, mb_y, frame ); + qp_adj = strength * (x264_log2( X264_MAX(energy, 1) ) - (14.427f + 2*(BIT_DEPTH-8))); + } + if( quant_offsets ) + qp_adj += quant_offsets[mb_xy]; + frame->f_qp_offset[mb_xy] = + frame->f_qp_offset_aq[mb_xy] = qp_adj; + if( h->frames.b_have_lowres ) + frame->i_inv_qscale_factor[mb_xy] = x264_exp2fix8(qp_adj); + } + } + + /* Remove mean from SSD calculation */ + for( int i = 0; i < 3; i++ ) + { + uint64_t ssd = frame->i_pixel_ssd[i]; + uint64_t sum = frame->i_pixel_sum[i]; + int width = 16*h->mb.i_mb_width >> (i && CHROMA_H_SHIFT); + int height = 16*h->mb.i_mb_height >> (i && CHROMA_V_SHIFT); + frame->i_pixel_ssd[i] = ssd - (sum * sum + width * height / 2) / (width * height); + } +} + +static int x264_macroblock_tree_rescale_init( x264_t *h, x264_ratecontrol_t *rc ) +{ + /* Use fractional QP array dimensions to compensate for edge padding */ + float srcdim[2] = {rc->mbtree.srcdim[0] / 16.f, rc->mbtree.srcdim[1] / 16.f}; + float dstdim[2] = { h->param.i_width / 16.f, h->param.i_height / 16.f}; + int srcdimi[2] = {ceil(srcdim[0]), ceil(srcdim[1])}; + int dstdimi[2] = {ceil(dstdim[0]), ceil(dstdim[1])}; + if( h->param.b_interlaced || h->param.b_fake_interlaced ) + { + srcdimi[1] = (srcdimi[1]+1)&~1; + dstdimi[1] = (dstdimi[1]+1)&~1; + } + + rc->mbtree.src_mb_count = srcdimi[0] * srcdimi[1]; + + CHECKED_MALLOC( rc->mbtree.qp_buffer[0], rc->mbtree.src_mb_count * sizeof(uint16_t) ); + if( h->param.i_bframe_pyramid && h->param.rc.b_stat_read ) + CHECKED_MALLOC( rc->mbtree.qp_buffer[1], rc->mbtree.src_mb_count * sizeof(uint16_t) ); + rc->mbtree.qpbuf_pos = -1; + + /* No rescaling to do */ + if( srcdimi[0] == dstdimi[0] && srcdimi[1] == dstdimi[1] ) + return 0; + + rc->mbtree.rescale_enabled = 1; + + /* Allocate intermediate scaling buffers */ + CHECKED_MALLOC( rc->mbtree.scale_buffer[0], srcdimi[0] * srcdimi[1] * sizeof(float) ); + CHECKED_MALLOC( rc->mbtree.scale_buffer[1], dstdimi[0] * srcdimi[1] * sizeof(float) ); + + /* Allocate and calculate resize filter parameters and coefficients */ + for( int i = 0; i < 2; i++ ) + { + if( srcdim[i] > dstdim[i] ) // downscale + rc->mbtree.filtersize[i] = 1 + (2 * srcdimi[i] + dstdimi[i] - 1) / dstdimi[i]; + else // upscale + rc->mbtree.filtersize[i] = 3; + + CHECKED_MALLOC( rc->mbtree.coeffs[i], rc->mbtree.filtersize[i] * dstdimi[i] * sizeof(float) ); + CHECKED_MALLOC( rc->mbtree.pos[i], dstdimi[i] * sizeof(int) ); + + /* Initialize filter coefficients */ + float inc = srcdim[i] / dstdim[i]; + float dmul = inc > 1.f ? dstdim[i] / srcdim[i] : 1.f; + float dstinsrc = 0.5f * inc - 0.5f; + int filtersize = rc->mbtree.filtersize[i]; + for( int j = 0; j < dstdimi[i]; j++ ) + { + int pos = dstinsrc - (filtersize - 2.f) * 0.5f; + float sum = 0.0; + rc->mbtree.pos[i][j] = pos; + for( int k = 0; k < filtersize; k++ ) + { + float d = fabs( pos + k - dstinsrc ) * dmul; + float coeff = X264_MAX( 1.f - d, 0 ); + rc->mbtree.coeffs[i][j * filtersize + k] = coeff; + sum += coeff; + } + sum = 1.0f / sum; + for( int k = 0; k < filtersize; k++ ) + rc->mbtree.coeffs[i][j * filtersize + k] *= sum; + dstinsrc += inc; + } + } + + /* Write back actual qp array dimensions */ + rc->mbtree.srcdim[0] = srcdimi[0]; + rc->mbtree.srcdim[1] = srcdimi[1]; + return 0; +fail: + return -1; +} + +static void x264_macroblock_tree_rescale_destroy( x264_ratecontrol_t *rc ) +{ + for( int i = 0; i < 2; i++ ) + { + x264_free( rc->mbtree.qp_buffer[i] ); + x264_free( rc->mbtree.scale_buffer[i] ); + x264_free( rc->mbtree.coeffs[i] ); + x264_free( rc->mbtree.pos[i] ); + } +} + +static ALWAYS_INLINE float tapfilter( float *src, int pos, int max, int stride, float *coeff, int filtersize ) +{ + float sum = 0.f; + for( int i = 0; i < filtersize; i++, pos++ ) + sum += src[x264_clip3( pos, 0, max-1 )*stride] * coeff[i]; + return sum; +} + +static void x264_macroblock_tree_rescale( x264_t *h, x264_ratecontrol_t *rc, float *dst ) +{ + float *input, *output; + int filtersize, stride, height; + + /* H scale first */ + input = rc->mbtree.scale_buffer[0]; + output = rc->mbtree.scale_buffer[1]; + filtersize = rc->mbtree.filtersize[0]; + stride = rc->mbtree.srcdim[0]; + height = rc->mbtree.srcdim[1]; + for( int y = 0; y < height; y++, input += stride, output += h->mb.i_mb_width ) + { + float *coeff = rc->mbtree.coeffs[0]; + for( int x = 0; x < h->mb.i_mb_width; x++, coeff+=filtersize ) + output[x] = tapfilter( input, rc->mbtree.pos[0][x], stride, 1, coeff, filtersize ); + } + + /* V scale next */ + input = rc->mbtree.scale_buffer[1]; + output = dst; + filtersize = rc->mbtree.filtersize[1]; + stride = h->mb.i_mb_width; + height = rc->mbtree.srcdim[1]; + for( int x = 0; x < h->mb.i_mb_width; x++, input++, output++ ) + { + float *coeff = rc->mbtree.coeffs[1]; + for( int y = 0; y < h->mb.i_mb_height; y++, coeff+=filtersize ) + output[y*stride] = tapfilter( input, rc->mbtree.pos[1][y], height, stride, coeff, filtersize ); + } +} + +int x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets ) +{ + x264_ratecontrol_t *rc = h->rc; + uint8_t i_type_actual = rc->entry[frame->i_frame].pict_type; + + if( rc->entry[frame->i_frame].kept_as_ref ) + { + uint8_t i_type; + if( rc->mbtree.qpbuf_pos < 0 ) + { + do + { + rc->mbtree.qpbuf_pos++; + + if( !fread( &i_type, 1, 1, rc->p_mbtree_stat_file_in ) ) + goto fail; + if( fread( rc->mbtree.qp_buffer[rc->mbtree.qpbuf_pos], sizeof(uint16_t), rc->mbtree.src_mb_count, rc->p_mbtree_stat_file_in ) != rc->mbtree.src_mb_count ) + goto fail; + + if( i_type != i_type_actual && rc->mbtree.qpbuf_pos == 1 ) + { + x264_log( h, X264_LOG_ERROR, "MB-tree frametype %d doesn't match actual frametype %d.\n", i_type, i_type_actual ); + return -1; + } + } while( i_type != i_type_actual ); + } + + float *dst = rc->mbtree.rescale_enabled ? rc->mbtree.scale_buffer[0] : frame->f_qp_offset; + h->mc.mbtree_fix8_unpack( dst, rc->mbtree.qp_buffer[rc->mbtree.qpbuf_pos], rc->mbtree.src_mb_count ); + if( rc->mbtree.rescale_enabled ) + x264_macroblock_tree_rescale( h, rc, frame->f_qp_offset ); + if( h->frames.b_have_lowres ) + for( int i = 0; i < h->mb.i_mb_count; i++ ) + frame->i_inv_qscale_factor[i] = x264_exp2fix8( frame->f_qp_offset[i] ); + rc->mbtree.qpbuf_pos--; + } + else + x264_stack_align( x264_adaptive_quant_frame, h, frame, quant_offsets ); + return 0; +fail: + x264_log( h, X264_LOG_ERROR, "Incomplete MB-tree stats file.\n" ); + return -1; +} + +int x264_reference_build_list_optimal( x264_t *h ) +{ + ratecontrol_entry_t *rce = h->rc->rce; + x264_frame_t *frames[16]; + x264_weight_t weights[16][3]; + int refcount[16]; + + if( rce->refs != h->i_ref[0] ) + return -1; + + memcpy( frames, h->fref[0], sizeof(frames) ); + memcpy( refcount, rce->refcount, sizeof(refcount) ); + memcpy( weights, h->fenc->weight, sizeof(weights) ); + memset( &h->fenc->weight[1][0], 0, sizeof(x264_weight_t[15][3]) ); + + /* For now don't reorder ref 0; it seems to lower quality + in most cases due to skips. */ + for( int ref = 1; ref < h->i_ref[0]; ref++ ) + { + int max = -1; + int bestref = 1; + + for( int i = 1; i < h->i_ref[0]; i++ ) + /* Favor lower POC as a tiebreaker. */ + COPY2_IF_GT( max, refcount[i], bestref, i ); + + /* FIXME: If there are duplicates from frames other than ref0 then it is possible + * that the optimal ordering doesnt place every duplicate. */ + + refcount[bestref] = -1; + h->fref[0][ref] = frames[bestref]; + memcpy( h->fenc->weight[ref], weights[bestref], sizeof(weights[bestref]) ); + } + + return 0; +} + +static char *x264_strcat_filename( char *input, char *suffix ) +{ + char *output = x264_malloc( strlen( input ) + strlen( suffix ) + 1 ); + if( !output ) + return NULL; + strcpy( output, input ); + strcat( output, suffix ); + return output; +} + +void x264_ratecontrol_init_reconfigurable( x264_t *h, int b_init ) +{ + x264_ratecontrol_t *rc = h->rc; + if( !b_init && rc->b_2pass ) + return; + + if( h->param.rc.i_rc_method == X264_RC_CRF ) + { + /* Arbitrary rescaling to make CRF somewhat similar to QP. + * Try to compensate for MB-tree's effects as well. */ + double base_cplx = h->mb.i_mb_count * (h->param.i_bframe ? 120 : 80); + double mbtree_offset = h->param.rc.b_mb_tree ? (1.0-h->param.rc.f_qcompress)*13.5 : 0; + rc->rate_factor_constant = pow( base_cplx, 1 - rc->qcompress ) + / qp2qscale( h->param.rc.f_rf_constant + mbtree_offset + QP_BD_OFFSET ); + } + + if( h->param.rc.i_vbv_max_bitrate > 0 && h->param.rc.i_vbv_buffer_size > 0 ) + { + /* We don't support changing the ABR bitrate right now, + so if the stream starts as CBR, keep it CBR. */ + if( rc->b_vbv_min_rate ) + h->param.rc.i_vbv_max_bitrate = h->param.rc.i_bitrate; + + if( h->param.rc.i_vbv_buffer_size < (int)(h->param.rc.i_vbv_max_bitrate / rc->fps) ) + { + h->param.rc.i_vbv_buffer_size = h->param.rc.i_vbv_max_bitrate / rc->fps; + x264_log( h, X264_LOG_WARNING, "VBV buffer size cannot be smaller than one frame, using %d kbit\n", + h->param.rc.i_vbv_buffer_size ); + } + + int kilobit_size = h->param.i_avcintra_class ? 1024 : 1000; + int vbv_buffer_size = h->param.rc.i_vbv_buffer_size * kilobit_size; + int vbv_max_bitrate = h->param.rc.i_vbv_max_bitrate * kilobit_size; + + /* Init HRD */ + if( h->param.i_nal_hrd && b_init ) + { + h->sps->vui.hrd.i_cpb_cnt = 1; + h->sps->vui.hrd.b_cbr_hrd = h->param.i_nal_hrd == X264_NAL_HRD_CBR; + h->sps->vui.hrd.i_time_offset_length = 0; + + #define BR_SHIFT 6 + #define CPB_SHIFT 4 + + // normalize HRD size and rate to the value / scale notation + h->sps->vui.hrd.i_bit_rate_scale = x264_clip3( x264_ctz( vbv_max_bitrate ) - BR_SHIFT, 0, 15 ); + h->sps->vui.hrd.i_bit_rate_value = vbv_max_bitrate >> ( h->sps->vui.hrd.i_bit_rate_scale + BR_SHIFT ); + h->sps->vui.hrd.i_bit_rate_unscaled = h->sps->vui.hrd.i_bit_rate_value << ( h->sps->vui.hrd.i_bit_rate_scale + BR_SHIFT ); + h->sps->vui.hrd.i_cpb_size_scale = x264_clip3( x264_ctz( vbv_buffer_size ) - CPB_SHIFT, 0, 15 ); + h->sps->vui.hrd.i_cpb_size_value = vbv_buffer_size >> ( h->sps->vui.hrd.i_cpb_size_scale + CPB_SHIFT ); + h->sps->vui.hrd.i_cpb_size_unscaled = h->sps->vui.hrd.i_cpb_size_value << ( h->sps->vui.hrd.i_cpb_size_scale + CPB_SHIFT ); + + #undef CPB_SHIFT + #undef BR_SHIFT + + // arbitrary + #define MAX_DURATION 0.5 + + int max_cpb_output_delay = X264_MIN( h->param.i_keyint_max * MAX_DURATION * h->sps->vui.i_time_scale / h->sps->vui.i_num_units_in_tick, INT_MAX ); + int max_dpb_output_delay = h->sps->vui.i_max_dec_frame_buffering * MAX_DURATION * h->sps->vui.i_time_scale / h->sps->vui.i_num_units_in_tick; + int max_delay = (int)(90000.0 * (double)h->sps->vui.hrd.i_cpb_size_unscaled / h->sps->vui.hrd.i_bit_rate_unscaled + 0.5); + + h->sps->vui.hrd.i_initial_cpb_removal_delay_length = 2 + x264_clip3( 32 - x264_clz( max_delay ), 4, 22 ); + h->sps->vui.hrd.i_cpb_removal_delay_length = x264_clip3( 32 - x264_clz( max_cpb_output_delay ), 4, 31 ); + h->sps->vui.hrd.i_dpb_output_delay_length = x264_clip3( 32 - x264_clz( max_dpb_output_delay ), 4, 31 ); + + #undef MAX_DURATION + + vbv_buffer_size = h->sps->vui.hrd.i_cpb_size_unscaled; + vbv_max_bitrate = h->sps->vui.hrd.i_bit_rate_unscaled; + } + else if( h->param.i_nal_hrd && !b_init ) + { + x264_log( h, X264_LOG_WARNING, "VBV parameters cannot be changed when NAL HRD is in use\n" ); + return; + } + h->sps->vui.hrd.i_bit_rate_unscaled = vbv_max_bitrate; + h->sps->vui.hrd.i_cpb_size_unscaled = vbv_buffer_size; + + if( rc->b_vbv_min_rate ) + rc->bitrate = (double)h->param.rc.i_bitrate * kilobit_size; + rc->buffer_rate = vbv_max_bitrate / rc->fps; + rc->vbv_max_rate = vbv_max_bitrate; + rc->buffer_size = vbv_buffer_size; + rc->single_frame_vbv = rc->buffer_rate * 1.1 > rc->buffer_size; + rc->cbr_decay = 1.0 - rc->buffer_rate / rc->buffer_size + * 0.5 * X264_MAX(0, 1.5 - rc->buffer_rate * rc->fps / rc->bitrate); + if( h->param.rc.i_rc_method == X264_RC_CRF && h->param.rc.f_rf_constant_max ) + { + rc->rate_factor_max_increment = h->param.rc.f_rf_constant_max - h->param.rc.f_rf_constant; + if( rc->rate_factor_max_increment <= 0 ) + { + x264_log( h, X264_LOG_WARNING, "CRF max must be greater than CRF\n" ); + rc->rate_factor_max_increment = 0; + } + } + if( b_init ) + { + if( h->param.rc.f_vbv_buffer_init > 1. ) + h->param.rc.f_vbv_buffer_init = x264_clip3f( h->param.rc.f_vbv_buffer_init / h->param.rc.i_vbv_buffer_size, 0, 1 ); + h->param.rc.f_vbv_buffer_init = x264_clip3f( X264_MAX( h->param.rc.f_vbv_buffer_init, rc->buffer_rate / rc->buffer_size ), 0, 1); + rc->buffer_fill_final = + rc->buffer_fill_final_min = rc->buffer_size * h->param.rc.f_vbv_buffer_init * h->sps->vui.i_time_scale; + rc->b_vbv = 1; + rc->b_vbv_min_rate = !rc->b_2pass + && h->param.rc.i_rc_method == X264_RC_ABR + && h->param.rc.i_vbv_max_bitrate <= h->param.rc.i_bitrate; + } + } +} + +int x264_ratecontrol_new( x264_t *h ) +{ + x264_ratecontrol_t *rc; + + x264_emms(); + + CHECKED_MALLOCZERO( h->rc, h->param.i_threads * sizeof(x264_ratecontrol_t) ); + rc = h->rc; + + rc->b_abr = h->param.rc.i_rc_method != X264_RC_CQP && !h->param.rc.b_stat_read; + rc->b_2pass = h->param.rc.i_rc_method == X264_RC_ABR && h->param.rc.b_stat_read; + + /* FIXME: use integers */ + if( h->param.i_fps_num > 0 && h->param.i_fps_den > 0 ) + rc->fps = (float) h->param.i_fps_num / h->param.i_fps_den; + else + rc->fps = 25.0; + + if( h->param.rc.b_mb_tree ) + { + h->param.rc.f_pb_factor = 1; + rc->qcompress = 1; + } + else + rc->qcompress = h->param.rc.f_qcompress; + + rc->bitrate = h->param.rc.i_bitrate * (h->param.i_avcintra_class ? 1024. : 1000.); + rc->rate_tolerance = h->param.rc.f_rate_tolerance; + rc->nmb = h->mb.i_mb_count; + rc->last_non_b_pict_type = -1; + rc->cbr_decay = 1.0; + + if( h->param.rc.i_rc_method == X264_RC_CRF && h->param.rc.b_stat_read ) + { + x264_log( h, X264_LOG_ERROR, "constant rate-factor is incompatible with 2pass.\n" ); + return -1; + } + + x264_ratecontrol_init_reconfigurable( h, 1 ); + + if( h->param.i_nal_hrd ) + { + uint64_t denom = (uint64_t)h->sps->vui.hrd.i_bit_rate_unscaled * h->sps->vui.i_time_scale; + uint64_t num = 90000; + x264_reduce_fraction64( &num, &denom ); + rc->hrd_multiply_denom = 90000 / num; + + double bits_required = log2( num ) + + log2( h->sps->vui.i_time_scale ) + + log2( h->sps->vui.hrd.i_cpb_size_unscaled ); + if( bits_required >= 63 ) + { + x264_log( h, X264_LOG_ERROR, "HRD with very large timescale and bufsize not supported\n" ); + return -1; + } + } + + if( rc->rate_tolerance < 0.01 ) + { + x264_log( h, X264_LOG_WARNING, "bitrate tolerance too small, using .01\n" ); + rc->rate_tolerance = 0.01; + } + + h->mb.b_variable_qp = rc->b_vbv || h->param.rc.i_aq_mode; + + if( rc->b_abr ) + { + /* FIXME ABR_INIT_QP is actually used only in CRF */ +#define ABR_INIT_QP (( h->param.rc.i_rc_method == X264_RC_CRF ? h->param.rc.f_rf_constant : 24 ) + QP_BD_OFFSET) + rc->accum_p_norm = .01; + rc->accum_p_qp = ABR_INIT_QP * rc->accum_p_norm; + /* estimated ratio that produces a reasonable QP for the first I-frame */ + rc->cplxr_sum = .01 * pow( 7.0e5, rc->qcompress ) * pow( h->mb.i_mb_count, 0.5 ); + rc->wanted_bits_window = 1.0 * rc->bitrate / rc->fps; + rc->last_non_b_pict_type = SLICE_TYPE_I; + } + + rc->ip_offset = 6.0 * log2f( h->param.rc.f_ip_factor ); + rc->pb_offset = 6.0 * log2f( h->param.rc.f_pb_factor ); + rc->qp_constant[SLICE_TYPE_P] = h->param.rc.i_qp_constant; + rc->qp_constant[SLICE_TYPE_I] = x264_clip3( h->param.rc.i_qp_constant - rc->ip_offset + 0.5, 0, QP_MAX ); + rc->qp_constant[SLICE_TYPE_B] = x264_clip3( h->param.rc.i_qp_constant + rc->pb_offset + 0.5, 0, QP_MAX ); + h->mb.ip_offset = rc->ip_offset + 0.5; + + rc->lstep = pow( 2, h->param.rc.i_qp_step / 6.0 ); + rc->last_qscale = qp2qscale( 26 + QP_BD_OFFSET ); + int num_preds = h->param.b_sliced_threads * h->param.i_threads + 1; + CHECKED_MALLOC( rc->pred, 5 * sizeof(predictor_t) * num_preds ); + CHECKED_MALLOC( rc->pred_b_from_p, sizeof(predictor_t) ); + static const float pred_coeff_table[3] = { 1.0, 1.0, 1.5 }; + for( int i = 0; i < 3; i++ ) + { + rc->last_qscale_for[i] = qp2qscale( ABR_INIT_QP ); + rc->lmin[i] = qp2qscale( h->param.rc.i_qp_min ); + rc->lmax[i] = qp2qscale( h->param.rc.i_qp_max ); + for( int j = 0; j < num_preds; j++ ) + { + rc->pred[i+j*5].coeff_min = pred_coeff_table[i] / 2; + rc->pred[i+j*5].coeff = pred_coeff_table[i]; + rc->pred[i+j*5].count = 1.0; + rc->pred[i+j*5].decay = 0.5; + rc->pred[i+j*5].offset = 0.0; + } + for( int j = 0; j < 2; j++ ) + { + rc->row_preds[i][j].coeff_min = .25 / 4; + rc->row_preds[i][j].coeff = .25; + rc->row_preds[i][j].count = 1.0; + rc->row_preds[i][j].decay = 0.5; + rc->row_preds[i][j].offset = 0.0; + } + } + rc->pred_b_from_p->coeff_min = 0.5 / 2; + rc->pred_b_from_p->coeff = 0.5; + rc->pred_b_from_p->count = 1.0; + rc->pred_b_from_p->decay = 0.5; + rc->pred_b_from_p->offset = 0.0; + + if( parse_zones( h ) < 0 ) + { + x264_log( h, X264_LOG_ERROR, "failed to parse zones\n" ); + return -1; + } + + /* Load stat file and init 2pass algo */ + if( h->param.rc.b_stat_read ) + { + char *p, *stats_in, *stats_buf; + + /* read 1st pass stats */ + assert( h->param.rc.psz_stat_in ); + stats_buf = stats_in = x264_slurp_file( h->param.rc.psz_stat_in ); + if( !stats_buf ) + { + x264_log( h, X264_LOG_ERROR, "ratecontrol_init: can't open stats file\n" ); + return -1; + } + if( h->param.rc.b_mb_tree ) + { + char *mbtree_stats_in = x264_strcat_filename( h->param.rc.psz_stat_in, ".mbtree" ); + if( !mbtree_stats_in ) + return -1; + rc->p_mbtree_stat_file_in = x264_fopen( mbtree_stats_in, "rb" ); + x264_free( mbtree_stats_in ); + if( !rc->p_mbtree_stat_file_in ) + { + x264_log( h, X264_LOG_ERROR, "ratecontrol_init: can't open mbtree stats file\n" ); + return -1; + } + } + + /* check whether 1st pass options were compatible with current options */ + if( strncmp( stats_buf, "#options:", 9 ) ) + { + x264_log( h, X264_LOG_ERROR, "options list in stats file not valid\n" ); + return -1; + } + + float res_factor, res_factor_bits; + { + int i, j; + uint32_t k, l; + char *opts = stats_buf; + stats_in = strchr( stats_buf, '\n' ); + if( !stats_in ) + return -1; + *stats_in = '\0'; + stats_in++; + if( sscanf( opts, "#options: %dx%d", &i, &j ) != 2 ) + { + x264_log( h, X264_LOG_ERROR, "resolution specified in stats file not valid\n" ); + return -1; + } + else if( h->param.rc.b_mb_tree ) + { + rc->mbtree.srcdim[0] = i; + rc->mbtree.srcdim[1] = j; + } + res_factor = (float)h->param.i_width * h->param.i_height / (i*j); + /* Change in bits relative to resolution isn't quite linear on typical sources, + * so we'll at least try to roughly approximate this effect. */ + res_factor_bits = powf( res_factor, 0.7 ); + + if( !( p = strstr( opts, "timebase=" ) ) || sscanf( p, "timebase=%u/%u", &k, &l ) != 2 ) + { + x264_log( h, X264_LOG_ERROR, "timebase specified in stats file not valid\n" ); + return -1; + } + if( k != h->param.i_timebase_num || l != h->param.i_timebase_den ) + { + x264_log( h, X264_LOG_ERROR, "timebase mismatch with 1st pass (%u/%u vs %u/%u)\n", + h->param.i_timebase_num, h->param.i_timebase_den, k, l ); + return -1; + } + + CMP_OPT_FIRST_PASS( "bitdepth", BIT_DEPTH ); + CMP_OPT_FIRST_PASS( "weightp", X264_MAX( 0, h->param.analyse.i_weighted_pred ) ); + CMP_OPT_FIRST_PASS( "bframes", h->param.i_bframe ); + CMP_OPT_FIRST_PASS( "b_pyramid", h->param.i_bframe_pyramid ); + CMP_OPT_FIRST_PASS( "intra_refresh", h->param.b_intra_refresh ); + CMP_OPT_FIRST_PASS( "open_gop", h->param.b_open_gop ); + CMP_OPT_FIRST_PASS( "bluray_compat", h->param.b_bluray_compat ); + + if( (p = strstr( opts, "interlaced=" )) ) + { + char *current = h->param.b_interlaced ? h->param.b_tff ? "tff" : "bff" : h->param.b_fake_interlaced ? "fake" : "0"; + char buf[5]; + sscanf( p, "interlaced=%4s", buf ); + if( strcmp( current, buf ) ) + { + x264_log( h, X264_LOG_ERROR, "different interlaced setting than first pass (%s vs %s)\n", current, buf ); + return -1; + } + } + + if( (p = strstr( opts, "keyint=" )) ) + { + p += 7; + char buf[13] = "infinite "; + if( h->param.i_keyint_max != X264_KEYINT_MAX_INFINITE ) + sprintf( buf, "%d ", h->param.i_keyint_max ); + if( strncmp( p, buf, strlen(buf) ) ) + { + x264_log( h, X264_LOG_ERROR, "different keyint setting than first pass (%.*s vs %.*s)\n", + strlen(buf)-1, buf, strcspn(p, " "), p ); + return -1; + } + } + + if( strstr( opts, "qp=0" ) && h->param.rc.i_rc_method == X264_RC_ABR ) + x264_log( h, X264_LOG_WARNING, "1st pass was lossless, bitrate prediction will be inaccurate\n" ); + + if( !strstr( opts, "direct=3" ) && h->param.analyse.i_direct_mv_pred == X264_DIRECT_PRED_AUTO ) + { + x264_log( h, X264_LOG_WARNING, "direct=auto not used on the first pass\n" ); + h->mb.b_direct_auto_write = 1; + } + + if( ( p = strstr( opts, "b_adapt=" ) ) && sscanf( p, "b_adapt=%d", &i ) && i >= X264_B_ADAPT_NONE && i <= X264_B_ADAPT_TRELLIS ) + h->param.i_bframe_adaptive = i; + else if( h->param.i_bframe ) + { + x264_log( h, X264_LOG_ERROR, "b_adapt method specified in stats file not valid\n" ); + return -1; + } + + if( (h->param.rc.b_mb_tree || h->param.rc.i_vbv_buffer_size) && ( p = strstr( opts, "rc_lookahead=" ) ) && sscanf( p, "rc_lookahead=%d", &i ) ) + h->param.rc.i_lookahead = i; + } + + /* find number of pics */ + p = stats_in; + int num_entries; + for( num_entries = -1; p; num_entries++ ) + p = strchr( p + 1, ';' ); + if( !num_entries ) + { + x264_log( h, X264_LOG_ERROR, "empty stats file\n" ); + return -1; + } + rc->num_entries = num_entries; + + if( h->param.i_frame_total < rc->num_entries && h->param.i_frame_total > 0 ) + { + x264_log( h, X264_LOG_WARNING, "2nd pass has fewer frames than 1st pass (%d vs %d)\n", + h->param.i_frame_total, rc->num_entries ); + } + if( h->param.i_frame_total > rc->num_entries ) + { + x264_log( h, X264_LOG_ERROR, "2nd pass has more frames than 1st pass (%d vs %d)\n", + h->param.i_frame_total, rc->num_entries ); + return -1; + } + + CHECKED_MALLOCZERO( rc->entry, rc->num_entries * sizeof(ratecontrol_entry_t) ); + CHECKED_MALLOC( rc->entry_out, rc->num_entries * sizeof(ratecontrol_entry_t*) ); + + /* init all to skipped p frames */ + for( int i = 0; i < rc->num_entries; i++ ) + { + ratecontrol_entry_t *rce = &rc->entry[i]; + rce->pict_type = SLICE_TYPE_P; + rce->qscale = rce->new_qscale = qp2qscale( 20 + QP_BD_OFFSET ); + rce->misc_bits = rc->nmb + 10; + rce->new_qp = 0; + rc->entry_out[i] = rce; + } + + /* read stats */ + p = stats_in; + double total_qp_aq = 0; + for( int i = 0; i < rc->num_entries; i++ ) + { + ratecontrol_entry_t *rce; + int frame_number = 0; + int frame_out_number = 0; + char pict_type = 0; + int e; + char *next; + float qp_rc, qp_aq; + int ref; + + next= strchr(p, ';'); + if( next ) + *next++ = 0; //sscanf is unbelievably slow on long strings + e = sscanf( p, " in:%d out:%d ", &frame_number, &frame_out_number ); + + if( frame_number < 0 || frame_number >= rc->num_entries ) + { + x264_log( h, X264_LOG_ERROR, "bad frame number (%d) at stats line %d\n", frame_number, i ); + return -1; + } + if( frame_out_number < 0 || frame_out_number >= rc->num_entries ) + { + x264_log( h, X264_LOG_ERROR, "bad frame output number (%d) at stats line %d\n", frame_out_number, i ); + return -1; + } + rce = &rc->entry[frame_number]; + rc->entry_out[frame_out_number] = rce; + rce->direct_mode = 0; + + e += sscanf( p, " in:%*d out:%*d type:%c dur:%"SCNd64" cpbdur:%"SCNd64" q:%f aq:%f tex:%d mv:%d misc:%d imb:%d pmb:%d smb:%d d:%c", + &pict_type, &rce->i_duration, &rce->i_cpb_duration, &qp_rc, &qp_aq, &rce->tex_bits, + &rce->mv_bits, &rce->misc_bits, &rce->i_count, &rce->p_count, + &rce->s_count, &rce->direct_mode ); + rce->tex_bits *= res_factor_bits; + rce->mv_bits *= res_factor_bits; + rce->misc_bits *= res_factor_bits; + rce->i_count *= res_factor; + rce->p_count *= res_factor; + rce->s_count *= res_factor; + + p = strstr( p, "ref:" ); + if( !p ) + goto parse_error; + p += 4; + for( ref = 0; ref < 16; ref++ ) + { + if( sscanf( p, " %d", &rce->refcount[ref] ) != 1 ) + break; + p = strchr( p+1, ' ' ); + if( !p ) + goto parse_error; + } + rce->refs = ref; + + /* find weights */ + rce->i_weight_denom[0] = rce->i_weight_denom[1] = -1; + char *w = strchr( p, 'w' ); + if( w ) + { + int count = sscanf( w, "w:%hd,%hd,%hd,%hd,%hd,%hd,%hd,%hd", + &rce->i_weight_denom[0], &rce->weight[0][0], &rce->weight[0][1], + &rce->i_weight_denom[1], &rce->weight[1][0], &rce->weight[1][1], + &rce->weight[2][0], &rce->weight[2][1] ); + if( count == 3 ) + rce->i_weight_denom[1] = -1; + else if( count != 8 ) + rce->i_weight_denom[0] = rce->i_weight_denom[1] = -1; + } + + if( pict_type != 'b' ) + rce->kept_as_ref = 1; + switch( pict_type ) + { + case 'I': + rce->frame_type = X264_TYPE_IDR; + rce->pict_type = SLICE_TYPE_I; + break; + case 'i': + rce->frame_type = X264_TYPE_I; + rce->pict_type = SLICE_TYPE_I; + break; + case 'P': + rce->frame_type = X264_TYPE_P; + rce->pict_type = SLICE_TYPE_P; + break; + case 'B': + rce->frame_type = X264_TYPE_BREF; + rce->pict_type = SLICE_TYPE_B; + break; + case 'b': + rce->frame_type = X264_TYPE_B; + rce->pict_type = SLICE_TYPE_B; + break; + default: e = -1; break; + } + if( e < 14 ) + { +parse_error: + x264_log( h, X264_LOG_ERROR, "statistics are damaged at line %d, parser out=%d\n", i, e ); + return -1; + } + rce->qscale = qp2qscale( qp_rc ); + total_qp_aq += qp_aq; + p = next; + } + if( !h->param.b_stitchable ) + h->pps->i_pic_init_qp = SPEC_QP( (int)(total_qp_aq / rc->num_entries + 0.5) ); + + x264_free( stats_buf ); + + if( h->param.rc.i_rc_method == X264_RC_ABR ) + { + if( init_pass2( h ) < 0 ) + return -1; + } /* else we're using constant quant, so no need to run the bitrate allocation */ + } + + /* Open output file */ + /* If input and output files are the same, output to a temp file + * and move it to the real name only when it's complete */ + if( h->param.rc.b_stat_write ) + { + char *p; + rc->psz_stat_file_tmpname = x264_strcat_filename( h->param.rc.psz_stat_out, ".temp" ); + if( !rc->psz_stat_file_tmpname ) + return -1; + + rc->p_stat_file_out = x264_fopen( rc->psz_stat_file_tmpname, "wb" ); + if( rc->p_stat_file_out == NULL ) + { + x264_log( h, X264_LOG_ERROR, "ratecontrol_init: can't open stats file\n" ); + return -1; + } + + p = x264_param2string( &h->param, 1 ); + if( p ) + fprintf( rc->p_stat_file_out, "#options: %s\n", p ); + x264_free( p ); + if( h->param.rc.b_mb_tree && !h->param.rc.b_stat_read ) + { + rc->psz_mbtree_stat_file_tmpname = x264_strcat_filename( h->param.rc.psz_stat_out, ".mbtree.temp" ); + rc->psz_mbtree_stat_file_name = x264_strcat_filename( h->param.rc.psz_stat_out, ".mbtree" ); + if( !rc->psz_mbtree_stat_file_tmpname || !rc->psz_mbtree_stat_file_name ) + return -1; + + rc->p_mbtree_stat_file_out = x264_fopen( rc->psz_mbtree_stat_file_tmpname, "wb" ); + if( rc->p_mbtree_stat_file_out == NULL ) + { + x264_log( h, X264_LOG_ERROR, "ratecontrol_init: can't open mbtree stats file\n" ); + return -1; + } + } + } + + if( h->param.rc.b_mb_tree && (h->param.rc.b_stat_read || h->param.rc.b_stat_write) ) + { + if( !h->param.rc.b_stat_read ) + { + rc->mbtree.srcdim[0] = h->param.i_width; + rc->mbtree.srcdim[1] = h->param.i_height; + } + if( x264_macroblock_tree_rescale_init( h, rc ) < 0 ) + return -1; + } + + for( int i = 0; iparam.i_threads; i++ ) + { + h->thread[i]->rc = rc+i; + if( i ) + { + rc[i] = rc[0]; + h->thread[i]->param = h->param; + h->thread[i]->mb.b_variable_qp = h->mb.b_variable_qp; + h->thread[i]->mb.ip_offset = h->mb.ip_offset; + } + } + + return 0; +fail: + return -1; +} + +static int parse_zone( x264_t *h, x264_zone_t *z, char *p ) +{ + int len = 0; + char *tok, UNUSED *saveptr=NULL; + z->param = NULL; + z->f_bitrate_factor = 1; + if( 3 <= sscanf(p, "%d,%d,q=%d%n", &z->i_start, &z->i_end, &z->i_qp, &len) ) + z->b_force_qp = 1; + else if( 3 <= sscanf(p, "%d,%d,b=%f%n", &z->i_start, &z->i_end, &z->f_bitrate_factor, &len) ) + z->b_force_qp = 0; + else if( 2 <= sscanf(p, "%d,%d%n", &z->i_start, &z->i_end, &len) ) + z->b_force_qp = 0; + else + { + x264_log( h, X264_LOG_ERROR, "invalid zone: \"%s\"\n", p ); + return -1; + } + p += len; + if( !*p ) + return 0; + CHECKED_MALLOC( z->param, sizeof(x264_param_t) ); + memcpy( z->param, &h->param, sizeof(x264_param_t) ); + z->param->param_free = x264_free; + while( (tok = strtok_r( p, ",", &saveptr )) ) + { + char *val = strchr( tok, '=' ); + if( val ) + { + *val = '\0'; + val++; + } + if( x264_param_parse( z->param, tok, val ) ) + { + x264_log( h, X264_LOG_ERROR, "invalid zone param: %s = %s\n", tok, val ); + return -1; + } + p = NULL; + } + return 0; +fail: + return -1; +} + +static int parse_zones( x264_t *h ) +{ + x264_ratecontrol_t *rc = h->rc; + if( h->param.rc.psz_zones && !h->param.rc.i_zones ) + { + char *psz_zones, *p; + CHECKED_MALLOC( psz_zones, strlen( h->param.rc.psz_zones )+1 ); + strcpy( psz_zones, h->param.rc.psz_zones ); + h->param.rc.i_zones = 1; + for( p = psz_zones; *p; p++ ) + h->param.rc.i_zones += (*p == '/'); + CHECKED_MALLOC( h->param.rc.zones, h->param.rc.i_zones * sizeof(x264_zone_t) ); + p = psz_zones; + for( int i = 0; i < h->param.rc.i_zones; i++ ) + { + int i_tok = strcspn( p, "/" ); + p[i_tok] = 0; + if( parse_zone( h, &h->param.rc.zones[i], p ) ) + { + x264_free( psz_zones ); + return -1; + } + p += i_tok + 1; + } + x264_free( psz_zones ); + } + + if( h->param.rc.i_zones > 0 ) + { + for( int i = 0; i < h->param.rc.i_zones; i++ ) + { + x264_zone_t z = h->param.rc.zones[i]; + if( z.i_start < 0 || z.i_start > z.i_end ) + { + x264_log( h, X264_LOG_ERROR, "invalid zone: start=%d end=%d\n", + z.i_start, z.i_end ); + return -1; + } + else if( !z.b_force_qp && z.f_bitrate_factor <= 0 ) + { + x264_log( h, X264_LOG_ERROR, "invalid zone: bitrate_factor=%f\n", + z.f_bitrate_factor ); + return -1; + } + } + + rc->i_zones = h->param.rc.i_zones + 1; + CHECKED_MALLOC( rc->zones, rc->i_zones * sizeof(x264_zone_t) ); + memcpy( rc->zones+1, h->param.rc.zones, (rc->i_zones-1) * sizeof(x264_zone_t) ); + + // default zone to fall back to if none of the others match + rc->zones[0].i_start = 0; + rc->zones[0].i_end = INT_MAX; + rc->zones[0].b_force_qp = 0; + rc->zones[0].f_bitrate_factor = 1; + CHECKED_MALLOC( rc->zones[0].param, sizeof(x264_param_t) ); + memcpy( rc->zones[0].param, &h->param, sizeof(x264_param_t) ); + for( int i = 1; i < rc->i_zones; i++ ) + { + if( !rc->zones[i].param ) + rc->zones[i].param = rc->zones[0].param; + } + } + + return 0; +fail: + return -1; +} + +static x264_zone_t *get_zone( x264_t *h, int frame_num ) +{ + for( int i = h->rc->i_zones - 1; i >= 0; i-- ) + { + x264_zone_t *z = &h->rc->zones[i]; + if( frame_num >= z->i_start && frame_num <= z->i_end ) + return z; + } + return NULL; +} + +void x264_ratecontrol_summary( x264_t *h ) +{ + x264_ratecontrol_t *rc = h->rc; + if( rc->b_abr && h->param.rc.i_rc_method == X264_RC_ABR && rc->cbr_decay > .9999 ) + { + double base_cplx = h->mb.i_mb_count * (h->param.i_bframe ? 120 : 80); + double mbtree_offset = h->param.rc.b_mb_tree ? (1.0-h->param.rc.f_qcompress)*13.5 : 0; + x264_log( h, X264_LOG_INFO, "final ratefactor: %.2f\n", + qscale2qp( pow( base_cplx, 1 - rc->qcompress ) + * rc->cplxr_sum / rc->wanted_bits_window ) - mbtree_offset - QP_BD_OFFSET ); + } +} + +void x264_ratecontrol_delete( x264_t *h ) +{ + x264_ratecontrol_t *rc = h->rc; + int b_regular_file; + + if( rc->p_stat_file_out ) + { + b_regular_file = x264_is_regular_file( rc->p_stat_file_out ); + fclose( rc->p_stat_file_out ); + if( h->i_frame >= rc->num_entries && b_regular_file ) + if( x264_rename( rc->psz_stat_file_tmpname, h->param.rc.psz_stat_out ) != 0 ) + { + x264_log( h, X264_LOG_ERROR, "failed to rename \"%s\" to \"%s\"\n", + rc->psz_stat_file_tmpname, h->param.rc.psz_stat_out ); + } + x264_free( rc->psz_stat_file_tmpname ); + } + if( rc->p_mbtree_stat_file_out ) + { + b_regular_file = x264_is_regular_file( rc->p_mbtree_stat_file_out ); + fclose( rc->p_mbtree_stat_file_out ); + if( h->i_frame >= rc->num_entries && b_regular_file ) + if( x264_rename( rc->psz_mbtree_stat_file_tmpname, rc->psz_mbtree_stat_file_name ) != 0 ) + { + x264_log( h, X264_LOG_ERROR, "failed to rename \"%s\" to \"%s\"\n", + rc->psz_mbtree_stat_file_tmpname, rc->psz_mbtree_stat_file_name ); + } + x264_free( rc->psz_mbtree_stat_file_tmpname ); + x264_free( rc->psz_mbtree_stat_file_name ); + } + if( rc->p_mbtree_stat_file_in ) + fclose( rc->p_mbtree_stat_file_in ); + x264_free( rc->pred ); + x264_free( rc->pred_b_from_p ); + x264_free( rc->entry ); + x264_free( rc->entry_out ); + x264_macroblock_tree_rescale_destroy( rc ); + if( rc->zones ) + { + x264_free( rc->zones[0].param ); + for( int i = 1; i < rc->i_zones; i++ ) + if( rc->zones[i].param != rc->zones[0].param && rc->zones[i].param->param_free ) + rc->zones[i].param->param_free( rc->zones[i].param ); + x264_free( rc->zones ); + } + x264_free( rc ); +} + +static void accum_p_qp_update( x264_t *h, float qp ) +{ + x264_ratecontrol_t *rc = h->rc; + rc->accum_p_qp *= .95; + rc->accum_p_norm *= .95; + rc->accum_p_norm += 1; + if( h->sh.i_type == SLICE_TYPE_I ) + rc->accum_p_qp += qp + rc->ip_offset; + else + rc->accum_p_qp += qp; +} + +void x264_ratecontrol_zone_init( x264_t *h ) +{ + x264_ratecontrol_t *rc = h->rc; + x264_zone_t *zone = get_zone( h, h->fenc->i_frame ); + if( zone && (!rc->prev_zone || zone->param != rc->prev_zone->param) ) + x264_encoder_reconfig_apply( h, zone->param ); + rc->prev_zone = zone; +} + +/* Before encoding a frame, choose a QP for it */ +void x264_ratecontrol_start( x264_t *h, int i_force_qp, int overhead ) +{ + x264_ratecontrol_t *rc = h->rc; + ratecontrol_entry_t *rce = NULL; + x264_zone_t *zone = get_zone( h, h->fenc->i_frame ); + float q; + + x264_emms(); + + if( h->param.rc.b_stat_read ) + { + int frame = h->fenc->i_frame; + assert( frame >= 0 && frame < rc->num_entries ); + rce = h->rc->rce = &h->rc->entry[frame]; + + if( h->sh.i_type == SLICE_TYPE_B + && h->param.analyse.i_direct_mv_pred == X264_DIRECT_PRED_AUTO ) + { + h->sh.b_direct_spatial_mv_pred = ( rce->direct_mode == 's' ); + h->mb.b_direct_auto_read = ( rce->direct_mode == 's' || rce->direct_mode == 't' ); + } + } + + if( rc->b_vbv ) + { + memset( h->fdec->i_row_bits, 0, h->mb.i_mb_height * sizeof(int) ); + memset( h->fdec->f_row_qp, 0, h->mb.i_mb_height * sizeof(float) ); + memset( h->fdec->f_row_qscale, 0, h->mb.i_mb_height * sizeof(float) ); + rc->row_pred = rc->row_preds[h->sh.i_type]; + rc->buffer_rate = h->fenc->i_cpb_duration * rc->vbv_max_rate * h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + update_vbv_plan( h, overhead ); + + const x264_level_t *l = x264_levels; + while( l->level_idc != 0 && l->level_idc != h->param.i_level_idc ) + l++; + + int mincr = l->mincr; + + if( h->param.b_bluray_compat ) + mincr = 4; + + /* Profiles above High don't require minCR, so just set the maximum to a large value. */ + if( h->sps->i_profile_idc > PROFILE_HIGH ) + rc->frame_size_maximum = 1e9; + else + { + /* The spec has a bizarre special case for the first frame. */ + if( h->i_frame == 0 ) + { + //384 * ( Max( PicSizeInMbs, fR * MaxMBPS ) + MaxMBPS * ( tr( 0 ) - tr,n( 0 ) ) ) / MinCR + double fr = 1. / (h->param.i_level_idc >= 60 ? 300 : 172); + int pic_size_in_mbs = h->mb.i_mb_width * h->mb.i_mb_height; + rc->frame_size_maximum = 384 * BIT_DEPTH * X264_MAX( pic_size_in_mbs, fr*l->mbps ) / mincr; + } + else + { + //384 * MaxMBPS * ( tr( n ) - tr( n - 1 ) ) / MinCR + rc->frame_size_maximum = 384 * BIT_DEPTH * ((double)h->fenc->i_cpb_duration * h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale) * l->mbps / mincr; + } + } + } + + if( h->sh.i_type != SLICE_TYPE_B ) + rc->bframes = h->fenc->i_bframes; + + if( rc->b_abr ) + { + q = qscale2qp( rate_estimate_qscale( h ) ); + } + else if( rc->b_2pass ) + { + rce->new_qscale = rate_estimate_qscale( h ); + q = qscale2qp( rce->new_qscale ); + } + else /* CQP */ + { + if( h->sh.i_type == SLICE_TYPE_B && h->fdec->b_kept_as_ref ) + q = ( rc->qp_constant[ SLICE_TYPE_B ] + rc->qp_constant[ SLICE_TYPE_P ] ) / 2; + else + q = rc->qp_constant[ h->sh.i_type ]; + + if( zone ) + { + if( zone->b_force_qp ) + q += zone->i_qp - rc->qp_constant[SLICE_TYPE_P]; + else + q -= 6*log2f( zone->f_bitrate_factor ); + } + } + if( i_force_qp != X264_QP_AUTO ) + q = i_force_qp - 1; + + q = x264_clip3f( q, h->param.rc.i_qp_min, h->param.rc.i_qp_max ); + + rc->qpa_rc = rc->qpa_rc_prev = + rc->qpa_aq = rc->qpa_aq_prev = 0; + h->fdec->f_qp_avg_rc = + h->fdec->f_qp_avg_aq = + rc->qpm = q; + if( rce ) + rce->new_qp = q; + + accum_p_qp_update( h, rc->qpm ); + + if( h->sh.i_type != SLICE_TYPE_B ) + rc->last_non_b_pict_type = h->sh.i_type; +} + +static float predict_row_size( x264_t *h, int y, float qscale ) +{ + /* average between two predictors: + * absolute SATD, and scaled bit cost of the colocated row in the previous frame */ + x264_ratecontrol_t *rc = h->rc; + float pred_s = predict_size( &rc->row_pred[0], qscale, h->fdec->i_row_satd[y] ); + if( h->sh.i_type == SLICE_TYPE_I || qscale >= h->fref[0][0]->f_row_qscale[y] ) + { + if( h->sh.i_type == SLICE_TYPE_P + && h->fref[0][0]->i_type == h->fdec->i_type + && h->fref[0][0]->f_row_qscale[y] > 0 + && h->fref[0][0]->i_row_satd[y] > 0 + && (abs(h->fref[0][0]->i_row_satd[y] - h->fdec->i_row_satd[y]) < h->fdec->i_row_satd[y]/2)) + { + float pred_t = h->fref[0][0]->i_row_bits[y] * h->fdec->i_row_satd[y] / h->fref[0][0]->i_row_satd[y] + * h->fref[0][0]->f_row_qscale[y] / qscale; + return (pred_s + pred_t) * 0.5f; + } + return pred_s; + } + /* Our QP is lower than the reference! */ + else + { + float pred_intra = predict_size( &rc->row_pred[1], qscale, h->fdec->i_row_satds[0][0][y] ); + /* Sum: better to overestimate than underestimate by using only one of the two predictors. */ + return pred_intra + pred_s; + } +} + +static int row_bits_so_far( x264_t *h, int y ) +{ + int bits = 0; + for( int i = h->i_threadslice_start; i <= y; i++ ) + bits += h->fdec->i_row_bits[i]; + return bits; +} + +static float predict_row_size_to_end( x264_t *h, int y, float qp ) +{ + float qscale = qp2qscale( qp ); + float bits = 0; + for( int i = y+1; i < h->i_threadslice_end; i++ ) + bits += predict_row_size( h, i, qscale ); + return bits; +} + +/* TODO: + * eliminate all use of qp in row ratecontrol: make it entirely qscale-based. + * make this function stop being needlessly O(N^2) + * update more often than once per row? */ +int x264_ratecontrol_mb( x264_t *h, int bits ) +{ + x264_ratecontrol_t *rc = h->rc; + const int y = h->mb.i_mb_y; + + h->fdec->i_row_bits[y] += bits; + rc->qpa_aq += h->mb.i_qp; + + if( h->mb.i_mb_x != h->mb.i_mb_width - 1 ) + return 0; + + x264_emms(); + rc->qpa_rc += rc->qpm * h->mb.i_mb_width; + + if( !rc->b_vbv ) + return 0; + + float qscale = qp2qscale( rc->qpm ); + h->fdec->f_row_qp[y] = rc->qpm; + h->fdec->f_row_qscale[y] = qscale; + + update_predictor( &rc->row_pred[0], qscale, h->fdec->i_row_satd[y], h->fdec->i_row_bits[y] ); + if( h->sh.i_type != SLICE_TYPE_I && rc->qpm < h->fref[0][0]->f_row_qp[y] ) + update_predictor( &rc->row_pred[1], qscale, h->fdec->i_row_satds[0][0][y], h->fdec->i_row_bits[y] ); + + /* update ratecontrol per-mbpair in MBAFF */ + if( SLICE_MBAFF && !(y&1) ) + return 0; + + /* FIXME: We don't currently support the case where there's a slice + * boundary in between. */ + int can_reencode_row = h->sh.i_first_mb <= ((h->mb.i_mb_y - SLICE_MBAFF) * h->mb.i_mb_stride); + + /* tweak quality based on difference from predicted size */ + float prev_row_qp = h->fdec->f_row_qp[y]; + float qp_absolute_max = h->param.rc.i_qp_max; + if( rc->rate_factor_max_increment ) + qp_absolute_max = X264_MIN( qp_absolute_max, rc->qp_novbv + rc->rate_factor_max_increment ); + float qp_max = X264_MIN( prev_row_qp + h->param.rc.i_qp_step, qp_absolute_max ); + float qp_min = X264_MAX( prev_row_qp - h->param.rc.i_qp_step, h->param.rc.i_qp_min ); + float step_size = 0.5f; + float slice_size_planned = h->param.b_sliced_threads ? rc->slice_size_planned : rc->frame_size_planned; + float bits_so_far = row_bits_so_far( h, y ); + float max_frame_error = x264_clip3f( 1.0 / h->mb.i_mb_height, 0.05, 0.25 ); + float max_frame_size = rc->frame_size_maximum - rc->frame_size_maximum * max_frame_error; + max_frame_size = X264_MIN( max_frame_size, rc->buffer_fill - rc->buffer_rate * max_frame_error ); + float size_of_other_slices = 0; + if( h->param.b_sliced_threads ) + { + float size_of_other_slices_planned = 0; + for( int i = 0; i < h->param.i_threads; i++ ) + if( h != h->thread[i] ) + { + size_of_other_slices += h->thread[i]->rc->frame_size_estimated; + size_of_other_slices_planned += h->thread[i]->rc->slice_size_planned; + } + float weight = rc->slice_size_planned / rc->frame_size_planned; + size_of_other_slices = (size_of_other_slices - size_of_other_slices_planned) * weight + size_of_other_slices_planned; + } + if( y < h->i_threadslice_end-1 ) + { + /* B-frames shouldn't use lower QP than their reference frames. */ + if( h->sh.i_type == SLICE_TYPE_B ) + { + qp_min = X264_MAX( qp_min, X264_MAX( h->fref[0][0]->f_row_qp[y+1], h->fref[1][0]->f_row_qp[y+1] ) ); + rc->qpm = X264_MAX( rc->qpm, qp_min ); + } + + float buffer_left_planned = rc->buffer_fill - rc->frame_size_planned; + buffer_left_planned = X264_MAX( buffer_left_planned, 0.f ); + /* More threads means we have to be more cautious in letting ratecontrol use up extra bits. */ + float rc_tol = buffer_left_planned / h->param.i_threads * rc->rate_tolerance; + float b1 = bits_so_far + predict_row_size_to_end( h, y, rc->qpm ) + size_of_other_slices; + float trust_coeff = x264_clip3f( bits_so_far / slice_size_planned, 0.0, 1.0 ); + + /* Don't increase the row QPs until a sufficent amount of the bits of the frame have been processed, in case a flat */ + /* area at the top of the frame was measured inaccurately. */ + if( trust_coeff < 0.05f ) + qp_max = qp_absolute_max = prev_row_qp; + + if( h->sh.i_type != SLICE_TYPE_I ) + rc_tol *= 0.5f; + + if( !rc->b_vbv_min_rate ) + qp_min = X264_MAX( qp_min, rc->qp_novbv ); + + while( rc->qpm < qp_max + && ((b1 > rc->frame_size_planned + rc_tol) || + (b1 > rc->frame_size_planned && rc->qpm < rc->qp_novbv) || + (b1 > rc->buffer_fill - buffer_left_planned * 0.5f)) ) + { + rc->qpm += step_size; + b1 = bits_so_far + predict_row_size_to_end( h, y, rc->qpm ) + size_of_other_slices; + } + + float b_max = b1 + ((rc->buffer_fill - rc->buffer_size + rc->buffer_rate) * 0.90f - b1) * trust_coeff; + rc->qpm -= step_size; + float b2 = bits_so_far + predict_row_size_to_end( h, y, rc->qpm ) + size_of_other_slices; + while( rc->qpm > qp_min && rc->qpm < prev_row_qp + && (rc->qpm > h->fdec->f_row_qp[0] || rc->single_frame_vbv) + && (b2 < max_frame_size) + && ((b2 < rc->frame_size_planned * 0.8f) || (b2 < b_max)) ) + { + b1 = b2; + rc->qpm -= step_size; + b2 = bits_so_far + predict_row_size_to_end( h, y, rc->qpm ) + size_of_other_slices; + } + rc->qpm += step_size; + + /* avoid VBV underflow or MinCR violation */ + while( rc->qpm < qp_absolute_max && (b1 > max_frame_size) ) + { + rc->qpm += step_size; + b1 = bits_so_far + predict_row_size_to_end( h, y, rc->qpm ) + size_of_other_slices; + } + + h->rc->frame_size_estimated = b1 - size_of_other_slices; + + /* If the current row was large enough to cause a large QP jump, try re-encoding it. */ + if( rc->qpm > qp_max && prev_row_qp < qp_max && can_reencode_row ) + { + /* Bump QP to halfway in between... close enough. */ + rc->qpm = x264_clip3f( (prev_row_qp + rc->qpm)*0.5f, prev_row_qp + 1.0f, qp_max ); + rc->qpa_rc = rc->qpa_rc_prev; + rc->qpa_aq = rc->qpa_aq_prev; + h->fdec->i_row_bits[y] = 0; + h->fdec->i_row_bits[y-SLICE_MBAFF] = 0; + return -1; + } + } + else + { + h->rc->frame_size_estimated = bits_so_far; + + /* Last-ditch attempt: if the last row of the frame underflowed the VBV, + * try again. */ + if( rc->qpm < qp_max && can_reencode_row + && (h->rc->frame_size_estimated + size_of_other_slices > X264_MIN( rc->frame_size_maximum, rc->buffer_fill )) ) + { + rc->qpm = qp_max; + rc->qpa_rc = rc->qpa_rc_prev; + rc->qpa_aq = rc->qpa_aq_prev; + h->fdec->i_row_bits[y] = 0; + h->fdec->i_row_bits[y-SLICE_MBAFF] = 0; + return -1; + } + } + + rc->qpa_rc_prev = rc->qpa_rc; + rc->qpa_aq_prev = rc->qpa_aq; + + return 0; +} + +int x264_ratecontrol_qp( x264_t *h ) +{ + x264_emms(); + return x264_clip3( h->rc->qpm + 0.5f, h->param.rc.i_qp_min, h->param.rc.i_qp_max ); +} + +int x264_ratecontrol_mb_qp( x264_t *h ) +{ + x264_emms(); + float qp = h->rc->qpm; + if( h->param.rc.i_aq_mode ) + { + /* MB-tree currently doesn't adjust quantizers in unreferenced frames. */ + float qp_offset = h->fdec->b_kept_as_ref ? h->fenc->f_qp_offset[h->mb.i_mb_xy] : h->fenc->f_qp_offset_aq[h->mb.i_mb_xy]; + /* Scale AQ's effect towards zero in emergency mode. */ + if( qp > QP_MAX_SPEC ) + qp_offset *= (QP_MAX - qp) / (QP_MAX - QP_MAX_SPEC); + qp += qp_offset; + } + return x264_clip3( qp + 0.5f, h->param.rc.i_qp_min, h->param.rc.i_qp_max ); +} + +/* In 2pass, force the same frame types as in the 1st pass */ +int x264_ratecontrol_slice_type( x264_t *h, int frame_num ) +{ + x264_ratecontrol_t *rc = h->rc; + if( h->param.rc.b_stat_read ) + { + if( frame_num >= rc->num_entries ) + { + /* We could try to initialize everything required for ABR and + * adaptive B-frames, but that would be complicated. + * So just calculate the average QP used so far. */ + h->param.rc.i_qp_constant = (h->stat.i_frame_count[SLICE_TYPE_P] == 0) ? 24 + QP_BD_OFFSET + : 1 + h->stat.f_frame_qp[SLICE_TYPE_P] / h->stat.i_frame_count[SLICE_TYPE_P]; + rc->qp_constant[SLICE_TYPE_P] = x264_clip3( h->param.rc.i_qp_constant, 0, QP_MAX ); + rc->qp_constant[SLICE_TYPE_I] = x264_clip3( (int)( qscale2qp( qp2qscale( h->param.rc.i_qp_constant ) / fabs( h->param.rc.f_ip_factor )) + 0.5 ), 0, QP_MAX ); + rc->qp_constant[SLICE_TYPE_B] = x264_clip3( (int)( qscale2qp( qp2qscale( h->param.rc.i_qp_constant ) * fabs( h->param.rc.f_pb_factor )) + 0.5 ), 0, QP_MAX ); + + x264_log( h, X264_LOG_ERROR, "2nd pass has more frames than 1st pass (%d)\n", rc->num_entries ); + x264_log( h, X264_LOG_ERROR, "continuing anyway, at constant QP=%d\n", h->param.rc.i_qp_constant ); + if( h->param.i_bframe_adaptive ) + x264_log( h, X264_LOG_ERROR, "disabling adaptive B-frames\n" ); + + for( int i = 0; i < h->param.i_threads; i++ ) + { + h->thread[i]->rc->b_abr = 0; + h->thread[i]->rc->b_2pass = 0; + h->thread[i]->param.rc.i_rc_method = X264_RC_CQP; + h->thread[i]->param.rc.b_stat_read = 0; + h->thread[i]->param.i_bframe_adaptive = 0; + h->thread[i]->param.i_scenecut_threshold = 0; + h->thread[i]->param.rc.b_mb_tree = 0; + if( h->thread[i]->param.i_bframe > 1 ) + h->thread[i]->param.i_bframe = 1; + } + return X264_TYPE_AUTO; + } + return rc->entry[frame_num].frame_type; + } + else + return X264_TYPE_AUTO; +} + +void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm ) +{ + ratecontrol_entry_t *rce = &h->rc->entry[frm->i_frame]; + if( h->param.analyse.i_weighted_pred <= 0 ) + return; + + if( rce->i_weight_denom[0] >= 0 ) + SET_WEIGHT( frm->weight[0][0], 1, rce->weight[0][0], rce->i_weight_denom[0], rce->weight[0][1] ); + + if( rce->i_weight_denom[1] >= 0 ) + { + SET_WEIGHT( frm->weight[0][1], 1, rce->weight[1][0], rce->i_weight_denom[1], rce->weight[1][1] ); + SET_WEIGHT( frm->weight[0][2], 1, rce->weight[2][0], rce->i_weight_denom[1], rce->weight[2][1] ); + } +} + +/* After encoding one frame, save stats and update ratecontrol state */ +int x264_ratecontrol_end( x264_t *h, int bits, int *filler ) +{ + x264_ratecontrol_t *rc = h->rc; + const int *mbs = h->stat.frame.i_mb_count; + + x264_emms(); + + h->stat.frame.i_mb_count_skip = mbs[P_SKIP] + mbs[B_SKIP]; + h->stat.frame.i_mb_count_i = mbs[I_16x16] + mbs[I_8x8] + mbs[I_4x4]; + h->stat.frame.i_mb_count_p = mbs[P_L0] + mbs[P_8x8]; + for( int i = B_DIRECT; i < B_8x8; i++ ) + h->stat.frame.i_mb_count_p += mbs[i]; + + h->fdec->f_qp_avg_rc = rc->qpa_rc /= h->mb.i_mb_count; + h->fdec->f_qp_avg_aq = (float)rc->qpa_aq / h->mb.i_mb_count; + h->fdec->f_crf_avg = h->param.rc.f_rf_constant + h->fdec->f_qp_avg_rc - rc->qp_novbv; + + if( h->param.rc.b_stat_write ) + { + char c_type = h->sh.i_type==SLICE_TYPE_I ? (h->fenc->i_poc==0 ? 'I' : 'i') + : h->sh.i_type==SLICE_TYPE_P ? 'P' + : h->fenc->b_kept_as_ref ? 'B' : 'b'; + int dir_frame = h->stat.frame.i_direct_score[1] - h->stat.frame.i_direct_score[0]; + int dir_avg = h->stat.i_direct_score[1] - h->stat.i_direct_score[0]; + char c_direct = h->mb.b_direct_auto_write ? + ( dir_frame>0 ? 's' : dir_frame<0 ? 't' : + dir_avg>0 ? 's' : dir_avg<0 ? 't' : '-' ) + : '-'; + if( fprintf( rc->p_stat_file_out, + "in:%d out:%d type:%c dur:%"PRId64" cpbdur:%"PRId64" q:%.2f aq:%.2f tex:%d mv:%d misc:%d imb:%d pmb:%d smb:%d d:%c ref:", + h->fenc->i_frame, h->i_frame, + c_type, h->fenc->i_duration, + h->fenc->i_cpb_duration, + rc->qpa_rc, h->fdec->f_qp_avg_aq, + h->stat.frame.i_tex_bits, + h->stat.frame.i_mv_bits, + h->stat.frame.i_misc_bits, + h->stat.frame.i_mb_count_i, + h->stat.frame.i_mb_count_p, + h->stat.frame.i_mb_count_skip, + c_direct) < 0 ) + goto fail; + + /* Only write information for reference reordering once. */ + int use_old_stats = h->param.rc.b_stat_read && rc->rce->refs > 1; + for( int i = 0; i < (use_old_stats ? rc->rce->refs : h->i_ref[0]); i++ ) + { + int refcount = use_old_stats ? rc->rce->refcount[i] + : PARAM_INTERLACED ? h->stat.frame.i_mb_count_ref[0][i*2] + + h->stat.frame.i_mb_count_ref[0][i*2+1] + : h->stat.frame.i_mb_count_ref[0][i]; + if( fprintf( rc->p_stat_file_out, "%d ", refcount ) < 0 ) + goto fail; + } + + if( h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE && h->sh.weight[0][0].weightfn ) + { + if( fprintf( rc->p_stat_file_out, "w:%d,%d,%d", + h->sh.weight[0][0].i_denom, h->sh.weight[0][0].i_scale, h->sh.weight[0][0].i_offset ) < 0 ) + goto fail; + if( h->sh.weight[0][1].weightfn || h->sh.weight[0][2].weightfn ) + { + if( fprintf( rc->p_stat_file_out, ",%d,%d,%d,%d,%d ", + h->sh.weight[0][1].i_denom, h->sh.weight[0][1].i_scale, h->sh.weight[0][1].i_offset, + h->sh.weight[0][2].i_scale, h->sh.weight[0][2].i_offset ) < 0 ) + goto fail; + } + else if( fprintf( rc->p_stat_file_out, " " ) < 0 ) + goto fail; + } + + if( fprintf( rc->p_stat_file_out, ";\n") < 0 ) + goto fail; + + /* Don't re-write the data in multi-pass mode. */ + if( h->param.rc.b_mb_tree && h->fenc->b_kept_as_ref && !h->param.rc.b_stat_read ) + { + uint8_t i_type = h->sh.i_type; + h->mc.mbtree_fix8_pack( rc->mbtree.qp_buffer[0], h->fenc->f_qp_offset, h->mb.i_mb_count ); + if( fwrite( &i_type, 1, 1, rc->p_mbtree_stat_file_out ) < 1 ) + goto fail; + if( fwrite( rc->mbtree.qp_buffer[0], sizeof(uint16_t), h->mb.i_mb_count, rc->p_mbtree_stat_file_out ) < h->mb.i_mb_count ) + goto fail; + } + } + + if( rc->b_abr ) + { + if( h->sh.i_type != SLICE_TYPE_B ) + rc->cplxr_sum += bits * qp2qscale( rc->qpa_rc ) / rc->last_rceq; + else + { + /* Depends on the fact that B-frame's QP is an offset from the following P-frame's. + * Not perfectly accurate with B-refs, but good enough. */ + rc->cplxr_sum += bits * qp2qscale( rc->qpa_rc ) / (rc->last_rceq * fabs( h->param.rc.f_pb_factor )); + } + rc->cplxr_sum *= rc->cbr_decay; + rc->wanted_bits_window += h->fenc->f_duration * rc->bitrate; + rc->wanted_bits_window *= rc->cbr_decay; + } + + if( rc->b_2pass ) + rc->expected_bits_sum += qscale2bits( rc->rce, qp2qscale( rc->rce->new_qp ) ); + + if( h->mb.b_variable_qp ) + { + if( h->sh.i_type == SLICE_TYPE_B ) + { + rc->bframe_bits += bits; + if( h->fenc->b_last_minigop_bframe ) + { + update_predictor( rc->pred_b_from_p, qp2qscale( rc->qpa_rc ), + h->fref[1][h->i_ref[1]-1]->i_satd, rc->bframe_bits / rc->bframes ); + rc->bframe_bits = 0; + } + } + } + + *filler = update_vbv( h, bits ); + rc->filler_bits_sum += *filler * 8; + + if( h->sps->vui.b_nal_hrd_parameters_present ) + { + if( h->fenc->i_frame == 0 ) + { + // access unit initialises the HRD + h->fenc->hrd_timing.cpb_initial_arrival_time = 0; + rc->initial_cpb_removal_delay = h->initial_cpb_removal_delay; + rc->initial_cpb_removal_delay_offset = h->initial_cpb_removal_delay_offset; + h->fenc->hrd_timing.cpb_removal_time = rc->nrt_first_access_unit = (double)rc->initial_cpb_removal_delay / 90000; + } + else + { + h->fenc->hrd_timing.cpb_removal_time = rc->nrt_first_access_unit + (double)(h->fenc->i_cpb_delay - h->i_cpb_delay_pir_offset) * + h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + + if( h->fenc->b_keyframe ) + { + rc->nrt_first_access_unit = h->fenc->hrd_timing.cpb_removal_time; + rc->initial_cpb_removal_delay = h->initial_cpb_removal_delay; + rc->initial_cpb_removal_delay_offset = h->initial_cpb_removal_delay_offset; + } + + double cpb_earliest_arrival_time = h->fenc->hrd_timing.cpb_removal_time - (double)rc->initial_cpb_removal_delay / 90000; + if( !h->fenc->b_keyframe ) + cpb_earliest_arrival_time -= (double)rc->initial_cpb_removal_delay_offset / 90000; + + if( h->sps->vui.hrd.b_cbr_hrd ) + h->fenc->hrd_timing.cpb_initial_arrival_time = rc->previous_cpb_final_arrival_time; + else + h->fenc->hrd_timing.cpb_initial_arrival_time = X264_MAX( rc->previous_cpb_final_arrival_time, cpb_earliest_arrival_time ); + } + int filler_bits = *filler ? X264_MAX( (FILLER_OVERHEAD - h->param.b_annexb), *filler )*8 : 0; + // Equation C-6 + h->fenc->hrd_timing.cpb_final_arrival_time = rc->previous_cpb_final_arrival_time = h->fenc->hrd_timing.cpb_initial_arrival_time + + (double)(bits + filler_bits) / h->sps->vui.hrd.i_bit_rate_unscaled; + + h->fenc->hrd_timing.dpb_output_time = (double)h->fenc->i_dpb_output_delay * h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale + + h->fenc->hrd_timing.cpb_removal_time; + } + + return 0; +fail: + x264_log( h, X264_LOG_ERROR, "ratecontrol_end: stats file could not be written to\n" ); + return -1; +} + +/**************************************************************************** + * 2 pass functions + ***************************************************************************/ + +/** + * modify the bitrate curve from pass1 for one frame + */ +static double get_qscale(x264_t *h, ratecontrol_entry_t *rce, double rate_factor, int frame_num) +{ + x264_ratecontrol_t *rcc= h->rc; + x264_zone_t *zone = get_zone( h, frame_num ); + double q; + if( h->param.rc.b_mb_tree ) + { + double timescale = (double)h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + q = pow( BASE_FRAME_DURATION / CLIP_DURATION(rce->i_duration * timescale), 1 - h->param.rc.f_qcompress ); + } + else + q = pow( rce->blurred_complexity, 1 - rcc->qcompress ); + + // avoid NaN's in the rc_eq + if( !isfinite(q) || rce->tex_bits + rce->mv_bits == 0 ) + q = rcc->last_qscale_for[rce->pict_type]; + else + { + rcc->last_rceq = q; + q /= rate_factor; + rcc->last_qscale = q; + } + + if( zone ) + { + if( zone->b_force_qp ) + q = qp2qscale( zone->i_qp ); + else + q /= zone->f_bitrate_factor; + } + + return q; +} + +static double get_diff_limited_q(x264_t *h, ratecontrol_entry_t *rce, double q, int frame_num) +{ + x264_ratecontrol_t *rcc = h->rc; + const int pict_type = rce->pict_type; + x264_zone_t *zone = get_zone( h, frame_num ); + + // force I/B quants as a function of P quants + const double last_p_q = rcc->last_qscale_for[SLICE_TYPE_P]; + const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type]; + if( pict_type == SLICE_TYPE_I ) + { + double iq = q; + double pq = qp2qscale( rcc->accum_p_qp / rcc->accum_p_norm ); + double ip_factor = fabs( h->param.rc.f_ip_factor ); + /* don't apply ip_factor if the following frame is also I */ + if( rcc->accum_p_norm <= 0 ) + q = iq; + else if( h->param.rc.f_ip_factor < 0 ) + q = iq / ip_factor; + else if( rcc->accum_p_norm >= 1 ) + q = pq / ip_factor; + else + q = rcc->accum_p_norm * pq / ip_factor + (1 - rcc->accum_p_norm) * iq; + } + else if( pict_type == SLICE_TYPE_B ) + { + if( h->param.rc.f_pb_factor > 0 ) + q = last_non_b_q; + if( !rce->kept_as_ref ) + q *= fabs( h->param.rc.f_pb_factor ); + } + else if( pict_type == SLICE_TYPE_P + && rcc->last_non_b_pict_type == SLICE_TYPE_P + && rce->tex_bits == 0 ) + { + q = last_p_q; + } + + /* last qscale / qdiff stuff */ + if( rcc->last_non_b_pict_type == pict_type && + (pict_type!=SLICE_TYPE_I || rcc->last_accum_p_norm < 1) ) + { + double last_q = rcc->last_qscale_for[pict_type]; + double max_qscale = last_q * rcc->lstep; + double min_qscale = last_q / rcc->lstep; + + if ( q > max_qscale ) q = max_qscale; + else if( q < min_qscale ) q = min_qscale; + } + + rcc->last_qscale_for[pict_type] = q; + if( pict_type != SLICE_TYPE_B ) + rcc->last_non_b_pict_type = pict_type; + if( pict_type == SLICE_TYPE_I ) + { + rcc->last_accum_p_norm = rcc->accum_p_norm; + rcc->accum_p_norm = 0; + rcc->accum_p_qp = 0; + } + if( pict_type == SLICE_TYPE_P ) + { + float mask = 1 - pow( (float)rce->i_count / rcc->nmb, 2 ); + rcc->accum_p_qp = mask * (qscale2qp( q ) + rcc->accum_p_qp); + rcc->accum_p_norm = mask * (1 + rcc->accum_p_norm); + } + + if( zone ) + { + if( zone->b_force_qp ) + q = qp2qscale( zone->i_qp ); + else + q /= zone->f_bitrate_factor; + } + + return q; +} + +static float predict_size( predictor_t *p, float q, float var ) +{ + return (p->coeff*var + p->offset) / (q*p->count); +} + +static void update_predictor( predictor_t *p, float q, float var, float bits ) +{ + float range = 1.5; + if( var < 10 ) + return; + float old_coeff = p->coeff / p->count; + float old_offset = p->offset / p->count; + float new_coeff = X264_MAX( (bits*q - old_offset) / var, p->coeff_min ); + float new_coeff_clipped = x264_clip3f( new_coeff, old_coeff/range, old_coeff*range ); + float new_offset = bits*q - new_coeff_clipped * var; + if( new_offset >= 0 ) + new_coeff = new_coeff_clipped; + else + new_offset = 0; + p->count *= p->decay; + p->coeff *= p->decay; + p->offset *= p->decay; + p->count ++; + p->coeff += new_coeff; + p->offset += new_offset; +} + +// update VBV after encoding a frame +static int update_vbv( x264_t *h, int bits ) +{ + int filler = 0; + int bitrate = h->sps->vui.hrd.i_bit_rate_unscaled; + x264_ratecontrol_t *rcc = h->rc; + x264_ratecontrol_t *rct = h->thread[0]->rc; + int64_t buffer_size = (int64_t)h->sps->vui.hrd.i_cpb_size_unscaled * h->sps->vui.i_time_scale; + + if( rcc->last_satd >= h->mb.i_mb_count ) + update_predictor( &rct->pred[h->sh.i_type], qp2qscale( rcc->qpa_rc ), rcc->last_satd, bits ); + + if( !rcc->b_vbv ) + return filler; + + uint64_t buffer_diff = (uint64_t)bits * h->sps->vui.i_time_scale; + rct->buffer_fill_final -= buffer_diff; + rct->buffer_fill_final_min -= buffer_diff; + + if( rct->buffer_fill_final_min < 0 ) + { + double underflow = (double)rct->buffer_fill_final_min / h->sps->vui.i_time_scale; + if( rcc->rate_factor_max_increment && rcc->qpm >= rcc->qp_novbv + rcc->rate_factor_max_increment ) + x264_log( h, X264_LOG_DEBUG, "VBV underflow due to CRF-max (frame %d, %.0f bits)\n", h->i_frame, underflow ); + else + x264_log( h, X264_LOG_WARNING, "VBV underflow (frame %d, %.0f bits)\n", h->i_frame, underflow ); + rct->buffer_fill_final = + rct->buffer_fill_final_min = 0; + } + + if( h->param.i_avcintra_class ) + buffer_diff = buffer_size; + else + buffer_diff = (uint64_t)bitrate * h->sps->vui.i_num_units_in_tick * h->fenc->i_cpb_duration; + rct->buffer_fill_final += buffer_diff; + rct->buffer_fill_final_min += buffer_diff; + + if( rct->buffer_fill_final > buffer_size ) + { + if( h->param.rc.b_filler ) + { + int64_t scale = (int64_t)h->sps->vui.i_time_scale * 8; + filler = (rct->buffer_fill_final - buffer_size + scale - 1) / scale; + bits = h->param.i_avcintra_class ? filler * 8 : X264_MAX( (FILLER_OVERHEAD - h->param.b_annexb), filler ) * 8; + buffer_diff = (uint64_t)bits * h->sps->vui.i_time_scale; + rct->buffer_fill_final -= buffer_diff; + rct->buffer_fill_final_min -= buffer_diff; + } + else + { + rct->buffer_fill_final = X264_MIN( rct->buffer_fill_final, buffer_size ); + rct->buffer_fill_final_min = X264_MIN( rct->buffer_fill_final_min, buffer_size ); + } + } + + return filler; +} + +void x264_hrd_fullness( x264_t *h ) +{ + x264_ratecontrol_t *rct = h->thread[0]->rc; + uint64_t denom = (uint64_t)h->sps->vui.hrd.i_bit_rate_unscaled * h->sps->vui.i_time_scale / rct->hrd_multiply_denom; + uint64_t cpb_state = rct->buffer_fill_final; + uint64_t cpb_size = (uint64_t)h->sps->vui.hrd.i_cpb_size_unscaled * h->sps->vui.i_time_scale; + uint64_t multiply_factor = 90000 / rct->hrd_multiply_denom; + + if( rct->buffer_fill_final < 0 || rct->buffer_fill_final > (int64_t)cpb_size ) + { + x264_log( h, X264_LOG_WARNING, "CPB %s: %.0f bits in a %.0f-bit buffer\n", + rct->buffer_fill_final < 0 ? "underflow" : "overflow", + (double)rct->buffer_fill_final / h->sps->vui.i_time_scale, (double)cpb_size / h->sps->vui.i_time_scale ); + } + + h->initial_cpb_removal_delay = (multiply_factor * cpb_state) / denom; + h->initial_cpb_removal_delay_offset = (multiply_factor * cpb_size) / denom - h->initial_cpb_removal_delay; + + int64_t decoder_buffer_fill = h->initial_cpb_removal_delay * denom / multiply_factor; + rct->buffer_fill_final_min = X264_MIN( rct->buffer_fill_final_min, decoder_buffer_fill ); +} + +// provisionally update VBV according to the planned size of all frames currently in progress +static void update_vbv_plan( x264_t *h, int overhead ) +{ + x264_ratecontrol_t *rcc = h->rc; + rcc->buffer_fill = h->thread[0]->rc->buffer_fill_final_min / h->sps->vui.i_time_scale; + if( h->i_thread_frames > 1 ) + { + int j = h->rc - h->thread[0]->rc; + for( int i = 1; i < h->i_thread_frames; i++ ) + { + x264_t *t = h->thread[ (j+i)%h->i_thread_frames ]; + double bits = t->rc->frame_size_planned; + if( !t->b_thread_active ) + continue; + bits = X264_MAX(bits, t->rc->frame_size_estimated); + rcc->buffer_fill -= bits; + rcc->buffer_fill = X264_MAX( rcc->buffer_fill, 0 ); + rcc->buffer_fill += t->rc->buffer_rate; + rcc->buffer_fill = X264_MIN( rcc->buffer_fill, rcc->buffer_size ); + } + } + rcc->buffer_fill = X264_MIN( rcc->buffer_fill, rcc->buffer_size ); + rcc->buffer_fill -= overhead; +} + +// apply VBV constraints and clip qscale to between lmin and lmax +static double clip_qscale( x264_t *h, int pict_type, double q ) +{ + x264_ratecontrol_t *rcc = h->rc; + double lmin = rcc->lmin[pict_type]; + double lmax = rcc->lmax[pict_type]; + if( rcc->rate_factor_max_increment ) + lmax = X264_MIN( lmax, qp2qscale( rcc->qp_novbv + rcc->rate_factor_max_increment ) ); + double q0 = q; + + /* B-frames are not directly subject to VBV, + * since they are controlled by the P-frames' QPs. */ + + if( rcc->b_vbv && rcc->last_satd > 0 ) + { + double fenc_cpb_duration = (double)h->fenc->i_cpb_duration * + h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + /* Lookahead VBV: raise the quantizer as necessary such that no frames in + * the lookahead overflow and such that the buffer is in a reasonable state + * by the end of the lookahead. */ + if( h->param.rc.i_lookahead ) + { + int terminate = 0; + + /* Avoid an infinite loop. */ + for( int iterations = 0; iterations < 1000 && terminate != 3; iterations++ ) + { + double frame_q[3]; + double cur_bits = predict_size( &rcc->pred[h->sh.i_type], q, rcc->last_satd ); + double buffer_fill_cur = rcc->buffer_fill - cur_bits; + double target_fill; + double total_duration = 0; + double last_duration = fenc_cpb_duration; + frame_q[0] = h->sh.i_type == SLICE_TYPE_I ? q * h->param.rc.f_ip_factor : q; + frame_q[1] = frame_q[0] * h->param.rc.f_pb_factor; + frame_q[2] = frame_q[0] / h->param.rc.f_ip_factor; + + /* Loop over the planned future frames. */ + for( int j = 0; buffer_fill_cur >= 0 && buffer_fill_cur <= rcc->buffer_size; j++ ) + { + total_duration += last_duration; + buffer_fill_cur += rcc->vbv_max_rate * last_duration; + int i_type = h->fenc->i_planned_type[j]; + int i_satd = h->fenc->i_planned_satd[j]; + if( i_type == X264_TYPE_AUTO ) + break; + i_type = IS_X264_TYPE_I( i_type ) ? SLICE_TYPE_I : IS_X264_TYPE_B( i_type ) ? SLICE_TYPE_B : SLICE_TYPE_P; + cur_bits = predict_size( &rcc->pred[i_type], frame_q[i_type], i_satd ); + buffer_fill_cur -= cur_bits; + last_duration = h->fenc->f_planned_cpb_duration[j]; + } + /* Try to get to get the buffer at least 50% filled, but don't set an impossible goal. */ + target_fill = X264_MIN( rcc->buffer_fill + total_duration * rcc->vbv_max_rate * 0.5, rcc->buffer_size * 0.5 ); + if( buffer_fill_cur < target_fill ) + { + q *= 1.01; + terminate |= 1; + continue; + } + /* Try to get the buffer no more than 80% filled, but don't set an impossible goal. */ + target_fill = x264_clip3f( rcc->buffer_fill - total_duration * rcc->vbv_max_rate * 0.5, rcc->buffer_size * 0.8, rcc->buffer_size ); + if( rcc->b_vbv_min_rate && buffer_fill_cur > target_fill ) + { + q /= 1.01; + terminate |= 2; + continue; + } + break; + } + } + /* Fallback to old purely-reactive algorithm: no lookahead. */ + else + { + if( ( pict_type == SLICE_TYPE_P || + ( pict_type == SLICE_TYPE_I && rcc->last_non_b_pict_type == SLICE_TYPE_I ) ) && + rcc->buffer_fill/rcc->buffer_size < 0.5 ) + { + q /= x264_clip3f( 2.0*rcc->buffer_fill/rcc->buffer_size, 0.5, 1.0 ); + } + + /* Now a hard threshold to make sure the frame fits in VBV. + * This one is mostly for I-frames. */ + double bits = predict_size( &rcc->pred[h->sh.i_type], q, rcc->last_satd ); + /* For small VBVs, allow the frame to use up the entire VBV. */ + double max_fill_factor = h->param.rc.i_vbv_buffer_size >= 5*h->param.rc.i_vbv_max_bitrate / rcc->fps ? 2 : 1; + /* For single-frame VBVs, request that the frame use up the entire VBV. */ + double min_fill_factor = rcc->single_frame_vbv ? 1 : 2; + + if( bits > rcc->buffer_fill/max_fill_factor ) + { + double qf = x264_clip3f( rcc->buffer_fill/(max_fill_factor*bits), 0.2, 1.0 ); + q /= qf; + bits *= qf; + } + if( bits < rcc->buffer_rate/min_fill_factor ) + { + double qf = x264_clip3f( bits*min_fill_factor/rcc->buffer_rate, 0.001, 1.0 ); + q *= qf; + } + q = X264_MAX( q0, q ); + } + + /* Check B-frame complexity, and use up any bits that would + * overflow before the next P-frame. */ + if( h->sh.i_type == SLICE_TYPE_P && !rcc->single_frame_vbv ) + { + int nb = rcc->bframes; + double bits = predict_size( &rcc->pred[h->sh.i_type], q, rcc->last_satd ); + double pbbits = bits; + double bbits = predict_size( rcc->pred_b_from_p, q * h->param.rc.f_pb_factor, rcc->last_satd ); + double space; + double bframe_cpb_duration = 0; + double minigop_cpb_duration; + for( int i = 0; i < nb; i++ ) + bframe_cpb_duration += h->fenc->f_planned_cpb_duration[i]; + + if( bbits * nb > bframe_cpb_duration * rcc->vbv_max_rate ) + nb = 0; + pbbits += nb * bbits; + + minigop_cpb_duration = bframe_cpb_duration + fenc_cpb_duration; + space = rcc->buffer_fill + minigop_cpb_duration*rcc->vbv_max_rate - rcc->buffer_size; + if( pbbits < space ) + { + q *= X264_MAX( pbbits / space, bits / (0.5 * rcc->buffer_size) ); + } + q = X264_MAX( q0/2, q ); + } + + /* Apply MinCR and buffer fill restrictions */ + double bits = predict_size( &rcc->pred[h->sh.i_type], q, rcc->last_satd ); + double frame_size_maximum = X264_MIN( rcc->frame_size_maximum, X264_MAX( rcc->buffer_fill, 0.001 ) ); + if( bits > frame_size_maximum ) + q *= bits / frame_size_maximum; + + if( !rcc->b_vbv_min_rate ) + q = X264_MAX( q0, q ); + } + + if( lmin==lmax ) + return lmin; + else if( rcc->b_2pass ) + { + double min2 = log( lmin ); + double max2 = log( lmax ); + q = (log(q) - min2)/(max2-min2) - 0.5; + q = 1.0/(1.0 + exp( -4*q )); + q = q*(max2-min2) + min2; + return exp( q ); + } + else + return x264_clip3f( q, lmin, lmax ); +} + +// update qscale for 1 frame based on actual bits used so far +static float rate_estimate_qscale( x264_t *h ) +{ + float q; + x264_ratecontrol_t *rcc = h->rc; + ratecontrol_entry_t rce = {0}; + int pict_type = h->sh.i_type; + int64_t total_bits = 8*(h->stat.i_frame_size[SLICE_TYPE_I] + + h->stat.i_frame_size[SLICE_TYPE_P] + + h->stat.i_frame_size[SLICE_TYPE_B]) + - rcc->filler_bits_sum; + + if( rcc->b_2pass ) + { + rce = *rcc->rce; + if( pict_type != rce.pict_type ) + { + x264_log( h, X264_LOG_ERROR, "slice=%c but 2pass stats say %c\n", + slice_type_to_char[pict_type], slice_type_to_char[rce.pict_type] ); + } + } + + if( pict_type == SLICE_TYPE_B ) + { + /* B-frames don't have independent ratecontrol, but rather get the + * average QP of the two adjacent P-frames + an offset */ + + int i0 = IS_X264_TYPE_I(h->fref_nearest[0]->i_type); + int i1 = IS_X264_TYPE_I(h->fref_nearest[1]->i_type); + int dt0 = abs(h->fenc->i_poc - h->fref_nearest[0]->i_poc); + int dt1 = abs(h->fenc->i_poc - h->fref_nearest[1]->i_poc); + float q0 = h->fref_nearest[0]->f_qp_avg_rc; + float q1 = h->fref_nearest[1]->f_qp_avg_rc; + + if( h->fref_nearest[0]->i_type == X264_TYPE_BREF ) + q0 -= rcc->pb_offset/2; + if( h->fref_nearest[1]->i_type == X264_TYPE_BREF ) + q1 -= rcc->pb_offset/2; + + if( i0 && i1 ) + q = (q0 + q1) / 2 + rcc->ip_offset; + else if( i0 ) + q = q1; + else if( i1 ) + q = q0; + else + q = (q0*dt1 + q1*dt0) / (dt0 + dt1); + + if( h->fenc->b_kept_as_ref ) + q += rcc->pb_offset/2; + else + q += rcc->pb_offset; + + rcc->qp_novbv = q; + q = qp2qscale( q ); + if( rcc->b_2pass ) + rcc->frame_size_planned = qscale2bits( &rce, q ); + else + rcc->frame_size_planned = predict_size( rcc->pred_b_from_p, q, h->fref[1][h->i_ref[1]-1]->i_satd ); + /* Limit planned size by MinCR */ + if( rcc->b_vbv ) + rcc->frame_size_planned = X264_MIN( rcc->frame_size_planned, rcc->frame_size_maximum ); + h->rc->frame_size_estimated = rcc->frame_size_planned; + + /* For row SATDs */ + if( rcc->b_vbv ) + rcc->last_satd = x264_rc_analyse_slice( h ); + return q; + } + else + { + double abr_buffer = 2 * rcc->rate_tolerance * rcc->bitrate; + double predicted_bits = total_bits; + if( h->i_thread_frames > 1 ) + { + int j = h->rc - h->thread[0]->rc; + for( int i = 1; i < h->i_thread_frames; i++ ) + { + x264_t *t = h->thread[(j+i) % h->i_thread_frames]; + double bits = t->rc->frame_size_planned; + if( !t->b_thread_active ) + continue; + bits = X264_MAX(bits, t->rc->frame_size_estimated); + predicted_bits += bits; + } + } + + if( rcc->b_2pass ) + { + double lmin = rcc->lmin[pict_type]; + double lmax = rcc->lmax[pict_type]; + double diff; + + /* Adjust ABR buffer based on distance to the end of the video. */ + if( rcc->num_entries > h->i_frame ) + { + double final_bits = rcc->entry_out[rcc->num_entries-1]->expected_bits; + double video_pos = rce.expected_bits / final_bits; + double scale_factor = sqrt( (1 - video_pos) * rcc->num_entries ); + abr_buffer *= 0.5 * X264_MAX( scale_factor, 0.5 ); + } + + diff = predicted_bits - rce.expected_bits; + q = rce.new_qscale; + q /= x264_clip3f((abr_buffer - diff) / abr_buffer, .5, 2); + if( h->i_frame >= rcc->fps && rcc->expected_bits_sum >= 1 ) + { + /* Adjust quant based on the difference between + * achieved and expected bitrate so far */ + double cur_time = (double)h->i_frame / rcc->num_entries; + double w = x264_clip3f( cur_time*100, 0.0, 1.0 ); + q *= pow( (double)total_bits / rcc->expected_bits_sum, w ); + } + rcc->qp_novbv = qscale2qp( q ); + if( rcc->b_vbv ) + { + /* Do not overflow vbv */ + double expected_size = qscale2bits( &rce, q ); + double expected_vbv = rcc->buffer_fill + rcc->buffer_rate - expected_size; + double expected_fullness = rce.expected_vbv / rcc->buffer_size; + double qmax = q*(2 - expected_fullness); + double size_constraint = 1 + expected_fullness; + qmax = X264_MAX( qmax, rce.new_qscale ); + if( expected_fullness < .05 ) + qmax = lmax; + qmax = X264_MIN(qmax, lmax); + while( ((expected_vbv < rce.expected_vbv/size_constraint) && (q < qmax)) || + ((expected_vbv < 0) && (q < lmax))) + { + q *= 1.05; + expected_size = qscale2bits(&rce, q); + expected_vbv = rcc->buffer_fill + rcc->buffer_rate - expected_size; + } + rcc->last_satd = x264_rc_analyse_slice( h ); + } + q = x264_clip3f( q, lmin, lmax ); + } + else /* 1pass ABR */ + { + /* Calculate the quantizer which would have produced the desired + * average bitrate if it had been applied to all frames so far. + * Then modulate that quant based on the current frame's complexity + * relative to the average complexity so far (using the 2pass RCEQ). + * Then bias the quant up or down if total size so far was far from + * the target. + * Result: Depending on the value of rate_tolerance, there is a + * tradeoff between quality and bitrate precision. But at large + * tolerances, the bit distribution approaches that of 2pass. */ + + double wanted_bits, overflow = 1; + + rcc->last_satd = x264_rc_analyse_slice( h ); + rcc->short_term_cplxsum *= 0.5; + rcc->short_term_cplxcount *= 0.5; + rcc->short_term_cplxsum += rcc->last_satd / (CLIP_DURATION(h->fenc->f_duration) / BASE_FRAME_DURATION); + rcc->short_term_cplxcount ++; + + rce.tex_bits = rcc->last_satd; + rce.blurred_complexity = rcc->short_term_cplxsum / rcc->short_term_cplxcount; + rce.mv_bits = 0; + rce.p_count = rcc->nmb; + rce.i_count = 0; + rce.s_count = 0; + rce.qscale = 1; + rce.pict_type = pict_type; + rce.i_duration = h->fenc->i_duration; + + if( h->param.rc.i_rc_method == X264_RC_CRF ) + { + q = get_qscale( h, &rce, rcc->rate_factor_constant, h->fenc->i_frame ); + } + else + { + q = get_qscale( h, &rce, rcc->wanted_bits_window / rcc->cplxr_sum, h->fenc->i_frame ); + + /* ABR code can potentially be counterproductive in CBR, so just don't bother. + * Don't run it if the frame complexity is zero either. */ + if( !rcc->b_vbv_min_rate && rcc->last_satd ) + { + // FIXME is it simpler to keep track of wanted_bits in ratecontrol_end? + int i_frame_done = h->i_frame; + double time_done = i_frame_done / rcc->fps; + if( h->param.b_vfr_input && i_frame_done > 0 ) + time_done = ((double)(h->fenc->i_reordered_pts - h->i_reordered_pts_delay)) * h->param.i_timebase_num / h->param.i_timebase_den; + wanted_bits = time_done * rcc->bitrate; + if( wanted_bits > 0 ) + { + abr_buffer *= X264_MAX( 1, sqrt( time_done ) ); + overflow = x264_clip3f( 1.0 + (predicted_bits - wanted_bits) / abr_buffer, .5, 2 ); + q *= overflow; + } + } + } + + if( pict_type == SLICE_TYPE_I && h->param.i_keyint_max > 1 + /* should test _next_ pict type, but that isn't decided yet */ + && rcc->last_non_b_pict_type != SLICE_TYPE_I ) + { + q = qp2qscale( rcc->accum_p_qp / rcc->accum_p_norm ); + q /= fabs( h->param.rc.f_ip_factor ); + } + else if( h->i_frame > 0 ) + { + if( h->param.rc.i_rc_method != X264_RC_CRF ) + { + /* Asymmetric clipping, because symmetric would prevent + * overflow control in areas of rapidly oscillating complexity */ + double lmin = rcc->last_qscale_for[pict_type] / rcc->lstep; + double lmax = rcc->last_qscale_for[pict_type] * rcc->lstep; + if( overflow > 1.1 && h->i_frame > 3 ) + lmax *= rcc->lstep; + else if( overflow < 0.9 ) + lmin /= rcc->lstep; + + q = x264_clip3f(q, lmin, lmax); + } + } + else if( h->param.rc.i_rc_method == X264_RC_CRF && rcc->qcompress != 1 ) + { + q = qp2qscale( ABR_INIT_QP ) / fabs( h->param.rc.f_ip_factor ); + } + rcc->qp_novbv = qscale2qp( q ); + + //FIXME use get_diff_limited_q() ? + q = clip_qscale( h, pict_type, q ); + } + + rcc->last_qscale_for[pict_type] = + rcc->last_qscale = q; + + if( !(rcc->b_2pass && !rcc->b_vbv) && h->fenc->i_frame == 0 ) + rcc->last_qscale_for[SLICE_TYPE_P] = q * fabs( h->param.rc.f_ip_factor ); + + if( rcc->b_2pass ) + rcc->frame_size_planned = qscale2bits( &rce, q ); + else + rcc->frame_size_planned = predict_size( &rcc->pred[h->sh.i_type], q, rcc->last_satd ); + + /* Always use up the whole VBV in this case. */ + if( rcc->single_frame_vbv ) + rcc->frame_size_planned = rcc->buffer_rate; + /* Limit planned size by MinCR */ + if( rcc->b_vbv ) + rcc->frame_size_planned = X264_MIN( rcc->frame_size_planned, rcc->frame_size_maximum ); + h->rc->frame_size_estimated = rcc->frame_size_planned; + return q; + } +} + +static void x264_threads_normalize_predictors( x264_t *h ) +{ + double totalsize = 0; + for( int i = 0; i < h->param.i_threads; i++ ) + totalsize += h->thread[i]->rc->slice_size_planned; + double factor = h->rc->frame_size_planned / totalsize; + for( int i = 0; i < h->param.i_threads; i++ ) + h->thread[i]->rc->slice_size_planned *= factor; +} + +void x264_threads_distribute_ratecontrol( x264_t *h ) +{ + int row; + x264_ratecontrol_t *rc = h->rc; + x264_emms(); + float qscale = qp2qscale( rc->qpm ); + + /* Initialize row predictors */ + if( h->i_frame == 0 ) + for( int i = 0; i < h->param.i_threads; i++ ) + { + x264_t *t = h->thread[i]; + if( t != h ) + memcpy( t->rc->row_preds, rc->row_preds, sizeof(rc->row_preds) ); + } + + for( int i = 0; i < h->param.i_threads; i++ ) + { + x264_t *t = h->thread[i]; + if( t != h ) + memcpy( t->rc, rc, offsetof(x264_ratecontrol_t, row_pred) ); + t->rc->row_pred = t->rc->row_preds[h->sh.i_type]; + /* Calculate the planned slice size. */ + if( rc->b_vbv && rc->frame_size_planned ) + { + int size = 0; + for( row = t->i_threadslice_start; row < t->i_threadslice_end; row++ ) + size += h->fdec->i_row_satd[row]; + t->rc->slice_size_planned = predict_size( &rc->pred[h->sh.i_type + (i+1)*5], qscale, size ); + } + else + t->rc->slice_size_planned = 0; + } + if( rc->b_vbv && rc->frame_size_planned ) + { + x264_threads_normalize_predictors( h ); + + if( rc->single_frame_vbv ) + { + /* Compensate for our max frame error threshold: give more bits (proportionally) to smaller slices. */ + for( int i = 0; i < h->param.i_threads; i++ ) + { + x264_t *t = h->thread[i]; + float max_frame_error = x264_clip3f( 1.0 / (t->i_threadslice_end - t->i_threadslice_start), 0.05, 0.25 ); + t->rc->slice_size_planned += 2 * max_frame_error * rc->frame_size_planned; + } + x264_threads_normalize_predictors( h ); + } + + for( int i = 0; i < h->param.i_threads; i++ ) + h->thread[i]->rc->frame_size_estimated = h->thread[i]->rc->slice_size_planned; + } +} + +void x264_threads_merge_ratecontrol( x264_t *h ) +{ + x264_ratecontrol_t *rc = h->rc; + x264_emms(); + + for( int i = 0; i < h->param.i_threads; i++ ) + { + x264_t *t = h->thread[i]; + x264_ratecontrol_t *rct = h->thread[i]->rc; + if( h->param.rc.i_vbv_buffer_size ) + { + int size = 0; + for( int row = t->i_threadslice_start; row < t->i_threadslice_end; row++ ) + size += h->fdec->i_row_satd[row]; + int bits = t->stat.frame.i_mv_bits + t->stat.frame.i_tex_bits + t->stat.frame.i_misc_bits; + int mb_count = (t->i_threadslice_end - t->i_threadslice_start) * h->mb.i_mb_width; + update_predictor( &rc->pred[h->sh.i_type+(i+1)*5], qp2qscale( rct->qpa_rc/mb_count ), size, bits ); + } + if( !i ) + continue; + rc->qpa_rc += rct->qpa_rc; + rc->qpa_aq += rct->qpa_aq; + } +} + +void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next ) +{ + if( cur != prev ) + { +#define COPY(var) memcpy(&cur->rc->var, &prev->rc->var, sizeof(cur->rc->var)) + /* these vars are updated in x264_ratecontrol_start() + * so copy them from the context that most recently started (prev) + * to the context that's about to start (cur). */ + COPY(accum_p_qp); + COPY(accum_p_norm); + COPY(last_satd); + COPY(last_rceq); + COPY(last_qscale_for); + COPY(last_non_b_pict_type); + COPY(short_term_cplxsum); + COPY(short_term_cplxcount); + COPY(bframes); + COPY(prev_zone); + COPY(mbtree.qpbuf_pos); + /* these vars can be updated by x264_ratecontrol_init_reconfigurable */ + COPY(bitrate); + COPY(buffer_size); + COPY(buffer_rate); + COPY(vbv_max_rate); + COPY(single_frame_vbv); + COPY(cbr_decay); + COPY(rate_factor_constant); + COPY(rate_factor_max_increment); +#undef COPY + } + if( cur != next ) + { +#define COPY(var) next->rc->var = cur->rc->var + /* these vars are updated in x264_ratecontrol_end() + * so copy them from the context that most recently ended (cur) + * to the context that's about to end (next) */ + COPY(cplxr_sum); + COPY(expected_bits_sum); + COPY(filler_bits_sum); + COPY(wanted_bits_window); + COPY(bframe_bits); + COPY(initial_cpb_removal_delay); + COPY(initial_cpb_removal_delay_offset); + COPY(nrt_first_access_unit); + COPY(previous_cpb_final_arrival_time); +#undef COPY + } + //FIXME row_preds[] (not strictly necessary, but would improve prediction) + /* the rest of the variables are either constant or thread-local */ +} + +static int find_underflow( x264_t *h, double *fills, int *t0, int *t1, int over ) +{ + /* find an interval ending on an overflow or underflow (depending on whether + * we're adding or removing bits), and starting on the earliest frame that + * can influence the buffer fill of that end frame. */ + x264_ratecontrol_t *rcc = h->rc; + const double buffer_min = .1 * rcc->buffer_size; + const double buffer_max = .9 * rcc->buffer_size; + double fill = fills[*t0-1]; + double parity = over ? 1. : -1.; + int start = -1, end = -1; + for( int i = *t0; i < rcc->num_entries; i++ ) + { + fill += (rcc->entry_out[i]->i_cpb_duration * rcc->vbv_max_rate * h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale - + qscale2bits( rcc->entry_out[i], rcc->entry_out[i]->new_qscale )) * parity; + fill = x264_clip3f(fill, 0, rcc->buffer_size); + fills[i] = fill; + if( fill <= buffer_min || i == 0 ) + { + if( end >= 0 ) + break; + start = i; + } + else if( fill >= buffer_max && start >= 0 ) + end = i; + } + *t0 = start; + *t1 = end; + return start >= 0 && end >= 0; +} + +static int fix_underflow( x264_t *h, int t0, int t1, double adjustment, double qscale_min, double qscale_max ) +{ + x264_ratecontrol_t *rcc = h->rc; + double qscale_orig, qscale_new; + int adjusted = 0; + if( t0 > 0 ) + t0++; + for( int i = t0; i <= t1; i++ ) + { + qscale_orig = rcc->entry_out[i]->new_qscale; + qscale_orig = x264_clip3f( qscale_orig, qscale_min, qscale_max ); + qscale_new = qscale_orig * adjustment; + qscale_new = x264_clip3f( qscale_new, qscale_min, qscale_max ); + rcc->entry_out[i]->new_qscale = qscale_new; + adjusted = adjusted || (qscale_new != qscale_orig); + } + return adjusted; +} + +static double count_expected_bits( x264_t *h ) +{ + x264_ratecontrol_t *rcc = h->rc; + double expected_bits = 0; + for( int i = 0; i < rcc->num_entries; i++ ) + { + ratecontrol_entry_t *rce = rcc->entry_out[i]; + rce->expected_bits = expected_bits; + expected_bits += qscale2bits( rce, rce->new_qscale ); + } + return expected_bits; +} + +static int vbv_pass2( x264_t *h, double all_available_bits ) +{ + /* for each interval of buffer_full .. underflow, uniformly increase the qp of all + * frames in the interval until either buffer is full at some intermediate frame or the + * last frame in the interval no longer underflows. Recompute intervals and repeat. + * Then do the converse to put bits back into overflow areas until target size is met */ + + x264_ratecontrol_t *rcc = h->rc; + double *fills; + double expected_bits = 0; + double adjustment; + double prev_bits = 0; + int t0, t1; + double qscale_min = qp2qscale( h->param.rc.i_qp_min ); + double qscale_max = qp2qscale( h->param.rc.i_qp_max ); + int iterations = 0; + int adj_min, adj_max; + CHECKED_MALLOC( fills, (rcc->num_entries+1)*sizeof(double) ); + + fills++; + + /* adjust overall stream size */ + do + { + iterations++; + prev_bits = expected_bits; + + if( expected_bits ) + { /* not first iteration */ + adjustment = X264_MAX(X264_MIN(expected_bits / all_available_bits, 0.999), 0.9); + fills[-1] = rcc->buffer_size * h->param.rc.f_vbv_buffer_init; + t0 = 0; + /* fix overflows */ + adj_min = 1; + while( adj_min && find_underflow( h, fills, &t0, &t1, 1 ) ) + { + adj_min = fix_underflow( h, t0, t1, adjustment, qscale_min, qscale_max ); + t0 = t1; + } + } + + fills[-1] = rcc->buffer_size * (1. - h->param.rc.f_vbv_buffer_init); + t0 = 0; + /* fix underflows -- should be done after overflow, as we'd better undersize target than underflowing VBV */ + adj_max = 1; + while( adj_max && find_underflow( h, fills, &t0, &t1, 0 ) ) + adj_max = fix_underflow( h, t0, t1, 1.001, qscale_min, qscale_max ); + + expected_bits = count_expected_bits( h ); + } while( (expected_bits < .995*all_available_bits) && ((int64_t)(expected_bits+.5) > (int64_t)(prev_bits+.5)) ); + + if( !adj_max ) + x264_log( h, X264_LOG_WARNING, "vbv-maxrate issue, qpmax or vbv-maxrate too low\n"); + + /* store expected vbv filling values for tracking when encoding */ + for( int i = 0; i < rcc->num_entries; i++ ) + rcc->entry_out[i]->expected_vbv = rcc->buffer_size - fills[i]; + + x264_free( fills-1 ); + return 0; +fail: + return -1; +} + +static int init_pass2( x264_t *h ) +{ + x264_ratecontrol_t *rcc = h->rc; + uint64_t all_const_bits = 0; + double timescale = (double)h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + double duration = 0; + for( int i = 0; i < rcc->num_entries; i++ ) + duration += rcc->entry[i].i_duration; + duration *= timescale; + uint64_t all_available_bits = h->param.rc.i_bitrate * 1000. * duration; + double rate_factor, step_mult; + double qblur = h->param.rc.f_qblur; + double cplxblur = h->param.rc.f_complexity_blur; + const int filter_size = (int)(qblur*4) | 1; + double expected_bits; + double *qscale, *blurred_qscale; + double base_cplx = h->mb.i_mb_count * (h->param.i_bframe ? 120 : 80); + + /* find total/average complexity & const_bits */ + for( int i = 0; i < rcc->num_entries; i++ ) + { + ratecontrol_entry_t *rce = &rcc->entry[i]; + all_const_bits += rce->misc_bits; + } + + if( all_available_bits < all_const_bits) + { + x264_log( h, X264_LOG_ERROR, "requested bitrate is too low. estimated minimum is %d kbps\n", + (int)(all_const_bits * rcc->fps / (rcc->num_entries * 1000.)) ); + return -1; + } + + /* Blur complexities, to reduce local fluctuation of QP. + * We don't blur the QPs directly, because then one very simple frame + * could drag down the QP of a nearby complex frame and give it more + * bits than intended. */ + for( int i = 0; i < rcc->num_entries; i++ ) + { + ratecontrol_entry_t *rce = &rcc->entry[i]; + double weight_sum = 0; + double cplx_sum = 0; + double weight = 1.0; + double gaussian_weight; + /* weighted average of cplx of future frames */ + for( int j = 1; j < cplxblur*2 && j < rcc->num_entries-i; j++ ) + { + ratecontrol_entry_t *rcj = &rcc->entry[i+j]; + double frame_duration = CLIP_DURATION(rcj->i_duration * timescale) / BASE_FRAME_DURATION; + weight *= 1 - pow( (float)rcj->i_count / rcc->nmb, 2 ); + if( weight < .0001 ) + break; + gaussian_weight = weight * exp( -j*j/200.0 ); + weight_sum += gaussian_weight; + cplx_sum += gaussian_weight * (qscale2bits( rcj, 1 ) - rcj->misc_bits) / frame_duration; + } + /* weighted average of cplx of past frames */ + weight = 1.0; + for( int j = 0; j <= cplxblur*2 && j <= i; j++ ) + { + ratecontrol_entry_t *rcj = &rcc->entry[i-j]; + double frame_duration = CLIP_DURATION(rcj->i_duration * timescale) / BASE_FRAME_DURATION; + gaussian_weight = weight * exp( -j*j/200.0 ); + weight_sum += gaussian_weight; + cplx_sum += gaussian_weight * (qscale2bits( rcj, 1 ) - rcj->misc_bits) / frame_duration; + weight *= 1 - pow( (float)rcj->i_count / rcc->nmb, 2 ); + if( weight < .0001 ) + break; + } + rce->blurred_complexity = cplx_sum / weight_sum; + } + + CHECKED_MALLOC( qscale, sizeof(double)*rcc->num_entries ); + if( filter_size > 1 ) + CHECKED_MALLOC( blurred_qscale, sizeof(double)*rcc->num_entries ); + else + blurred_qscale = qscale; + + /* Search for a factor which, when multiplied by the RCEQ values from + * each frame, adds up to the desired total size. + * There is no exact closed-form solution because of VBV constraints and + * because qscale2bits is not invertible, but we can start with the simple + * approximation of scaling the 1st pass by the ratio of bitrates. + * The search range is probably overkill, but speed doesn't matter here. */ + + expected_bits = 1; + for( int i = 0; i < rcc->num_entries; i++ ) + { + double q = get_qscale(h, &rcc->entry[i], 1.0, i); + expected_bits += qscale2bits(&rcc->entry[i], q); + rcc->last_qscale_for[rcc->entry[i].pict_type] = q; + } + step_mult = all_available_bits / expected_bits; + + rate_factor = 0; + for( double step = 1E4 * step_mult; step > 1E-7 * step_mult; step *= 0.5) + { + expected_bits = 0; + rate_factor += step; + + rcc->last_non_b_pict_type = -1; + rcc->last_accum_p_norm = 1; + rcc->accum_p_norm = 0; + + rcc->last_qscale_for[0] = + rcc->last_qscale_for[1] = + rcc->last_qscale_for[2] = pow( base_cplx, 1 - rcc->qcompress ) / rate_factor; + + /* find qscale */ + for( int i = 0; i < rcc->num_entries; i++ ) + { + qscale[i] = get_qscale( h, &rcc->entry[i], rate_factor, -1 ); + rcc->last_qscale_for[rcc->entry[i].pict_type] = qscale[i]; + } + + /* fixed I/B qscale relative to P */ + for( int i = rcc->num_entries-1; i >= 0; i-- ) + { + qscale[i] = get_diff_limited_q( h, &rcc->entry[i], qscale[i], i ); + assert(qscale[i] >= 0); + } + + /* smooth curve */ + if( filter_size > 1 ) + { + assert( filter_size%2 == 1 ); + for( int i = 0; i < rcc->num_entries; i++ ) + { + ratecontrol_entry_t *rce = &rcc->entry[i]; + double q = 0.0, sum = 0.0; + + for( int j = 0; j < filter_size; j++ ) + { + int idx = i+j-filter_size/2; + double d = idx-i; + double coeff = qblur==0 ? 1.0 : exp( -d*d/(qblur*qblur) ); + if( idx < 0 || idx >= rcc->num_entries ) + continue; + if( rce->pict_type != rcc->entry[idx].pict_type ) + continue; + q += qscale[idx] * coeff; + sum += coeff; + } + blurred_qscale[i] = q/sum; + } + } + + /* find expected bits */ + for( int i = 0; i < rcc->num_entries; i++ ) + { + ratecontrol_entry_t *rce = &rcc->entry[i]; + rce->new_qscale = clip_qscale( h, rce->pict_type, blurred_qscale[i] ); + assert(rce->new_qscale >= 0); + expected_bits += qscale2bits( rce, rce->new_qscale ); + } + + if( expected_bits > all_available_bits ) + rate_factor -= step; + } + + x264_free( qscale ); + if( filter_size > 1 ) + x264_free( blurred_qscale ); + + if( rcc->b_vbv ) + if( vbv_pass2( h, all_available_bits ) ) + return -1; + expected_bits = count_expected_bits( h ); + + if( fabs( expected_bits/all_available_bits - 1.0 ) > 0.01 ) + { + double avgq = 0; + for( int i = 0; i < rcc->num_entries; i++ ) + avgq += rcc->entry[i].new_qscale; + avgq = qscale2qp( avgq / rcc->num_entries ); + + if( expected_bits > all_available_bits || !rcc->b_vbv ) + x264_log( h, X264_LOG_WARNING, "Error: 2pass curve failed to converge\n" ); + x264_log( h, X264_LOG_WARNING, "target: %.2f kbit/s, expected: %.2f kbit/s, avg QP: %.4f\n", + (float)h->param.rc.i_bitrate, + expected_bits * rcc->fps / (rcc->num_entries * 1000.), + avgq ); + if( expected_bits < all_available_bits && avgq < h->param.rc.i_qp_min + 2 ) + { + if( h->param.rc.i_qp_min > 0 ) + x264_log( h, X264_LOG_WARNING, "try reducing target bitrate or reducing qp_min (currently %d)\n", h->param.rc.i_qp_min ); + else + x264_log( h, X264_LOG_WARNING, "try reducing target bitrate\n" ); + } + else if( expected_bits > all_available_bits && avgq > h->param.rc.i_qp_max - 2 ) + { + if( h->param.rc.i_qp_max < QP_MAX ) + x264_log( h, X264_LOG_WARNING, "try increasing target bitrate or increasing qp_max (currently %d)\n", h->param.rc.i_qp_max ); + else + x264_log( h, X264_LOG_WARNING, "try increasing target bitrate\n"); + } + else if( !(rcc->b_2pass && rcc->b_vbv) ) + x264_log( h, X264_LOG_WARNING, "internal error\n" ); + } + + return 0; +fail: + return -1; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.h new file mode 100644 index 00000000..168b515c --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/ratecontrol.h @@ -0,0 +1,66 @@ +/***************************************************************************** + * ratecontrol.h: ratecontrol + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Loren Merritt + * Laurent Aimar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_RATECONTROL_H +#define X264_RATECONTROL_H + +/* Completely arbitrary. Ratecontrol lowers relative quality at higher framerates + * and the reverse at lower framerates; this serves as the center of the curve. + * Halve all the values for frame-packed 3D to compensate for the "doubled" + * framerate. */ +#define BASE_FRAME_DURATION (0.04f / ((h->param.i_frame_packing == 5)+1)) + +/* Arbitrary limitations as a sanity check. */ +#define MAX_FRAME_DURATION (1.00f / ((h->param.i_frame_packing == 5)+1)) +#define MIN_FRAME_DURATION (0.01f / ((h->param.i_frame_packing == 5)+1)) + +#define CLIP_DURATION(f) x264_clip3f(f,MIN_FRAME_DURATION,MAX_FRAME_DURATION) + +int x264_ratecontrol_new ( x264_t * ); +void x264_ratecontrol_delete( x264_t * ); + +void x264_ratecontrol_init_reconfigurable( x264_t *h, int b_init ); +int x264_encoder_reconfig_apply( x264_t *h, x264_param_t *param ); + +void x264_adaptive_quant_frame( x264_t *h, x264_frame_t *frame, float *quant_offsets ); +int x264_macroblock_tree_read( x264_t *h, x264_frame_t *frame, float *quant_offsets ); +int x264_reference_build_list_optimal( x264_t *h ); +void x264_thread_sync_ratecontrol( x264_t *cur, x264_t *prev, x264_t *next ); +void x264_ratecontrol_zone_init( x264_t * ); +void x264_ratecontrol_start( x264_t *, int i_force_qp, int overhead ); +int x264_ratecontrol_slice_type( x264_t *, int i_frame ); +void x264_ratecontrol_set_weights( x264_t *h, x264_frame_t *frm ); +int x264_ratecontrol_mb( x264_t *, int bits ); +int x264_ratecontrol_qp( x264_t * ); +int x264_ratecontrol_mb_qp( x264_t *h ); +int x264_ratecontrol_end( x264_t *, int bits, int *filler ); +void x264_ratecontrol_summary( x264_t * ); +int x264_rc_analyse_slice( x264_t *h ); +void x264_threads_distribute_ratecontrol( x264_t *h ); +void x264_threads_merge_ratecontrol( x264_t *h ); +void x264_hrd_fullness( x264_t *h ); +#endif + diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/rdo.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/rdo.c new file mode 100644 index 00000000..a6865bd3 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/rdo.c @@ -0,0 +1,1165 @@ +/***************************************************************************** + * rdo.c: rate-distortion optimization + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +/* duplicate all the writer functions, just calculating bit cost + * instead of writing the bitstream. + * TODO: use these for fast 1st pass too. */ + +#define RDO_SKIP_BS 1 + +/* Transition and size tables for abs<9 MVD and residual coding */ +/* Consist of i_prefix-2 1s, one zero, and a bypass sign bit */ +uint8_t x264_cabac_transition_unary[15][128]; +uint16_t x264_cabac_size_unary[15][128]; +/* Transition and size tables for abs>9 MVD */ +/* Consist of 5 1s and a bypass sign bit */ +static uint8_t cabac_transition_5ones[128]; +static uint16_t cabac_size_5ones[128]; + +/* CAVLC: produces exactly the same bit count as a normal encode */ +/* this probably still leaves some unnecessary computations */ +#define bs_write1(s,v) ((s)->i_bits_encoded += 1) +#define bs_write(s,n,v) ((s)->i_bits_encoded += (n)) +#define bs_write_ue(s,v) ((s)->i_bits_encoded += bs_size_ue(v)) +#define bs_write_se(s,v) ((s)->i_bits_encoded += bs_size_se(v)) +#define bs_write_te(s,v,l) ((s)->i_bits_encoded += bs_size_te(v,l)) +#define x264_macroblock_write_cavlc static x264_macroblock_size_cavlc +#include "cavlc.c" + +/* CABAC: not exactly the same. x264_cabac_size_decision() keeps track of + * fractional bits, but only finite precision. */ +#undef x264_cabac_encode_decision +#undef x264_cabac_encode_decision_noup +#undef x264_cabac_encode_bypass +#undef x264_cabac_encode_terminal +#define x264_cabac_encode_decision(c,x,v) x264_cabac_size_decision(c,x,v) +#define x264_cabac_encode_decision_noup(c,x,v) x264_cabac_size_decision_noup(c,x,v) +#define x264_cabac_encode_terminal(c) ((c)->f8_bits_encoded += 7) +#define x264_cabac_encode_bypass(c,v) ((c)->f8_bits_encoded += 256) +#define x264_cabac_encode_ue_bypass(c,e,v) ((c)->f8_bits_encoded += (bs_size_ue_big(v+(1<mc.memcpy_aligned( &cabac_tmp.f8_bits_encoded, &h->cabac.f8_bits_encoded, \ + sizeof(int) + (CHROMA444 ? 1024+12 : 460) ) +#define COPY_CABAC_PART( pos, size ) memcpy( &cb->state[pos], &h->cabac.state[pos], size ) + +static ALWAYS_INLINE uint64_t cached_hadamard( x264_t *h, int size, int x, int y ) +{ + static const uint8_t hadamard_shift_x[4] = {4, 4, 3, 3}; + static const uint8_t hadamard_shift_y[4] = {4-0, 3-0, 4-1, 3-1}; + static const uint8_t hadamard_offset[4] = {0, 1, 3, 5}; + int cache_index = (x >> hadamard_shift_x[size]) + (y >> hadamard_shift_y[size]) + + hadamard_offset[size]; + uint64_t res = h->mb.pic.fenc_hadamard_cache[cache_index]; + if( res ) + return res - 1; + else + { + pixel *fenc = h->mb.pic.p_fenc[0] + x + y*FENC_STRIDE; + res = h->pixf.hadamard_ac[size]( fenc, FENC_STRIDE ); + h->mb.pic.fenc_hadamard_cache[cache_index] = res + 1; + return res; + } +} + +static ALWAYS_INLINE int cached_satd( x264_t *h, int size, int x, int y ) +{ + static const uint8_t satd_shift_x[3] = {3, 2, 2}; + static const uint8_t satd_shift_y[3] = {2-1, 3-2, 2-2}; + static const uint8_t satd_offset[3] = {0, 8, 16}; + ALIGNED_16( static pixel zero[16] ) = {0}; + int cache_index = (x >> satd_shift_x[size - PIXEL_8x4]) + (y >> satd_shift_y[size - PIXEL_8x4]) + + satd_offset[size - PIXEL_8x4]; + int res = h->mb.pic.fenc_satd_cache[cache_index]; + if( res ) + return res - 1; + else + { + pixel *fenc = h->mb.pic.p_fenc[0] + x + y*FENC_STRIDE; + int dc = h->pixf.sad[size]( fenc, FENC_STRIDE, zero, 0 ) >> 1; + res = h->pixf.satd[size]( fenc, FENC_STRIDE, zero, 0 ) - dc; + h->mb.pic.fenc_satd_cache[cache_index] = res + 1; + return res; + } +} + +/* Psy RD distortion metric: SSD plus "Absolute Difference of Complexities" */ +/* SATD and SA8D are used to measure block complexity. */ +/* The difference between SATD and SA8D scores are both used to avoid bias from the DCT size. Using SATD */ +/* only, for example, results in overusage of 8x8dct, while the opposite occurs when using SA8D. */ + +/* FIXME: Is there a better metric than averaged SATD/SA8D difference for complexity difference? */ +/* Hadamard transform is recursive, so a SATD+SA8D can be done faster by taking advantage of this fact. */ +/* This optimization can also be used in non-RD transform decision. */ + +static inline int ssd_plane( x264_t *h, int size, int p, int x, int y ) +{ + ALIGNED_16( static pixel zero[16] ) = {0}; + int satd = 0; + pixel *fdec = h->mb.pic.p_fdec[p] + x + y*FDEC_STRIDE; + pixel *fenc = h->mb.pic.p_fenc[p] + x + y*FENC_STRIDE; + if( p == 0 && h->mb.i_psy_rd ) + { + /* If the plane is smaller than 8x8, we can't do an SA8D; this probably isn't a big problem. */ + if( size <= PIXEL_8x8 ) + { + uint64_t fdec_acs = h->pixf.hadamard_ac[size]( fdec, FDEC_STRIDE ); + uint64_t fenc_acs = cached_hadamard( h, size, x, y ); + satd = abs((int32_t)fdec_acs - (int32_t)fenc_acs) + + abs((int32_t)(fdec_acs>>32) - (int32_t)(fenc_acs>>32)); + satd >>= 1; + } + else + { + int dc = h->pixf.sad[size]( fdec, FDEC_STRIDE, zero, 0 ) >> 1; + satd = abs(h->pixf.satd[size]( fdec, FDEC_STRIDE, zero, 0 ) - dc - cached_satd( h, size, x, y )); + } + satd = (satd * h->mb.i_psy_rd * h->mb.i_psy_rd_lambda + 128) >> 8; + } + return h->pixf.ssd[size](fenc, FENC_STRIDE, fdec, FDEC_STRIDE) + satd; +} + +static inline int ssd_mb( x264_t *h ) +{ + int chroma_size = h->luma2chroma_pixel[PIXEL_16x16]; + int chroma_ssd = ssd_plane(h, chroma_size, 1, 0, 0) + ssd_plane(h, chroma_size, 2, 0, 0); + chroma_ssd = ((uint64_t)chroma_ssd * h->mb.i_chroma_lambda2_offset + 128) >> 8; + return ssd_plane(h, PIXEL_16x16, 0, 0, 0) + chroma_ssd; +} + +static int x264_rd_cost_mb( x264_t *h, int i_lambda2 ) +{ + int b_transform_bak = h->mb.b_transform_8x8; + int i_ssd; + int i_bits; + int type_bak = h->mb.i_type; + + x264_macroblock_encode( h ); + + if( h->mb.b_deblock_rdo ) + x264_macroblock_deblock( h ); + + i_ssd = ssd_mb( h ); + + if( IS_SKIP( h->mb.i_type ) ) + { + i_bits = (1 * i_lambda2 + 128) >> 8; + } + else if( h->param.b_cabac ) + { + x264_cabac_t cabac_tmp; + COPY_CABAC; + x264_macroblock_size_cabac( h, &cabac_tmp ); + i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 32768 ) >> 16; + } + else + { + x264_macroblock_size_cavlc( h ); + i_bits = ( (uint64_t)h->out.bs.i_bits_encoded * i_lambda2 + 128 ) >> 8; + } + + h->mb.b_transform_8x8 = b_transform_bak; + h->mb.i_type = type_bak; + + return X264_MIN( i_ssd + i_bits, COST_MAX ); +} + +/* partition RD functions use 8 bits more precision to avoid large rounding errors at low QPs */ + +static uint64_t x264_rd_cost_subpart( x264_t *h, int i_lambda2, int i4, int i_pixel ) +{ + uint64_t i_ssd, i_bits; + + x264_macroblock_encode_p4x4( h, i4 ); + if( i_pixel == PIXEL_8x4 ) + x264_macroblock_encode_p4x4( h, i4+1 ); + if( i_pixel == PIXEL_4x8 ) + x264_macroblock_encode_p4x4( h, i4+2 ); + + i_ssd = ssd_plane( h, i_pixel, 0, block_idx_x[i4]*4, block_idx_y[i4]*4 ); + if( CHROMA444 ) + { + int chromassd = ssd_plane( h, i_pixel, 1, block_idx_x[i4]*4, block_idx_y[i4]*4 ) + + ssd_plane( h, i_pixel, 2, block_idx_x[i4]*4, block_idx_y[i4]*4 ); + chromassd = ((uint64_t)chromassd * h->mb.i_chroma_lambda2_offset + 128) >> 8; + i_ssd += chromassd; + } + + if( h->param.b_cabac ) + { + x264_cabac_t cabac_tmp; + COPY_CABAC; + x264_subpartition_size_cabac( h, &cabac_tmp, i4, i_pixel ); + i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8; + } + else + i_bits = x264_subpartition_size_cavlc( h, i4, i_pixel ); + + return (i_ssd<<8) + i_bits; +} + +uint64_t x264_rd_cost_part( x264_t *h, int i_lambda2, int i4, int i_pixel ) +{ + uint64_t i_ssd, i_bits; + int i8 = i4 >> 2; + + if( i_pixel == PIXEL_16x16 ) + { + int i_cost = x264_rd_cost_mb( h, i_lambda2 ); + return i_cost; + } + + if( i_pixel > PIXEL_8x8 ) + return x264_rd_cost_subpart( h, i_lambda2, i4, i_pixel ); + + h->mb.i_cbp_luma = 0; + + x264_macroblock_encode_p8x8( h, i8 ); + if( i_pixel == PIXEL_16x8 ) + x264_macroblock_encode_p8x8( h, i8+1 ); + if( i_pixel == PIXEL_8x16 ) + x264_macroblock_encode_p8x8( h, i8+2 ); + + int ssd_x = 8*(i8&1); + int ssd_y = 8*(i8>>1); + i_ssd = ssd_plane( h, i_pixel, 0, ssd_x, ssd_y ); + int chromapix = h->luma2chroma_pixel[i_pixel]; + int chromassd = ssd_plane( h, chromapix, 1, ssd_x>>CHROMA_H_SHIFT, ssd_y>>CHROMA_V_SHIFT ) + + ssd_plane( h, chromapix, 2, ssd_x>>CHROMA_H_SHIFT, ssd_y>>CHROMA_V_SHIFT ); + i_ssd += ((uint64_t)chromassd * h->mb.i_chroma_lambda2_offset + 128) >> 8; + + if( h->param.b_cabac ) + { + x264_cabac_t cabac_tmp; + COPY_CABAC; + x264_partition_size_cabac( h, &cabac_tmp, i8, i_pixel ); + i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8; + } + else + i_bits = (uint64_t)x264_partition_size_cavlc( h, i8, i_pixel ) * i_lambda2; + + return (i_ssd<<8) + i_bits; +} + +static uint64_t x264_rd_cost_i8x8( x264_t *h, int i_lambda2, int i8, int i_mode, pixel edge[4][32] ) +{ + uint64_t i_ssd, i_bits; + int plane_count = CHROMA444 ? 3 : 1; + int i_qp = h->mb.i_qp; + h->mb.i_cbp_luma &= ~(1<mb.b_transform_8x8 = 1; + + for( int p = 0; p < plane_count; p++ ) + { + x264_mb_encode_i8x8( h, p, i8, i_qp, i_mode, edge[p], 1 ); + i_qp = h->mb.i_chroma_qp; + } + + i_ssd = ssd_plane( h, PIXEL_8x8, 0, (i8&1)*8, (i8>>1)*8 ); + if( CHROMA444 ) + { + int chromassd = ssd_plane( h, PIXEL_8x8, 1, (i8&1)*8, (i8>>1)*8 ) + + ssd_plane( h, PIXEL_8x8, 2, (i8&1)*8, (i8>>1)*8 ); + chromassd = ((uint64_t)chromassd * h->mb.i_chroma_lambda2_offset + 128) >> 8; + i_ssd += chromassd; + } + + if( h->param.b_cabac ) + { + x264_cabac_t cabac_tmp; + COPY_CABAC; + x264_partition_i8x8_size_cabac( h, &cabac_tmp, i8, i_mode ); + i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8; + } + else + i_bits = (uint64_t)x264_partition_i8x8_size_cavlc( h, i8, i_mode ) * i_lambda2; + + return (i_ssd<<8) + i_bits; +} + +static uint64_t x264_rd_cost_i4x4( x264_t *h, int i_lambda2, int i4, int i_mode ) +{ + uint64_t i_ssd, i_bits; + int plane_count = CHROMA444 ? 3 : 1; + int i_qp = h->mb.i_qp; + + for( int p = 0; p < plane_count; p++ ) + { + x264_mb_encode_i4x4( h, p, i4, i_qp, i_mode, 1 ); + i_qp = h->mb.i_chroma_qp; + } + + i_ssd = ssd_plane( h, PIXEL_4x4, 0, block_idx_x[i4]*4, block_idx_y[i4]*4 ); + if( CHROMA444 ) + { + int chromassd = ssd_plane( h, PIXEL_4x4, 1, block_idx_x[i4]*4, block_idx_y[i4]*4 ) + + ssd_plane( h, PIXEL_4x4, 2, block_idx_x[i4]*4, block_idx_y[i4]*4 ); + chromassd = ((uint64_t)chromassd * h->mb.i_chroma_lambda2_offset + 128) >> 8; + i_ssd += chromassd; + } + + if( h->param.b_cabac ) + { + x264_cabac_t cabac_tmp; + COPY_CABAC; + x264_partition_i4x4_size_cabac( h, &cabac_tmp, i4, i_mode ); + i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8; + } + else + i_bits = (uint64_t)x264_partition_i4x4_size_cavlc( h, i4, i_mode ) * i_lambda2; + + return (i_ssd<<8) + i_bits; +} + +static uint64_t x264_rd_cost_chroma( x264_t *h, int i_lambda2, int i_mode, int b_dct ) +{ + uint64_t i_ssd, i_bits; + + if( b_dct ) + x264_mb_encode_chroma( h, 0, h->mb.i_chroma_qp ); + + int chromapix = h->luma2chroma_pixel[PIXEL_16x16]; + i_ssd = ssd_plane( h, chromapix, 1, 0, 0 ) + + ssd_plane( h, chromapix, 2, 0, 0 ); + + h->mb.i_chroma_pred_mode = i_mode; + + if( h->param.b_cabac ) + { + x264_cabac_t cabac_tmp; + COPY_CABAC; + x264_chroma_size_cabac( h, &cabac_tmp ); + i_bits = ( (uint64_t)cabac_tmp.f8_bits_encoded * i_lambda2 + 128 ) >> 8; + } + else + i_bits = (uint64_t)x264_chroma_size_cavlc( h ) * i_lambda2; + + return (i_ssd<<8) + i_bits; +} +/**************************************************************************** + * Trellis RD quantization + ****************************************************************************/ + +#define TRELLIS_SCORE_MAX -1LL // negative marks the node as invalid +#define TRELLIS_SCORE_BIAS 1LL<<60; // bias so that all valid scores are positive, even after negative contributions from psy +#define CABAC_SIZE_BITS 8 +#define LAMBDA_BITS 4 + +/* precalculate the cost of coding various combinations of bits in a single context */ +void x264_rdo_init( void ) +{ + for( int i_prefix = 0; i_prefix < 15; i_prefix++ ) + { + for( int i_ctx = 0; i_ctx < 128; i_ctx++ ) + { + int f8_bits = 0; + uint8_t ctx = i_ctx; + + for( int i = 1; i < i_prefix; i++ ) + f8_bits += x264_cabac_size_decision2( &ctx, 1 ); + if( i_prefix > 0 && i_prefix < 14 ) + f8_bits += x264_cabac_size_decision2( &ctx, 0 ); + f8_bits += 1 << CABAC_SIZE_BITS; //sign + + x264_cabac_size_unary[i_prefix][i_ctx] = f8_bits; + x264_cabac_transition_unary[i_prefix][i_ctx] = ctx; + } + } + for( int i_ctx = 0; i_ctx < 128; i_ctx++ ) + { + int f8_bits = 0; + uint8_t ctx = i_ctx; + + for( int i = 0; i < 5; i++ ) + f8_bits += x264_cabac_size_decision2( &ctx, 1 ); + f8_bits += 1 << CABAC_SIZE_BITS; //sign + + cabac_size_5ones[i_ctx] = f8_bits; + cabac_transition_5ones[i_ctx] = ctx; + } +} + +typedef struct +{ + uint64_t score; + int level_idx; // index into level_tree[] + uint8_t cabac_state[4]; // just contexts 0,4,8,9 of the 10 relevant to coding abs_level_m1 +} trellis_node_t; + +typedef struct +{ + uint16_t next; + uint16_t abs_level; +} trellis_level_t; + +// TODO: +// save cabac state between blocks? +// use trellis' RD score instead of x264_mb_decimate_score? +// code 8x8 sig/last flags forwards with deadzone and save the contexts at +// each position? +// change weights when using CQMs? + +// possible optimizations: +// make scores fit in 32bit +// save quantized coefs during rd, to avoid a duplicate trellis in the final encode +// if trellissing all MBRD modes, finish SSD calculation so we can skip all of +// the normal dequant/idct/ssd/cabac + +// the unquant_mf here is not the same as dequant_mf: +// in normal operation (dct->quant->dequant->idct) the dct and idct are not +// normalized. quant/dequant absorb those scaling factors. +// in this function, we just do (quant->unquant) and want the output to be +// comparable to the input. so unquant is the direct inverse of quant, +// and uses the dct scaling factors, not the idct ones. + +#define SIGN(x,y) ((x^(y >> 31))-(y >> 31)) + +#define SET_LEVEL(ndst, nsrc, l) {\ + if( sizeof(trellis_level_t) == sizeof(uint32_t) )\ + M32( &level_tree[levels_used] ) = pack16to32( nsrc.level_idx, l );\ + else\ + level_tree[levels_used] = (trellis_level_t){ nsrc.level_idx, l };\ + ndst.level_idx = levels_used;\ + levels_used++;\ +} + +// encode all values of the dc coef in a block which is known to have no ac +static NOINLINE +int trellis_dc_shortcut( int sign_coef, int quant_coef, int unquant_mf, int coef_weight, int lambda2, uint8_t *cabac_state, int cost_sig ) +{ + uint64_t bscore = TRELLIS_SCORE_MAX; + int ret = 0; + int q = abs( quant_coef ); + for( int abs_level = q-1; abs_level <= q; abs_level++ ) + { + int unquant_abs_level = (unquant_mf * abs_level + 128) >> 8; + + /* Optimize rounding for DC coefficients in DC-only luma 4x4/8x8 blocks. */ + int d = sign_coef - ((SIGN(unquant_abs_level, sign_coef) + 8)&~15); + uint64_t score = (uint64_t)d*d * coef_weight; + + /* code the proposed level, and count how much entropy it would take */ + if( abs_level ) + { + unsigned f8_bits = cost_sig; + int prefix = X264_MIN( abs_level - 1, 14 ); + f8_bits += x264_cabac_size_decision_noup2( cabac_state+1, prefix > 0 ); + f8_bits += x264_cabac_size_unary[prefix][cabac_state[5]]; + if( abs_level >= 15 ) + f8_bits += bs_size_ue_big( abs_level - 15 ) << CABAC_SIZE_BITS; + score += (uint64_t)f8_bits * lambda2 >> ( CABAC_SIZE_BITS - LAMBDA_BITS ); + } + + COPY2_IF_LT( bscore, score, ret, abs_level ); + } + return SIGN(ret, sign_coef); +} + +// encode one value of one coef in one context +static ALWAYS_INLINE +int trellis_coef( int j, int const_level, int abs_level, int prefix, int suffix_cost, + int node_ctx, int level1_ctx, int levelgt1_ctx, uint64_t ssd, int cost_siglast[3], + trellis_node_t *nodes_cur, trellis_node_t *nodes_prev, + trellis_level_t *level_tree, int levels_used, int lambda2, uint8_t *level_state ) +{ + uint64_t score = nodes_prev[j].score + ssd; + /* code the proposed level, and count how much entropy it would take */ + unsigned f8_bits = cost_siglast[ j ? 1 : 2 ]; + uint8_t level1_state = (j >= 3) ? nodes_prev[j].cabac_state[level1_ctx>>2] : level_state[level1_ctx]; + f8_bits += x264_cabac_entropy[level1_state ^ (const_level > 1)]; + uint8_t levelgt1_state; + if( const_level > 1 ) + { + levelgt1_state = j >= 6 ? nodes_prev[j].cabac_state[levelgt1_ctx-6] : level_state[levelgt1_ctx]; + f8_bits += x264_cabac_size_unary[prefix][levelgt1_state] + suffix_cost; + } + else + f8_bits += 1 << CABAC_SIZE_BITS; + score += (uint64_t)f8_bits * lambda2 >> ( CABAC_SIZE_BITS - LAMBDA_BITS ); + + /* save the node if it's better than any existing node with the same cabac ctx */ + if( score < nodes_cur[node_ctx].score ) + { + nodes_cur[node_ctx].score = score; + if( j == 2 || (j <= 3 && node_ctx == 4) ) // init from input state + M32(nodes_cur[node_ctx].cabac_state) = M32(level_state+12); + else if( j >= 3 ) + M32(nodes_cur[node_ctx].cabac_state) = M32(nodes_prev[j].cabac_state); + if( j >= 3 ) // skip the transition if we're not going to reuse the context + nodes_cur[node_ctx].cabac_state[level1_ctx>>2] = x264_cabac_transition[level1_state][const_level > 1]; + if( const_level > 1 && node_ctx == 7 ) + nodes_cur[node_ctx].cabac_state[levelgt1_ctx-6] = x264_cabac_transition_unary[prefix][levelgt1_state]; + nodes_cur[node_ctx].level_idx = nodes_prev[j].level_idx; + SET_LEVEL( nodes_cur[node_ctx], nodes_prev[j], abs_level ); + } + return levels_used; +} + +// encode one value of one coef in all contexts, templated by which value that is. +// in ctx_lo, the set of live nodes is contiguous and starts at ctx0, so return as soon as we've seen one failure. +// in ctx_hi, they're contiguous within each block of 4 ctxs, but not necessarily starting at the beginning, +// so exploiting that would be more complicated. +static NOINLINE +int trellis_coef0_0( uint64_t ssd0, trellis_node_t *nodes_cur, trellis_node_t *nodes_prev, + trellis_level_t *level_tree, int levels_used ) +{ + nodes_cur[0].score = nodes_prev[0].score + ssd0; + nodes_cur[0].level_idx = nodes_prev[0].level_idx; + for( int j = 1; j < 4 && (int64_t)nodes_prev[j].score >= 0; j++ ) + { + nodes_cur[j].score = nodes_prev[j].score; + if( j >= 3 ) + M32(nodes_cur[j].cabac_state) = M32(nodes_prev[j].cabac_state); + SET_LEVEL( nodes_cur[j], nodes_prev[j], 0 ); + } + return levels_used; +} + +static NOINLINE +int trellis_coef0_1( uint64_t ssd0, trellis_node_t *nodes_cur, trellis_node_t *nodes_prev, + trellis_level_t *level_tree, int levels_used ) +{ + for( int j = 1; j < 8; j++ ) + // this branch only affects speed, not function; there's nothing wrong with updating invalid nodes in coef0. + if( (int64_t)nodes_prev[j].score >= 0 ) + { + nodes_cur[j].score = nodes_prev[j].score; + if( j >= 3 ) + M32(nodes_cur[j].cabac_state) = M32(nodes_prev[j].cabac_state); + SET_LEVEL( nodes_cur[j], nodes_prev[j], 0 ); + } + return levels_used; +} + +#define COEF(const_level, ctx_hi, j, ...)\ + if( !j || (int64_t)nodes_prev[j].score >= 0 )\ + levels_used = trellis_coef( j, const_level, abs_level, prefix, suffix_cost, __VA_ARGS__,\ + j?ssd1:ssd0, cost_siglast, nodes_cur, nodes_prev,\ + level_tree, levels_used, lambda2, level_state );\ + else if( !ctx_hi )\ + return levels_used; + +static NOINLINE +int trellis_coef1_0( uint64_t ssd0, uint64_t ssd1, int cost_siglast[3], + trellis_node_t *nodes_cur, trellis_node_t *nodes_prev, + trellis_level_t *level_tree, int levels_used, int lambda2, + uint8_t *level_state ) +{ + int abs_level = 1, prefix = 1, suffix_cost = 0; + COEF( 1, 0, 0, 1, 1, 0 ); + COEF( 1, 0, 1, 2, 2, 0 ); + COEF( 1, 0, 2, 3, 3, 0 ); + COEF( 1, 0, 3, 3, 4, 0 ); + return levels_used; +} + +static NOINLINE +int trellis_coef1_1( uint64_t ssd0, uint64_t ssd1, int cost_siglast[3], + trellis_node_t *nodes_cur, trellis_node_t *nodes_prev, + trellis_level_t *level_tree, int levels_used, int lambda2, + uint8_t *level_state ) +{ + int abs_level = 1, prefix = 1, suffix_cost = 0; + COEF( 1, 1, 1, 2, 2, 0 ); + COEF( 1, 1, 2, 3, 3, 0 ); + COEF( 1, 1, 3, 3, 4, 0 ); + COEF( 1, 1, 4, 4, 0, 0 ); + COEF( 1, 1, 5, 5, 0, 0 ); + COEF( 1, 1, 6, 6, 0, 0 ); + COEF( 1, 1, 7, 7, 0, 0 ); + return levels_used; +} + +static NOINLINE +int trellis_coefn_0( int abs_level, uint64_t ssd0, uint64_t ssd1, int cost_siglast[3], + trellis_node_t *nodes_cur, trellis_node_t *nodes_prev, + trellis_level_t *level_tree, int levels_used, int lambda2, + uint8_t *level_state, int levelgt1_ctx ) +{ + int prefix = X264_MIN( abs_level-1, 14 ); + int suffix_cost = abs_level >= 15 ? bs_size_ue_big( abs_level - 15 ) << CABAC_SIZE_BITS : 0; + COEF( 2, 0, 0, 4, 1, 5 ); + COEF( 2, 0, 1, 4, 2, 5 ); + COEF( 2, 0, 2, 4, 3, 5 ); + COEF( 2, 0, 3, 4, 4, 5 ); + return levels_used; +} + +static NOINLINE +int trellis_coefn_1( int abs_level, uint64_t ssd0, uint64_t ssd1, int cost_siglast[3], + trellis_node_t *nodes_cur, trellis_node_t *nodes_prev, + trellis_level_t *level_tree, int levels_used, int lambda2, + uint8_t *level_state, int levelgt1_ctx ) +{ + int prefix = X264_MIN( abs_level-1, 14 ); + int suffix_cost = abs_level >= 15 ? bs_size_ue_big( abs_level - 15 ) << CABAC_SIZE_BITS : 0; + COEF( 2, 1, 1, 4, 2, 5 ); + COEF( 2, 1, 2, 4, 3, 5 ); + COEF( 2, 1, 3, 4, 4, 5 ); + COEF( 2, 1, 4, 5, 0, 6 ); + COEF( 2, 1, 5, 6, 0, 7 ); + COEF( 2, 1, 6, 7, 0, 8 ); + COEF( 2, 1, 7, 7, 0, levelgt1_ctx ); + return levels_used; +} + +static ALWAYS_INLINE +int quant_trellis_cabac( x264_t *h, dctcoef *dct, + udctcoef *quant_mf, udctcoef *quant_bias, const int *unquant_mf, + const uint8_t *zigzag, int ctx_block_cat, int lambda2, int b_ac, + int b_chroma, int dc, int num_coefs, int idx ) +{ + ALIGNED_ARRAY_64( dctcoef, orig_coefs, [64] ); + ALIGNED_ARRAY_64( dctcoef, quant_coefs, [64] ); + const uint32_t *coef_weight1 = num_coefs == 64 ? x264_dct8_weight_tab : x264_dct4_weight_tab; + const uint32_t *coef_weight2 = num_coefs == 64 ? x264_dct8_weight2_tab : x264_dct4_weight2_tab; + const int b_interlaced = MB_INTERLACED; + uint8_t *cabac_state_sig = &h->cabac.state[ x264_significant_coeff_flag_offset[b_interlaced][ctx_block_cat] ]; + uint8_t *cabac_state_last = &h->cabac.state[ x264_last_coeff_flag_offset[b_interlaced][ctx_block_cat] ]; + int levelgt1_ctx = b_chroma && dc ? 8 : 9; + + if( dc ) + { + if( num_coefs == 16 ) + { + memcpy( orig_coefs, dct, sizeof(dctcoef)*16 ); + if( !h->quantf.quant_4x4_dc( dct, quant_mf[0] >> 1, quant_bias[0] << 1 ) ) + return 0; + h->zigzagf.scan_4x4( quant_coefs, dct ); + } + else + { + memcpy( orig_coefs, dct, sizeof(dctcoef)*num_coefs ); + int nz = h->quantf.quant_2x2_dc( &dct[0], quant_mf[0] >> 1, quant_bias[0] << 1 ); + if( num_coefs == 8 ) + nz |= h->quantf.quant_2x2_dc( &dct[4], quant_mf[0] >> 1, quant_bias[0] << 1 ); + if( !nz ) + return 0; + for( int i = 0; i < num_coefs; i++ ) + quant_coefs[i] = dct[zigzag[i]]; + } + } + else + { + if( num_coefs == 64 ) + { + h->mc.memcpy_aligned( orig_coefs, dct, sizeof(dctcoef)*64 ); + if( !h->quantf.quant_8x8( dct, quant_mf, quant_bias ) ) + return 0; + h->zigzagf.scan_8x8( quant_coefs, dct ); + } + else //if( num_coefs == 16 ) + { + memcpy( orig_coefs, dct, sizeof(dctcoef)*16 ); + if( !h->quantf.quant_4x4( dct, quant_mf, quant_bias ) ) + return 0; + h->zigzagf.scan_4x4( quant_coefs, dct ); + } + } + + int last_nnz = h->quantf.coeff_last[ctx_block_cat]( quant_coefs+b_ac )+b_ac; + uint8_t *cabac_state = &h->cabac.state[ x264_coeff_abs_level_m1_offset[ctx_block_cat] ]; + + /* shortcut for dc-only blocks. + * this doesn't affect the output, but saves some unnecessary computation. */ + if( last_nnz == 0 && !dc ) + { + int cost_sig = x264_cabac_size_decision_noup2( &cabac_state_sig[0], 1 ) + + x264_cabac_size_decision_noup2( &cabac_state_last[0], 1 ); + dct[0] = trellis_dc_shortcut( orig_coefs[0], quant_coefs[0], unquant_mf[0], coef_weight2[0], lambda2, cabac_state, cost_sig ); + return !!dct[0]; + } + +#if HAVE_MMX && ARCH_X86_64 && !defined( __MACH__ ) +#define TRELLIS_ARGS unquant_mf, zigzag, lambda2, last_nnz, orig_coefs, quant_coefs, dct,\ + cabac_state_sig, cabac_state_last, M64(cabac_state), M16(cabac_state+8) + if( num_coefs == 16 && !dc ) + if( b_chroma || !h->mb.i_psy_trellis ) + return h->quantf.trellis_cabac_4x4( TRELLIS_ARGS, b_ac ); + else + return h->quantf.trellis_cabac_4x4_psy( TRELLIS_ARGS, b_ac, h->mb.pic.fenc_dct4[idx&15], h->mb.i_psy_trellis ); + else if( num_coefs == 64 && !dc ) + if( b_chroma || !h->mb.i_psy_trellis ) + return h->quantf.trellis_cabac_8x8( TRELLIS_ARGS, b_interlaced ); + else + return h->quantf.trellis_cabac_8x8_psy( TRELLIS_ARGS, b_interlaced, h->mb.pic.fenc_dct8[idx&3], h->mb.i_psy_trellis); + else if( num_coefs == 8 && dc ) + return h->quantf.trellis_cabac_chroma_422_dc( TRELLIS_ARGS ); + else if( dc ) + return h->quantf.trellis_cabac_dc( TRELLIS_ARGS, num_coefs-1 ); +#endif + + // (# of coefs) * (# of ctx) * (# of levels tried) = 1024 + // we don't need to keep all of those: (# of coefs) * (# of ctx) would be enough, + // but it takes more time to remove dead states than you gain in reduced memory. + trellis_level_t level_tree[64*8*2]; + int levels_used = 1; + /* init trellis */ + trellis_node_t nodes[2][8]; + trellis_node_t *nodes_cur = nodes[0]; + trellis_node_t *nodes_prev = nodes[1]; + trellis_node_t *bnode; + for( int j = 1; j < 4; j++ ) + nodes_cur[j].score = TRELLIS_SCORE_MAX; + nodes_cur[0].score = TRELLIS_SCORE_BIAS; + nodes_cur[0].level_idx = 0; + level_tree[0].abs_level = 0; + level_tree[0].next = 0; + ALIGNED_4( uint8_t level_state[16] ); + memcpy( level_state, cabac_state, 10 ); + level_state[12] = cabac_state[0]; // packed subset for copying into trellis_node_t + level_state[13] = cabac_state[4]; + level_state[14] = cabac_state[8]; + level_state[15] = cabac_state[9]; + + idx &= num_coefs == 64 ? 3 : 15; + + // coefs are processed in reverse order, because that's how the abs value is coded. + // last_coef and significant_coef flags are normally coded in forward order, but + // we have to reverse them to match the levels. + // in 4x4 blocks, last_coef and significant_coef use a separate context for each + // position, so the order doesn't matter, and we don't even have to update their contexts. + // in 8x8 blocks, some positions share contexts, so we'll just have to hope that + // cabac isn't too sensitive. + int i = last_nnz; +#define TRELLIS_LOOP(ctx_hi)\ + for( ; i >= b_ac; i-- )\ + {\ + /* skip 0s: this doesn't affect the output, but saves some unnecessary computation. */\ + if( !quant_coefs[i] )\ + {\ + /* no need to calculate ssd of 0s: it's the same in all nodes.\ + * no need to modify level_tree for ctx=0: it starts with an infinite loop of 0s. + * subtracting from one score is equivalent to adding to the rest. */\ + if( !ctx_hi )\ + {\ + int sigindex = !dc && num_coefs == 64 ? x264_significant_coeff_flag_offset_8x8[b_interlaced][i] :\ + b_chroma && dc && num_coefs == 8 ? x264_coeff_flag_offset_chroma_422_dc[i] : i;\ + uint64_t cost_sig0 = x264_cabac_size_decision_noup2( &cabac_state_sig[sigindex], 0 )\ + * (uint64_t)lambda2 >> ( CABAC_SIZE_BITS - LAMBDA_BITS );\ + nodes_cur[0].score -= cost_sig0;\ + }\ + for( int j = 1; j < (ctx_hi?8:4); j++ )\ + SET_LEVEL( nodes_cur[j], nodes_cur[j], 0 );\ + continue;\ + }\ +\ + int sign_coef = orig_coefs[zigzag[i]];\ + int abs_coef = abs( sign_coef );\ + int q = abs( quant_coefs[i] );\ + int cost_siglast[3]; /* { zero, nonzero, nonzero-and-last } */\ + XCHG( trellis_node_t*, nodes_cur, nodes_prev );\ + for( int j = ctx_hi; j < 8; j++ )\ + nodes_cur[j].score = TRELLIS_SCORE_MAX;\ +\ + if( i < num_coefs-1 || ctx_hi )\ + {\ + int sigindex = !dc && num_coefs == 64 ? x264_significant_coeff_flag_offset_8x8[b_interlaced][i] :\ + b_chroma && dc && num_coefs == 8 ? x264_coeff_flag_offset_chroma_422_dc[i] : i;\ + int lastindex = !dc && num_coefs == 64 ? x264_last_coeff_flag_offset_8x8[i] :\ + b_chroma && dc && num_coefs == 8 ? x264_coeff_flag_offset_chroma_422_dc[i] : i;\ + cost_siglast[0] = x264_cabac_size_decision_noup2( &cabac_state_sig[sigindex], 0 );\ + int cost_sig1 = x264_cabac_size_decision_noup2( &cabac_state_sig[sigindex], 1 );\ + cost_siglast[1] = x264_cabac_size_decision_noup2( &cabac_state_last[lastindex], 0 ) + cost_sig1;\ + if( !ctx_hi )\ + cost_siglast[2] = x264_cabac_size_decision_noup2( &cabac_state_last[lastindex], 1 ) + cost_sig1;\ + }\ + else\ + {\ + cost_siglast[0] = cost_siglast[1] = cost_siglast[2] = 0;\ + }\ +\ + /* there are a few cases where increasing the coeff magnitude helps,\ + * but it's only around .003 dB, and skipping them ~doubles the speed of trellis.\ + * could also try q-2: that sometimes helps, but also sometimes decimates blocks\ + * that are better left coded, especially at QP > 40. */\ + uint64_t ssd0[2], ssd1[2];\ + for( int k = 0; k < 2; k++ )\ + {\ + int abs_level = q-1+k;\ + int unquant_abs_level = (((dc?unquant_mf[0]<<1:unquant_mf[zigzag[i]]) * abs_level + 128) >> 8);\ + int d = abs_coef - unquant_abs_level;\ + /* Psy trellis: bias in favor of higher AC coefficients in the reconstructed frame. */\ + if( h->mb.i_psy_trellis && i && !dc && !b_chroma )\ + {\ + int orig_coef = (num_coefs == 64) ? h->mb.pic.fenc_dct8[idx][zigzag[i]] : h->mb.pic.fenc_dct4[idx][zigzag[i]];\ + int predicted_coef = orig_coef - sign_coef;\ + int psy_value = abs(unquant_abs_level + SIGN(predicted_coef, sign_coef));\ + int psy_weight = coef_weight1[zigzag[i]] * h->mb.i_psy_trellis;\ + ssd1[k] = (uint64_t)d*d * coef_weight2[zigzag[i]] - psy_weight * psy_value;\ + }\ + else\ + /* FIXME: for i16x16 dc is this weight optimal? */\ + ssd1[k] = (uint64_t)d*d * (dc?256:coef_weight2[zigzag[i]]);\ + ssd0[k] = ssd1[k];\ + if( !i && !dc && !ctx_hi )\ + {\ + /* Optimize rounding for DC coefficients in DC-only luma 4x4/8x8 blocks. */\ + d = sign_coef - ((SIGN(unquant_abs_level, sign_coef) + 8)&~15);\ + ssd0[k] = (uint64_t)d*d * coef_weight2[zigzag[i]];\ + }\ + }\ +\ + /* argument passing imposes some significant overhead here. gcc's interprocedural register allocation isn't up to it. */\ + switch( q )\ + {\ + case 1:\ + ssd1[0] += (uint64_t)cost_siglast[0] * lambda2 >> ( CABAC_SIZE_BITS - LAMBDA_BITS );\ + levels_used = trellis_coef0_##ctx_hi( ssd0[0]-ssd1[0], nodes_cur, nodes_prev, level_tree, levels_used );\ + levels_used = trellis_coef1_##ctx_hi( ssd0[1]-ssd1[0], ssd1[1]-ssd1[0], cost_siglast, nodes_cur, nodes_prev, level_tree, levels_used, lambda2, level_state );\ + goto next##ctx_hi;\ + case 2:\ + levels_used = trellis_coef1_##ctx_hi( ssd0[0], ssd1[0], cost_siglast, nodes_cur, nodes_prev, level_tree, levels_used, lambda2, level_state );\ + levels_used = trellis_coefn_##ctx_hi( q, ssd0[1], ssd1[1], cost_siglast, nodes_cur, nodes_prev, level_tree, levels_used, lambda2, level_state, levelgt1_ctx );\ + goto next1;\ + default:\ + levels_used = trellis_coefn_##ctx_hi( q-1, ssd0[0], ssd1[0], cost_siglast, nodes_cur, nodes_prev, level_tree, levels_used, lambda2, level_state, levelgt1_ctx );\ + levels_used = trellis_coefn_##ctx_hi( q, ssd0[1], ssd1[1], cost_siglast, nodes_cur, nodes_prev, level_tree, levels_used, lambda2, level_state, levelgt1_ctx );\ + goto next1;\ + }\ + next##ctx_hi:;\ + }\ + /* output levels from the best path through the trellis */\ + bnode = &nodes_cur[ctx_hi];\ + for( int j = ctx_hi+1; j < (ctx_hi?8:4); j++ )\ + if( nodes_cur[j].score < bnode->score )\ + bnode = &nodes_cur[j]; + + // keep 2 versions of the main quantization loop, depending on which subsets of the node_ctxs are live + // node_ctx 0..3, i.e. having not yet encountered any coefs that might be quantized to >1 + TRELLIS_LOOP(0); + + if( bnode == &nodes_cur[0] ) + { + /* We only need to zero an empty 4x4 block. 8x8 can be + implicitly emptied via zero nnz, as can dc. */ + if( num_coefs == 16 && !dc ) + memset( dct, 0, 16 * sizeof(dctcoef) ); + return 0; + } + + if( 0 ) // accessible only by goto, not fallthrough + { + // node_ctx 1..7 (ctx0 ruled out because we never try both level0 and level2+ on the same coef) + TRELLIS_LOOP(1); + } + + int level = bnode->level_idx; + for( i = b_ac; i <= last_nnz; i++ ) + { + dct[zigzag[i]] = SIGN(level_tree[level].abs_level, dct[zigzag[i]]); + level = level_tree[level].next; + } + + return 1; +} + +/* FIXME: This is a gigantic hack. See below. + * + * CAVLC is much more difficult to trellis than CABAC. + * + * CABAC has only three states to track: significance map, last, and the + * level state machine. + * CAVLC, by comparison, has five: coeff_token (trailing + total), + * total_zeroes, zero_run, and the level state machine. + * + * I know of no paper that has managed to design a close-to-optimal trellis + * that covers all five of these and isn't exponential-time. As a result, this + * "trellis" isn't: it's just a QNS search. Patches welcome for something better. + * It's actually surprisingly fast, albeit not quite optimal. It's pretty close + * though; since CAVLC only has 2^16 possible rounding modes (assuming only two + * roundings as options), a bruteforce search is feasible. Testing shows + * that this QNS is reasonably close to optimal in terms of compression. + * + * TODO: + * Don't bother changing large coefficients when it wouldn't affect bit cost + * (e.g. only affecting bypassed suffix bits). + * Don't re-run all parts of CAVLC bit cost calculation when not necessary. + * e.g. when changing a coefficient from one non-zero value to another in + * such a way that trailing ones and suffix length isn't affected. */ +static ALWAYS_INLINE +int quant_trellis_cavlc( x264_t *h, dctcoef *dct, + const udctcoef *quant_mf, const int *unquant_mf, + const uint8_t *zigzag, int ctx_block_cat, int lambda2, int b_ac, + int b_chroma, int dc, int num_coefs, int idx, int b_8x8 ) +{ + ALIGNED_16( dctcoef quant_coefs[2][16] ); + ALIGNED_16( dctcoef coefs[16] ) = {0}; + const uint32_t *coef_weight1 = b_8x8 ? x264_dct8_weight_tab : x264_dct4_weight_tab; + const uint32_t *coef_weight2 = b_8x8 ? x264_dct8_weight2_tab : x264_dct4_weight2_tab; + int delta_distortion[16]; + int64_t score = 1ULL<<62; + int i, j; + const int f = 1<<15; + int nC = b_chroma && dc ? 3 + (num_coefs>>2) + : ct_index[x264_mb_predict_non_zero_code( h, !b_chroma && dc ? (idx - LUMA_DC)*16 : idx )]; + + /* Code for handling 8x8dct -> 4x4dct CAVLC munging. Input/output use a different + * step/start/end than internal processing. */ + int step = 1; + int start = b_ac; + int end = num_coefs - 1; + if( b_8x8 ) + { + start = idx&3; + end = 60 + start; + step = 4; + } + idx &= 15; + + lambda2 <<= LAMBDA_BITS; + + /* Find last non-zero coefficient. */ + for( i = end; i >= start; i -= step ) + if( (unsigned)(dct[zigzag[i]] * (dc?quant_mf[0]>>1:quant_mf[zigzag[i]]) + f-1) >= 2*f ) + break; + + if( i < start ) + goto zeroblock; + + /* Prepare for QNS search: calculate distortion caused by each DCT coefficient + * rounding to be searched. + * + * We only search two roundings (nearest and nearest-1) like in CABAC trellis, + * so we just store the difference in distortion between them. */ + int last_nnz = b_8x8 ? i >> 2 : i; + int coef_mask = 0; + int round_mask = 0; + for( i = b_ac, j = start; i <= last_nnz; i++, j += step ) + { + int coef = dct[zigzag[j]]; + int abs_coef = abs(coef); + int sign = coef < 0 ? -1 : 1; + int nearest_quant = ( f + abs_coef * (dc?quant_mf[0]>>1:quant_mf[zigzag[j]]) ) >> 16; + quant_coefs[1][i] = quant_coefs[0][i] = sign * nearest_quant; + coefs[i] = quant_coefs[1][i]; + if( nearest_quant ) + { + /* We initialize the trellis with a deadzone halfway between nearest rounding + * and always-round-down. This gives much better results than initializing to either + * extreme. + * FIXME: should we initialize to the deadzones used by deadzone quant? */ + int deadzone_quant = ( f/2 + abs_coef * (dc?quant_mf[0]>>1:quant_mf[zigzag[j]]) ) >> 16; + int unquant1 = (((dc?unquant_mf[0]<<1:unquant_mf[zigzag[j]]) * (nearest_quant-0) + 128) >> 8); + int unquant0 = (((dc?unquant_mf[0]<<1:unquant_mf[zigzag[j]]) * (nearest_quant-1) + 128) >> 8); + int d1 = abs_coef - unquant1; + int d0 = abs_coef - unquant0; + delta_distortion[i] = (d0*d0 - d1*d1) * (dc?256:coef_weight2[zigzag[j]]); + + /* Psy trellis: bias in favor of higher AC coefficients in the reconstructed frame. */ + if( h->mb.i_psy_trellis && j && !dc && !b_chroma ) + { + int orig_coef = b_8x8 ? h->mb.pic.fenc_dct8[idx>>2][zigzag[j]] : h->mb.pic.fenc_dct4[idx][zigzag[j]]; + int predicted_coef = orig_coef - coef; + int psy_weight = coef_weight1[zigzag[j]]; + int psy_value0 = h->mb.i_psy_trellis * abs(predicted_coef + unquant0 * sign); + int psy_value1 = h->mb.i_psy_trellis * abs(predicted_coef + unquant1 * sign); + delta_distortion[i] += (psy_value0 - psy_value1) * psy_weight; + } + + quant_coefs[0][i] = sign * (nearest_quant-1); + if( deadzone_quant != nearest_quant ) + coefs[i] = quant_coefs[0][i]; + else + round_mask |= 1 << i; + } + else + delta_distortion[i] = 0; + coef_mask |= (!!coefs[i]) << i; + } + + /* Calculate the cost of the starting state. */ + h->out.bs.i_bits_encoded = 0; + if( !coef_mask ) + bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] ); + else + x264_cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC ); + score = (int64_t)h->out.bs.i_bits_encoded * lambda2; + + /* QNS loop: pick the change that improves RD the most, apply it, repeat. + * coef_mask and round_mask are used to simplify tracking of nonzeroness + * and rounding modes chosen. */ + while( 1 ) + { + int64_t iter_score = score; + int iter_distortion_delta = 0; + int iter_coef = -1; + int iter_mask = coef_mask; + int iter_round = round_mask; + for( i = b_ac; i <= last_nnz; i++ ) + { + if( !delta_distortion[i] ) + continue; + + /* Set up all the variables for this iteration. */ + int cur_round = round_mask ^ (1 << i); + int round_change = (cur_round >> i)&1; + int old_coef = coefs[i]; + int new_coef = quant_coefs[round_change][i]; + int cur_mask = (coef_mask&~(1 << i))|(!!new_coef << i); + int cur_distortion_delta = delta_distortion[i] * (round_change ? -1 : 1); + int64_t cur_score = cur_distortion_delta; + coefs[i] = new_coef; + + /* Count up bits. */ + h->out.bs.i_bits_encoded = 0; + if( !cur_mask ) + bs_write_vlc( &h->out.bs, x264_coeff0_token[nC] ); + else + x264_cavlc_block_residual_internal( h, ctx_block_cat, coefs + b_ac, nC ); + cur_score += (int64_t)h->out.bs.i_bits_encoded * lambda2; + + coefs[i] = old_coef; + if( cur_score < iter_score ) + { + iter_score = cur_score; + iter_coef = i; + iter_mask = cur_mask; + iter_round = cur_round; + iter_distortion_delta = cur_distortion_delta; + } + } + if( iter_coef >= 0 ) + { + score = iter_score - iter_distortion_delta; + coef_mask = iter_mask; + round_mask = iter_round; + coefs[iter_coef] = quant_coefs[((round_mask >> iter_coef)&1)][iter_coef]; + /* Don't try adjusting coefficients we've already adjusted. + * Testing suggests this doesn't hurt results -- and sometimes actually helps. */ + delta_distortion[iter_coef] = 0; + } + else + break; + } + + if( coef_mask ) + { + for( i = b_ac, j = start; i < num_coefs; i++, j += step ) + dct[zigzag[j]] = coefs[i]; + return 1; + } + +zeroblock: + if( !dc ) + { + if( b_8x8 ) + for( i = start; i <= end; i+=step ) + dct[zigzag[i]] = 0; + else + memset( dct, 0, 16*sizeof(dctcoef) ); + } + return 0; +} + +int x264_quant_luma_dc_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, int i_qp, int ctx_block_cat, int b_intra, int idx ) +{ + if( h->param.b_cabac ) + return quant_trellis_cabac( h, dct, + h->quant4_mf[i_quant_cat][i_qp], h->quant4_bias0[i_quant_cat][i_qp], + h->unquant4_mf[i_quant_cat][i_qp], x264_zigzag_scan4[MB_INTERLACED], + ctx_block_cat, h->mb.i_trellis_lambda2[0][b_intra], 0, 0, 1, 16, idx ); + + return quant_trellis_cavlc( h, dct, + h->quant4_mf[i_quant_cat][i_qp], h->unquant4_mf[i_quant_cat][i_qp], x264_zigzag_scan4[MB_INTERLACED], + DCT_LUMA_DC, h->mb.i_trellis_lambda2[0][b_intra], 0, 0, 1, 16, idx, 0 ); +} + +static const uint8_t x264_zigzag_scan2x2[4] = { 0, 1, 2, 3 }; +static const uint8_t x264_zigzag_scan2x4[8] = { 0, 2, 1, 4, 6, 3, 5, 7 }; + +int x264_quant_chroma_dc_trellis( x264_t *h, dctcoef *dct, int i_qp, int b_intra, int idx ) +{ + const uint8_t *zigzag; + int num_coefs; + int quant_cat = CQM_4IC+1 - b_intra; + + if( CHROMA_FORMAT == CHROMA_422 ) + { + zigzag = x264_zigzag_scan2x4; + num_coefs = 8; + } + else + { + zigzag = x264_zigzag_scan2x2; + num_coefs = 4; + } + + if( h->param.b_cabac ) + return quant_trellis_cabac( h, dct, + h->quant4_mf[quant_cat][i_qp], h->quant4_bias0[quant_cat][i_qp], + h->unquant4_mf[quant_cat][i_qp], zigzag, + DCT_CHROMA_DC, h->mb.i_trellis_lambda2[1][b_intra], 0, 1, 1, num_coefs, idx ); + + return quant_trellis_cavlc( h, dct, + h->quant4_mf[quant_cat][i_qp], h->unquant4_mf[quant_cat][i_qp], zigzag, + DCT_CHROMA_DC, h->mb.i_trellis_lambda2[1][b_intra], 0, 1, 1, num_coefs, idx, 0 ); +} + +int x264_quant_4x4_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, + int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx ) +{ + static const uint8_t ctx_ac[14] = {0,1,0,0,1,0,0,1,0,0,0,1,0,0}; + int b_ac = ctx_ac[ctx_block_cat]; + if( h->param.b_cabac ) + return quant_trellis_cabac( h, dct, + h->quant4_mf[i_quant_cat][i_qp], h->quant4_bias0[i_quant_cat][i_qp], + h->unquant4_mf[i_quant_cat][i_qp], x264_zigzag_scan4[MB_INTERLACED], + ctx_block_cat, h->mb.i_trellis_lambda2[b_chroma][b_intra], b_ac, b_chroma, 0, 16, idx ); + + return quant_trellis_cavlc( h, dct, + h->quant4_mf[i_quant_cat][i_qp], h->unquant4_mf[i_quant_cat][i_qp], + x264_zigzag_scan4[MB_INTERLACED], + ctx_block_cat, h->mb.i_trellis_lambda2[b_chroma][b_intra], b_ac, b_chroma, 0, 16, idx, 0 ); +} + +int x264_quant_8x8_trellis( x264_t *h, dctcoef *dct, int i_quant_cat, + int i_qp, int ctx_block_cat, int b_intra, int b_chroma, int idx ) +{ + if( h->param.b_cabac ) + { + return quant_trellis_cabac( h, dct, + h->quant8_mf[i_quant_cat][i_qp], h->quant8_bias0[i_quant_cat][i_qp], + h->unquant8_mf[i_quant_cat][i_qp], x264_zigzag_scan8[MB_INTERLACED], + ctx_block_cat, h->mb.i_trellis_lambda2[b_chroma][b_intra], 0, b_chroma, 0, 64, idx ); + } + + /* 8x8 CAVLC is split into 4 4x4 blocks */ + int nzaccum = 0; + for( int i = 0; i < 4; i++ ) + { + int nz = quant_trellis_cavlc( h, dct, + h->quant8_mf[i_quant_cat][i_qp], h->unquant8_mf[i_quant_cat][i_qp], + x264_zigzag_scan8[MB_INTERLACED], + DCT_LUMA_4x4, h->mb.i_trellis_lambda2[b_chroma][b_intra], 0, b_chroma, 0, 16, idx*4+i, 1 ); + /* Set up nonzero count for future calls */ + h->mb.cache.non_zero_count[x264_scan8[idx*4+i]] = nz; + nzaccum |= nz; + } + STORE_8x8_NNZ( 0, idx, 0 ); + return nzaccum; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.c new file mode 100644 index 00000000..2ab4e4e8 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.c @@ -0,0 +1,853 @@ +/***************************************************************************** + * set: header writing + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "set.h" + +#define bs_write_ue bs_write_ue_big + +// Indexed by pic_struct values +static const uint8_t num_clock_ts[10] = { 0, 1, 1, 1, 2, 2, 3, 3, 2, 3 }; +const static uint8_t avcintra_uuid[] = {0xF7, 0x49, 0x3E, 0xB3, 0xD4, 0x00, 0x47, 0x96, 0x86, 0x86, 0xC9, 0x70, 0x7B, 0x64, 0x37, 0x2A}; + +static void transpose( uint8_t *buf, int w ) +{ + for( int i = 0; i < w; i++ ) + for( int j = 0; j < i; j++ ) + XCHG( uint8_t, buf[w*i+j], buf[w*j+i] ); +} + +static void scaling_list_write( bs_t *s, x264_pps_t *pps, int idx ) +{ + const int len = idx<4 ? 16 : 64; + const uint8_t *zigzag = idx<4 ? x264_zigzag_scan4[0] : x264_zigzag_scan8[0]; + const uint8_t *list = pps->scaling_list[idx]; + const uint8_t *def_list = (idx==CQM_4IC) ? pps->scaling_list[CQM_4IY] + : (idx==CQM_4PC) ? pps->scaling_list[CQM_4PY] + : (idx==CQM_8IC+4) ? pps->scaling_list[CQM_8IY+4] + : (idx==CQM_8PC+4) ? pps->scaling_list[CQM_8PY+4] + : x264_cqm_jvt[idx]; + if( !memcmp( list, def_list, len ) ) + bs_write1( s, 0 ); // scaling_list_present_flag + else if( !memcmp( list, x264_cqm_jvt[idx], len ) ) + { + bs_write1( s, 1 ); // scaling_list_present_flag + bs_write_se( s, -8 ); // use jvt list + } + else + { + int run; + bs_write1( s, 1 ); // scaling_list_present_flag + + // try run-length compression of trailing values + for( run = len; run > 1; run-- ) + if( list[zigzag[run-1]] != list[zigzag[run-2]] ) + break; + if( run < len && len - run < bs_size_se( (int8_t)-list[zigzag[run]] ) ) + run = len; + + for( int j = 0; j < run; j++ ) + bs_write_se( s, (int8_t)(list[zigzag[j]] - (j>0 ? list[zigzag[j-1]] : 8)) ); // delta + + if( run < len ) + bs_write_se( s, (int8_t)-list[zigzag[run]] ); + } +} + +void x264_sei_write( bs_t *s, uint8_t *payload, int payload_size, int payload_type ) +{ + int i; + + bs_realign( s ); + + for( i = 0; i <= payload_type-255; i += 255 ) + bs_write( s, 8, 255 ); + bs_write( s, 8, payload_type-i ); + + for( i = 0; i <= payload_size-255; i += 255 ) + bs_write( s, 8, 255 ); + bs_write( s, 8, payload_size-i ); + + for( i = 0; i < payload_size; i++ ) + bs_write( s, 8, payload[i] ); + + bs_rbsp_trailing( s ); + bs_flush( s ); +} + +void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param ) +{ + int csp = param->i_csp & X264_CSP_MASK; + + sps->i_id = i_id; + sps->i_mb_width = ( param->i_width + 15 ) / 16; + sps->i_mb_height= ( param->i_height + 15 ) / 16; + sps->i_chroma_format_idc = csp >= X264_CSP_I444 ? CHROMA_444 : + csp >= X264_CSP_I422 ? CHROMA_422 : CHROMA_420; + + sps->b_qpprime_y_zero_transform_bypass = param->rc.i_rc_method == X264_RC_CQP && param->rc.i_qp_constant == 0; + if( sps->b_qpprime_y_zero_transform_bypass || sps->i_chroma_format_idc == CHROMA_444 ) + sps->i_profile_idc = PROFILE_HIGH444_PREDICTIVE; + else if( sps->i_chroma_format_idc == CHROMA_422 ) + sps->i_profile_idc = PROFILE_HIGH422; + else if( BIT_DEPTH > 8 ) + sps->i_profile_idc = PROFILE_HIGH10; + else if( param->analyse.b_transform_8x8 || param->i_cqm_preset != X264_CQM_FLAT ) + sps->i_profile_idc = PROFILE_HIGH; + else if( param->b_cabac || param->i_bframe > 0 || param->b_interlaced || param->b_fake_interlaced || param->analyse.i_weighted_pred > 0 ) + sps->i_profile_idc = PROFILE_MAIN; + else + sps->i_profile_idc = PROFILE_BASELINE; + + sps->b_constraint_set0 = sps->i_profile_idc == PROFILE_BASELINE; + /* x264 doesn't support the features that are in Baseline and not in Main, + * namely arbitrary_slice_order and slice_groups. */ + sps->b_constraint_set1 = sps->i_profile_idc <= PROFILE_MAIN; + /* Never set constraint_set2, it is not necessary and not used in real world. */ + sps->b_constraint_set2 = 0; + sps->b_constraint_set3 = 0; + + sps->i_level_idc = param->i_level_idc; + if( param->i_level_idc == 9 && ( sps->i_profile_idc == PROFILE_BASELINE || sps->i_profile_idc == PROFILE_MAIN ) ) + { + sps->b_constraint_set3 = 1; /* level 1b with Baseline or Main profile is signalled via constraint_set3 */ + sps->i_level_idc = 11; + } + /* Intra profiles */ + if( param->i_keyint_max == 1 && sps->i_profile_idc >= PROFILE_HIGH ) + sps->b_constraint_set3 = 1; + + sps->vui.i_num_reorder_frames = param->i_bframe_pyramid ? 2 : param->i_bframe ? 1 : 0; + /* extra slot with pyramid so that we don't have to override the + * order of forgetting old pictures */ + sps->vui.i_max_dec_frame_buffering = + sps->i_num_ref_frames = X264_MIN(X264_REF_MAX, X264_MAX4(param->i_frame_reference, 1 + sps->vui.i_num_reorder_frames, + param->i_bframe_pyramid ? 4 : 1, param->i_dpb_size)); + sps->i_num_ref_frames -= param->i_bframe_pyramid == X264_B_PYRAMID_STRICT; + if( param->i_keyint_max == 1 ) + { + sps->i_num_ref_frames = 0; + sps->vui.i_max_dec_frame_buffering = 0; + } + + /* number of refs + current frame */ + int max_frame_num = sps->vui.i_max_dec_frame_buffering * (!!param->i_bframe_pyramid+1) + 1; + /* Intra refresh cannot write a recovery time greater than max frame num-1 */ + if( param->b_intra_refresh ) + { + int time_to_recovery = X264_MIN( sps->i_mb_width - 1, param->i_keyint_max ) + param->i_bframe - 1; + max_frame_num = X264_MAX( max_frame_num, time_to_recovery+1 ); + } + + sps->i_log2_max_frame_num = 4; + while( (1 << sps->i_log2_max_frame_num) <= max_frame_num ) + sps->i_log2_max_frame_num++; + + sps->i_poc_type = param->i_bframe || param->b_interlaced || param->i_avcintra_class ? 0 : 2; + if( sps->i_poc_type == 0 ) + { + int max_delta_poc = (param->i_bframe + 2) * (!!param->i_bframe_pyramid + 1) * 2; + sps->i_log2_max_poc_lsb = 4; + while( (1 << sps->i_log2_max_poc_lsb) <= max_delta_poc * 2 ) + sps->i_log2_max_poc_lsb++; + } + + sps->b_vui = 1; + + sps->b_gaps_in_frame_num_value_allowed = 0; + sps->b_frame_mbs_only = !(param->b_interlaced || param->b_fake_interlaced); + if( !sps->b_frame_mbs_only ) + sps->i_mb_height = ( sps->i_mb_height + 1 ) & ~1; + sps->b_mb_adaptive_frame_field = param->b_interlaced; + sps->b_direct8x8_inference = 1; + + x264_sps_init_reconfigurable( sps, param ); + + sps->vui.b_overscan_info_present = param->vui.i_overscan > 0 && param->vui.i_overscan <= 2; + if( sps->vui.b_overscan_info_present ) + sps->vui.b_overscan_info = ( param->vui.i_overscan == 2 ? 1 : 0 ); + + sps->vui.b_signal_type_present = 0; + sps->vui.i_vidformat = ( param->vui.i_vidformat >= 0 && param->vui.i_vidformat <= 5 ? param->vui.i_vidformat : 5 ); + sps->vui.b_fullrange = ( param->vui.b_fullrange >= 0 && param->vui.b_fullrange <= 1 ? param->vui.b_fullrange : + ( csp >= X264_CSP_BGR ? 1 : 0 ) ); + sps->vui.b_color_description_present = 0; + + sps->vui.i_colorprim = ( param->vui.i_colorprim >= 0 && param->vui.i_colorprim <= 12 ? param->vui.i_colorprim : 2 ); + sps->vui.i_transfer = ( param->vui.i_transfer >= 0 && param->vui.i_transfer <= 17 ? param->vui.i_transfer : 2 ); + sps->vui.i_colmatrix = ( param->vui.i_colmatrix >= 0 && param->vui.i_colmatrix <= 11 ? param->vui.i_colmatrix : + ( csp >= X264_CSP_BGR ? 0 : 2 ) ); + if( sps->vui.i_colorprim != 2 || + sps->vui.i_transfer != 2 || + sps->vui.i_colmatrix != 2 ) + { + sps->vui.b_color_description_present = 1; + } + + if( sps->vui.i_vidformat != 5 || + sps->vui.b_fullrange || + sps->vui.b_color_description_present ) + { + sps->vui.b_signal_type_present = 1; + } + + /* FIXME: not sufficient for interlaced video */ + sps->vui.b_chroma_loc_info_present = param->vui.i_chroma_loc > 0 && param->vui.i_chroma_loc <= 5 && + sps->i_chroma_format_idc == CHROMA_420; + if( sps->vui.b_chroma_loc_info_present ) + { + sps->vui.i_chroma_loc_top = param->vui.i_chroma_loc; + sps->vui.i_chroma_loc_bottom = param->vui.i_chroma_loc; + } + + sps->vui.b_timing_info_present = param->i_timebase_num > 0 && param->i_timebase_den > 0; + + if( sps->vui.b_timing_info_present ) + { + sps->vui.i_num_units_in_tick = param->i_timebase_num; + sps->vui.i_time_scale = param->i_timebase_den * 2; + sps->vui.b_fixed_frame_rate = !param->b_vfr_input; + } + + sps->vui.b_vcl_hrd_parameters_present = 0; // we don't support VCL HRD + sps->vui.b_nal_hrd_parameters_present = !!param->i_nal_hrd; + sps->vui.b_pic_struct_present = param->b_pic_struct; + + // NOTE: HRD related parts of the SPS are initialised in x264_ratecontrol_init_reconfigurable + + sps->vui.b_bitstream_restriction = !(sps->b_constraint_set3 && sps->i_profile_idc >= PROFILE_HIGH); + if( sps->vui.b_bitstream_restriction ) + { + sps->vui.b_motion_vectors_over_pic_boundaries = 1; + sps->vui.i_max_bytes_per_pic_denom = 0; + sps->vui.i_max_bits_per_mb_denom = 0; + sps->vui.i_log2_max_mv_length_horizontal = + sps->vui.i_log2_max_mv_length_vertical = (int)log2f( X264_MAX( 1, param->analyse.i_mv_range*4-1 ) ) + 1; + } +} + +void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param ) +{ + sps->crop.i_left = param->crop_rect.i_left; + sps->crop.i_top = param->crop_rect.i_top; + sps->crop.i_right = param->crop_rect.i_right + sps->i_mb_width*16 - param->i_width; + sps->crop.i_bottom = (param->crop_rect.i_bottom + sps->i_mb_height*16 - param->i_height) >> !sps->b_frame_mbs_only; + sps->b_crop = sps->crop.i_left || sps->crop.i_top || + sps->crop.i_right || sps->crop.i_bottom; + + sps->vui.b_aspect_ratio_info_present = 0; + if( param->vui.i_sar_width > 0 && param->vui.i_sar_height > 0 ) + { + sps->vui.b_aspect_ratio_info_present = 1; + sps->vui.i_sar_width = param->vui.i_sar_width; + sps->vui.i_sar_height= param->vui.i_sar_height; + } +} + +void x264_sps_write( bs_t *s, x264_sps_t *sps ) +{ + bs_realign( s ); + bs_write( s, 8, sps->i_profile_idc ); + bs_write1( s, sps->b_constraint_set0 ); + bs_write1( s, sps->b_constraint_set1 ); + bs_write1( s, sps->b_constraint_set2 ); + bs_write1( s, sps->b_constraint_set3 ); + + bs_write( s, 4, 0 ); /* reserved */ + + bs_write( s, 8, sps->i_level_idc ); + + bs_write_ue( s, sps->i_id ); + + if( sps->i_profile_idc >= PROFILE_HIGH ) + { + bs_write_ue( s, sps->i_chroma_format_idc ); + if( sps->i_chroma_format_idc == CHROMA_444 ) + bs_write1( s, 0 ); // separate_colour_plane_flag + bs_write_ue( s, BIT_DEPTH-8 ); // bit_depth_luma_minus8 + bs_write_ue( s, BIT_DEPTH-8 ); // bit_depth_chroma_minus8 + bs_write1( s, sps->b_qpprime_y_zero_transform_bypass ); + bs_write1( s, 0 ); // seq_scaling_matrix_present_flag + } + + bs_write_ue( s, sps->i_log2_max_frame_num - 4 ); + bs_write_ue( s, sps->i_poc_type ); + if( sps->i_poc_type == 0 ) + bs_write_ue( s, sps->i_log2_max_poc_lsb - 4 ); + bs_write_ue( s, sps->i_num_ref_frames ); + bs_write1( s, sps->b_gaps_in_frame_num_value_allowed ); + bs_write_ue( s, sps->i_mb_width - 1 ); + bs_write_ue( s, (sps->i_mb_height >> !sps->b_frame_mbs_only) - 1); + bs_write1( s, sps->b_frame_mbs_only ); + if( !sps->b_frame_mbs_only ) + bs_write1( s, sps->b_mb_adaptive_frame_field ); + bs_write1( s, sps->b_direct8x8_inference ); + + bs_write1( s, sps->b_crop ); + if( sps->b_crop ) + { + int h_shift = sps->i_chroma_format_idc == CHROMA_420 || sps->i_chroma_format_idc == CHROMA_422; + int v_shift = sps->i_chroma_format_idc == CHROMA_420; + bs_write_ue( s, sps->crop.i_left >> h_shift ); + bs_write_ue( s, sps->crop.i_right >> h_shift ); + bs_write_ue( s, sps->crop.i_top >> v_shift ); + bs_write_ue( s, sps->crop.i_bottom >> v_shift ); + } + + bs_write1( s, sps->b_vui ); + if( sps->b_vui ) + { + bs_write1( s, sps->vui.b_aspect_ratio_info_present ); + if( sps->vui.b_aspect_ratio_info_present ) + { + int i; + static const struct { uint8_t w, h, sar; } sar[] = + { + // aspect_ratio_idc = 0 -> unspecified + { 1, 1, 1 }, { 12, 11, 2 }, { 10, 11, 3 }, { 16, 11, 4 }, + { 40, 33, 5 }, { 24, 11, 6 }, { 20, 11, 7 }, { 32, 11, 8 }, + { 80, 33, 9 }, { 18, 11, 10}, { 15, 11, 11}, { 64, 33, 12}, + {160, 99, 13}, { 4, 3, 14}, { 3, 2, 15}, { 2, 1, 16}, + // aspect_ratio_idc = [17..254] -> reserved + { 0, 0, 255 } + }; + for( i = 0; sar[i].sar != 255; i++ ) + { + if( sar[i].w == sps->vui.i_sar_width && + sar[i].h == sps->vui.i_sar_height ) + break; + } + bs_write( s, 8, sar[i].sar ); + if( sar[i].sar == 255 ) /* aspect_ratio_idc (extended) */ + { + bs_write( s, 16, sps->vui.i_sar_width ); + bs_write( s, 16, sps->vui.i_sar_height ); + } + } + + bs_write1( s, sps->vui.b_overscan_info_present ); + if( sps->vui.b_overscan_info_present ) + bs_write1( s, sps->vui.b_overscan_info ); + + bs_write1( s, sps->vui.b_signal_type_present ); + if( sps->vui.b_signal_type_present ) + { + bs_write( s, 3, sps->vui.i_vidformat ); + bs_write1( s, sps->vui.b_fullrange ); + bs_write1( s, sps->vui.b_color_description_present ); + if( sps->vui.b_color_description_present ) + { + bs_write( s, 8, sps->vui.i_colorprim ); + bs_write( s, 8, sps->vui.i_transfer ); + bs_write( s, 8, sps->vui.i_colmatrix ); + } + } + + bs_write1( s, sps->vui.b_chroma_loc_info_present ); + if( sps->vui.b_chroma_loc_info_present ) + { + bs_write_ue( s, sps->vui.i_chroma_loc_top ); + bs_write_ue( s, sps->vui.i_chroma_loc_bottom ); + } + + bs_write1( s, sps->vui.b_timing_info_present ); + if( sps->vui.b_timing_info_present ) + { + bs_write32( s, sps->vui.i_num_units_in_tick ); + bs_write32( s, sps->vui.i_time_scale ); + bs_write1( s, sps->vui.b_fixed_frame_rate ); + } + + bs_write1( s, sps->vui.b_nal_hrd_parameters_present ); + if( sps->vui.b_nal_hrd_parameters_present ) + { + bs_write_ue( s, sps->vui.hrd.i_cpb_cnt - 1 ); + bs_write( s, 4, sps->vui.hrd.i_bit_rate_scale ); + bs_write( s, 4, sps->vui.hrd.i_cpb_size_scale ); + + bs_write_ue( s, sps->vui.hrd.i_bit_rate_value - 1 ); + bs_write_ue( s, sps->vui.hrd.i_cpb_size_value - 1 ); + + bs_write1( s, sps->vui.hrd.b_cbr_hrd ); + + bs_write( s, 5, sps->vui.hrd.i_initial_cpb_removal_delay_length - 1 ); + bs_write( s, 5, sps->vui.hrd.i_cpb_removal_delay_length - 1 ); + bs_write( s, 5, sps->vui.hrd.i_dpb_output_delay_length - 1 ); + bs_write( s, 5, sps->vui.hrd.i_time_offset_length ); + } + + bs_write1( s, sps->vui.b_vcl_hrd_parameters_present ); + + if( sps->vui.b_nal_hrd_parameters_present || sps->vui.b_vcl_hrd_parameters_present ) + bs_write1( s, 0 ); /* low_delay_hrd_flag */ + + bs_write1( s, sps->vui.b_pic_struct_present ); + bs_write1( s, sps->vui.b_bitstream_restriction ); + if( sps->vui.b_bitstream_restriction ) + { + bs_write1( s, sps->vui.b_motion_vectors_over_pic_boundaries ); + bs_write_ue( s, sps->vui.i_max_bytes_per_pic_denom ); + bs_write_ue( s, sps->vui.i_max_bits_per_mb_denom ); + bs_write_ue( s, sps->vui.i_log2_max_mv_length_horizontal ); + bs_write_ue( s, sps->vui.i_log2_max_mv_length_vertical ); + bs_write_ue( s, sps->vui.i_num_reorder_frames ); + bs_write_ue( s, sps->vui.i_max_dec_frame_buffering ); + } + } + + bs_rbsp_trailing( s ); + bs_flush( s ); +} + +void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *sps ) +{ + pps->i_id = i_id; + pps->i_sps_id = sps->i_id; + pps->b_cabac = param->b_cabac; + + pps->b_pic_order = !param->i_avcintra_class && param->b_interlaced; + pps->i_num_slice_groups = 1; + + pps->i_num_ref_idx_l0_default_active = param->i_frame_reference; + pps->i_num_ref_idx_l1_default_active = 1; + + pps->b_weighted_pred = param->analyse.i_weighted_pred > 0; + pps->b_weighted_bipred = param->analyse.b_weighted_bipred ? 2 : 0; + + pps->i_pic_init_qp = param->rc.i_rc_method == X264_RC_ABR || param->b_stitchable ? 26 + QP_BD_OFFSET : SPEC_QP( param->rc.i_qp_constant ); + pps->i_pic_init_qs = 26 + QP_BD_OFFSET; + + pps->i_chroma_qp_index_offset = param->analyse.i_chroma_qp_offset; + pps->b_deblocking_filter_control = 1; + pps->b_constrained_intra_pred = param->b_constrained_intra; + pps->b_redundant_pic_cnt = 0; + + pps->b_transform_8x8_mode = param->analyse.b_transform_8x8 ? 1 : 0; + + pps->i_cqm_preset = param->i_cqm_preset; + + switch( pps->i_cqm_preset ) + { + case X264_CQM_FLAT: + for( int i = 0; i < 8; i++ ) + pps->scaling_list[i] = x264_cqm_flat16; + break; + case X264_CQM_JVT: + for( int i = 0; i < 8; i++ ) + pps->scaling_list[i] = x264_cqm_jvt[i]; + break; + case X264_CQM_CUSTOM: + /* match the transposed DCT & zigzag */ + transpose( param->cqm_4iy, 4 ); + transpose( param->cqm_4py, 4 ); + transpose( param->cqm_4ic, 4 ); + transpose( param->cqm_4pc, 4 ); + transpose( param->cqm_8iy, 8 ); + transpose( param->cqm_8py, 8 ); + transpose( param->cqm_8ic, 8 ); + transpose( param->cqm_8pc, 8 ); + pps->scaling_list[CQM_4IY] = param->cqm_4iy; + pps->scaling_list[CQM_4PY] = param->cqm_4py; + pps->scaling_list[CQM_4IC] = param->cqm_4ic; + pps->scaling_list[CQM_4PC] = param->cqm_4pc; + pps->scaling_list[CQM_8IY+4] = param->cqm_8iy; + pps->scaling_list[CQM_8PY+4] = param->cqm_8py; + pps->scaling_list[CQM_8IC+4] = param->cqm_8ic; + pps->scaling_list[CQM_8PC+4] = param->cqm_8pc; + for( int i = 0; i < 8; i++ ) + for( int j = 0; j < (i < 4 ? 16 : 64); j++ ) + if( pps->scaling_list[i][j] == 0 ) + pps->scaling_list[i] = x264_cqm_jvt[i]; + break; + } +} + +void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps ) +{ + bs_realign( s ); + bs_write_ue( s, pps->i_id ); + bs_write_ue( s, pps->i_sps_id ); + + bs_write1( s, pps->b_cabac ); + bs_write1( s, pps->b_pic_order ); + bs_write_ue( s, pps->i_num_slice_groups - 1 ); + + bs_write_ue( s, pps->i_num_ref_idx_l0_default_active - 1 ); + bs_write_ue( s, pps->i_num_ref_idx_l1_default_active - 1 ); + bs_write1( s, pps->b_weighted_pred ); + bs_write( s, 2, pps->b_weighted_bipred ); + + bs_write_se( s, pps->i_pic_init_qp - 26 - QP_BD_OFFSET ); + bs_write_se( s, pps->i_pic_init_qs - 26 - QP_BD_OFFSET ); + bs_write_se( s, pps->i_chroma_qp_index_offset ); + + bs_write1( s, pps->b_deblocking_filter_control ); + bs_write1( s, pps->b_constrained_intra_pred ); + bs_write1( s, pps->b_redundant_pic_cnt ); + + if( pps->b_transform_8x8_mode || pps->i_cqm_preset != X264_CQM_FLAT ) + { + bs_write1( s, pps->b_transform_8x8_mode ); + bs_write1( s, (pps->i_cqm_preset != X264_CQM_FLAT) ); + if( pps->i_cqm_preset != X264_CQM_FLAT ) + { + scaling_list_write( s, pps, CQM_4IY ); + scaling_list_write( s, pps, CQM_4IC ); + bs_write1( s, 0 ); // Cr = Cb + scaling_list_write( s, pps, CQM_4PY ); + scaling_list_write( s, pps, CQM_4PC ); + bs_write1( s, 0 ); // Cr = Cb + if( pps->b_transform_8x8_mode ) + { + scaling_list_write( s, pps, CQM_8IY+4 ); + scaling_list_write( s, pps, CQM_8PY+4 ); + if( sps->i_chroma_format_idc == CHROMA_444 ) + { + scaling_list_write( s, pps, CQM_8IC+4 ); + scaling_list_write( s, pps, CQM_8PC+4 ); + bs_write1( s, 0 ); // Cr = Cb + bs_write1( s, 0 ); // Cr = Cb + } + } + } + bs_write_se( s, pps->i_chroma_qp_index_offset ); + } + + bs_rbsp_trailing( s ); + bs_flush( s ); +} + +void x264_sei_recovery_point_write( x264_t *h, bs_t *s, int recovery_frame_cnt ) +{ + bs_t q; + ALIGNED_4( uint8_t tmp_buf[100] ); + M32( tmp_buf ) = 0; // shut up gcc + bs_init( &q, tmp_buf, 100 ); + + bs_realign( &q ); + + bs_write_ue( &q, recovery_frame_cnt ); // recovery_frame_cnt + bs_write1( &q, 1 ); //exact_match_flag 1 + bs_write1( &q, 0 ); //broken_link_flag 0 + bs_write( &q, 2, 0 ); //changing_slice_group 0 + + bs_align_10( &q ); + bs_flush( &q ); + + x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_RECOVERY_POINT ); +} + +int x264_sei_version_write( x264_t *h, bs_t *s ) +{ + // random ID number generated according to ISO-11578 + static const uint8_t uuid[16] = + { + 0xdc, 0x45, 0xe9, 0xbd, 0xe6, 0xd9, 0x48, 0xb7, + 0x96, 0x2c, 0xd8, 0x20, 0xd9, 0x23, 0xee, 0xef + }; + char *opts = x264_param2string( &h->param, 0 ); + char *payload; + int length; + + if( !opts ) + return -1; + CHECKED_MALLOC( payload, 200 + strlen( opts ) ); + + memcpy( payload, uuid, 16 ); + sprintf( payload+16, "x264 - core %d%s - H.264/MPEG-4 AVC codec - " + "Copy%s 2003-2017 - http://www.videolan.org/x264.html - options: %s", + X264_BUILD, X264_VERSION, HAVE_GPL?"left":"right", opts ); + length = strlen(payload)+1; + + x264_sei_write( s, (uint8_t *)payload, length, SEI_USER_DATA_UNREGISTERED ); + + x264_free( opts ); + x264_free( payload ); + return 0; +fail: + x264_free( opts ); + return -1; +} + +void x264_sei_buffering_period_write( x264_t *h, bs_t *s ) +{ + x264_sps_t *sps = h->sps; + bs_t q; + ALIGNED_4( uint8_t tmp_buf[100] ); + M32( tmp_buf ) = 0; // shut up gcc + bs_init( &q, tmp_buf, 100 ); + + bs_realign( &q ); + bs_write_ue( &q, sps->i_id ); + + if( sps->vui.b_nal_hrd_parameters_present ) + { + bs_write( &q, sps->vui.hrd.i_initial_cpb_removal_delay_length, h->initial_cpb_removal_delay ); + bs_write( &q, sps->vui.hrd.i_initial_cpb_removal_delay_length, h->initial_cpb_removal_delay_offset ); + } + + bs_align_10( &q ); + bs_flush( &q ); + + x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_BUFFERING_PERIOD ); +} + +void x264_sei_pic_timing_write( x264_t *h, bs_t *s ) +{ + x264_sps_t *sps = h->sps; + bs_t q; + ALIGNED_4( uint8_t tmp_buf[100] ); + M32( tmp_buf ) = 0; // shut up gcc + bs_init( &q, tmp_buf, 100 ); + + bs_realign( &q ); + + if( sps->vui.b_nal_hrd_parameters_present || sps->vui.b_vcl_hrd_parameters_present ) + { + bs_write( &q, sps->vui.hrd.i_cpb_removal_delay_length, h->fenc->i_cpb_delay - h->i_cpb_delay_pir_offset ); + bs_write( &q, sps->vui.hrd.i_dpb_output_delay_length, h->fenc->i_dpb_output_delay ); + } + + if( sps->vui.b_pic_struct_present ) + { + bs_write( &q, 4, h->fenc->i_pic_struct-1 ); // We use index 0 for "Auto" + + // These clock timestamps are not standardised so we don't set them + // They could be time of origin, capture or alternative ideal display + for( int i = 0; i < num_clock_ts[h->fenc->i_pic_struct]; i++ ) + bs_write1( &q, 0 ); // clock_timestamp_flag + } + + bs_align_10( &q ); + bs_flush( &q ); + + x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_PIC_TIMING ); +} + +void x264_sei_frame_packing_write( x264_t *h, bs_t *s ) +{ + int quincunx_sampling_flag = h->param.i_frame_packing == 0; + bs_t q; + ALIGNED_4( uint8_t tmp_buf[100] ); + M32( tmp_buf ) = 0; // shut up gcc + bs_init( &q, tmp_buf, 100 ); + + bs_realign( &q ); + + bs_write_ue( &q, 0 ); // frame_packing_arrangement_id + bs_write1( &q, 0 ); // frame_packing_arrangement_cancel_flag + bs_write ( &q, 7, h->param.i_frame_packing ); // frame_packing_arrangement_type + bs_write1( &q, quincunx_sampling_flag ); // quincunx_sampling_flag + + // 0: views are unrelated, 1: left view is on the left, 2: left view is on the right + bs_write ( &q, 6, h->param.i_frame_packing != 6 ); // content_interpretation_type + + bs_write1( &q, 0 ); // spatial_flipping_flag + bs_write1( &q, 0 ); // frame0_flipped_flag + bs_write1( &q, 0 ); // field_views_flag + bs_write1( &q, h->param.i_frame_packing == 5 && !(h->fenc->i_frame&1) ); // current_frame_is_frame0_flag + bs_write1( &q, 0 ); // frame0_self_contained_flag + bs_write1( &q, 0 ); // frame1_self_contained_flag + if( quincunx_sampling_flag == 0 && h->param.i_frame_packing != 5 ) + { + bs_write( &q, 4, 0 ); // frame0_grid_position_x + bs_write( &q, 4, 0 ); // frame0_grid_position_y + bs_write( &q, 4, 0 ); // frame1_grid_position_x + bs_write( &q, 4, 0 ); // frame1_grid_position_y + } + bs_write( &q, 8, 0 ); // frame_packing_arrangement_reserved_byte + // "frame_packing_arrangement_repetition_period equal to 1 specifies that the frame packing arrangement SEI message persists in output" + // for (i_frame_packing == 5) this will undermine current_frame_is_frame0_flag which must alternate every view sequence + bs_write_ue( &q, h->param.i_frame_packing != 5 ); // frame_packing_arrangement_repetition_period + bs_write1( &q, 0 ); // frame_packing_arrangement_extension_flag + + bs_align_10( &q ); + bs_flush( &q ); + + x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_FRAME_PACKING ); +} + +void x264_filler_write( x264_t *h, bs_t *s, int filler ) +{ + bs_realign( s ); + + for( int i = 0; i < filler; i++ ) + bs_write( s, 8, 0xff ); + + bs_rbsp_trailing( s ); + bs_flush( s ); +} + +void x264_sei_dec_ref_pic_marking_write( x264_t *h, bs_t *s ) +{ + x264_slice_header_t *sh = &h->sh_backup; + bs_t q; + ALIGNED_4( uint8_t tmp_buf[100] ); + M32( tmp_buf ) = 0; // shut up gcc + bs_init( &q, tmp_buf, 100 ); + + bs_realign( &q ); + + /* We currently only use this for repeating B-refs, as required by Blu-ray. */ + bs_write1( &q, 0 ); //original_idr_flag + bs_write_ue( &q, sh->i_frame_num ); //original_frame_num + if( !h->sps->b_frame_mbs_only ) + bs_write1( &q, 0 ); //original_field_pic_flag + + bs_write1( &q, sh->i_mmco_command_count > 0 ); + if( sh->i_mmco_command_count > 0 ) + { + for( int i = 0; i < sh->i_mmco_command_count; i++ ) + { + bs_write_ue( &q, 1 ); + bs_write_ue( &q, sh->mmco[i].i_difference_of_pic_nums - 1 ); + } + bs_write_ue( &q, 0 ); + } + + bs_align_10( &q ); + bs_flush( &q ); + + x264_sei_write( s, tmp_buf, bs_pos( &q ) / 8, SEI_DEC_REF_PIC_MARKING ); +} + +int x264_sei_avcintra_umid_write( x264_t *h, bs_t *s ) +{ + uint8_t data[512]; + const char *msg = "UMID"; + const int len = 497; + + memset( data, 0xff, len ); + memcpy( data, avcintra_uuid, sizeof(avcintra_uuid) ); + memcpy( data+16, msg, strlen(msg) ); + + data[20] = 0x13; + /* These bytes appear to be some sort of frame/seconds counter in certain applications, + * but others jump around, so leave them as zero for now */ + data[22] = data[23] = data[25] = data[26] = 0; + data[28] = 0x14; + data[30] = data[31] = data[33] = data[34] = 0; + data[36] = 0x60; + data[41] = 0x22; /* Believed to be some sort of end of basic UMID identifier */ + data[60] = 0x62; + data[62] = data[63] = data[65] = data[66] = 0; + data[68] = 0x63; + data[70] = data[71] = data[73] = data[74] = 0; + + x264_sei_write( &h->out.bs, data, len, SEI_USER_DATA_UNREGISTERED ); + + return 0; +} + +int x264_sei_avcintra_vanc_write( x264_t *h, bs_t *s, int len ) +{ + uint8_t data[6000]; + const char *msg = "VANC"; + if( len > sizeof(data) ) + { + x264_log( h, X264_LOG_ERROR, "AVC-Intra SEI is too large (%d)\n", len ); + return -1; + } + + memset( data, 0xff, len ); + memcpy( data, avcintra_uuid, sizeof(avcintra_uuid) ); + memcpy( data+16, msg, strlen(msg) ); + + x264_sei_write( &h->out.bs, data, len, SEI_USER_DATA_UNREGISTERED ); + + return 0; +} + +const x264_level_t x264_levels[] = +{ + { 10, 1485, 99, 396, 64, 175, 64, 64, 0, 2, 0, 0, 1 }, + { 9, 1485, 99, 396, 128, 350, 64, 64, 0, 2, 0, 0, 1 }, /* "1b" */ + { 11, 3000, 396, 900, 192, 500, 128, 64, 0, 2, 0, 0, 1 }, + { 12, 6000, 396, 2376, 384, 1000, 128, 64, 0, 2, 0, 0, 1 }, + { 13, 11880, 396, 2376, 768, 2000, 128, 64, 0, 2, 0, 0, 1 }, + { 20, 11880, 396, 2376, 2000, 2000, 128, 64, 0, 2, 0, 0, 1 }, + { 21, 19800, 792, 4752, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 }, + { 22, 20250, 1620, 8100, 4000, 4000, 256, 64, 0, 2, 0, 0, 0 }, + { 30, 40500, 1620, 8100, 10000, 10000, 256, 32, 22, 2, 0, 1, 0 }, + { 31, 108000, 3600, 18000, 14000, 14000, 512, 16, 60, 4, 1, 1, 0 }, + { 32, 216000, 5120, 20480, 20000, 20000, 512, 16, 60, 4, 1, 1, 0 }, + { 40, 245760, 8192, 32768, 20000, 25000, 512, 16, 60, 4, 1, 1, 0 }, + { 41, 245760, 8192, 32768, 50000, 62500, 512, 16, 24, 2, 1, 1, 0 }, + { 42, 522240, 8704, 34816, 50000, 62500, 512, 16, 24, 2, 1, 1, 1 }, + { 50, 589824, 22080, 110400, 135000, 135000, 512, 16, 24, 2, 1, 1, 1 }, + { 51, 983040, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 }, + { 52, 2073600, 36864, 184320, 240000, 240000, 512, 16, 24, 2, 1, 1, 1 }, + { 60, 4177920, 139264, 696320, 240000, 240000, 8192, 16, 24, 2, 1, 1, 1 }, + { 61, 8355840, 139264, 696320, 480000, 480000, 8192, 16, 24, 2, 1, 1, 1 }, + { 62, 16711680, 139264, 696320, 800000, 800000, 8192, 16, 24, 2, 1, 1, 1 }, + { 0 } +}; + +#define ERROR(...)\ +{\ + if( verbose )\ + x264_log( h, X264_LOG_WARNING, __VA_ARGS__ );\ + ret = 1;\ +} + +int x264_validate_levels( x264_t *h, int verbose ) +{ + int ret = 0; + int mbs = h->sps->i_mb_width * h->sps->i_mb_height; + int dpb = mbs * h->sps->vui.i_max_dec_frame_buffering; + int cbp_factor = h->sps->i_profile_idc>=PROFILE_HIGH422 ? 16 : + h->sps->i_profile_idc==PROFILE_HIGH10 ? 12 : + h->sps->i_profile_idc==PROFILE_HIGH ? 5 : 4; + + const x264_level_t *l = x264_levels; + while( l->level_idc != 0 && l->level_idc != h->param.i_level_idc ) + l++; + + if( l->frame_size < mbs + || l->frame_size*8 < h->sps->i_mb_width * h->sps->i_mb_width + || l->frame_size*8 < h->sps->i_mb_height * h->sps->i_mb_height ) + ERROR( "frame MB size (%dx%d) > level limit (%d)\n", + h->sps->i_mb_width, h->sps->i_mb_height, l->frame_size ); + if( dpb > l->dpb ) + ERROR( "DPB size (%d frames, %d mbs) > level limit (%d frames, %d mbs)\n", + h->sps->vui.i_max_dec_frame_buffering, dpb, l->dpb / mbs, l->dpb ); + +#define CHECK( name, limit, val ) \ + if( (val) > (limit) ) \ + ERROR( name " (%"PRId64") > level limit (%d)\n", (int64_t)(val), (limit) ); + + CHECK( "VBV bitrate", (l->bitrate * cbp_factor) / 4, h->param.rc.i_vbv_max_bitrate ); + CHECK( "VBV buffer", (l->cpb * cbp_factor) / 4, h->param.rc.i_vbv_buffer_size ); + CHECK( "MV range", l->mv_range, h->param.analyse.i_mv_range ); + CHECK( "interlaced", !l->frame_only, h->param.b_interlaced ); + CHECK( "fake interlaced", !l->frame_only, h->param.b_fake_interlaced ); + + if( h->param.i_fps_den > 0 ) + CHECK( "MB rate", l->mbps, (int64_t)mbs * h->param.i_fps_num / h->param.i_fps_den ); + + /* TODO check the rest of the limits */ + return ret; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.h new file mode 100644 index 00000000..8e11655d --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/set.h @@ -0,0 +1,47 @@ +/***************************************************************************** + * set.h: header writing + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_ENCODER_SET_H +#define X264_ENCODER_SET_H + +void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param ); +void x264_sps_init_reconfigurable( x264_sps_t *sps, x264_param_t *param ); +void x264_sps_write( bs_t *s, x264_sps_t *sps ); +void x264_pps_init( x264_pps_t *pps, int i_id, x264_param_t *param, x264_sps_t *sps ); +void x264_pps_write( bs_t *s, x264_sps_t *sps, x264_pps_t *pps ); +void x264_sei_recovery_point_write( x264_t *h, bs_t *s, int recovery_frame_cnt ); +int x264_sei_version_write( x264_t *h, bs_t *s ); +int x264_validate_levels( x264_t *h, int verbose ); +void x264_sei_buffering_period_write( x264_t *h, bs_t *s ); +void x264_sei_pic_timing_write( x264_t *h, bs_t *s ); +void x264_sei_dec_ref_pic_marking_write( x264_t *h, bs_t *s ); +void x264_sei_frame_packing_write( x264_t *h, bs_t *s ); +int x264_sei_avcintra_umid_write( x264_t *h, bs_t *s ); +int x264_sei_avcintra_vanc_write( x264_t *h, bs_t *s, int len ); +void x264_sei_write( bs_t *s, uint8_t *payload, int payload_size, int payload_type ); +void x264_filler_write( x264_t *h, bs_t *s, int filler ); + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype-cl.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype-cl.c new file mode 100644 index 00000000..7768b7cb --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype-cl.c @@ -0,0 +1,780 @@ +/***************************************************************************** + * slicetype-cl.c: OpenCL slicetype decision code (lowres lookahead) + ***************************************************************************** + * Copyright (C) 2012-2017 x264 project + * + * Authors: Steve Borho + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "macroblock.h" +#include "me.h" + +#if HAVE_OPENCL +#ifdef _WIN32 +#include +#endif + +void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead ); + +/* We define CL_QUEUE_THREAD_HANDLE_AMD here because it is not defined + * in the OpenCL headers shipped with NVIDIA drivers. We need to be + * able to compile on an NVIDIA machine and run optimally on an AMD GPU. */ +#define CL_QUEUE_THREAD_HANDLE_AMD 0x403E + +#define OCLCHECK( method, ... )\ +do\ +{\ + if( h->opencl.b_fatal_error )\ + return -1;\ + status = ocl->method( __VA_ARGS__ );\ + if( status != CL_SUCCESS ) {\ + h->param.b_opencl = 0;\ + h->opencl.b_fatal_error = 1;\ + x264_log( h, X264_LOG_ERROR, # method " error '%d'\n", status );\ + return -1;\ + }\ +} while( 0 ) + +void x264_opencl_flush( x264_t *h ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + + ocl->clFinish( h->opencl.queue ); + + /* Finish copies from the GPU by copying from the page-locked buffer to + * their final destination */ + for( int i = 0; i < h->opencl.num_copies; i++ ) + memcpy( h->opencl.copies[i].dest, h->opencl.copies[i].src, h->opencl.copies[i].bytes ); + h->opencl.num_copies = 0; + h->opencl.pl_occupancy = 0; +} + +static void *x264_opencl_alloc_locked( x264_t *h, int bytes ) +{ + if( h->opencl.pl_occupancy + bytes >= PAGE_LOCKED_BUF_SIZE ) + x264_opencl_flush( h ); + assert( bytes < PAGE_LOCKED_BUF_SIZE ); + char *ptr = h->opencl.page_locked_ptr + h->opencl.pl_occupancy; + h->opencl.pl_occupancy += bytes; + return ptr; +} + +int x264_opencl_lowres_init( x264_t *h, x264_frame_t *fenc, int lambda ) +{ + if( fenc->b_intra_calculated ) + return 0; + fenc->b_intra_calculated = 1; + + x264_opencl_function_t *ocl = h->opencl.ocl; + int luma_length = fenc->i_stride[0] * fenc->i_lines[0]; + +#define CREATEBUF( out, flags, size )\ + out = ocl->clCreateBuffer( h->opencl.context, (flags), (size), NULL, &status );\ + if( status != CL_SUCCESS ) { h->param.b_opencl = 0; x264_log( h, X264_LOG_ERROR, "clCreateBuffer error '%d'\n", status ); return -1; } +#define CREATEIMAGE( out, flags, pf, width, height )\ + out = ocl->clCreateImage2D( h->opencl.context, (flags), &pf, width, height, 0, NULL, &status );\ + if( status != CL_SUCCESS ) { h->param.b_opencl = 0; x264_log( h, X264_LOG_ERROR, "clCreateImage2D error '%d'\n", status ); return -1; } + + int mb_count = h->mb.i_mb_count; + cl_int status; + + if( !h->opencl.lowres_mv_costs ) + { + /* Allocate shared memory buffers */ + int width = h->mb.i_mb_width * 8 * sizeof(pixel); + int height = h->mb.i_mb_height * 8 * sizeof(pixel); + + cl_image_format pixel_format; + pixel_format.image_channel_order = CL_R; + pixel_format.image_channel_data_type = CL_UNSIGNED_INT32; + CREATEIMAGE( h->opencl.weighted_luma_hpel, CL_MEM_READ_WRITE, pixel_format, width, height ); + + for( int i = 0; i < NUM_IMAGE_SCALES; i++ ) + { + pixel_format.image_channel_order = CL_RGBA; + pixel_format.image_channel_data_type = CL_UNSIGNED_INT8; + CREATEIMAGE( h->opencl.weighted_scaled_images[i], CL_MEM_READ_WRITE, pixel_format, width, height ); + width >>= 1; + height >>= 1; + } + + CREATEBUF( h->opencl.lowres_mv_costs, CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) ); + CREATEBUF( h->opencl.lowres_costs[0], CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) ); + CREATEBUF( h->opencl.lowres_costs[1], CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) ); + CREATEBUF( h->opencl.mv_buffers[0], CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) * 2 ); + CREATEBUF( h->opencl.mv_buffers[1], CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) * 2 ); + CREATEBUF( h->opencl.mvp_buffer, CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) * 2 ); + CREATEBUF( h->opencl.frame_stats[0], CL_MEM_WRITE_ONLY, 4 * sizeof(int) ); + CREATEBUF( h->opencl.frame_stats[1], CL_MEM_WRITE_ONLY, 4 * sizeof(int) ); + CREATEBUF( h->opencl.row_satds[0], CL_MEM_WRITE_ONLY, h->mb.i_mb_height * sizeof(int) ); + CREATEBUF( h->opencl.row_satds[1], CL_MEM_WRITE_ONLY, h->mb.i_mb_height * sizeof(int) ); + CREATEBUF( h->opencl.luma_16x16_image[0], CL_MEM_READ_ONLY, luma_length ); + CREATEBUF( h->opencl.luma_16x16_image[1], CL_MEM_READ_ONLY, luma_length ); + } + + if( !fenc->opencl.intra_cost ) + { + /* Allocate per-frame buffers */ + int width = h->mb.i_mb_width * 8 * sizeof(pixel); + int height = h->mb.i_mb_height * 8 * sizeof(pixel); + + cl_image_format pixel_format; + pixel_format.image_channel_order = CL_R; + pixel_format.image_channel_data_type = CL_UNSIGNED_INT32; + CREATEIMAGE( fenc->opencl.luma_hpel, CL_MEM_READ_WRITE, pixel_format, width, height ); + + for( int i = 0; i < NUM_IMAGE_SCALES; i++ ) + { + pixel_format.image_channel_order = CL_RGBA; + pixel_format.image_channel_data_type = CL_UNSIGNED_INT8; + CREATEIMAGE( fenc->opencl.scaled_image2Ds[i], CL_MEM_READ_WRITE, pixel_format, width, height ); + width >>= 1; + height >>= 1; + } + CREATEBUF( fenc->opencl.inv_qscale_factor, CL_MEM_READ_ONLY, mb_count * sizeof(int16_t) ); + CREATEBUF( fenc->opencl.intra_cost, CL_MEM_WRITE_ONLY, mb_count * sizeof(int16_t) ); + CREATEBUF( fenc->opencl.lowres_mvs0, CL_MEM_READ_WRITE, mb_count * 2 * sizeof(int16_t) * (h->param.i_bframe + 1) ); + CREATEBUF( fenc->opencl.lowres_mvs1, CL_MEM_READ_WRITE, mb_count * 2 * sizeof(int16_t) * (h->param.i_bframe + 1) ); + CREATEBUF( fenc->opencl.lowres_mv_costs0, CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) * (h->param.i_bframe + 1) ); + CREATEBUF( fenc->opencl.lowres_mv_costs1, CL_MEM_READ_WRITE, mb_count * sizeof(int16_t) * (h->param.i_bframe + 1) ); + } +#undef CREATEBUF +#undef CREATEIMAGE + + /* Copy image to the GPU, downscale to unpadded 8x8, then continue for all scales */ + + char *locked = x264_opencl_alloc_locked( h, luma_length ); + memcpy( locked, fenc->plane[0], luma_length ); + OCLCHECK( clEnqueueWriteBuffer, h->opencl.queue, h->opencl.luma_16x16_image[h->opencl.last_buf], CL_FALSE, 0, luma_length, locked, 0, NULL, NULL ); + + size_t gdim[2]; + if( h->param.rc.i_aq_mode && fenc->i_inv_qscale_factor ) + { + int size = h->mb.i_mb_count * sizeof(int16_t); + locked = x264_opencl_alloc_locked( h, size ); + memcpy( locked, fenc->i_inv_qscale_factor, size ); + OCLCHECK( clEnqueueWriteBuffer, h->opencl.queue, fenc->opencl.inv_qscale_factor, CL_FALSE, 0, size, locked, 0, NULL, NULL ); + } + else + { + /* Fill fenc->opencl.inv_qscale_factor with NOP (256) */ + cl_uint arg = 0; + int16_t value = 256; + OCLCHECK( clSetKernelArg, h->opencl.memset_kernel, arg++, sizeof(cl_mem), &fenc->opencl.inv_qscale_factor ); + OCLCHECK( clSetKernelArg, h->opencl.memset_kernel, arg++, sizeof(int16_t), &value ); + gdim[0] = h->mb.i_mb_count; + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.memset_kernel, 1, NULL, gdim, NULL, 0, NULL, NULL ); + } + + int stride = fenc->i_stride[0]; + cl_uint arg = 0; + OCLCHECK( clSetKernelArg, h->opencl.downscale_hpel_kernel, arg++, sizeof(cl_mem), &h->opencl.luma_16x16_image[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.downscale_hpel_kernel, arg++, sizeof(cl_mem), &fenc->opencl.scaled_image2Ds[0] ); + OCLCHECK( clSetKernelArg, h->opencl.downscale_hpel_kernel, arg++, sizeof(cl_mem), &fenc->opencl.luma_hpel ); + OCLCHECK( clSetKernelArg, h->opencl.downscale_hpel_kernel, arg++, sizeof(int), &stride ); + gdim[0] = 8 * h->mb.i_mb_width; + gdim[1] = 8 * h->mb.i_mb_height; + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.downscale_hpel_kernel, 2, NULL, gdim, NULL, 0, NULL, NULL ); + + for( int i = 0; i < NUM_IMAGE_SCALES - 1; i++ ) + { + /* Workaround for AMD Southern Island: + * + * Alternate kernel instances. No perf impact to this, so we do it for + * all GPUs. It prevents the same kernel from being enqueued + * back-to-back, avoiding a dependency calculation bug in the driver. + */ + cl_kernel kern = i & 1 ? h->opencl.downscale_kernel1 : h->opencl.downscale_kernel2; + + arg = 0; + OCLCHECK( clSetKernelArg, kern, arg++, sizeof(cl_mem), &fenc->opencl.scaled_image2Ds[i] ); + OCLCHECK( clSetKernelArg, kern, arg++, sizeof(cl_mem), &fenc->opencl.scaled_image2Ds[i+1] ); + gdim[0] >>= 1; + gdim[1] >>= 1; + if( gdim[0] < 16 || gdim[1] < 16 ) + break; + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, kern, 2, NULL, gdim, NULL, 0, NULL, NULL ); + } + + size_t ldim[2]; + gdim[0] = ((h->mb.i_mb_width + 31)>>5)<<5; + gdim[1] = 8*h->mb.i_mb_height; + ldim[0] = 32; + ldim[1] = 8; + arg = 0; + + /* For presets slow, slower, and placebo, check all 10 intra modes that the + * C lookahead supports. For faster presets, only check the most frequent 8 + * modes + */ + int slow = h->param.analyse.i_subpel_refine > 7; + OCLCHECK( clSetKernelArg, h->opencl.intra_kernel, arg++, sizeof(cl_mem), &fenc->opencl.scaled_image2Ds[0] ); + OCLCHECK( clSetKernelArg, h->opencl.intra_kernel, arg++, sizeof(cl_mem), &fenc->opencl.intra_cost ); + OCLCHECK( clSetKernelArg, h->opencl.intra_kernel, arg++, sizeof(cl_mem), &h->opencl.frame_stats[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.intra_kernel, arg++, sizeof(int), &lambda ); + OCLCHECK( clSetKernelArg, h->opencl.intra_kernel, arg++, sizeof(int), &h->mb.i_mb_width ); + OCLCHECK( clSetKernelArg, h->opencl.intra_kernel, arg++, sizeof(int), &slow ); + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.intra_kernel, 2, NULL, gdim, ldim, 0, NULL, NULL ); + + gdim[0] = 256; + gdim[1] = h->mb.i_mb_height; + ldim[0] = 256; + ldim[1] = 1; + arg = 0; + OCLCHECK( clSetKernelArg, h->opencl.rowsum_intra_kernel, arg++, sizeof(cl_mem), &fenc->opencl.intra_cost ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_intra_kernel, arg++, sizeof(cl_mem), &fenc->opencl.inv_qscale_factor ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_intra_kernel, arg++, sizeof(cl_mem), &h->opencl.row_satds[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_intra_kernel, arg++, sizeof(cl_mem), &h->opencl.frame_stats[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_intra_kernel, arg++, sizeof(int), &h->mb.i_mb_width ); + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.rowsum_intra_kernel, 2, NULL, gdim, ldim, 0, NULL, NULL ); + + if( h->opencl.num_copies >= MAX_FINISH_COPIES - 4 ) + x264_opencl_flush( h ); + + int size = h->mb.i_mb_count * sizeof(int16_t); + locked = x264_opencl_alloc_locked( h, size ); + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, fenc->opencl.intra_cost, CL_FALSE, 0, size, locked, 0, NULL, NULL ); + h->opencl.copies[h->opencl.num_copies].dest = fenc->lowres_costs[0][0]; + h->opencl.copies[h->opencl.num_copies].src = locked; + h->opencl.copies[h->opencl.num_copies].bytes = size; + h->opencl.num_copies++; + + size = h->mb.i_mb_height * sizeof(int); + locked = x264_opencl_alloc_locked( h, size ); + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.row_satds[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL ); + h->opencl.copies[h->opencl.num_copies].dest = fenc->i_row_satds[0][0]; + h->opencl.copies[h->opencl.num_copies].src = locked; + h->opencl.copies[h->opencl.num_copies].bytes = size; + h->opencl.num_copies++; + + size = sizeof(int) * 4; + locked = x264_opencl_alloc_locked( h, size ); + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.frame_stats[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL ); + h->opencl.copies[h->opencl.num_copies].dest = &fenc->i_cost_est[0][0]; + h->opencl.copies[h->opencl.num_copies].src = locked; + h->opencl.copies[h->opencl.num_copies].bytes = sizeof(int); + h->opencl.num_copies++; + h->opencl.copies[h->opencl.num_copies].dest = &fenc->i_cost_est_aq[0][0]; + h->opencl.copies[h->opencl.num_copies].src = locked + sizeof(int); + h->opencl.copies[h->opencl.num_copies].bytes = sizeof(int); + h->opencl.num_copies++; + + h->opencl.last_buf = !h->opencl.last_buf; + return 0; +} + +/* This function was tested emprically on a number of AMD and NV GPUs. Making a + * function which returns perfect launch dimensions is impossible; some + * applications will have self-tuning code to try many possible variables and + * measure the runtime. Here we simply make an educated guess based on what we + * know GPUs typically prefer. */ +static void x264_optimal_launch_dims( x264_t *h, size_t *gdims, size_t *ldims, const cl_kernel kernel, const cl_device_id device ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + size_t max_work_group = 256; /* reasonable defaults for OpenCL 1.0 devices, below APIs may fail */ + size_t preferred_multiple = 64; + cl_uint num_cus = 6; + + ocl->clGetKernelWorkGroupInfo( kernel, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t), &max_work_group, NULL ); + ocl->clGetKernelWorkGroupInfo( kernel, device, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, sizeof(size_t), &preferred_multiple, NULL ); + ocl->clGetDeviceInfo( device, CL_DEVICE_MAX_COMPUTE_UNITS, sizeof(cl_uint), &num_cus, NULL ); + + ldims[0] = preferred_multiple; + ldims[1] = 8; + + /* make ldims[1] an even divisor of gdims[1] */ + while( gdims[1] & (ldims[1] - 1) ) + { + ldims[0] <<= 1; + ldims[1] >>= 1; + } + /* make total ldims fit under the max work-group dimensions for the device */ + while( ldims[0] * ldims[1] > max_work_group ) + { + if( (ldims[0] <= preferred_multiple) && (ldims[1] > 1) ) + ldims[1] >>= 1; + else + ldims[0] >>= 1; + } + + if( ldims[0] > gdims[0] ) + { + /* remove preferred multiples until we're close to gdims[0] */ + while( gdims[0] + preferred_multiple < ldims[0] ) + ldims[0] -= preferred_multiple; + gdims[0] = ldims[0]; + } + else + { + /* make gdims an even multiple of ldims */ + gdims[0] = (gdims[0]+ldims[0]-1)/ldims[0]; + gdims[0] *= ldims[0]; + } + + /* make ldims smaller to spread work across compute units */ + while( (gdims[0]/ldims[0]) * (gdims[1]/ldims[1]) * 2 <= num_cus ) + { + if( ldims[0] > preferred_multiple ) + ldims[0] >>= 1; + else if( ldims[1] > 1 ) + ldims[1] >>= 1; + else + break; + } + /* for smaller GPUs, try not to abuse their texture cache */ + if( num_cus == 6 && ldims[0] == 64 && ldims[1] == 4 ) + ldims[0] = 32; +} + +int x264_opencl_motionsearch( x264_t *h, x264_frame_t **frames, int b, int ref, int b_islist1, int lambda, const x264_weight_t *w ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + x264_frame_t *fenc = frames[b]; + x264_frame_t *fref = frames[ref]; + + cl_mem ref_scaled_images[NUM_IMAGE_SCALES]; + cl_mem ref_luma_hpel; + cl_int status; + + if( w && w->weightfn ) + { + size_t gdims[2]; + + gdims[0] = 8 * h->mb.i_mb_width; + gdims[1] = 8 * h->mb.i_mb_height; + + /* WeightP: Perform a filter on fref->opencl.scaled_image2Ds[] and fref->opencl.luma_hpel */ + for( int i = 0; i < NUM_IMAGE_SCALES; i++ ) + { + cl_uint arg = 0; + OCLCHECK( clSetKernelArg, h->opencl.weightp_scaled_images_kernel, arg++, sizeof(cl_mem), &fref->opencl.scaled_image2Ds[i] ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_scaled_images_kernel, arg++, sizeof(cl_mem), &h->opencl.weighted_scaled_images[i] ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_scaled_images_kernel, arg++, sizeof(int32_t), &w->i_offset ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_scaled_images_kernel, arg++, sizeof(int32_t), &w->i_scale ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_scaled_images_kernel, arg++, sizeof(int32_t), &w->i_denom ); + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.weightp_scaled_images_kernel, 2, NULL, gdims, NULL, 0, NULL, NULL ); + + gdims[0] >>= 1; + gdims[1] >>= 1; + if( gdims[0] < 16 || gdims[1] < 16 ) + break; + } + + cl_uint arg = 0; + gdims[0] = 8 * h->mb.i_mb_width; + gdims[1] = 8 * h->mb.i_mb_height; + + OCLCHECK( clSetKernelArg, h->opencl.weightp_hpel_kernel, arg++, sizeof(cl_mem), &fref->opencl.luma_hpel ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_hpel_kernel, arg++, sizeof(cl_mem), &h->opencl.weighted_luma_hpel ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_hpel_kernel, arg++, sizeof(int32_t), &w->i_offset ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_hpel_kernel, arg++, sizeof(int32_t), &w->i_scale ); + OCLCHECK( clSetKernelArg, h->opencl.weightp_hpel_kernel, arg++, sizeof(int32_t), &w->i_denom ); + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.weightp_hpel_kernel, 2, NULL, gdims, NULL, 0, NULL, NULL ); + + /* Use weighted reference planes for motion search */ + for( int i = 0; i < NUM_IMAGE_SCALES; i++ ) + ref_scaled_images[i] = h->opencl.weighted_scaled_images[i]; + ref_luma_hpel = h->opencl.weighted_luma_hpel; + } + else + { + /* Use unweighted reference planes for motion search */ + for( int i = 0; i < NUM_IMAGE_SCALES; i++ ) + ref_scaled_images[i] = fref->opencl.scaled_image2Ds[i]; + ref_luma_hpel = fref->opencl.luma_hpel; + } + + const int num_iterations[NUM_IMAGE_SCALES] = { 1, 1, 2, 3 }; + int b_first_iteration = 1; + int b_reverse_references = 1; + int A = 1; + + + int mb_per_group = 0; + int cost_local_size = 0; + int mvc_local_size = 0; + int mb_width; + + size_t gdims[2]; + size_t ldims[2]; + + /* scale 0 is 8x8 */ + for( int scale = NUM_IMAGE_SCALES-1; scale >= 0; scale-- ) + { + mb_width = h->mb.i_mb_width >> scale; + gdims[0] = mb_width; + gdims[1] = h->mb.i_mb_height >> scale; + if( gdims[0] < 2 || gdims[1] < 2 ) + continue; + gdims[0] <<= 2; + x264_optimal_launch_dims( h, gdims, ldims, h->opencl.hme_kernel, h->opencl.device ); + + mb_per_group = (ldims[0] >> 2) * ldims[1]; + cost_local_size = 4 * mb_per_group * sizeof(int16_t); + mvc_local_size = 4 * mb_per_group * sizeof(int16_t) * 2; + int scaled_me_range = h->param.analyse.i_me_range >> scale; + int b_shift_index = 1; + + cl_uint arg = 0; + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(cl_mem), &fenc->opencl.scaled_image2Ds[scale] ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(cl_mem), &ref_scaled_images[scale] ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(cl_mem), &h->opencl.mv_buffers[A] ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(cl_mem), &h->opencl.mv_buffers[!A] ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(cl_mem), &h->opencl.lowres_mv_costs ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(cl_mem), (void*)&h->opencl.mvp_buffer ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, cost_local_size, NULL ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, mvc_local_size, NULL ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(int), &mb_width ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(int), &lambda ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(int), &scaled_me_range ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(int), &scale ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(int), &b_shift_index ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(int), &b_first_iteration ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg++, sizeof(int), &b_reverse_references ); + + for( int iter = 0; iter < num_iterations[scale]; iter++ ) + { + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.hme_kernel, 2, NULL, gdims, ldims, 0, NULL, NULL ); + + b_shift_index = 0; + b_first_iteration = 0; + + /* alternate top-left vs bot-right MB references at lower scales, so + * motion field smooths more quickly. */ + if( scale > 2 ) + b_reverse_references ^= 1; + else + b_reverse_references = 0; + A = !A; + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, 2, sizeof(cl_mem), &h->opencl.mv_buffers[A] ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, 3, sizeof(cl_mem), &h->opencl.mv_buffers[!A] ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg - 3, sizeof(int), &b_shift_index ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg - 2, sizeof(int), &b_first_iteration ); + OCLCHECK( clSetKernelArg, h->opencl.hme_kernel, arg - 1, sizeof(int), &b_reverse_references ); + } + } + + int satd_local_size = mb_per_group * sizeof(uint32_t) * 16; + cl_uint arg = 0; + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &fenc->opencl.scaled_image2Ds[0] ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &ref_luma_hpel ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &h->opencl.mv_buffers[A] ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &h->opencl.lowres_mv_costs ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, cost_local_size, NULL ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, satd_local_size, NULL ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, mvc_local_size, NULL ); + + if( b_islist1 ) + { + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mvs1 ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mv_costs1 ); + } + else + { + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mvs0 ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mv_costs0 ); + } + + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(int), &mb_width ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(int), &lambda ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(int), &b ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(int), &ref ); + OCLCHECK( clSetKernelArg, h->opencl.subpel_refine_kernel, arg++, sizeof(int), &b_islist1 ); + + if( h->opencl.b_device_AMD_SI ) + { + /* workaround for AMD Southern Island driver scheduling bug (fixed in + * July 2012), perform meaningless small copy to add a data dependency */ + OCLCHECK( clEnqueueCopyBuffer, h->opencl.queue, h->opencl.mv_buffers[A], h->opencl.mv_buffers[!A], 0, 0, 20, 0, NULL, NULL ); + } + + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.subpel_refine_kernel, 2, NULL, gdims, ldims, 0, NULL, NULL ); + + int mvlen = 2 * sizeof(int16_t) * h->mb.i_mb_count; + + if( h->opencl.num_copies >= MAX_FINISH_COPIES - 1 ) + x264_opencl_flush( h ); + + char *locked = x264_opencl_alloc_locked( h, mvlen ); + h->opencl.copies[h->opencl.num_copies].src = locked; + h->opencl.copies[h->opencl.num_copies].bytes = mvlen; + + if( b_islist1 ) + { + int mvs_offset = mvlen * (ref - b - 1); + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, fenc->opencl.lowres_mvs1, CL_FALSE, mvs_offset, mvlen, locked, 0, NULL, NULL ); + h->opencl.copies[h->opencl.num_copies].dest = fenc->lowres_mvs[1][ref - b - 1]; + } + else + { + int mvs_offset = mvlen * (b - ref - 1); + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, fenc->opencl.lowres_mvs0, CL_FALSE, mvs_offset, mvlen, locked, 0, NULL, NULL ); + h->opencl.copies[h->opencl.num_copies].dest = fenc->lowres_mvs[0][b - ref - 1]; + } + + h->opencl.num_copies++; + + return 0; +} + +int x264_opencl_finalize_cost( x264_t *h, int lambda, x264_frame_t **frames, int p0, int p1, int b, int dist_scale_factor ) +{ + x264_opencl_function_t *ocl = h->opencl.ocl; + cl_int status; + x264_frame_t *fenc = frames[b]; + x264_frame_t *fref0 = frames[p0]; + x264_frame_t *fref1 = frames[p1]; + + int bipred_weight = h->param.analyse.b_weighted_bipred ? 64 - (dist_scale_factor >> 2) : 32; + + /* Tasks for this kernel: + * 1. Select least cost mode (intra, ref0, ref1) + * list_used 0, 1, 2, or 3. if B frame, do not allow intra + * 2. if B frame, try bidir predictions. + * 3. lowres_costs[i_mb_xy] = X264_MIN( bcost, LOWRES_COST_MASK ) + (list_used << LOWRES_COST_SHIFT); */ + size_t gdims[2] = { h->mb.i_mb_width, h->mb.i_mb_height }; + size_t ldim_bidir[2]; + size_t *ldims = NULL; + int cost_local_size = 4; + int satd_local_size = 4; + if( b < p1 ) + { + /* For B frames, use 4 threads per MB for BIDIR checks */ + ldims = ldim_bidir; + gdims[0] <<= 2; + x264_optimal_launch_dims( h, gdims, ldims, h->opencl.mode_select_kernel, h->opencl.device ); + int mb_per_group = (ldims[0] >> 2) * ldims[1]; + cost_local_size = 4 * mb_per_group * sizeof(int16_t); + satd_local_size = 16 * mb_per_group * sizeof(uint32_t); + } + + cl_uint arg = 0; + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fenc->opencl.scaled_image2Ds[0] ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fref0->opencl.luma_hpel ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fref1->opencl.luma_hpel ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mvs0 ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mvs1 ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fref1->opencl.lowres_mvs0 ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mv_costs0 ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fenc->opencl.lowres_mv_costs1 ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &fenc->opencl.intra_cost ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &h->opencl.lowres_costs[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(cl_mem), &h->opencl.frame_stats[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, cost_local_size, NULL ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, satd_local_size, NULL ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(int), &h->mb.i_mb_width ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(int), &bipred_weight ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(int), &dist_scale_factor ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(int), &b ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(int), &p0 ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(int), &p1 ); + OCLCHECK( clSetKernelArg, h->opencl.mode_select_kernel, arg++, sizeof(int), &lambda ); + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.mode_select_kernel, 2, NULL, gdims, ldims, 0, NULL, NULL ); + + /* Sum costs across rows, atomicAdd down frame */ + size_t gdim[2] = { 256, h->mb.i_mb_height }; + size_t ldim[2] = { 256, 1 }; + + arg = 0; + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(cl_mem), &h->opencl.lowres_costs[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(cl_mem), &fenc->opencl.inv_qscale_factor ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(cl_mem), &h->opencl.row_satds[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(cl_mem), &h->opencl.frame_stats[h->opencl.last_buf] ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(int), &h->mb.i_mb_width ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(int), &h->param.i_bframe_bias ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(int), &b ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(int), &p0 ); + OCLCHECK( clSetKernelArg, h->opencl.rowsum_inter_kernel, arg++, sizeof(int), &p1 ); + OCLCHECK( clEnqueueNDRangeKernel, h->opencl.queue, h->opencl.rowsum_inter_kernel, 2, NULL, gdim, ldim, 0, NULL, NULL ); + + if( h->opencl.num_copies >= MAX_FINISH_COPIES - 4 ) + x264_opencl_flush( h ); + + int size = h->mb.i_mb_count * sizeof(int16_t); + char *locked = x264_opencl_alloc_locked( h, size ); + h->opencl.copies[h->opencl.num_copies].src = locked; + h->opencl.copies[h->opencl.num_copies].dest = fenc->lowres_costs[b - p0][p1 - b]; + h->opencl.copies[h->opencl.num_copies].bytes = size; + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.lowres_costs[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL ); + h->opencl.num_copies++; + + size = h->mb.i_mb_height * sizeof(int); + locked = x264_opencl_alloc_locked( h, size ); + h->opencl.copies[h->opencl.num_copies].src = locked; + h->opencl.copies[h->opencl.num_copies].dest = fenc->i_row_satds[b - p0][p1 - b]; + h->opencl.copies[h->opencl.num_copies].bytes = size; + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.row_satds[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL ); + h->opencl.num_copies++; + + size = 4 * sizeof(int); + locked = x264_opencl_alloc_locked( h, size ); + OCLCHECK( clEnqueueReadBuffer, h->opencl.queue, h->opencl.frame_stats[h->opencl.last_buf], CL_FALSE, 0, size, locked, 0, NULL, NULL ); + h->opencl.last_buf = !h->opencl.last_buf; + + h->opencl.copies[h->opencl.num_copies].src = locked; + h->opencl.copies[h->opencl.num_copies].dest = &fenc->i_cost_est[b - p0][p1 - b]; + h->opencl.copies[h->opencl.num_copies].bytes = sizeof(int); + h->opencl.num_copies++; + h->opencl.copies[h->opencl.num_copies].src = locked + sizeof(int); + h->opencl.copies[h->opencl.num_copies].dest = &fenc->i_cost_est_aq[b - p0][p1 - b]; + h->opencl.copies[h->opencl.num_copies].bytes = sizeof(int); + h->opencl.num_copies++; + + if( b == p1 ) // P frames only + { + h->opencl.copies[h->opencl.num_copies].src = locked + 2 * sizeof(int); + h->opencl.copies[h->opencl.num_copies].dest = &fenc->i_intra_mbs[b - p0]; + h->opencl.copies[h->opencl.num_copies].bytes = sizeof(int); + h->opencl.num_copies++; + } + return 0; +} + +void x264_opencl_slicetype_prep( x264_t *h, x264_frame_t **frames, int num_frames, int lambda ) +{ + if( h->param.b_opencl ) + { +#ifdef _WIN32 + /* Temporarily boost priority of this lookahead thread and the OpenCL + * driver's thread until the end of this function. On AMD GPUs this + * greatly reduces the latency of enqueuing kernels and getting results + * on Windows. */ + HANDLE id = GetCurrentThread(); + h->opencl.lookahead_thread_pri = GetThreadPriority( id ); + SetThreadPriority( id, THREAD_PRIORITY_ABOVE_NORMAL ); + x264_opencl_function_t *ocl = h->opencl.ocl; + cl_int status = ocl->clGetCommandQueueInfo( h->opencl.queue, CL_QUEUE_THREAD_HANDLE_AMD, sizeof(HANDLE), &id, NULL ); + if( status == CL_SUCCESS ) + { + h->opencl.opencl_thread_pri = GetThreadPriority( id ); + SetThreadPriority( id, THREAD_PRIORITY_ABOVE_NORMAL ); + } +#endif + + /* precalculate intra and I frames */ + for( int i = 0; i <= num_frames; i++ ) + x264_opencl_lowres_init( h, frames[i], lambda ); + x264_opencl_flush( h ); + + if( h->param.i_bframe_adaptive == X264_B_ADAPT_TRELLIS && h->param.i_bframe ) + { + /* For trellis B-Adapt, precompute exhaustive motion searches */ + for( int b = 0; b <= num_frames; b++ ) + { + for( int j = 1; j < h->param.i_bframe; j++ ) + { + int p0 = b - j; + if( p0 >= 0 && frames[b]->lowres_mvs[0][b-p0-1][0][0] == 0x7FFF ) + { + const x264_weight_t *w = x264_weight_none; + + if( h->param.analyse.i_weighted_pred ) + { + x264_emms(); + x264_weights_analyse( h, frames[b], frames[p0], 1 ); + w = frames[b]->weight[0]; + } + frames[b]->lowres_mvs[0][b-p0-1][0][0] = 0; + x264_opencl_motionsearch( h, frames, b, p0, 0, lambda, w ); + } + int p1 = b + j; + if( p1 <= num_frames && frames[b]->lowres_mvs[1][p1-b-1][0][0] == 0x7FFF ) + { + frames[b]->lowres_mvs[1][p1-b-1][0][0] = 0; + x264_opencl_motionsearch( h, frames, b, p1, 1, lambda, NULL ); + } + } + } + + x264_opencl_flush( h ); + } + } +} + + +void x264_opencl_slicetype_end( x264_t *h ) +{ +#ifdef _WIN32 + if( h->param.b_opencl ) + { + HANDLE id = GetCurrentThread(); + SetThreadPriority( id, h->opencl.lookahead_thread_pri ); + x264_opencl_function_t *ocl = h->opencl.ocl; + cl_int status = ocl->clGetCommandQueueInfo( h->opencl.queue, CL_QUEUE_THREAD_HANDLE_AMD, sizeof(HANDLE), &id, NULL ); + if( status == CL_SUCCESS ) + SetThreadPriority( id, h->opencl.opencl_thread_pri ); + } +#endif +} + +int x264_opencl_precalculate_frame_cost( x264_t *h, x264_frame_t **frames, int lambda, int p0, int p1, int b ) +{ + if( (frames[b]->i_cost_est[b-p0][p1-b] >= 0) || (b == p0 && b == p1) ) + return 0; + else + { + int do_search[2]; + int dist_scale_factor = 128; + const x264_weight_t *w = x264_weight_none; + + // avoid duplicating work + frames[b]->i_cost_est[b-p0][p1-b] = 0; + + do_search[0] = b != p0 && frames[b]->lowres_mvs[0][b-p0-1][0][0] == 0x7FFF; + do_search[1] = b != p1 && frames[b]->lowres_mvs[1][p1-b-1][0][0] == 0x7FFF; + if( do_search[0] ) + { + if( h->param.analyse.i_weighted_pred && b == p1 ) + { + x264_emms(); + x264_weights_analyse( h, frames[b], frames[p0], 1 ); + w = frames[b]->weight[0]; + } + frames[b]->lowres_mvs[0][b-p0-1][0][0] = 0; + } + if( do_search[1] ) + frames[b]->lowres_mvs[1][p1-b-1][0][0] = 0; + if( b == p1 ) + frames[b]->i_intra_mbs[b-p0] = 0; + if( p1 != p0 ) + dist_scale_factor = ( ((b-p0) << 8) + ((p1-p0) >> 1) ) / (p1-p0); + + frames[b]->i_cost_est[b-p0][p1-b] = 0; + frames[b]->i_cost_est_aq[b-p0][p1-b] = 0; + + x264_opencl_lowres_init( h, frames[b], lambda ); + + if( do_search[0] ) + { + x264_opencl_lowres_init( h, frames[p0], lambda ); + x264_opencl_motionsearch( h, frames, b, p0, 0, lambda, w ); + } + if( do_search[1] ) + { + x264_opencl_lowres_init( h, frames[p1], lambda ); + x264_opencl_motionsearch( h, frames, b, p1, 1, lambda, NULL ); + } + x264_opencl_finalize_cost( h, lambda, frames, p0, p1, b, dist_scale_factor ); + return 1; + } +} + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype.c b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype.c new file mode 100644 index 00000000..6c0aaa8c --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/encoder/slicetype.c @@ -0,0 +1,2033 @@ +/***************************************************************************** + * slicetype.c: lookahead analysis + ***************************************************************************** + * Copyright (C) 2005-2017 x264 project + * + * Authors: Fiona Glaser + * Loren Merritt + * Dylan Yudaken + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#include "common/common.h" +#include "macroblock.h" +#include "me.h" + +// Indexed by pic_struct values +static const uint8_t delta_tfi_divisor[10] = { 0, 2, 1, 1, 2, 2, 3, 3, 4, 6 }; + +static int x264_slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a, + x264_frame_t **frames, int p0, int p1, int b ); + +void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead ); + +#if HAVE_OPENCL +int x264_opencl_lowres_init( x264_t *h, x264_frame_t *fenc, int lambda ); +int x264_opencl_motionsearch( x264_t *h, x264_frame_t **frames, int b, int ref, int b_islist1, int lambda, const x264_weight_t *w ); +int x264_opencl_finalize_cost( x264_t *h, int lambda, x264_frame_t **frames, int p0, int p1, int b, int dist_scale_factor ); +int x264_opencl_precalculate_frame_cost( x264_t *h, x264_frame_t **frames, int lambda, int p0, int p1, int b ); +void x264_opencl_flush( x264_t *h ); +void x264_opencl_slicetype_prep( x264_t *h, x264_frame_t **frames, int num_frames, int lambda ); +void x264_opencl_slicetype_end( x264_t *h ); +#endif + +static void x264_lowres_context_init( x264_t *h, x264_mb_analysis_t *a ) +{ + a->i_qp = X264_LOOKAHEAD_QP; + a->i_lambda = x264_lambda_tab[ a->i_qp ]; + x264_mb_analyse_load_costs( h, a ); + if( h->param.analyse.i_subpel_refine > 1 ) + { + h->mb.i_me_method = X264_MIN( X264_ME_HEX, h->param.analyse.i_me_method ); + h->mb.i_subpel_refine = 4; + } + else + { + h->mb.i_me_method = X264_ME_DIA; + h->mb.i_subpel_refine = 2; + } + h->mb.b_chroma_me = 0; +} + +/* makes a non-h264 weight (i.e. fix7), into an h264 weight */ +static void x264_weight_get_h264( int weight_nonh264, int offset, x264_weight_t *w ) +{ + w->i_offset = offset; + w->i_denom = 7; + w->i_scale = weight_nonh264; + while( w->i_denom > 0 && (w->i_scale > 127) ) + { + w->i_denom--; + w->i_scale >>= 1; + } + w->i_scale = X264_MIN( w->i_scale, 127 ); +} + +static NOINLINE pixel *x264_weight_cost_init_luma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dest ) +{ + int ref0_distance = fenc->i_frame - ref->i_frame - 1; + /* Note: this will never run during lookahead as weights_analyse is only called if no + * motion search has been done. */ + if( fenc->lowres_mvs[0][ref0_distance][0][0] != 0x7FFF ) + { + int i_stride = fenc->i_stride_lowres; + int i_lines = fenc->i_lines_lowres; + int i_width = fenc->i_width_lowres; + int i_mb_xy = 0; + pixel *p = dest; + + for( int y = 0; y < i_lines; y += 8, p += i_stride*8 ) + for( int x = 0; x < i_width; x += 8, i_mb_xy++ ) + { + int mvx = fenc->lowres_mvs[0][ref0_distance][i_mb_xy][0]; + int mvy = fenc->lowres_mvs[0][ref0_distance][i_mb_xy][1]; + h->mc.mc_luma( p+x, i_stride, ref->lowres, i_stride, + mvx+(x<<2), mvy+(y<<2), 8, 8, x264_weight_none ); + } + x264_emms(); + return dest; + } + x264_emms(); + return ref->lowres[0]; +} + +/* How data is organized for 4:2:0/4:2:2 chroma weightp: + * [U: ref] [U: fenc] + * [V: ref] [V: fenc] + * fenc = ref + offset + * v = u + stride * chroma height */ + +static NOINLINE void x264_weight_cost_init_chroma( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dstu, pixel *dstv ) +{ + int ref0_distance = fenc->i_frame - ref->i_frame - 1; + int i_stride = fenc->i_stride[1]; + int i_offset = i_stride / 2; + int i_lines = fenc->i_lines[1]; + int i_width = fenc->i_width[1]; + int v_shift = CHROMA_V_SHIFT; + int cw = 8*h->mb.i_mb_width; + int ch = 16*h->mb.i_mb_height >> v_shift; + int height = 16 >> v_shift; + + if( fenc->lowres_mvs[0][ref0_distance][0][0] != 0x7FFF ) + { + x264_frame_expand_border_chroma( h, ref, 1 ); + for( int y = 0, mb_xy = 0, pel_offset_y = 0; y < i_lines; y += height, pel_offset_y = y*i_stride ) + for( int x = 0, pel_offset_x = 0; x < i_width; x += 8, mb_xy++, pel_offset_x += 8 ) + { + pixel *pixu = dstu + pel_offset_y + pel_offset_x; + pixel *pixv = dstv + pel_offset_y + pel_offset_x; + pixel *src1 = ref->plane[1] + pel_offset_y + pel_offset_x*2; /* NV12/NV16 */ + int mvx = fenc->lowres_mvs[0][ref0_distance][mb_xy][0]; + int mvy = fenc->lowres_mvs[0][ref0_distance][mb_xy][1]; + h->mc.mc_chroma( pixu, pixv, i_stride, src1, i_stride, mvx, 2*mvy>>v_shift, 8, height ); + } + } + else + h->mc.plane_copy_deinterleave( dstu, i_stride, dstv, i_stride, ref->plane[1], i_stride, cw, ch ); + h->mc.plane_copy_deinterleave( dstu+i_offset, i_stride, dstv+i_offset, i_stride, fenc->plane[1], i_stride, cw, ch ); + x264_emms(); +} + +static NOINLINE pixel *x264_weight_cost_init_chroma444( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, pixel *dst, int p ) +{ + int ref0_distance = fenc->i_frame - ref->i_frame - 1; + int i_stride = fenc->i_stride[p]; + int i_lines = fenc->i_lines[p]; + int i_width = fenc->i_width[p]; + + if( fenc->lowres_mvs[0][ref0_distance][0][0] != 0x7FFF ) + { + x264_frame_expand_border_chroma( h, ref, p ); + for( int y = 0, mb_xy = 0, pel_offset_y = 0; y < i_lines; y += 16, pel_offset_y = y*i_stride ) + for( int x = 0, pel_offset_x = 0; x < i_width; x += 16, mb_xy++, pel_offset_x += 16 ) + { + pixel *pix = dst + pel_offset_y + pel_offset_x; + pixel *src = ref->plane[p] + pel_offset_y + pel_offset_x; + int mvx = fenc->lowres_mvs[0][ref0_distance][mb_xy][0] / 2; + int mvy = fenc->lowres_mvs[0][ref0_distance][mb_xy][1] / 2; + /* We don't want to calculate hpels for fenc frames, so we round the motion + * vectors to fullpel here. It's not too bad, I guess? */ + h->mc.copy_16x16_unaligned( pix, i_stride, src+mvx+mvy*i_stride, i_stride, 16 ); + } + x264_emms(); + return dst; + } + x264_emms(); + return ref->plane[p]; +} + +static int x264_weight_slice_header_cost( x264_t *h, x264_weight_t *w, int b_chroma ) +{ + /* Add cost of weights in the slice header. */ + int lambda = x264_lambda_tab[X264_LOOKAHEAD_QP]; + /* 4 times higher, because chroma is analyzed at full resolution. */ + if( b_chroma ) + lambda *= 4; + int numslices; + if( h->param.i_slice_count ) + numslices = h->param.i_slice_count; + else if( h->param.i_slice_max_mbs ) + numslices = (h->mb.i_mb_width * h->mb.i_mb_height + h->param.i_slice_max_mbs-1) / h->param.i_slice_max_mbs; + else + numslices = 1; + /* FIXME: find a way to account for --slice-max-size? + * Multiply by 2 as there will be a duplicate. 10 bits added as if there is a weighted frame, then an additional duplicate is used. + * Cut denom cost in half if chroma, since it's shared between the two chroma planes. */ + int denom_cost = bs_size_ue( w[0].i_denom ) * (2 - b_chroma); + return lambda * numslices * ( 10 + denom_cost + 2 * (bs_size_se( w[0].i_scale ) + bs_size_se( w[0].i_offset )) ); +} + +static NOINLINE unsigned int x264_weight_cost_luma( x264_t *h, x264_frame_t *fenc, pixel *src, x264_weight_t *w ) +{ + unsigned int cost = 0; + int i_stride = fenc->i_stride_lowres; + int i_lines = fenc->i_lines_lowres; + int i_width = fenc->i_width_lowres; + pixel *fenc_plane = fenc->lowres[0]; + ALIGNED_ARRAY_16( pixel, buf,[8*8] ); + int pixoff = 0; + int i_mb = 0; + + if( w ) + { + for( int y = 0; y < i_lines; y += 8, pixoff = y*i_stride ) + for( int x = 0; x < i_width; x += 8, i_mb++, pixoff += 8) + { + w->weightfn[8>>2]( buf, 8, &src[pixoff], i_stride, w, 8 ); + int cmp = h->pixf.mbcmp[PIXEL_8x8]( buf, 8, &fenc_plane[pixoff], i_stride ); + cost += X264_MIN( cmp, fenc->i_intra_cost[i_mb] ); + } + cost += x264_weight_slice_header_cost( h, w, 0 ); + } + else + for( int y = 0; y < i_lines; y += 8, pixoff = y*i_stride ) + for( int x = 0; x < i_width; x += 8, i_mb++, pixoff += 8 ) + { + int cmp = h->pixf.mbcmp[PIXEL_8x8]( &src[pixoff], i_stride, &fenc_plane[pixoff], i_stride ); + cost += X264_MIN( cmp, fenc->i_intra_cost[i_mb] ); + } + x264_emms(); + return cost; +} + +static NOINLINE unsigned int x264_weight_cost_chroma( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w ) +{ + unsigned int cost = 0; + int i_stride = fenc->i_stride[1]; + int i_lines = fenc->i_lines[1]; + int i_width = fenc->i_width[1]; + pixel *src = ref + (i_stride >> 1); + ALIGNED_ARRAY_16( pixel, buf, [8*16] ); + int pixoff = 0; + int height = 16 >> CHROMA_V_SHIFT; + if( w ) + { + for( int y = 0; y < i_lines; y += height, pixoff = y*i_stride ) + for( int x = 0; x < i_width; x += 8, pixoff += 8 ) + { + w->weightfn[8>>2]( buf, 8, &ref[pixoff], i_stride, w, height ); + /* The naive and seemingly sensible algorithm is to use mbcmp as in luma. + * But testing shows that for chroma the DC coefficient is by far the most + * important part of the coding cost. Thus a more useful chroma weight is + * obtained by comparing each block's DC coefficient instead of the actual + * pixels. */ + cost += h->pixf.asd8( buf, 8, &src[pixoff], i_stride, height ); + } + cost += x264_weight_slice_header_cost( h, w, 1 ); + } + else + for( int y = 0; y < i_lines; y += height, pixoff = y*i_stride ) + for( int x = 0; x < i_width; x += 8, pixoff += 8 ) + cost += h->pixf.asd8( &ref[pixoff], i_stride, &src[pixoff], i_stride, height ); + x264_emms(); + return cost; +} + +static NOINLINE unsigned int x264_weight_cost_chroma444( x264_t *h, x264_frame_t *fenc, pixel *ref, x264_weight_t *w, int p ) +{ + unsigned int cost = 0; + int i_stride = fenc->i_stride[p]; + int i_lines = fenc->i_lines[p]; + int i_width = fenc->i_width[p]; + pixel *src = fenc->plane[p]; + ALIGNED_ARRAY_64( pixel, buf, [16*16] ); + int pixoff = 0; + if( w ) + { + for( int y = 0; y < i_lines; y += 16, pixoff = y*i_stride ) + for( int x = 0; x < i_width; x += 16, pixoff += 16 ) + { + w->weightfn[16>>2]( buf, 16, &ref[pixoff], i_stride, w, 16 ); + cost += h->pixf.mbcmp[PIXEL_16x16]( buf, 16, &src[pixoff], i_stride ); + } + cost += x264_weight_slice_header_cost( h, w, 1 ); + } + else + for( int y = 0; y < i_lines; y += 16, pixoff = y*i_stride ) + for( int x = 0; x < i_width; x += 16, pixoff += 16 ) + cost += h->pixf.mbcmp[PIXEL_16x16]( &ref[pixoff], i_stride, &src[pixoff], i_stride ); + x264_emms(); + return cost; +} + +void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int b_lookahead ) +{ + int i_delta_index = fenc->i_frame - ref->i_frame - 1; + /* epsilon is chosen to require at least a numerator of 127 (with denominator = 128) */ + const float epsilon = 1.f/128.f; + x264_weight_t *weights = fenc->weight[0]; + SET_WEIGHT( weights[0], 0, 1, 0, 0 ); + SET_WEIGHT( weights[1], 0, 1, 0, 0 ); + SET_WEIGHT( weights[2], 0, 1, 0, 0 ); + int chroma_initted = 0; + float guess_scale[3]; + float fenc_mean[3]; + float ref_mean[3]; + for( int plane = 0; plane <= 2*!b_lookahead; plane++ ) + { + float fenc_var = fenc->i_pixel_ssd[plane] + !ref->i_pixel_ssd[plane]; + float ref_var = ref->i_pixel_ssd[plane] + !ref->i_pixel_ssd[plane]; + guess_scale[plane] = sqrtf( fenc_var / ref_var ); + fenc_mean[plane] = (float)fenc->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8)); + ref_mean[plane] = (float) ref->i_pixel_sum[plane] / (fenc->i_lines[!!plane] * fenc->i_width[!!plane]) / (1 << (BIT_DEPTH - 8)); + } + + int chroma_denom = 7; + if( !b_lookahead ) + { + /* make sure both our scale factors fit */ + while( chroma_denom > 0 ) + { + float thresh = 127.f / (1< 127 ) + { + weights[1].weightfn = weights[2].weightfn = NULL; + break; + } + } + else + x264_weight_get_h264( round( guess_scale[plane] * 128 ), 0, &weights[plane] ); + + found = 0; + mindenom = weights[plane].i_denom; + minscale = weights[plane].i_scale; + minoff = 0; + + pixel *mcbuf; + if( !plane ) + { + if( !fenc->b_intra_calculated ) + { + x264_mb_analysis_t a; + x264_lowres_context_init( h, &a ); + x264_slicetype_frame_cost( h, &a, &fenc, 0, 0, 0 ); + } + mcbuf = x264_weight_cost_init_luma( h, fenc, ref, h->mb.p_weight_buf[0] ); + origscore = minscore = x264_weight_cost_luma( h, fenc, mcbuf, NULL ); + } + else + { + if( CHROMA444 ) + { + mcbuf = x264_weight_cost_init_chroma444( h, fenc, ref, h->mb.p_weight_buf[0], plane ); + origscore = minscore = x264_weight_cost_chroma444( h, fenc, mcbuf, NULL, plane ); + } + else + { + pixel *dstu = h->mb.p_weight_buf[0]; + pixel *dstv = h->mb.p_weight_buf[0]+fenc->i_stride[1]*fenc->i_lines[1]; + if( !chroma_initted++ ) + x264_weight_cost_init_chroma( h, fenc, ref, dstu, dstv ); + mcbuf = plane == 1 ? dstu : dstv; + origscore = minscore = x264_weight_cost_chroma( h, fenc, mcbuf, NULL ); + } + } + + if( !minscore ) + continue; + + /* Picked somewhat arbitrarily */ + static const uint8_t weight_check_distance[][2] = + { + {0,0},{0,0},{0,1},{0,1}, + {0,1},{0,1},{0,1},{1,1}, + {1,1},{2,1},{2,1},{4,2} + }; + int scale_dist = b_lookahead ? 0 : weight_check_distance[h->param.analyse.i_subpel_refine][0]; + int offset_dist = b_lookahead ? 0 : weight_check_distance[h->param.analyse.i_subpel_refine][1]; + + int start_scale = x264_clip3( minscale - scale_dist, 0, 127 ); + int end_scale = x264_clip3( minscale + scale_dist, 0, 127 ); + for( int i_scale = start_scale; i_scale <= end_scale; i_scale++ ) + { + int cur_scale = i_scale; + int cur_offset = fenc_mean[plane] - ref_mean[plane] * cur_scale / (1 << mindenom) + 0.5f * b_lookahead; + if( cur_offset < - 128 || cur_offset > 127 ) + { + /* Rescale considering the constraints on cur_offset. We do it in this order + * because scale has a much wider range than offset (because of denom), so + * it should almost never need to be clamped. */ + cur_offset = x264_clip3( cur_offset, -128, 127 ); + cur_scale = (1 << mindenom) * (fenc_mean[plane] - cur_offset) / ref_mean[plane] + 0.5f; + cur_scale = x264_clip3( cur_scale, 0, 127 ); + } + int start_offset = x264_clip3( cur_offset - offset_dist, -128, 127 ); + int end_offset = x264_clip3( cur_offset + offset_dist, -128, 127 ); + for( int i_off = start_offset; i_off <= end_offset; i_off++ ) + { + SET_WEIGHT( weights[plane], 1, cur_scale, mindenom, i_off ); + unsigned int s; + if( plane ) + { + if( CHROMA444 ) + s = x264_weight_cost_chroma444( h, fenc, mcbuf, &weights[plane], plane ); + else + s = x264_weight_cost_chroma( h, fenc, mcbuf, &weights[plane] ); + } + else + s = x264_weight_cost_luma( h, fenc, mcbuf, &weights[plane] ); + COPY4_IF_LT( minscore, s, minscale, cur_scale, minoff, i_off, found, 1 ); + + // Don't check any more offsets if the previous one had a lower cost than the current one + if( minoff == start_offset && i_off != start_offset ) + break; + } + } + x264_emms(); + + /* Use a smaller denominator if possible */ + if( !plane ) + { + while( mindenom > 0 && !(minscale&1) ) + { + mindenom--; + minscale >>= 1; + } + } + + /* FIXME: More analysis can be done here on SAD vs. SATD termination. */ + /* 0.2% termination derived experimentally to avoid weird weights in frames that are mostly intra. */ + if( !found || (minscale == 1 << mindenom && minoff == 0) || (float)minscore / origscore > 0.998f ) + { + SET_WEIGHT( weights[plane], 0, 1, 0, 0 ); + continue; + } + else + SET_WEIGHT( weights[plane], 1, minscale, mindenom, minoff ); + + if( h->param.analyse.i_weighted_pred == X264_WEIGHTP_FAKE && weights[0].weightfn && !plane ) + fenc->f_weighted_cost_delta[i_delta_index] = (float)minscore / origscore; + } + + /* Optimize and unify denominator */ + if( weights[1].weightfn || weights[2].weightfn ) + { + int denom = weights[1].weightfn ? weights[1].i_denom : weights[2].i_denom; + int both_weighted = weights[1].weightfn && weights[2].weightfn; + /* If only one plane is weighted, the other has an implicit scale of 1< 0 && !(weights[1].weightfn && (weights[1].i_scale&1)) + && !(weights[2].weightfn && (weights[2].i_scale&1))) ) + { + denom--; + for( int i = 1; i <= 2; i++ ) + if( weights[i].weightfn ) + { + weights[i].i_scale >>= 1; + weights[i].i_denom = denom; + } + } + } + for( int i = 1; i <= 2; i++ ) + if( weights[i].weightfn ) + h->mc.weight_cache( h, &weights[i] ); + + if( weights[0].weightfn && b_lookahead ) + { + //scale lowres in lookahead for slicetype_frame_cost + pixel *src = ref->buffer_lowres[0]; + pixel *dst = h->mb.p_weight_buf[0]; + int width = ref->i_width_lowres + PADH*2; + int height = ref->i_lines_lowres + PADV*2; + x264_weight_scale_plane( h, dst, ref->i_stride_lowres, src, ref->i_stride_lowres, + width, height, &weights[0] ); + fenc->weighted[0] = h->mb.p_weight_buf[0] + PADH + ref->i_stride_lowres * PADV; + } +} + +/* Output buffers are separated by 128 bytes to avoid false sharing of cachelines + * in multithreaded lookahead. */ +#define PAD_SIZE 32 +/* cost_est, cost_est_aq, intra_mbs, num rows */ +#define NUM_INTS 4 +#define COST_EST 0 +#define COST_EST_AQ 1 +#define INTRA_MBS 2 +#define NUM_ROWS 3 +#define ROW_SATD (NUM_INTS + (h->mb.i_mb_y - h->i_threadslice_start)) + +static void x264_slicetype_mb_cost( x264_t *h, x264_mb_analysis_t *a, + x264_frame_t **frames, int p0, int p1, int b, + int dist_scale_factor, int do_search[2], const x264_weight_t *w, + int *output_inter, int *output_intra ) +{ + x264_frame_t *fref0 = frames[p0]; + x264_frame_t *fref1 = frames[p1]; + x264_frame_t *fenc = frames[b]; + const int b_bidir = (b < p1); + const int i_mb_x = h->mb.i_mb_x; + const int i_mb_y = h->mb.i_mb_y; + const int i_mb_stride = h->mb.i_mb_width; + const int i_mb_xy = i_mb_x + i_mb_y * i_mb_stride; + const int i_stride = fenc->i_stride_lowres; + const int i_pel_offset = 8 * (i_mb_x + i_mb_y * i_stride); + const int i_bipred_weight = h->param.analyse.b_weighted_bipred ? 64 - (dist_scale_factor>>2) : 32; + int16_t (*fenc_mvs[2])[2] = { &fenc->lowres_mvs[0][b-p0-1][i_mb_xy], &fenc->lowres_mvs[1][p1-b-1][i_mb_xy] }; + int (*fenc_costs[2]) = { &fenc->lowres_mv_costs[0][b-p0-1][i_mb_xy], &fenc->lowres_mv_costs[1][p1-b-1][i_mb_xy] }; + int b_frame_score_mb = (i_mb_x > 0 && i_mb_x < h->mb.i_mb_width - 1 && + i_mb_y > 0 && i_mb_y < h->mb.i_mb_height - 1) || + h->mb.i_mb_width <= 2 || h->mb.i_mb_height <= 2; + + ALIGNED_ARRAY_16( pixel, pix1,[9*FDEC_STRIDE] ); + pixel *pix2 = pix1+8; + x264_me_t m[2]; + int i_bcost = COST_MAX; + int list_used = 0; + /* A small, arbitrary bias to avoid VBV problems caused by zero-residual lookahead blocks. */ + int lowres_penalty = 4; + + h->mb.pic.p_fenc[0] = h->mb.pic.fenc_buf; + h->mc.copy[PIXEL_8x8]( h->mb.pic.p_fenc[0], FENC_STRIDE, &fenc->lowres[0][i_pel_offset], i_stride, 8 ); + + if( p0 == p1 ) + goto lowres_intra_mb; + + int mv_range = 2 * h->param.analyse.i_mv_range; + // no need for h->mb.mv_min[] + h->mb.mv_min_spel[0] = X264_MAX( 4*(-8*h->mb.i_mb_x - 12), -mv_range ); + h->mb.mv_max_spel[0] = X264_MIN( 4*(8*(h->mb.i_mb_width - h->mb.i_mb_x - 1) + 12), mv_range-1 ); + h->mb.mv_limit_fpel[0][0] = h->mb.mv_min_spel[0] >> 2; + h->mb.mv_limit_fpel[1][0] = h->mb.mv_max_spel[0] >> 2; + if( h->mb.i_mb_x >= h->mb.i_mb_width - 2 ) + { + h->mb.mv_min_spel[1] = X264_MAX( 4*(-8*h->mb.i_mb_y - 12), -mv_range ); + h->mb.mv_max_spel[1] = X264_MIN( 4*(8*( h->mb.i_mb_height - h->mb.i_mb_y - 1) + 12), mv_range-1 ); + h->mb.mv_limit_fpel[0][1] = h->mb.mv_min_spel[1] >> 2; + h->mb.mv_limit_fpel[1][1] = h->mb.mv_max_spel[1] >> 2; + } + +#define LOAD_HPELS_LUMA(dst, src) \ + { \ + (dst)[0] = &(src)[0][i_pel_offset]; \ + (dst)[1] = &(src)[1][i_pel_offset]; \ + (dst)[2] = &(src)[2][i_pel_offset]; \ + (dst)[3] = &(src)[3][i_pel_offset]; \ + } +#define LOAD_WPELS_LUMA(dst,src) \ + (dst) = &(src)[i_pel_offset]; + +#define CLIP_MV( mv ) \ + { \ + mv[0] = x264_clip3( mv[0], h->mb.mv_min_spel[0], h->mb.mv_max_spel[0] ); \ + mv[1] = x264_clip3( mv[1], h->mb.mv_min_spel[1], h->mb.mv_max_spel[1] ); \ + } +#define TRY_BIDIR( mv0, mv1, penalty ) \ + { \ + int i_cost; \ + if( h->param.analyse.i_subpel_refine <= 1 ) \ + { \ + int hpel_idx1 = (((mv0)[0]&2)>>1) + ((mv0)[1]&2); \ + int hpel_idx2 = (((mv1)[0]&2)>>1) + ((mv1)[1]&2); \ + pixel *src1 = m[0].p_fref[hpel_idx1] + ((mv0)[0]>>2) + ((mv0)[1]>>2) * m[0].i_stride[0]; \ + pixel *src2 = m[1].p_fref[hpel_idx2] + ((mv1)[0]>>2) + ((mv1)[1]>>2) * m[1].i_stride[0]; \ + h->mc.avg[PIXEL_8x8]( pix1, 16, src1, m[0].i_stride[0], src2, m[1].i_stride[0], i_bipred_weight ); \ + } \ + else \ + { \ + intptr_t stride1 = 16, stride2 = 16; \ + pixel *src1, *src2; \ + src1 = h->mc.get_ref( pix1, &stride1, m[0].p_fref, m[0].i_stride[0], \ + (mv0)[0], (mv0)[1], 8, 8, w ); \ + src2 = h->mc.get_ref( pix2, &stride2, m[1].p_fref, m[1].i_stride[0], \ + (mv1)[0], (mv1)[1], 8, 8, w ); \ + h->mc.avg[PIXEL_8x8]( pix1, 16, src1, stride1, src2, stride2, i_bipred_weight ); \ + } \ + i_cost = penalty * a->i_lambda + h->pixf.mbcmp[PIXEL_8x8]( \ + m[0].p_fenc[0], FENC_STRIDE, pix1, 16 ); \ + COPY2_IF_LT( i_bcost, i_cost, list_used, 3 ); \ + } + + m[0].i_pixel = PIXEL_8x8; + m[0].p_cost_mv = a->p_cost_mv; + m[0].i_stride[0] = i_stride; + m[0].p_fenc[0] = h->mb.pic.p_fenc[0]; + m[0].weight = w; + m[0].i_ref = 0; + LOAD_HPELS_LUMA( m[0].p_fref, fref0->lowres ); + m[0].p_fref_w = m[0].p_fref[0]; + if( w[0].weightfn ) + LOAD_WPELS_LUMA( m[0].p_fref_w, fenc->weighted[0] ); + + if( b_bidir ) + { + ALIGNED_ARRAY_8( int16_t, dmv,[2],[2] ); + + m[1].i_pixel = PIXEL_8x8; + m[1].p_cost_mv = a->p_cost_mv; + m[1].i_stride[0] = i_stride; + m[1].p_fenc[0] = h->mb.pic.p_fenc[0]; + m[1].i_ref = 0; + m[1].weight = x264_weight_none; + LOAD_HPELS_LUMA( m[1].p_fref, fref1->lowres ); + m[1].p_fref_w = m[1].p_fref[0]; + + if( fref1->lowres_mvs[0][p1-p0-1][0][0] != 0x7FFF ) + { + int16_t *mvr = fref1->lowres_mvs[0][p1-p0-1][i_mb_xy]; + dmv[0][0] = ( mvr[0] * dist_scale_factor + 128 ) >> 8; + dmv[0][1] = ( mvr[1] * dist_scale_factor + 128 ) >> 8; + dmv[1][0] = dmv[0][0] - mvr[0]; + dmv[1][1] = dmv[0][1] - mvr[1]; + CLIP_MV( dmv[0] ); + CLIP_MV( dmv[1] ); + if( h->param.analyse.i_subpel_refine <= 1 ) + M64( dmv ) &= ~0x0001000100010001ULL; /* mv & ~1 */ + } + else + M64( dmv ) = 0; + + TRY_BIDIR( dmv[0], dmv[1], 0 ); + if( M64( dmv ) ) + { + int i_cost; + h->mc.avg[PIXEL_8x8]( pix1, 16, m[0].p_fref[0], m[0].i_stride[0], m[1].p_fref[0], m[1].i_stride[0], i_bipred_weight ); + i_cost = h->pixf.mbcmp[PIXEL_8x8]( m[0].p_fenc[0], FENC_STRIDE, pix1, 16 ); + COPY2_IF_LT( i_bcost, i_cost, list_used, 3 ); + } + } + + for( int l = 0; l < 1 + b_bidir; l++ ) + { + if( do_search[l] ) + { + int i_mvc = 0; + int16_t (*fenc_mv)[2] = fenc_mvs[l]; + ALIGNED_4( int16_t mvc[4][2] ); + + /* Reverse-order MV prediction. */ + M32( mvc[0] ) = 0; + M32( mvc[2] ) = 0; +#define MVC(mv) { CP32( mvc[i_mvc], mv ); i_mvc++; } + if( i_mb_x < h->mb.i_mb_width - 1 ) + MVC( fenc_mv[1] ); + if( i_mb_y < h->i_threadslice_end - 1 ) + { + MVC( fenc_mv[i_mb_stride] ); + if( i_mb_x > 0 ) + MVC( fenc_mv[i_mb_stride-1] ); + if( i_mb_x < h->mb.i_mb_width - 1 ) + MVC( fenc_mv[i_mb_stride+1] ); + } +#undef MVC + if( i_mvc <= 1 ) + CP32( m[l].mvp, mvc[0] ); + else + x264_median_mv( m[l].mvp, mvc[0], mvc[1], mvc[2] ); + + /* Fast skip for cases of near-zero residual. Shortcut: don't bother except in the mv0 case, + * since anything else is likely to have enough residual to not trigger the skip. */ + if( !M32( m[l].mvp ) ) + { + m[l].cost = h->pixf.mbcmp[PIXEL_8x8]( m[l].p_fenc[0], FENC_STRIDE, m[l].p_fref[0], m[l].i_stride[0] ); + if( m[l].cost < 64 ) + { + M32( m[l].mv ) = 0; + goto skip_motionest; + } + } + + x264_me_search( h, &m[l], mvc, i_mvc ); + m[l].cost -= a->p_cost_mv[0]; // remove mvcost from skip mbs + if( M32( m[l].mv ) ) + m[l].cost += 5 * a->i_lambda; + +skip_motionest: + CP32( fenc_mvs[l], m[l].mv ); + *fenc_costs[l] = m[l].cost; + } + else + { + CP32( m[l].mv, fenc_mvs[l] ); + m[l].cost = *fenc_costs[l]; + } + COPY2_IF_LT( i_bcost, m[l].cost, list_used, l+1 ); + } + + if( b_bidir && ( M32( m[0].mv ) || M32( m[1].mv ) ) ) + TRY_BIDIR( m[0].mv, m[1].mv, 5 ); + +lowres_intra_mb: + if( !fenc->b_intra_calculated ) + { + ALIGNED_ARRAY_16( pixel, edge,[36] ); + pixel *pix = &pix1[8+FDEC_STRIDE]; + pixel *src = &fenc->lowres[0][i_pel_offset]; + const int intra_penalty = 5 * a->i_lambda; + int satds[3]; + int pixoff = 4 / sizeof(pixel); + + /* Avoid store forwarding stalls by writing larger chunks */ + memcpy( pix-FDEC_STRIDE, src-i_stride, 16 * sizeof(pixel) ); + for( int i = -1; i < 8; i++ ) + M32( &pix[i*FDEC_STRIDE-pixoff] ) = M32( &src[i*i_stride-pixoff] ); + + h->pixf.intra_mbcmp_x3_8x8c( h->mb.pic.p_fenc[0], pix, satds ); + int i_icost = X264_MIN3( satds[0], satds[1], satds[2] ); + + if( h->param.analyse.i_subpel_refine > 1 ) + { + h->predict_8x8c[I_PRED_CHROMA_P]( pix ); + int satd = h->pixf.mbcmp[PIXEL_8x8]( h->mb.pic.p_fenc[0], FENC_STRIDE, pix, FDEC_STRIDE ); + i_icost = X264_MIN( i_icost, satd ); + h->predict_8x8_filter( pix, edge, ALL_NEIGHBORS, ALL_NEIGHBORS ); + for( int i = 3; i < 9; i++ ) + { + h->predict_8x8[i]( pix, edge ); + satd = h->pixf.mbcmp[PIXEL_8x8]( h->mb.pic.p_fenc[0], FENC_STRIDE, pix, FDEC_STRIDE ); + i_icost = X264_MIN( i_icost, satd ); + } + } + + i_icost = ((i_icost + intra_penalty) >> (BIT_DEPTH - 8)) + lowres_penalty; + fenc->i_intra_cost[i_mb_xy] = i_icost; + int i_icost_aq = i_icost; + if( h->param.rc.i_aq_mode ) + i_icost_aq = (i_icost_aq * fenc->i_inv_qscale_factor[i_mb_xy] + 128) >> 8; + output_intra[ROW_SATD] += i_icost_aq; + if( b_frame_score_mb ) + { + output_intra[COST_EST] += i_icost; + output_intra[COST_EST_AQ] += i_icost_aq; + } + } + i_bcost = (i_bcost >> (BIT_DEPTH - 8)) + lowres_penalty; + + /* forbid intra-mbs in B-frames, because it's rare and not worth checking */ + /* FIXME: Should we still forbid them now that we cache intra scores? */ + if( !b_bidir ) + { + int i_icost = fenc->i_intra_cost[i_mb_xy]; + int b_intra = i_icost < i_bcost; + if( b_intra ) + { + i_bcost = i_icost; + list_used = 0; + } + if( b_frame_score_mb ) + output_inter[INTRA_MBS] += b_intra; + } + + /* In an I-frame, we've already added the results above in the intra section. */ + if( p0 != p1 ) + { + int i_bcost_aq = i_bcost; + if( h->param.rc.i_aq_mode ) + i_bcost_aq = (i_bcost_aq * fenc->i_inv_qscale_factor[i_mb_xy] + 128) >> 8; + output_inter[ROW_SATD] += i_bcost_aq; + if( b_frame_score_mb ) + { + /* Don't use AQ-weighted costs for slicetype decision, only for ratecontrol. */ + output_inter[COST_EST] += i_bcost; + output_inter[COST_EST_AQ] += i_bcost_aq; + } + } + + fenc->lowres_costs[b-p0][p1-b][i_mb_xy] = X264_MIN( i_bcost, LOWRES_COST_MASK ) + (list_used << LOWRES_COST_SHIFT); +} +#undef TRY_BIDIR + +#define NUM_MBS\ + (h->mb.i_mb_width > 2 && h->mb.i_mb_height > 2 ?\ + (h->mb.i_mb_width - 2) * (h->mb.i_mb_height - 2) :\ + h->mb.i_mb_width * h->mb.i_mb_height) + +typedef struct +{ + x264_t *h; + x264_mb_analysis_t *a; + x264_frame_t **frames; + int p0; + int p1; + int b; + int dist_scale_factor; + int *do_search; + const x264_weight_t *w; + int *output_inter; + int *output_intra; +} x264_slicetype_slice_t; + +static void x264_slicetype_slice_cost( x264_slicetype_slice_t *s ) +{ + x264_t *h = s->h; + + /* Lowres lookahead goes backwards because the MVs are used as predictors in the main encode. + * This considerably improves MV prediction overall. */ + + /* The edge mbs seem to reduce the predictive quality of the + * whole frame's score, but are needed for a spatial distribution. */ + int do_edges = h->param.rc.b_mb_tree || h->param.rc.i_vbv_buffer_size || h->mb.i_mb_width <= 2 || h->mb.i_mb_height <= 2; + + int start_y = X264_MIN( h->i_threadslice_end - 1, h->mb.i_mb_height - 2 + do_edges ); + int end_y = X264_MAX( h->i_threadslice_start, 1 - do_edges ); + int start_x = h->mb.i_mb_width - 2 + do_edges; + int end_x = 1 - do_edges; + + for( h->mb.i_mb_y = start_y; h->mb.i_mb_y >= end_y; h->mb.i_mb_y-- ) + for( h->mb.i_mb_x = start_x; h->mb.i_mb_x >= end_x; h->mb.i_mb_x-- ) + x264_slicetype_mb_cost( h, s->a, s->frames, s->p0, s->p1, s->b, s->dist_scale_factor, + s->do_search, s->w, s->output_inter, s->output_intra ); +} + +static int x264_slicetype_frame_cost( x264_t *h, x264_mb_analysis_t *a, + x264_frame_t **frames, int p0, int p1, int b ) +{ + int i_score = 0; + int do_search[2]; + const x264_weight_t *w = x264_weight_none; + x264_frame_t *fenc = frames[b]; + + /* Check whether we already evaluated this frame + * If we have tried this frame as P, then we have also tried + * the preceding frames as B. (is this still true?) */ + /* Also check that we already calculated the row SATDs for the current frame. */ + if( fenc->i_cost_est[b-p0][p1-b] >= 0 && (!h->param.rc.i_vbv_buffer_size || fenc->i_row_satds[b-p0][p1-b][0] != -1) ) + i_score = fenc->i_cost_est[b-p0][p1-b]; + else + { + int dist_scale_factor = 128; + + /* For each list, check to see whether we have lowres motion-searched this reference frame before. */ + do_search[0] = b != p0 && fenc->lowres_mvs[0][b-p0-1][0][0] == 0x7FFF; + do_search[1] = b != p1 && fenc->lowres_mvs[1][p1-b-1][0][0] == 0x7FFF; + if( do_search[0] ) + { + if( h->param.analyse.i_weighted_pred && b == p1 ) + { + x264_emms(); + x264_weights_analyse( h, fenc, frames[p0], 1 ); + w = fenc->weight[0]; + } + fenc->lowres_mvs[0][b-p0-1][0][0] = 0; + } + if( do_search[1] ) fenc->lowres_mvs[1][p1-b-1][0][0] = 0; + + if( p1 != p0 ) + dist_scale_factor = ( ((b-p0) << 8) + ((p1-p0) >> 1) ) / (p1-p0); + + int output_buf_size = h->mb.i_mb_height + (NUM_INTS + PAD_SIZE) * h->param.i_lookahead_threads; + int *output_inter[X264_LOOKAHEAD_THREAD_MAX+1]; + int *output_intra[X264_LOOKAHEAD_THREAD_MAX+1]; + output_inter[0] = h->scratch_buffer2; + output_intra[0] = output_inter[0] + output_buf_size; + +#if HAVE_OPENCL + if( h->param.b_opencl ) + { + x264_opencl_lowres_init(h, fenc, a->i_lambda ); + if( do_search[0] ) + { + x264_opencl_lowres_init( h, frames[p0], a->i_lambda ); + x264_opencl_motionsearch( h, frames, b, p0, 0, a->i_lambda, w ); + } + if( do_search[1] ) + { + x264_opencl_lowres_init( h, frames[p1], a->i_lambda ); + x264_opencl_motionsearch( h, frames, b, p1, 1, a->i_lambda, NULL ); + } + if( b != p0 ) + x264_opencl_finalize_cost( h, a->i_lambda, frames, p0, p1, b, dist_scale_factor ); + x264_opencl_flush( h ); + + i_score = fenc->i_cost_est[b-p0][p1-b]; + } + else +#endif + { + if( h->param.i_lookahead_threads > 1 ) + { + x264_slicetype_slice_t s[X264_LOOKAHEAD_THREAD_MAX]; + + for( int i = 0; i < h->param.i_lookahead_threads; i++ ) + { + x264_t *t = h->lookahead_thread[i]; + + /* FIXME move this somewhere else */ + t->mb.i_me_method = h->mb.i_me_method; + t->mb.i_subpel_refine = h->mb.i_subpel_refine; + t->mb.b_chroma_me = h->mb.b_chroma_me; + + s[i] = (x264_slicetype_slice_t){ t, a, frames, p0, p1, b, dist_scale_factor, do_search, w, + output_inter[i], output_intra[i] }; + + t->i_threadslice_start = ((h->mb.i_mb_height * i + h->param.i_lookahead_threads/2) / h->param.i_lookahead_threads); + t->i_threadslice_end = ((h->mb.i_mb_height * (i+1) + h->param.i_lookahead_threads/2) / h->param.i_lookahead_threads); + + int thread_height = t->i_threadslice_end - t->i_threadslice_start; + int thread_output_size = thread_height + NUM_INTS; + memset( output_inter[i], 0, thread_output_size * sizeof(int) ); + memset( output_intra[i], 0, thread_output_size * sizeof(int) ); + output_inter[i][NUM_ROWS] = output_intra[i][NUM_ROWS] = thread_height; + + output_inter[i+1] = output_inter[i] + thread_output_size + PAD_SIZE; + output_intra[i+1] = output_intra[i] + thread_output_size + PAD_SIZE; + + x264_threadpool_run( h->lookaheadpool, (void*)x264_slicetype_slice_cost, &s[i] ); + } + for( int i = 0; i < h->param.i_lookahead_threads; i++ ) + x264_threadpool_wait( h->lookaheadpool, &s[i] ); + } + else + { + h->i_threadslice_start = 0; + h->i_threadslice_end = h->mb.i_mb_height; + memset( output_inter[0], 0, (output_buf_size - PAD_SIZE) * sizeof(int) ); + memset( output_intra[0], 0, (output_buf_size - PAD_SIZE) * sizeof(int) ); + output_inter[0][NUM_ROWS] = output_intra[0][NUM_ROWS] = h->mb.i_mb_height; + x264_slicetype_slice_t s = (x264_slicetype_slice_t){ h, a, frames, p0, p1, b, dist_scale_factor, do_search, w, + output_inter[0], output_intra[0] }; + x264_slicetype_slice_cost( &s ); + } + + /* Sum up accumulators */ + if( b == p1 ) + fenc->i_intra_mbs[b-p0] = 0; + if( !fenc->b_intra_calculated ) + { + fenc->i_cost_est[0][0] = 0; + fenc->i_cost_est_aq[0][0] = 0; + } + fenc->i_cost_est[b-p0][p1-b] = 0; + fenc->i_cost_est_aq[b-p0][p1-b] = 0; + + int *row_satd_inter = fenc->i_row_satds[b-p0][p1-b]; + int *row_satd_intra = fenc->i_row_satds[0][0]; + for( int i = 0; i < h->param.i_lookahead_threads; i++ ) + { + if( b == p1 ) + fenc->i_intra_mbs[b-p0] += output_inter[i][INTRA_MBS]; + if( !fenc->b_intra_calculated ) + { + fenc->i_cost_est[0][0] += output_intra[i][COST_EST]; + fenc->i_cost_est_aq[0][0] += output_intra[i][COST_EST_AQ]; + } + + fenc->i_cost_est[b-p0][p1-b] += output_inter[i][COST_EST]; + fenc->i_cost_est_aq[b-p0][p1-b] += output_inter[i][COST_EST_AQ]; + + if( h->param.rc.i_vbv_buffer_size ) + { + int row_count = output_inter[i][NUM_ROWS]; + memcpy( row_satd_inter, output_inter[i] + NUM_INTS, row_count * sizeof(int) ); + if( !fenc->b_intra_calculated ) + memcpy( row_satd_intra, output_intra[i] + NUM_INTS, row_count * sizeof(int) ); + row_satd_inter += row_count; + row_satd_intra += row_count; + } + } + + i_score = fenc->i_cost_est[b-p0][p1-b]; + if( b != p1 ) + i_score = (uint64_t)i_score * 100 / (120 + h->param.i_bframe_bias); + else + fenc->b_intra_calculated = 1; + + fenc->i_cost_est[b-p0][p1-b] = i_score; + x264_emms(); + } + } + + return i_score; +} + +/* If MB-tree changes the quantizers, we need to recalculate the frame cost without + * re-running lookahead. */ +static int x264_slicetype_frame_cost_recalculate( x264_t *h, x264_frame_t **frames, int p0, int p1, int b ) +{ + int i_score = 0; + int *row_satd = frames[b]->i_row_satds[b-p0][p1-b]; + float *qp_offset = IS_X264_TYPE_B(frames[b]->i_type) ? frames[b]->f_qp_offset_aq : frames[b]->f_qp_offset; + x264_emms(); + for( h->mb.i_mb_y = h->mb.i_mb_height - 1; h->mb.i_mb_y >= 0; h->mb.i_mb_y-- ) + { + row_satd[ h->mb.i_mb_y ] = 0; + for( h->mb.i_mb_x = h->mb.i_mb_width - 1; h->mb.i_mb_x >= 0; h->mb.i_mb_x-- ) + { + int i_mb_xy = h->mb.i_mb_x + h->mb.i_mb_y*h->mb.i_mb_stride; + int i_mb_cost = frames[b]->lowres_costs[b-p0][p1-b][i_mb_xy] & LOWRES_COST_MASK; + float qp_adj = qp_offset[i_mb_xy]; + i_mb_cost = (i_mb_cost * x264_exp2fix8(qp_adj) + 128) >> 8; + row_satd[ h->mb.i_mb_y ] += i_mb_cost; + if( (h->mb.i_mb_y > 0 && h->mb.i_mb_y < h->mb.i_mb_height - 1 && + h->mb.i_mb_x > 0 && h->mb.i_mb_x < h->mb.i_mb_width - 1) || + h->mb.i_mb_width <= 2 || h->mb.i_mb_height <= 2 ) + { + i_score += i_mb_cost; + } + } + } + return i_score; +} + +/* Trade off precision in mbtree for increased range */ +#define MBTREE_PRECISION 0.5f + +static void x264_macroblock_tree_finish( x264_t *h, x264_frame_t *frame, float average_duration, int ref0_distance ) +{ + int fps_factor = round( CLIP_DURATION(average_duration) / CLIP_DURATION(frame->f_duration) * 256 / MBTREE_PRECISION ); + float weightdelta = 0.0; + if( ref0_distance && frame->f_weighted_cost_delta[ref0_distance-1] > 0 ) + weightdelta = (1.0 - frame->f_weighted_cost_delta[ref0_distance-1]); + + /* Allow the strength to be adjusted via qcompress, since the two + * concepts are very similar. */ + float strength = 5.0f * (1.0f - h->param.rc.f_qcompress); + for( int mb_index = 0; mb_index < h->mb.i_mb_count; mb_index++ ) + { + int intra_cost = (frame->i_intra_cost[mb_index] * frame->i_inv_qscale_factor[mb_index] + 128) >> 8; + if( intra_cost ) + { + int propagate_cost = (frame->i_propagate_cost[mb_index] * fps_factor + 128) >> 8; + float log2_ratio = x264_log2(intra_cost + propagate_cost) - x264_log2(intra_cost) + weightdelta; + frame->f_qp_offset[mb_index] = frame->f_qp_offset_aq[mb_index] - strength * log2_ratio; + } + } +} + +static void x264_macroblock_tree_propagate( x264_t *h, x264_frame_t **frames, float average_duration, int p0, int p1, int b, int referenced ) +{ + uint16_t *ref_costs[2] = {frames[p0]->i_propagate_cost,frames[p1]->i_propagate_cost}; + int dist_scale_factor = ( ((b-p0) << 8) + ((p1-p0) >> 1) ) / (p1-p0); + int i_bipred_weight = h->param.analyse.b_weighted_bipred ? 64 - (dist_scale_factor>>2) : 32; + int16_t (*mvs[2])[2] = { frames[b]->lowres_mvs[0][b-p0-1], frames[b]->lowres_mvs[1][p1-b-1] }; + int bipred_weights[2] = {i_bipred_weight, 64 - i_bipred_weight}; + int16_t *buf = h->scratch_buffer; + uint16_t *propagate_cost = frames[b]->i_propagate_cost; + uint16_t *lowres_costs = frames[b]->lowres_costs[b-p0][p1-b]; + + x264_emms(); + float fps_factor = CLIP_DURATION(frames[b]->f_duration) / (CLIP_DURATION(average_duration) * 256.0f) * MBTREE_PRECISION; + + /* For non-reffed frames the source costs are always zero, so just memset one row and re-use it. */ + if( !referenced ) + memset( frames[b]->i_propagate_cost, 0, h->mb.i_mb_width * sizeof(uint16_t) ); + + for( h->mb.i_mb_y = 0; h->mb.i_mb_y < h->mb.i_mb_height; h->mb.i_mb_y++ ) + { + int mb_index = h->mb.i_mb_y*h->mb.i_mb_stride; + h->mc.mbtree_propagate_cost( buf, propagate_cost, + frames[b]->i_intra_cost+mb_index, lowres_costs+mb_index, + frames[b]->i_inv_qscale_factor+mb_index, &fps_factor, h->mb.i_mb_width ); + if( referenced ) + propagate_cost += h->mb.i_mb_width; + + h->mc.mbtree_propagate_list( h, ref_costs[0], &mvs[0][mb_index], buf, &lowres_costs[mb_index], + bipred_weights[0], h->mb.i_mb_y, h->mb.i_mb_width, 0 ); + if( b != p1 ) + { + h->mc.mbtree_propagate_list( h, ref_costs[1], &mvs[1][mb_index], buf, &lowres_costs[mb_index], + bipred_weights[1], h->mb.i_mb_y, h->mb.i_mb_width, 1 ); + } + } + + if( h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead && referenced ) + x264_macroblock_tree_finish( h, frames[b], average_duration, b == p1 ? b - p0 : 0 ); +} + +static void x264_macroblock_tree( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int b_intra ) +{ + int idx = !b_intra; + int last_nonb, cur_nonb = 1; + int bframes = 0; + + x264_emms(); + float total_duration = 0.0; + for( int j = 0; j <= num_frames; j++ ) + total_duration += frames[j]->f_duration; + float average_duration = total_duration / (num_frames + 1); + + int i = num_frames; + + if( b_intra ) + x264_slicetype_frame_cost( h, a, frames, 0, 0, 0 ); + + while( i > 0 && IS_X264_TYPE_B( frames[i]->i_type ) ) + i--; + last_nonb = i; + + /* Lookaheadless MB-tree is not a theoretically distinct case; the same extrapolation could + * be applied to the end of a lookahead buffer of any size. However, it's most needed when + * lookahead=0, so that's what's currently implemented. */ + if( !h->param.rc.i_lookahead ) + { + if( b_intra ) + { + memset( frames[0]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) ); + memcpy( frames[0]->f_qp_offset, frames[0]->f_qp_offset_aq, h->mb.i_mb_count * sizeof(float) ); + return; + } + XCHG( uint16_t*, frames[last_nonb]->i_propagate_cost, frames[0]->i_propagate_cost ); + memset( frames[0]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) ); + } + else + { + if( last_nonb < idx ) + return; + memset( frames[last_nonb]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) ); + } + + while( i-- > idx ) + { + cur_nonb = i; + while( IS_X264_TYPE_B( frames[cur_nonb]->i_type ) && cur_nonb > 0 ) + cur_nonb--; + if( cur_nonb < idx ) + break; + x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, last_nonb ); + memset( frames[cur_nonb]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) ); + bframes = last_nonb - cur_nonb - 1; + if( h->param.i_bframe_pyramid && bframes > 1 ) + { + int middle = (bframes + 1)/2 + cur_nonb; + x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, middle ); + memset( frames[middle]->i_propagate_cost, 0, h->mb.i_mb_count * sizeof(uint16_t) ); + while( i > cur_nonb ) + { + int p0 = i > middle ? middle : cur_nonb; + int p1 = i < middle ? middle : last_nonb; + if( i != middle ) + { + x264_slicetype_frame_cost( h, a, frames, p0, p1, i ); + x264_macroblock_tree_propagate( h, frames, average_duration, p0, p1, i, 0 ); + } + i--; + } + x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, middle, 1 ); + } + else + { + while( i > cur_nonb ) + { + x264_slicetype_frame_cost( h, a, frames, cur_nonb, last_nonb, i ); + x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, i, 0 ); + i--; + } + } + x264_macroblock_tree_propagate( h, frames, average_duration, cur_nonb, last_nonb, last_nonb, 1 ); + last_nonb = cur_nonb; + } + + if( !h->param.rc.i_lookahead ) + { + x264_slicetype_frame_cost( h, a, frames, 0, last_nonb, last_nonb ); + x264_macroblock_tree_propagate( h, frames, average_duration, 0, last_nonb, last_nonb, 1 ); + XCHG( uint16_t*, frames[last_nonb]->i_propagate_cost, frames[0]->i_propagate_cost ); + } + + x264_macroblock_tree_finish( h, frames[last_nonb], average_duration, last_nonb ); + if( h->param.i_bframe_pyramid && bframes > 1 && !h->param.rc.i_vbv_buffer_size ) + x264_macroblock_tree_finish( h, frames[last_nonb+(bframes+1)/2], average_duration, 0 ); +} + +static int x264_vbv_frame_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int b ) +{ + int cost = x264_slicetype_frame_cost( h, a, frames, p0, p1, b ); + if( h->param.rc.i_aq_mode ) + { + if( h->param.rc.b_mb_tree ) + return x264_slicetype_frame_cost_recalculate( h, frames, p0, p1, b ); + else + return frames[b]->i_cost_est_aq[b-p0][p1-b]; + } + return cost; +} + +static void x264_calculate_durations( x264_t *h, x264_frame_t *cur_frame, x264_frame_t *prev_frame, int64_t *i_cpb_delay, int64_t *i_coded_fields ) +{ + cur_frame->i_cpb_delay = *i_cpb_delay; + cur_frame->i_dpb_output_delay = cur_frame->i_field_cnt - *i_coded_fields; + + // add a correction term for frame reordering + cur_frame->i_dpb_output_delay += h->sps->vui.i_num_reorder_frames*2; + + // fix possible negative dpb_output_delay because of pulldown changes and reordering + if( cur_frame->i_dpb_output_delay < 0 ) + { + cur_frame->i_cpb_delay += cur_frame->i_dpb_output_delay; + cur_frame->i_dpb_output_delay = 0; + if( prev_frame ) + prev_frame->i_cpb_duration += cur_frame->i_dpb_output_delay; + } + + // don't reset cpb delay for IDR frames when using intra-refresh + if( cur_frame->b_keyframe && !h->param.b_intra_refresh ) + *i_cpb_delay = 0; + + *i_cpb_delay += cur_frame->i_duration; + *i_coded_fields += cur_frame->i_duration; + cur_frame->i_cpb_duration = cur_frame->i_duration; +} + +static void x264_vbv_lookahead( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int num_frames, int keyframe ) +{ + int last_nonb = 0, cur_nonb = 1, idx = 0; + x264_frame_t *prev_frame = NULL; + int prev_frame_idx = 0; + while( cur_nonb < num_frames && IS_X264_TYPE_B( frames[cur_nonb]->i_type ) ) + cur_nonb++; + int next_nonb = keyframe ? last_nonb : cur_nonb; + + if( frames[cur_nonb]->i_coded_fields_lookahead >= 0 ) + { + h->i_coded_fields_lookahead = frames[cur_nonb]->i_coded_fields_lookahead; + h->i_cpb_delay_lookahead = frames[cur_nonb]->i_cpb_delay_lookahead; + } + + while( cur_nonb < num_frames ) + { + /* P/I cost: This shouldn't include the cost of next_nonb */ + if( next_nonb != cur_nonb ) + { + int p0 = IS_X264_TYPE_I( frames[cur_nonb]->i_type ) ? cur_nonb : last_nonb; + frames[next_nonb]->i_planned_satd[idx] = x264_vbv_frame_cost( h, a, frames, p0, cur_nonb, cur_nonb ); + frames[next_nonb]->i_planned_type[idx] = frames[cur_nonb]->i_type; + frames[cur_nonb]->i_coded_fields_lookahead = h->i_coded_fields_lookahead; + frames[cur_nonb]->i_cpb_delay_lookahead = h->i_cpb_delay_lookahead; + x264_calculate_durations( h, frames[cur_nonb], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead ); + if( prev_frame ) + { + frames[next_nonb]->f_planned_cpb_duration[prev_frame_idx] = (double)prev_frame->i_cpb_duration * + h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + } + frames[next_nonb]->f_planned_cpb_duration[idx] = (double)frames[cur_nonb]->i_cpb_duration * + h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + prev_frame = frames[cur_nonb]; + prev_frame_idx = idx; + idx++; + } + /* Handle the B-frames: coded order */ + for( int i = last_nonb+1; i < cur_nonb; i++, idx++ ) + { + frames[next_nonb]->i_planned_satd[idx] = x264_vbv_frame_cost( h, a, frames, last_nonb, cur_nonb, i ); + frames[next_nonb]->i_planned_type[idx] = X264_TYPE_B; + frames[i]->i_coded_fields_lookahead = h->i_coded_fields_lookahead; + frames[i]->i_cpb_delay_lookahead = h->i_cpb_delay_lookahead; + x264_calculate_durations( h, frames[i], prev_frame, &h->i_cpb_delay_lookahead, &h->i_coded_fields_lookahead ); + if( prev_frame ) + { + frames[next_nonb]->f_planned_cpb_duration[prev_frame_idx] = (double)prev_frame->i_cpb_duration * + h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + } + frames[next_nonb]->f_planned_cpb_duration[idx] = (double)frames[i]->i_cpb_duration * + h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + prev_frame = frames[i]; + prev_frame_idx = idx; + } + last_nonb = cur_nonb; + cur_nonb++; + while( cur_nonb <= num_frames && IS_X264_TYPE_B( frames[cur_nonb]->i_type ) ) + cur_nonb++; + } + frames[next_nonb]->i_planned_type[idx] = X264_TYPE_AUTO; +} + +static int x264_slicetype_path_cost( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, char *path, int threshold ) +{ + int loc = 1; + int cost = 0; + int cur_nonb = 0; + path--; /* Since the 1st path element is really the second frame */ + while( path[loc] ) + { + int next_nonb = loc; + /* Find the location of the next non-B-frame. */ + while( path[next_nonb] == 'B' ) + next_nonb++; + + /* Add the cost of the non-B-frame found above */ + if( path[next_nonb] == 'P' ) + cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_nonb ); + else /* I-frame */ + cost += x264_slicetype_frame_cost( h, a, frames, next_nonb, next_nonb, next_nonb ); + /* Early terminate if the cost we have found is larger than the best path cost so far */ + if( cost > threshold ) + break; + + if( h->param.i_bframe_pyramid && next_nonb - cur_nonb > 2 ) + { + int middle = cur_nonb + (next_nonb - cur_nonb)/2; + cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, middle ); + for( int next_b = loc; next_b < middle && cost < threshold; next_b++ ) + cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, middle, next_b ); + for( int next_b = middle+1; next_b < next_nonb && cost < threshold; next_b++ ) + cost += x264_slicetype_frame_cost( h, a, frames, middle, next_nonb, next_b ); + } + else + for( int next_b = loc; next_b < next_nonb && cost < threshold; next_b++ ) + cost += x264_slicetype_frame_cost( h, a, frames, cur_nonb, next_nonb, next_b ); + + loc = next_nonb + 1; + cur_nonb = next_nonb; + } + return cost; +} + +/* Viterbi/trellis slicetype decision algorithm. */ +/* Uses strings due to the fact that the speed of the control functions is + negligible compared to the cost of running slicetype_frame_cost, and because + it makes debugging easier. */ +static void x264_slicetype_path( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int length, char (*best_paths)[X264_LOOKAHEAD_MAX+1] ) +{ + char paths[2][X264_LOOKAHEAD_MAX+1]; + int num_paths = X264_MIN( h->param.i_bframe+1, length ); + int best_cost = COST_MAX; + int best_possible = 0; + int idx = 0; + + /* Iterate over all currently possible paths */ + for( int path = 0; path < num_paths; path++ ) + { + /* Add suffixes to the current path */ + int len = length - (path + 1); + memcpy( paths[idx], best_paths[len % (X264_BFRAME_MAX+1)], len ); + memset( paths[idx]+len, 'B', path ); + strcpy( paths[idx]+len+path, "P" ); + + int possible = 1; + for( int i = 1; i <= length; i++ ) + { + int i_type = frames[i]->i_type; + if( i_type == X264_TYPE_AUTO ) + continue; + if( IS_X264_TYPE_B( i_type ) ) + possible = possible && (i < len || i == length || paths[idx][i-1] == 'B'); + else + { + possible = possible && (i < len || paths[idx][i-1] != 'B'); + paths[idx][i-1] = IS_X264_TYPE_I( i_type ) ? 'I' : 'P'; + } + } + + if( possible || !best_possible ) + { + if( possible && !best_possible ) + best_cost = COST_MAX; + /* Calculate the actual cost of the current path */ + int cost = x264_slicetype_path_cost( h, a, frames, paths[idx], best_cost ); + if( cost < best_cost ) + { + best_cost = cost; + best_possible = possible; + idx ^= 1; + } + } + } + + /* Store the best path. */ + memcpy( best_paths[length % (X264_BFRAME_MAX+1)], paths[idx^1], length ); +} + +static int scenecut_internal( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int real_scenecut ) +{ + x264_frame_t *frame = frames[p1]; + + /* Don't do scenecuts on the right view of a frame-packed video. */ + if( real_scenecut && h->param.i_frame_packing == 5 && (frame->i_frame&1) ) + return 0; + + x264_slicetype_frame_cost( h, a, frames, p0, p1, p1 ); + + int icost = frame->i_cost_est[0][0]; + int pcost = frame->i_cost_est[p1-p0][0]; + float f_bias; + int i_gop_size = frame->i_frame - h->lookahead->i_last_keyframe; + float f_thresh_max = h->param.i_scenecut_threshold / 100.0; + /* magic numbers pulled out of thin air */ + float f_thresh_min = f_thresh_max * 0.25; + int res; + + if( h->param.i_keyint_min == h->param.i_keyint_max ) + f_thresh_min = f_thresh_max; + if( i_gop_size <= h->param.i_keyint_min / 4 || h->param.b_intra_refresh ) + f_bias = f_thresh_min / 4; + else if( i_gop_size <= h->param.i_keyint_min ) + f_bias = f_thresh_min * i_gop_size / h->param.i_keyint_min; + else + { + f_bias = f_thresh_min + + ( f_thresh_max - f_thresh_min ) + * ( i_gop_size - h->param.i_keyint_min ) + / ( h->param.i_keyint_max - h->param.i_keyint_min ); + } + + res = pcost >= (1.0 - f_bias) * icost; + if( res && real_scenecut ) + { + int imb = frame->i_intra_mbs[p1-p0]; + int pmb = NUM_MBS - imb; + x264_log( h, X264_LOG_DEBUG, "scene cut at %d Icost:%d Pcost:%d ratio:%.4f bias:%.4f gop:%d (imb:%d pmb:%d)\n", + frame->i_frame, + icost, pcost, 1. - (double)pcost / icost, + f_bias, i_gop_size, imb, pmb ); + } + return res; +} + +static int scenecut( x264_t *h, x264_mb_analysis_t *a, x264_frame_t **frames, int p0, int p1, int real_scenecut, int num_frames, int i_max_search ) +{ + /* Only do analysis during a normal scenecut check. */ + if( real_scenecut && h->param.i_bframe ) + { + int origmaxp1 = p0 + 1; + /* Look ahead to avoid coding short flashes as scenecuts. */ + if( h->param.i_bframe_adaptive == X264_B_ADAPT_TRELLIS ) + /* Don't analyse any more frames than the trellis would have covered. */ + origmaxp1 += h->param.i_bframe; + else + origmaxp1++; + int maxp1 = X264_MIN( origmaxp1, num_frames ); + + /* Where A and B are scenes: AAAAAABBBAAAAAA + * If BBB is shorter than (maxp1-p0), it is detected as a flash + * and not considered a scenecut. */ + for( int curp1 = p1; curp1 <= maxp1; curp1++ ) + if( !scenecut_internal( h, a, frames, p0, curp1, 0 ) ) + /* Any frame in between p0 and cur_p1 cannot be a real scenecut. */ + for( int i = curp1; i > p0; i-- ) + frames[i]->b_scenecut = 0; + + /* Where A-F are scenes: AAAAABBCCDDEEFFFFFF + * If each of BB ... EE are shorter than (maxp1-p0), they are + * detected as flashes and not considered scenecuts. + * Instead, the first F frame becomes a scenecut. + * If the video ends before F, no frame becomes a scenecut. */ + for( int curp0 = p0; curp0 <= maxp1; curp0++ ) + if( origmaxp1 > i_max_search || (curp0 < maxp1 && scenecut_internal( h, a, frames, curp0, maxp1, 0 )) ) + /* If cur_p0 is the p0 of a scenecut, it cannot be the p1 of a scenecut. */ + frames[curp0]->b_scenecut = 0; + } + + /* Ignore frames that are part of a flash, i.e. cannot be real scenecuts. */ + if( !frames[p1]->b_scenecut ) + return 0; + return scenecut_internal( h, a, frames, p0, p1, real_scenecut ); +} + +#define IS_X264_TYPE_AUTO_OR_I(x) ((x)==X264_TYPE_AUTO || IS_X264_TYPE_I(x)) +#define IS_X264_TYPE_AUTO_OR_B(x) ((x)==X264_TYPE_AUTO || IS_X264_TYPE_B(x)) + +void x264_slicetype_analyse( x264_t *h, int intra_minigop ) +{ + x264_mb_analysis_t a; + x264_frame_t *frames[X264_LOOKAHEAD_MAX+3] = { NULL, }; + int num_frames, orig_num_frames, keyint_limit, framecnt; + int i_max_search = X264_MIN( h->lookahead->next.i_size, X264_LOOKAHEAD_MAX ); + int vbv_lookahead = h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead; + /* For determinism we should limit the search to the number of frames lookahead has for sure + * in h->lookahead->next.list buffer, except at the end of stream. + * For normal calls with (intra_minigop == 0) that is h->lookahead->i_slicetype_length + 1 frames. + * And for I-frame calls (intra_minigop != 0) we already removed intra_minigop frames from there. */ + if( h->param.b_deterministic ) + i_max_search = X264_MIN( i_max_search, h->lookahead->i_slicetype_length + 1 - intra_minigop ); + int keyframe = !!intra_minigop; + + assert( h->frames.b_have_lowres ); + + if( !h->lookahead->last_nonb ) + return; + frames[0] = h->lookahead->last_nonb; + for( framecnt = 0; framecnt < i_max_search; framecnt++ ) + frames[framecnt+1] = h->lookahead->next.list[framecnt]; + + x264_lowres_context_init( h, &a ); + + if( !framecnt ) + { + if( h->param.rc.b_mb_tree ) + x264_macroblock_tree( h, &a, frames, 0, keyframe ); + return; + } + + keyint_limit = h->param.i_keyint_max - frames[0]->i_frame + h->lookahead->i_last_keyframe - 1; + orig_num_frames = num_frames = h->param.b_intra_refresh ? framecnt : X264_MIN( framecnt, keyint_limit ); + + /* This is important psy-wise: if we have a non-scenecut keyframe, + * there will be significant visual artifacts if the frames just before + * go down in quality due to being referenced less, despite it being + * more RD-optimal. */ + if( (h->param.analyse.b_psy && h->param.rc.b_mb_tree) || vbv_lookahead ) + num_frames = framecnt; + else if( h->param.b_open_gop && num_frames < framecnt ) + num_frames++; + else if( num_frames == 0 ) + { + frames[1]->i_type = X264_TYPE_I; + return; + } + + if( IS_X264_TYPE_AUTO_OR_I( frames[1]->i_type ) && + h->param.i_scenecut_threshold && scenecut( h, &a, frames, 0, 1, 1, orig_num_frames, i_max_search ) ) + { + if( frames[1]->i_type == X264_TYPE_AUTO ) + frames[1]->i_type = X264_TYPE_I; + return; + } + +#if HAVE_OPENCL + x264_opencl_slicetype_prep( h, frames, num_frames, a.i_lambda ); +#endif + + /* Replace forced keyframes with I/IDR-frames */ + for( int j = 1; j <= num_frames; j++ ) + { + if( frames[j]->i_type == X264_TYPE_KEYFRAME ) + frames[j]->i_type = h->param.b_open_gop ? X264_TYPE_I : X264_TYPE_IDR; + } + + /* Close GOP at IDR-frames */ + for( int j = 2; j <= num_frames; j++ ) + { + if( frames[j]->i_type == X264_TYPE_IDR && IS_X264_TYPE_AUTO_OR_B( frames[j-1]->i_type ) ) + frames[j-1]->i_type = X264_TYPE_P; + } + + int num_analysed_frames = num_frames; + int reset_start; + + if( h->param.i_bframe ) + { + if( h->param.i_bframe_adaptive == X264_B_ADAPT_TRELLIS ) + { + if( num_frames > 1 ) + { + char best_paths[X264_BFRAME_MAX+1][X264_LOOKAHEAD_MAX+1] = {"","P"}; + int best_path_index = num_frames % (X264_BFRAME_MAX+1); + + /* Perform the frametype analysis. */ + for( int j = 2; j <= num_frames; j++ ) + x264_slicetype_path( h, &a, frames, j, best_paths ); + + /* Load the results of the analysis into the frame types. */ + for( int j = 1; j < num_frames; j++ ) + { + if( best_paths[best_path_index][j-1] != 'B' ) + { + if( IS_X264_TYPE_AUTO_OR_B( frames[j]->i_type ) ) + frames[j]->i_type = X264_TYPE_P; + } + else + { + if( frames[j]->i_type == X264_TYPE_AUTO ) + frames[j]->i_type = X264_TYPE_B; + } + } + } + } + else if( h->param.i_bframe_adaptive == X264_B_ADAPT_FAST ) + { + int last_nonb = 0; + int num_bframes = h->param.i_bframe; + char path[X264_LOOKAHEAD_MAX+1]; + for( int j = 1; j < num_frames; j++ ) + { + if( j-1 > 0 && IS_X264_TYPE_B( frames[j-1]->i_type ) ) + num_bframes--; + else + { + last_nonb = j-1; + num_bframes = h->param.i_bframe; + } + if( !num_bframes ) + { + if( IS_X264_TYPE_AUTO_OR_B( frames[j]->i_type ) ) + frames[j]->i_type = X264_TYPE_P; + continue; + } + + if( frames[j]->i_type != X264_TYPE_AUTO ) + continue; + + if( IS_X264_TYPE_B( frames[j+1]->i_type ) ) + { + frames[j]->i_type = X264_TYPE_P; + continue; + } + + int bframes = j - last_nonb - 1; + memset( path, 'B', bframes ); + strcpy( path+bframes, "PP" ); + int cost_p = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, COST_MAX ); + strcpy( path+bframes, "BP" ); + int cost_b = x264_slicetype_path_cost( h, &a, frames+last_nonb, path, cost_p ); + + if( cost_b < cost_p ) + frames[j]->i_type = X264_TYPE_B; + else + frames[j]->i_type = X264_TYPE_P; + } + } + else + { + int num_bframes = h->param.i_bframe; + for( int j = 1; j < num_frames; j++ ) + { + if( !num_bframes ) + { + if( IS_X264_TYPE_AUTO_OR_B( frames[j]->i_type ) ) + frames[j]->i_type = X264_TYPE_P; + } + else if( frames[j]->i_type == X264_TYPE_AUTO ) + { + if( IS_X264_TYPE_B( frames[j+1]->i_type ) ) + frames[j]->i_type = X264_TYPE_P; + else + frames[j]->i_type = X264_TYPE_B; + } + if( IS_X264_TYPE_B( frames[j]->i_type ) ) + num_bframes--; + else + num_bframes = h->param.i_bframe; + } + } + if( IS_X264_TYPE_AUTO_OR_B( frames[num_frames]->i_type ) ) + frames[num_frames]->i_type = X264_TYPE_P; + + int num_bframes = 0; + while( num_bframes < num_frames && IS_X264_TYPE_B( frames[num_bframes+1]->i_type ) ) + num_bframes++; + + /* Check scenecut on the first minigop. */ + for( int j = 1; j < num_bframes+1; j++ ) + { + if( frames[j]->i_forced_type == X264_TYPE_AUTO && IS_X264_TYPE_AUTO_OR_I( frames[j+1]->i_forced_type ) && + h->param.i_scenecut_threshold && scenecut( h, &a, frames, j, j+1, 0, orig_num_frames, i_max_search ) ) + { + frames[j]->i_type = X264_TYPE_P; + num_analysed_frames = j; + break; + } + } + + reset_start = keyframe ? 1 : X264_MIN( num_bframes+2, num_analysed_frames+1 ); + } + else + { + for( int j = 1; j <= num_frames; j++ ) + if( IS_X264_TYPE_AUTO_OR_B( frames[j]->i_type ) ) + frames[j]->i_type = X264_TYPE_P; + reset_start = !keyframe + 1; + } + + /* Perform the actual macroblock tree analysis. + * Don't go farther than the maximum keyframe interval; this helps in short GOPs. */ + if( h->param.rc.b_mb_tree ) + x264_macroblock_tree( h, &a, frames, X264_MIN(num_frames, h->param.i_keyint_max), keyframe ); + + /* Enforce keyframe limit. */ + if( !h->param.b_intra_refresh ) + { + int last_keyframe = h->lookahead->i_last_keyframe; + int last_possible = 0; + for( int j = 1; j <= num_frames; j++ ) + { + x264_frame_t *frm = frames[j]; + int keyframe_dist = frm->i_frame - last_keyframe; + + if( IS_X264_TYPE_AUTO_OR_I( frm->i_forced_type ) ) + { + if( h->param.b_open_gop || !IS_X264_TYPE_B( frames[j-1]->i_forced_type ) ) + last_possible = j; + } + if( keyframe_dist >= h->param.i_keyint_max ) + { + if( last_possible != 0 && last_possible != j ) + { + j = last_possible; + frm = frames[j]; + keyframe_dist = frm->i_frame - last_keyframe; + } + last_possible = 0; + if( frm->i_type != X264_TYPE_IDR ) + frm->i_type = h->param.b_open_gop ? X264_TYPE_I : X264_TYPE_IDR; + } + if( frm->i_type == X264_TYPE_I && keyframe_dist >= h->param.i_keyint_min ) + { + if( h->param.b_open_gop ) + { + last_keyframe = frm->i_frame; + if( h->param.b_bluray_compat ) + { + // Use bluray order + int bframes = 0; + while( bframes < j-1 && IS_X264_TYPE_B( frames[j-1-bframes]->i_type ) ) + bframes++; + last_keyframe -= bframes; + } + } + else if( frm->i_forced_type != X264_TYPE_I ) + frm->i_type = X264_TYPE_IDR; + } + if( frm->i_type == X264_TYPE_IDR ) + { + last_keyframe = frm->i_frame; + if( j > 1 && IS_X264_TYPE_B( frames[j-1]->i_type ) ) + frames[j-1]->i_type = X264_TYPE_P; + } + } + } + + if( vbv_lookahead ) + x264_vbv_lookahead( h, &a, frames, num_frames, keyframe ); + + /* Restore frametypes for all frames that haven't actually been decided yet. */ + for( int j = reset_start; j <= num_frames; j++ ) + frames[j]->i_type = frames[j]->i_forced_type; + +#if HAVE_OPENCL + x264_opencl_slicetype_end( h ); +#endif +} + +void x264_slicetype_decide( x264_t *h ) +{ + x264_frame_t *frames[X264_BFRAME_MAX+2]; + x264_frame_t *frm; + int bframes; + int brefs; + + if( !h->lookahead->next.i_size ) + return; + + int lookahead_size = h->lookahead->next.i_size; + + for( int i = 0; i < h->lookahead->next.i_size; i++ ) + { + if( h->param.b_vfr_input ) + { + if( lookahead_size-- > 1 ) + h->lookahead->next.list[i]->i_duration = 2 * (h->lookahead->next.list[i+1]->i_pts - h->lookahead->next.list[i]->i_pts); + else + h->lookahead->next.list[i]->i_duration = h->i_prev_duration; + } + else + h->lookahead->next.list[i]->i_duration = delta_tfi_divisor[h->lookahead->next.list[i]->i_pic_struct]; + h->i_prev_duration = h->lookahead->next.list[i]->i_duration; + h->lookahead->next.list[i]->f_duration = (double)h->lookahead->next.list[i]->i_duration + * h->sps->vui.i_num_units_in_tick + / h->sps->vui.i_time_scale; + + if( h->lookahead->next.list[i]->i_frame > h->i_disp_fields_last_frame && lookahead_size > 0 ) + { + h->lookahead->next.list[i]->i_field_cnt = h->i_disp_fields; + h->i_disp_fields += h->lookahead->next.list[i]->i_duration; + h->i_disp_fields_last_frame = h->lookahead->next.list[i]->i_frame; + } + else if( lookahead_size == 0 ) + { + h->lookahead->next.list[i]->i_field_cnt = h->i_disp_fields; + h->lookahead->next.list[i]->i_duration = h->i_prev_duration; + } + } + + if( h->param.rc.b_stat_read ) + { + /* Use the frame types from the first pass */ + for( int i = 0; i < h->lookahead->next.i_size; i++ ) + h->lookahead->next.list[i]->i_type = + x264_ratecontrol_slice_type( h, h->lookahead->next.list[i]->i_frame ); + } + else if( (h->param.i_bframe && h->param.i_bframe_adaptive) + || h->param.i_scenecut_threshold + || h->param.rc.b_mb_tree + || (h->param.rc.i_vbv_buffer_size && h->param.rc.i_lookahead) ) + x264_slicetype_analyse( h, 0 ); + + for( bframes = 0, brefs = 0;; bframes++ ) + { + frm = h->lookahead->next.list[bframes]; + + if( frm->i_forced_type != X264_TYPE_AUTO && frm->i_type != frm->i_forced_type && + !(frm->i_forced_type == X264_TYPE_KEYFRAME && IS_X264_TYPE_I( frm->i_type )) ) + { + x264_log( h, X264_LOG_WARNING, "forced frame type (%d) at %d was changed to frame type (%d)\n", + frm->i_forced_type, frm->i_frame, frm->i_type ); + } + + if( frm->i_type == X264_TYPE_BREF && h->param.i_bframe_pyramid < X264_B_PYRAMID_NORMAL && + brefs == h->param.i_bframe_pyramid ) + { + frm->i_type = X264_TYPE_B; + x264_log( h, X264_LOG_WARNING, "B-ref at frame %d incompatible with B-pyramid %s \n", + frm->i_frame, x264_b_pyramid_names[h->param.i_bframe_pyramid] ); + } + /* pyramid with multiple B-refs needs a big enough dpb that the preceding P-frame stays available. + smaller dpb could be supported by smart enough use of mmco, but it's easier just to forbid it. */ + else if( frm->i_type == X264_TYPE_BREF && h->param.i_bframe_pyramid == X264_B_PYRAMID_NORMAL && + brefs && h->param.i_frame_reference <= (brefs+3) ) + { + frm->i_type = X264_TYPE_B; + x264_log( h, X264_LOG_WARNING, "B-ref at frame %d incompatible with B-pyramid %s and %d reference frames\n", + frm->i_frame, x264_b_pyramid_names[h->param.i_bframe_pyramid], h->param.i_frame_reference ); + } + + if( frm->i_type == X264_TYPE_KEYFRAME ) + frm->i_type = h->param.b_open_gop ? X264_TYPE_I : X264_TYPE_IDR; + + /* Limit GOP size */ + if( (!h->param.b_intra_refresh || frm->i_frame == 0) && frm->i_frame - h->lookahead->i_last_keyframe >= h->param.i_keyint_max ) + { + if( frm->i_type == X264_TYPE_AUTO || frm->i_type == X264_TYPE_I ) + frm->i_type = h->param.b_open_gop && h->lookahead->i_last_keyframe >= 0 ? X264_TYPE_I : X264_TYPE_IDR; + int warn = frm->i_type != X264_TYPE_IDR; + if( warn && h->param.b_open_gop ) + warn &= frm->i_type != X264_TYPE_I; + if( warn ) + { + x264_log( h, X264_LOG_WARNING, "specified frame type (%d) at %d is not compatible with keyframe interval\n", frm->i_type, frm->i_frame ); + frm->i_type = h->param.b_open_gop && h->lookahead->i_last_keyframe >= 0 ? X264_TYPE_I : X264_TYPE_IDR; + } + } + if( frm->i_type == X264_TYPE_I && frm->i_frame - h->lookahead->i_last_keyframe >= h->param.i_keyint_min ) + { + if( h->param.b_open_gop ) + { + h->lookahead->i_last_keyframe = frm->i_frame; // Use display order + if( h->param.b_bluray_compat ) + h->lookahead->i_last_keyframe -= bframes; // Use bluray order + frm->b_keyframe = 1; + } + else + frm->i_type = X264_TYPE_IDR; + } + if( frm->i_type == X264_TYPE_IDR ) + { + /* Close GOP */ + h->lookahead->i_last_keyframe = frm->i_frame; + frm->b_keyframe = 1; + if( bframes > 0 ) + { + bframes--; + h->lookahead->next.list[bframes]->i_type = X264_TYPE_P; + } + } + + if( bframes == h->param.i_bframe || + !h->lookahead->next.list[bframes+1] ) + { + if( IS_X264_TYPE_B( frm->i_type ) ) + x264_log( h, X264_LOG_WARNING, "specified frame type is not compatible with max B-frames\n" ); + if( frm->i_type == X264_TYPE_AUTO + || IS_X264_TYPE_B( frm->i_type ) ) + frm->i_type = X264_TYPE_P; + } + + if( frm->i_type == X264_TYPE_BREF ) + brefs++; + + if( frm->i_type == X264_TYPE_AUTO ) + frm->i_type = X264_TYPE_B; + + else if( !IS_X264_TYPE_B( frm->i_type ) ) break; + } + + if( bframes ) + h->lookahead->next.list[bframes-1]->b_last_minigop_bframe = 1; + h->lookahead->next.list[bframes]->i_bframes = bframes; + + /* insert a bref into the sequence */ + if( h->param.i_bframe_pyramid && bframes > 1 && !brefs ) + { + h->lookahead->next.list[(bframes-1)/2]->i_type = X264_TYPE_BREF; + brefs++; + } + + /* calculate the frame costs ahead of time for x264_rc_analyse_slice while we still have lowres */ + if( h->param.rc.i_rc_method != X264_RC_CQP ) + { + x264_mb_analysis_t a; + int p0, p1, b; + p1 = b = bframes + 1; + + x264_lowres_context_init( h, &a ); + + frames[0] = h->lookahead->last_nonb; + memcpy( &frames[1], h->lookahead->next.list, (bframes+1) * sizeof(x264_frame_t*) ); + if( IS_X264_TYPE_I( h->lookahead->next.list[bframes]->i_type ) ) + p0 = bframes + 1; + else // P + p0 = 0; + + x264_slicetype_frame_cost( h, &a, frames, p0, p1, b ); + + if( (p0 != p1 || bframes) && h->param.rc.i_vbv_buffer_size ) + { + /* We need the intra costs for row SATDs. */ + x264_slicetype_frame_cost( h, &a, frames, b, b, b ); + + /* We need B-frame costs for row SATDs. */ + p0 = 0; + for( b = 1; b <= bframes; b++ ) + { + if( frames[b]->i_type == X264_TYPE_B ) + for( p1 = b; frames[p1]->i_type == X264_TYPE_B; ) + p1++; + else + p1 = bframes + 1; + x264_slicetype_frame_cost( h, &a, frames, p0, p1, b ); + if( frames[b]->i_type == X264_TYPE_BREF ) + p0 = b; + } + } + } + + /* Analyse for weighted P frames */ + if( !h->param.rc.b_stat_read && h->lookahead->next.list[bframes]->i_type == X264_TYPE_P + && h->param.analyse.i_weighted_pred >= X264_WEIGHTP_SIMPLE ) + { + x264_emms(); + x264_weights_analyse( h, h->lookahead->next.list[bframes], h->lookahead->last_nonb, 0 ); + } + + /* shift sequence to coded order. + use a small temporary list to avoid shifting the entire next buffer around */ + int i_coded = h->lookahead->next.list[0]->i_frame; + if( bframes ) + { + int idx_list[] = { brefs+1, 1 }; + for( int i = 0; i < bframes; i++ ) + { + int idx = idx_list[h->lookahead->next.list[i]->i_type == X264_TYPE_BREF]++; + frames[idx] = h->lookahead->next.list[i]; + frames[idx]->i_reordered_pts = h->lookahead->next.list[idx]->i_pts; + } + frames[0] = h->lookahead->next.list[bframes]; + frames[0]->i_reordered_pts = h->lookahead->next.list[0]->i_pts; + memcpy( h->lookahead->next.list, frames, (bframes+1) * sizeof(x264_frame_t*) ); + } + + for( int i = 0; i <= bframes; i++ ) + { + h->lookahead->next.list[i]->i_coded = i_coded++; + if( i ) + { + x264_calculate_durations( h, h->lookahead->next.list[i], h->lookahead->next.list[i-1], &h->i_cpb_delay, &h->i_coded_fields ); + h->lookahead->next.list[0]->f_planned_cpb_duration[i-1] = (double)h->lookahead->next.list[i]->i_cpb_duration * + h->sps->vui.i_num_units_in_tick / h->sps->vui.i_time_scale; + } + else + x264_calculate_durations( h, h->lookahead->next.list[i], NULL, &h->i_cpb_delay, &h->i_coded_fields ); + } +} + +int x264_rc_analyse_slice( x264_t *h ) +{ + int p0 = 0, p1, b; + int cost; + x264_emms(); + + if( IS_X264_TYPE_I(h->fenc->i_type) ) + p1 = b = 0; + else if( h->fenc->i_type == X264_TYPE_P ) + p1 = b = h->fenc->i_bframes + 1; + else //B + { + p1 = (h->fref_nearest[1]->i_poc - h->fref_nearest[0]->i_poc)/2; + b = (h->fenc->i_poc - h->fref_nearest[0]->i_poc)/2; + } + /* We don't need to assign p0/p1 since we are not performing any real analysis here. */ + x264_frame_t **frames = &h->fenc - b; + + /* cost should have been already calculated by x264_slicetype_decide */ + cost = frames[b]->i_cost_est[b-p0][p1-b]; + assert( cost >= 0 ); + + if( h->param.rc.b_mb_tree && !h->param.rc.b_stat_read ) + { + cost = x264_slicetype_frame_cost_recalculate( h, frames, p0, p1, b ); + if( b && h->param.rc.i_vbv_buffer_size ) + x264_slicetype_frame_cost_recalculate( h, frames, b, b, b ); + } + /* In AQ, use the weighted score instead. */ + else if( h->param.rc.i_aq_mode ) + cost = frames[b]->i_cost_est_aq[b-p0][p1-b]; + + h->fenc->i_row_satd = h->fenc->i_row_satds[b-p0][p1-b]; + h->fdec->i_row_satd = h->fdec->i_row_satds[b-p0][p1-b]; + h->fdec->i_satd = cost; + memcpy( h->fdec->i_row_satd, h->fenc->i_row_satd, h->mb.i_mb_height * sizeof(int) ); + if( !IS_X264_TYPE_I(h->fenc->i_type) ) + memcpy( h->fdec->i_row_satds[0][0], h->fenc->i_row_satds[0][0], h->mb.i_mb_height * sizeof(int) ); + + if( h->param.b_intra_refresh && h->param.rc.i_vbv_buffer_size && h->fenc->i_type == X264_TYPE_P ) + { + int ip_factor = 256 * h->param.rc.f_ip_factor; /* fix8 */ + for( int y = 0; y < h->mb.i_mb_height; y++ ) + { + int mb_xy = y * h->mb.i_mb_stride + h->fdec->i_pir_start_col; + for( int x = h->fdec->i_pir_start_col; x <= h->fdec->i_pir_end_col; x++, mb_xy++ ) + { + int intra_cost = (h->fenc->i_intra_cost[mb_xy] * ip_factor + 128) >> 8; + int inter_cost = h->fenc->lowres_costs[b-p0][p1-b][mb_xy] & LOWRES_COST_MASK; + int diff = intra_cost - inter_cost; + if( h->param.rc.i_aq_mode ) + h->fdec->i_row_satd[y] += (diff * frames[b]->i_inv_qscale_factor[mb_xy] + 128) >> 8; + else + h->fdec->i_row_satd[y] += diff; + cost += diff; + } + } + } + + return cost; +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/external/x264/x264.h b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/x264.h new file mode 100644 index 00000000..21c2c18d --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/external/x264/x264.h @@ -0,0 +1,964 @@ +/***************************************************************************** + * x264.h: x264 public header + ***************************************************************************** + * Copyright (C) 2003-2017 x264 project + * + * Authors: Laurent Aimar + * Loren Merritt + * Fiona Glaser + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA. + * + * This program is also available under a commercial proprietary license. + * For more information, contact us at licensing@x264.com. + *****************************************************************************/ + +#ifndef X264_X264_H +#define X264_X264_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_STDINT_H) && !defined(_STDINT_H_) && !defined(_STDINT_H_INCLUDED) && !defined(_STDINT) &&\ + !defined(_SYS_STDINT_H_) && !defined(_INTTYPES_H) && !defined(_INTTYPES_H_) && !defined(_INTTYPES) +# ifdef _MSC_VER +# pragma message("You must include stdint.h or inttypes.h before x264.h") +# else +# warning You must include stdint.h or inttypes.h before x264.h +# endif +#endif + +#include + +//#include "x264_config.h" + +#define X264_VERSION "" + +#define X264_BUILD 152 + +/* Application developers planning to link against a shared library version of + * libx264 from a Microsoft Visual Studio or similar development environment + * will need to define X264_API_IMPORTS before including this header. + * This clause does not apply to MinGW, similar development environments, or non + * Windows platforms. */ +#ifdef X264_API_IMPORTS +#define X264_API __declspec(dllimport) +#else +#define X264_API +#endif + +/* x264_t: + * opaque handler for encoder */ +typedef struct x264_t x264_t; + +/**************************************************************************** + * NAL structure and functions + ****************************************************************************/ + +enum nal_unit_type_e +{ + NAL_UNKNOWN = 0, + NAL_SLICE = 1, + NAL_SLICE_DPA = 2, + NAL_SLICE_DPB = 3, + NAL_SLICE_DPC = 4, + NAL_SLICE_IDR = 5, /* ref_idc != 0 */ + NAL_SEI = 6, /* ref_idc == 0 */ + NAL_SPS = 7, + NAL_PPS = 8, + NAL_AUD = 9, + NAL_FILLER = 12, + /* ref_idc == 0 for 6,9,10,11,12 */ +}; +enum nal_priority_e +{ + NAL_PRIORITY_DISPOSABLE = 0, + NAL_PRIORITY_LOW = 1, + NAL_PRIORITY_HIGH = 2, + NAL_PRIORITY_HIGHEST = 3, +}; + +/* The data within the payload is already NAL-encapsulated; the ref_idc and type + * are merely in the struct for easy access by the calling application. + * All data returned in an x264_nal_t, including the data in p_payload, is no longer + * valid after the next call to x264_encoder_encode. Thus it must be used or copied + * before calling x264_encoder_encode or x264_encoder_headers again. */ +typedef struct x264_nal_t +{ + int i_ref_idc; /* nal_priority_e */ + int i_type; /* nal_unit_type_e */ + int b_long_startcode; + int i_first_mb; /* If this NAL is a slice, the index of the first MB in the slice. */ + int i_last_mb; /* If this NAL is a slice, the index of the last MB in the slice. */ + + /* Size of payload (including any padding) in bytes. */ + int i_payload; + /* If param->b_annexb is set, Annex-B bytestream with startcode. + * Otherwise, startcode is replaced with a 4-byte size. + * This size is the size used in mp4/similar muxing; it is equal to i_payload-4 */ + uint8_t *p_payload; + + /* Size of padding in bytes. */ + int i_padding; +} x264_nal_t; + +/**************************************************************************** + * Encoder parameters + ****************************************************************************/ +/* CPU flags */ + +/* x86 */ +#define X264_CPU_MMX (1<<0) +#define X264_CPU_MMX2 (1<<1) /* MMX2 aka MMXEXT aka ISSE */ +#define X264_CPU_MMXEXT X264_CPU_MMX2 +#define X264_CPU_SSE (1<<2) +#define X264_CPU_SSE2 (1<<3) +#define X264_CPU_LZCNT (1<<4) +#define X264_CPU_SSE3 (1<<5) +#define X264_CPU_SSSE3 (1<<6) +#define X264_CPU_SSE4 (1<<7) /* SSE4.1 */ +#define X264_CPU_SSE42 (1<<8) /* SSE4.2 */ +#define X264_CPU_AVX (1<<9) /* Requires OS support even if YMM registers aren't used */ +#define X264_CPU_XOP (1<<10) /* AMD XOP */ +#define X264_CPU_FMA4 (1<<11) /* AMD FMA4 */ +#define X264_CPU_FMA3 (1<<12) +#define X264_CPU_BMI1 (1<<13) +#define X264_CPU_BMI2 (1<<14) +#define X264_CPU_AVX2 (1<<15) +#define X264_CPU_AVX512 (1<<16) /* AVX-512 {F, CD, BW, DQ, VL}, requires OS support */ +/* x86 modifiers */ +#define X264_CPU_CACHELINE_32 (1<<17) /* avoid memory loads that span the border between two cachelines */ +#define X264_CPU_CACHELINE_64 (1<<18) /* 32/64 is the size of a cacheline in bytes */ +#define X264_CPU_SSE2_IS_SLOW (1<<19) /* avoid most SSE2 functions on Athlon64 */ +#define X264_CPU_SSE2_IS_FAST (1<<20) /* a few functions are only faster on Core2 and Phenom */ +#define X264_CPU_SLOW_SHUFFLE (1<<21) /* The Conroe has a slow shuffle unit (relative to overall SSE performance) */ +#define X264_CPU_STACK_MOD4 (1<<22) /* if stack is only mod4 and not mod16 */ +#define X264_CPU_SLOW_ATOM (1<<23) /* The Atom is terrible: slow SSE unaligned loads, slow + * SIMD multiplies, slow SIMD variable shifts, slow pshufb, + * cacheline split penalties -- gather everything here that + * isn't shared by other CPUs to avoid making half a dozen + * new SLOW flags. */ +#define X264_CPU_SLOW_PSHUFB (1<<24) /* such as on the Intel Atom */ +#define X264_CPU_SLOW_PALIGNR (1<<25) /* such as on the AMD Bobcat */ + +/* PowerPC */ +#define X264_CPU_ALTIVEC 0x0000001 + +/* ARM and AArch64 */ +#define X264_CPU_ARMV6 0x0000001 +#define X264_CPU_NEON 0x0000002 /* ARM NEON */ +#define X264_CPU_FAST_NEON_MRC 0x0000004 /* Transfer from NEON to ARM register is fast (Cortex-A9) */ +#define X264_CPU_ARMV8 0x0000008 + +/* MIPS */ +#define X264_CPU_MSA 0x0000001 /* MIPS MSA */ + +/* Analyse flags */ +#define X264_ANALYSE_I4x4 0x0001 /* Analyse i4x4 */ +#define X264_ANALYSE_I8x8 0x0002 /* Analyse i8x8 (requires 8x8 transform) */ +#define X264_ANALYSE_PSUB16x16 0x0010 /* Analyse p16x8, p8x16 and p8x8 */ +#define X264_ANALYSE_PSUB8x8 0x0020 /* Analyse p8x4, p4x8, p4x4 */ +#define X264_ANALYSE_BSUB16x16 0x0100 /* Analyse b16x8, b8x16 and b8x8 */ +#define X264_DIRECT_PRED_NONE 0 +#define X264_DIRECT_PRED_SPATIAL 1 +#define X264_DIRECT_PRED_TEMPORAL 2 +#define X264_DIRECT_PRED_AUTO 3 +#define X264_ME_DIA 0 +#define X264_ME_HEX 1 +#define X264_ME_UMH 2 +#define X264_ME_ESA 3 +#define X264_ME_TESA 4 +#define X264_CQM_FLAT 0 +#define X264_CQM_JVT 1 +#define X264_CQM_CUSTOM 2 +#define X264_RC_CQP 0 +#define X264_RC_CRF 1 +#define X264_RC_ABR 2 +#define X264_QP_AUTO 0 +#define X264_AQ_NONE 0 +#define X264_AQ_VARIANCE 1 +#define X264_AQ_AUTOVARIANCE 2 +#define X264_AQ_AUTOVARIANCE_BIASED 3 +#define X264_B_ADAPT_NONE 0 +#define X264_B_ADAPT_FAST 1 +#define X264_B_ADAPT_TRELLIS 2 +#define X264_WEIGHTP_NONE 0 +#define X264_WEIGHTP_SIMPLE 1 +#define X264_WEIGHTP_SMART 2 +#define X264_B_PYRAMID_NONE 0 +#define X264_B_PYRAMID_STRICT 1 +#define X264_B_PYRAMID_NORMAL 2 +#define X264_KEYINT_MIN_AUTO 0 +#define X264_KEYINT_MAX_INFINITE (1<<30) + +static const char * const x264_direct_pred_names[] = { "none", "spatial", "temporal", "auto", 0 }; +static const char * const x264_motion_est_names[] = { "dia", "hex", "umh", "esa", "tesa", 0 }; +static const char * const x264_b_pyramid_names[] = { "none", "strict", "normal", 0 }; +static const char * const x264_overscan_names[] = { "undef", "show", "crop", 0 }; +static const char * const x264_vidformat_names[] = { "component", "pal", "ntsc", "secam", "mac", "undef", 0 }; +static const char * const x264_fullrange_names[] = { "off", "on", 0 }; +static const char * const x264_colorprim_names[] = { "", "bt709", "undef", "", "bt470m", "bt470bg", "smpte170m", "smpte240m", "film", "bt2020", "smpte428", + "smpte431", "smpte432", 0 }; +static const char * const x264_transfer_names[] = { "", "bt709", "undef", "", "bt470m", "bt470bg", "smpte170m", "smpte240m", "linear", "log100", "log316", + "iec61966-2-4", "bt1361e", "iec61966-2-1", "bt2020-10", "bt2020-12", "smpte2084", "smpte428", 0 }; +static const char * const x264_colmatrix_names[] = { "GBR", "bt709", "undef", "", "fcc", "bt470bg", "smpte170m", "smpte240m", "YCgCo", "bt2020nc", "bt2020c", + "smpte2085", 0 }; +static const char * const x264_nal_hrd_names[] = { "none", "vbr", "cbr", 0 }; + +/* Colorspace type */ +#define X264_CSP_MASK 0x00ff /* */ +#define X264_CSP_NONE 0x0000 /* Invalid mode */ +#define X264_CSP_I420 0x0001 /* yuv 4:2:0 planar */ +#define X264_CSP_YV12 0x0002 /* yvu 4:2:0 planar */ +#define X264_CSP_NV12 0x0003 /* yuv 4:2:0, with one y plane and one packed u+v */ +#define X264_CSP_NV21 0x0004 /* yuv 4:2:0, with one y plane and one packed v+u */ +#define X264_CSP_I422 0x0005 /* yuv 4:2:2 planar */ +#define X264_CSP_YV16 0x0006 /* yvu 4:2:2 planar */ +#define X264_CSP_NV16 0x0007 /* yuv 4:2:2, with one y plane and one packed u+v */ +#define X264_CSP_YUYV 0x0008 /* yuyv 4:2:2 packed */ +#define X264_CSP_UYVY 0x0009 /* uyvy 4:2:2 packed */ +#define X264_CSP_V210 0x000a /* 10-bit yuv 4:2:2 packed in 32 */ +#define X264_CSP_I444 0x000b /* yuv 4:4:4 planar */ +#define X264_CSP_YV24 0x000c /* yvu 4:4:4 planar */ +#define X264_CSP_BGR 0x000d /* packed bgr 24bits */ +#define X264_CSP_BGRA 0x000e /* packed bgr 32bits */ +#define X264_CSP_RGB 0x000f /* packed rgb 24bits */ +#define X264_CSP_MAX 0x0010 /* end of list */ +#define X264_CSP_VFLIP 0x1000 /* the csp is vertically flipped */ +#define X264_CSP_HIGH_DEPTH 0x2000 /* the csp has a depth of 16 bits per pixel component */ + +/* Slice type */ +#define X264_TYPE_AUTO 0x0000 /* Let x264 choose the right type */ +#define X264_TYPE_IDR 0x0001 +#define X264_TYPE_I 0x0002 +#define X264_TYPE_P 0x0003 +#define X264_TYPE_BREF 0x0004 /* Non-disposable B-frame */ +#define X264_TYPE_B 0x0005 +#define X264_TYPE_KEYFRAME 0x0006 /* IDR or I depending on b_open_gop option */ +#define IS_X264_TYPE_I(x) ((x)==X264_TYPE_I || (x)==X264_TYPE_IDR || (x)==X264_TYPE_KEYFRAME) +#define IS_X264_TYPE_B(x) ((x)==X264_TYPE_B || (x)==X264_TYPE_BREF) + +/* Log level */ +#define X264_LOG_NONE (-1) +#define X264_LOG_ERROR 0 +#define X264_LOG_WARNING 1 +#define X264_LOG_INFO 2 +#define X264_LOG_DEBUG 3 + +/* Threading */ +#define X264_THREADS_AUTO 0 /* Automatically select optimal number of threads */ +#define X264_SYNC_LOOKAHEAD_AUTO (-1) /* Automatically select optimal lookahead thread buffer size */ + +/* HRD */ +#define X264_NAL_HRD_NONE 0 +#define X264_NAL_HRD_VBR 1 +#define X264_NAL_HRD_CBR 2 + +/* Zones: override ratecontrol or other options for specific sections of the video. + * See x264_encoder_reconfig() for which options can be changed. + * If zones overlap, whichever comes later in the list takes precedence. */ +typedef struct x264_zone_t +{ + int i_start, i_end; /* range of frame numbers */ + int b_force_qp; /* whether to use qp vs bitrate factor */ + int i_qp; + float f_bitrate_factor; + struct x264_param_t *param; +} x264_zone_t; + +typedef struct x264_param_t +{ + /* CPU flags */ + unsigned int cpu; + int i_threads; /* encode multiple frames in parallel */ + int i_lookahead_threads; /* multiple threads for lookahead analysis */ + int b_sliced_threads; /* Whether to use slice-based threading. */ + int b_deterministic; /* whether to allow non-deterministic optimizations when threaded */ + int b_cpu_independent; /* force canonical behavior rather than cpu-dependent optimal algorithms */ + int i_sync_lookahead; /* threaded lookahead buffer */ + + /* Video Properties */ + int i_width; + int i_height; + int i_csp; /* CSP of encoded bitstream */ + int i_level_idc; + int i_frame_total; /* number of frames to encode if known, else 0 */ + + /* NAL HRD + * Uses Buffering and Picture Timing SEIs to signal HRD + * The HRD in H.264 was not designed with VFR in mind. + * It is therefore not recommendeded to use NAL HRD with VFR. + * Furthermore, reconfiguring the VBV (via x264_encoder_reconfig) + * will currently generate invalid HRD. */ + int i_nal_hrd; + + struct + { + /* they will be reduced to be 0 < x <= 65535 and prime */ + int i_sar_height; + int i_sar_width; + + int i_overscan; /* 0=undef, 1=no overscan, 2=overscan */ + + /* see h264 annex E for the values of the following */ + int i_vidformat; + int b_fullrange; + int i_colorprim; + int i_transfer; + int i_colmatrix; + int i_chroma_loc; /* both top & bottom */ + } vui; + + /* Bitstream parameters */ + int i_frame_reference; /* Maximum number of reference frames */ + int i_dpb_size; /* Force a DPB size larger than that implied by B-frames and reference frames. + * Useful in combination with interactive error resilience. */ + int i_keyint_max; /* Force an IDR keyframe at this interval */ + int i_keyint_min; /* Scenecuts closer together than this are coded as I, not IDR. */ + int i_scenecut_threshold; /* how aggressively to insert extra I frames */ + int b_intra_refresh; /* Whether or not to use periodic intra refresh instead of IDR frames. */ + + int i_bframe; /* how many b-frame between 2 references pictures */ + int i_bframe_adaptive; + int i_bframe_bias; + int i_bframe_pyramid; /* Keep some B-frames as references: 0=off, 1=strict hierarchical, 2=normal */ + int b_open_gop; + int b_bluray_compat; + int i_avcintra_class; + + int b_deblocking_filter; + int i_deblocking_filter_alphac0; /* [-6, 6] -6 light filter, 6 strong */ + int i_deblocking_filter_beta; /* [-6, 6] idem */ + + int b_cabac; + int i_cabac_init_idc; + + int b_interlaced; + int b_constrained_intra; + + int i_cqm_preset; + char *psz_cqm_file; /* filename (in UTF-8) of CQM file, JM format */ + uint8_t cqm_4iy[16]; /* used only if i_cqm_preset == X264_CQM_CUSTOM */ + uint8_t cqm_4py[16]; + uint8_t cqm_4ic[16]; + uint8_t cqm_4pc[16]; + uint8_t cqm_8iy[64]; + uint8_t cqm_8py[64]; + uint8_t cqm_8ic[64]; + uint8_t cqm_8pc[64]; + + /* Log */ + void (*pf_log)( void *, int i_level, const char *psz, va_list ); + void *p_log_private; + int i_log_level; + int b_full_recon; /* fully reconstruct frames, even when not necessary for encoding. Implied by psz_dump_yuv */ + char *psz_dump_yuv; /* filename (in UTF-8) for reconstructed frames */ + + /* Encoder analyser parameters */ + struct + { + unsigned int intra; /* intra partitions */ + unsigned int inter; /* inter partitions */ + + int b_transform_8x8; + int i_weighted_pred; /* weighting for P-frames */ + int b_weighted_bipred; /* implicit weighting for B-frames */ + int i_direct_mv_pred; /* spatial vs temporal mv prediction */ + int i_chroma_qp_offset; + + int i_me_method; /* motion estimation algorithm to use (X264_ME_*) */ + int i_me_range; /* integer pixel motion estimation search range (from predicted mv) */ + int i_mv_range; /* maximum length of a mv (in pixels). -1 = auto, based on level */ + int i_mv_range_thread; /* minimum space between threads. -1 = auto, based on number of threads. */ + int i_subpel_refine; /* subpixel motion estimation quality */ + int b_chroma_me; /* chroma ME for subpel and mode decision in P-frames */ + int b_mixed_references; /* allow each mb partition to have its own reference number */ + int i_trellis; /* trellis RD quantization */ + int b_fast_pskip; /* early SKIP detection on P-frames */ + int b_dct_decimate; /* transform coefficient thresholding on P-frames */ + int i_noise_reduction; /* adaptive pseudo-deadzone */ + float f_psy_rd; /* Psy RD strength */ + float f_psy_trellis; /* Psy trellis strength */ + int b_psy; /* Toggle all psy optimizations */ + + int b_mb_info; /* Use input mb_info data in x264_picture_t */ + int b_mb_info_update; /* Update the values in mb_info according to the results of encoding. */ + + /* the deadzone size that will be used in luma quantization */ + int i_luma_deadzone[2]; /* {inter, intra} */ + + int b_psnr; /* compute and print PSNR stats */ + int b_ssim; /* compute and print SSIM stats */ + } analyse; + + /* Rate control parameters */ + struct + { + int i_rc_method; /* X264_RC_* */ + + int i_qp_constant; /* 0 to (51 + 6*(x264_bit_depth-8)). 0=lossless */ + int i_qp_min; /* min allowed QP value */ + int i_qp_max; /* max allowed QP value */ + int i_qp_step; /* max QP step between frames */ + + int i_bitrate; + float f_rf_constant; /* 1pass VBR, nominal QP */ + float f_rf_constant_max; /* In CRF mode, maximum CRF as caused by VBV */ + float f_rate_tolerance; + int i_vbv_max_bitrate; + int i_vbv_buffer_size; + float f_vbv_buffer_init; /* <=1: fraction of buffer_size. >1: kbit */ + float f_ip_factor; + float f_pb_factor; + + /* VBV filler: force CBR VBV and use filler bytes to ensure hard-CBR. + * Implied by NAL-HRD CBR. */ + int b_filler; + + int i_aq_mode; /* psy adaptive QP. (X264_AQ_*) */ + float f_aq_strength; + int b_mb_tree; /* Macroblock-tree ratecontrol. */ + int i_lookahead; + + /* 2pass */ + int b_stat_write; /* Enable stat writing in psz_stat_out */ + char *psz_stat_out; /* output filename (in UTF-8) of the 2pass stats file */ + int b_stat_read; /* Read stat from psz_stat_in and use it */ + char *psz_stat_in; /* input filename (in UTF-8) of the 2pass stats file */ + + /* 2pass params (same as ffmpeg ones) */ + float f_qcompress; /* 0.0 => cbr, 1.0 => constant qp */ + float f_qblur; /* temporally blur quants */ + float f_complexity_blur; /* temporally blur complexity */ + x264_zone_t *zones; /* ratecontrol overrides */ + int i_zones; /* number of zone_t's */ + char *psz_zones; /* alternate method of specifying zones */ + } rc; + + /* Cropping Rectangle parameters: added to those implicitly defined by + non-mod16 video resolutions. */ + struct + { + unsigned int i_left; + unsigned int i_top; + unsigned int i_right; + unsigned int i_bottom; + } crop_rect; + + /* frame packing arrangement flag */ + int i_frame_packing; + + /* Muxing parameters */ + int b_aud; /* generate access unit delimiters */ + int b_repeat_headers; /* put SPS/PPS before each keyframe */ + int b_annexb; /* if set, place start codes (4 bytes) before NAL units, + * otherwise place size (4 bytes) before NAL units. */ + int i_sps_id; /* SPS and PPS id number */ + int b_vfr_input; /* VFR input. If 1, use timebase and timestamps for ratecontrol purposes. + * If 0, use fps only. */ + int b_pulldown; /* use explicity set timebase for CFR */ + uint32_t i_fps_num; + uint32_t i_fps_den; + uint32_t i_timebase_num; /* Timebase numerator */ + uint32_t i_timebase_den; /* Timebase denominator */ + + int b_tff; + + /* Pulldown: + * The correct pic_struct must be passed with each input frame. + * The input timebase should be the timebase corresponding to the output framerate. This should be constant. + * e.g. for 3:2 pulldown timebase should be 1001/30000 + * The PTS passed with each frame must be the PTS of the frame after pulldown is applied. + * Frame doubling and tripling require b_vfr_input set to zero (see H.264 Table D-1) + * + * Pulldown changes are not clearly defined in H.264. Therefore, it is the calling app's responsibility to manage this. + */ + + int b_pic_struct; + + /* Fake Interlaced. + * + * Used only when b_interlaced=0. Setting this flag makes it possible to flag the stream as PAFF interlaced yet + * encode all frames progessively. It is useful for encoding 25p and 30p Blu-Ray streams. + */ + + int b_fake_interlaced; + + /* Don't optimize header parameters based on video content, e.g. ensure that splitting an input video, compressing + * each part, and stitching them back together will result in identical SPS/PPS. This is necessary for stitching + * with container formats that don't allow multiple SPS/PPS. */ + int b_stitchable; + + int b_opencl; /* use OpenCL when available */ + int i_opencl_device; /* specify count of GPU devices to skip, for CLI users */ + void *opencl_device_id; /* pass explicit cl_device_id as void*, for API users */ + char *psz_clbin_file; /* filename (in UTF-8) of the compiled OpenCL kernel cache file */ + + /* Slicing parameters */ + int i_slice_max_size; /* Max size per slice in bytes; includes estimated NAL overhead. */ + int i_slice_max_mbs; /* Max number of MBs per slice; overrides i_slice_count. */ + int i_slice_min_mbs; /* Min number of MBs per slice */ + int i_slice_count; /* Number of slices per frame: forces rectangular slices. */ + int i_slice_count_max; /* Absolute cap on slices per frame; stops applying slice-max-size + * and slice-max-mbs if this is reached. */ + + /* Optional callback for freeing this x264_param_t when it is done being used. + * Only used when the x264_param_t sits in memory for an indefinite period of time, + * i.e. when an x264_param_t is passed to x264_t in an x264_picture_t or in zones. + * Not used when x264_encoder_reconfig is called directly. */ + void (*param_free)( void* ); + + /* Optional low-level callback for low-latency encoding. Called for each output NAL unit + * immediately after the NAL unit is finished encoding. This allows the calling application + * to begin processing video data (e.g. by sending packets over a network) before the frame + * is done encoding. + * + * This callback MUST do the following in order to work correctly: + * 1) Have available an output buffer of at least size nal->i_payload*3/2 + 5 + 64. + * 2) Call x264_nal_encode( h, dst, nal ), where dst is the output buffer. + * After these steps, the content of nal is valid and can be used in the same way as if + * the NAL unit were output by x264_encoder_encode. + * + * This does not need to be synchronous with the encoding process: the data pointed to + * by nal (both before and after x264_nal_encode) will remain valid until the next + * x264_encoder_encode call. The callback must be re-entrant. + * + * This callback does not work with frame-based threads; threads must be disabled + * or sliced-threads enabled. This callback also does not work as one would expect + * with HRD -- since the buffering period SEI cannot be calculated until the frame + * is finished encoding, it will not be sent via this callback. + * + * Note also that the NALs are not necessarily returned in order when sliced threads is + * enabled. Accordingly, the variable i_first_mb and i_last_mb are available in + * x264_nal_t to help the calling application reorder the slices if necessary. + * + * When this callback is enabled, x264_encoder_encode does not return valid NALs; + * the calling application is expected to acquire all output NALs through the callback. + * + * It is generally sensible to combine this callback with a use of slice-max-mbs or + * slice-max-size. + * + * The opaque pointer is the opaque pointer from the input frame associated with this + * NAL unit. This helps distinguish between nalu_process calls from different sources, + * e.g. if doing multiple encodes in one process. + */ + void (*nalu_process)( x264_t *h, x264_nal_t *nal, void *opaque ); +} x264_param_t; + +void x264_nal_encode( x264_t *h, uint8_t *dst, x264_nal_t *nal ); + +/**************************************************************************** + * H.264 level restriction information + ****************************************************************************/ + +typedef struct x264_level_t +{ + uint8_t level_idc; + uint32_t mbps; /* max macroblock processing rate (macroblocks/sec) */ + uint32_t frame_size; /* max frame size (macroblocks) */ + uint32_t dpb; /* max decoded picture buffer (mbs) */ + uint32_t bitrate; /* max bitrate (kbit/sec) */ + uint32_t cpb; /* max vbv buffer (kbit) */ + uint16_t mv_range; /* max vertical mv component range (pixels) */ + uint8_t mvs_per_2mb; /* max mvs per 2 consecutive mbs. */ + uint8_t slice_rate; /* ?? */ + uint8_t mincr; /* min compression ratio */ + uint8_t bipred8x8; /* limit bipred to >=8x8 */ + uint8_t direct8x8; /* limit b_direct to >=8x8 */ + uint8_t frame_only; /* forbid interlacing */ +} x264_level_t; + +/* all of the levels defined in the standard, terminated by .level_idc=0 */ +X264_API extern const x264_level_t x264_levels[]; + +/**************************************************************************** + * Basic parameter handling functions + ****************************************************************************/ + +/* x264_param_default: + * fill x264_param_t with default values and do CPU detection */ +void x264_param_default( x264_param_t * ); + +/* x264_param_parse: + * set one parameter by name. + * returns 0 on success, or returns one of the following errors. + * note: BAD_VALUE occurs only if it can't even parse the value, + * numerical range is not checked until x264_encoder_open() or + * x264_encoder_reconfig(). + * value=NULL means "true" for boolean options, but is a BAD_VALUE for non-booleans. */ +#define X264_PARAM_BAD_NAME (-1) +#define X264_PARAM_BAD_VALUE (-2) +int x264_param_parse( x264_param_t *, const char *name, const char *value ); + +/**************************************************************************** + * Advanced parameter handling functions + ****************************************************************************/ + +/* These functions expose the full power of x264's preset-tune-profile system for + * easy adjustment of large numbers of internal parameters. + * + * In order to replicate x264CLI's option handling, these functions MUST be called + * in the following order: + * 1) x264_param_default_preset + * 2) Custom user options (via param_parse or directly assigned variables) + * 3) x264_param_apply_fastfirstpass + * 4) x264_param_apply_profile + * + * Additionally, x264CLI does not apply step 3 if the preset chosen is "placebo" + * or --slow-firstpass is set. */ + +/* x264_param_default_preset: + * The same as x264_param_default, but also use the passed preset and tune + * to modify the default settings. + * (either can be NULL, which implies no preset or no tune, respectively) + * + * Currently available presets are, ordered from fastest to slowest: */ +static const char * const x264_preset_names[] = { "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo", 0 }; + +/* The presets can also be indexed numerically, as in: + * x264_param_default_preset( ¶m, "3", ... ) + * with ultrafast mapping to "0" and placebo mapping to "9". This mapping may + * of course change if new presets are added in between, but will always be + * ordered from fastest to slowest. + * + * Warning: the speed of these presets scales dramatically. Ultrafast is a full + * 100 times faster than placebo! + * + * Currently available tunings are: */ +static const char * const x264_tune_names[] = { "film", "animation", "grain", "stillimage", "psnr", "ssim", "fastdecode", "zerolatency", 0 }; + +/* Multiple tunings can be used if separated by a delimiter in ",./-+", + * however multiple psy tunings cannot be used. + * film, animation, grain, stillimage, psnr, and ssim are psy tunings. + * + * returns 0 on success, negative on failure (e.g. invalid preset/tune name). */ +int x264_param_default_preset( x264_param_t *, const char *preset, const char *tune ); + +/* x264_param_apply_fastfirstpass: + * If first-pass mode is set (rc.b_stat_read == 0, rc.b_stat_write == 1), + * modify the encoder settings to disable options generally not useful on + * the first pass. */ +void x264_param_apply_fastfirstpass( x264_param_t * ); + +/* x264_param_apply_profile: + * Applies the restrictions of the given profile. + * Currently available profiles are, from most to least restrictive: */ +static const char * const x264_profile_names[] = { "baseline", "main", "high", "high10", "high422", "high444", 0 }; + +/* (can be NULL, in which case the function will do nothing) + * + * Does NOT guarantee that the given profile will be used: if the restrictions + * of "High" are applied to settings that are already Baseline-compatible, the + * stream will remain baseline. In short, it does not increase settings, only + * decrease them. + * + * returns 0 on success, negative on failure (e.g. invalid profile name). */ +int x264_param_apply_profile( x264_param_t *, const char *profile ); + +/**************************************************************************** + * Picture structures and functions + ****************************************************************************/ + +/* x264_bit_depth: + * Specifies the number of bits per pixel that x264 uses. This is also the + * bit depth that x264 encodes in. If this value is > 8, x264 will read + * two bytes of input data for each pixel sample, and expect the upper + * (16-x264_bit_depth) bits to be zero. + * Note: The flag X264_CSP_HIGH_DEPTH must be used to specify the + * colorspace depth as well. */ +X264_API extern const int x264_bit_depth; + +/* x264_chroma_format: + * Specifies the chroma formats that x264 supports encoding. When this + * value is non-zero, then it represents a X264_CSP_* that is the only + * chroma format that x264 supports encoding. If the value is 0 then + * there are no restrictions. */ +X264_API extern const int x264_chroma_format; + +enum pic_struct_e +{ + PIC_STRUCT_AUTO = 0, // automatically decide (default) + PIC_STRUCT_PROGRESSIVE = 1, // progressive frame + // "TOP" and "BOTTOM" are not supported in x264 (PAFF only) + PIC_STRUCT_TOP_BOTTOM = 4, // top field followed by bottom + PIC_STRUCT_BOTTOM_TOP = 5, // bottom field followed by top + PIC_STRUCT_TOP_BOTTOM_TOP = 6, // top field, bottom field, top field repeated + PIC_STRUCT_BOTTOM_TOP_BOTTOM = 7, // bottom field, top field, bottom field repeated + PIC_STRUCT_DOUBLE = 8, // double frame + PIC_STRUCT_TRIPLE = 9, // triple frame +}; + +typedef struct x264_hrd_t +{ + double cpb_initial_arrival_time; + double cpb_final_arrival_time; + double cpb_removal_time; + + double dpb_output_time; +} x264_hrd_t; + +/* Arbitrary user SEI: + * Payload size is in bytes and the payload pointer must be valid. + * Payload types and syntax can be found in Annex D of the H.264 Specification. + * SEI payload alignment bits as described in Annex D must be included at the + * end of the payload if needed. + * The payload should not be NAL-encapsulated. + * Payloads are written first in order of input, apart from in the case when HRD + * is enabled where payloads are written after the Buffering Period SEI. */ + +typedef struct x264_sei_payload_t +{ + int payload_size; + int payload_type; + uint8_t *payload; +} x264_sei_payload_t; + +typedef struct x264_sei_t +{ + int num_payloads; + x264_sei_payload_t *payloads; + /* In: optional callback to free each payload AND x264_sei_payload_t when used. */ + void (*sei_free)( void* ); +} x264_sei_t; + +typedef struct x264_image_t +{ + int i_csp; /* Colorspace */ + int i_plane; /* Number of image planes */ + int i_stride[4]; /* Strides for each plane */ + uint8_t *plane[4]; /* Pointers to each plane */ +} x264_image_t; + +typedef struct x264_image_properties_t +{ + /* All arrays of data here are ordered as follows: + * each array contains one offset per macroblock, in raster scan order. In interlaced + * mode, top-field MBs and bottom-field MBs are interleaved at the row level. + * Macroblocks are 16x16 blocks of pixels (with respect to the luma plane). For the + * purposes of calculating the number of macroblocks, width and height are rounded up to + * the nearest 16. If in interlaced mode, height is rounded up to the nearest 32 instead. */ + + /* In: an array of quantizer offsets to be applied to this image during encoding. + * These are added on top of the decisions made by x264. + * Offsets can be fractional; they are added before QPs are rounded to integer. + * Adaptive quantization must be enabled to use this feature. Behavior if quant + * offsets differ between encoding passes is undefined. */ + float *quant_offsets; + /* In: optional callback to free quant_offsets when used. + * Useful if one wants to use a different quant_offset array for each frame. */ + void (*quant_offsets_free)( void* ); + + /* In: optional array of flags for each macroblock. + * Allows specifying additional information for the encoder such as which macroblocks + * remain unchanged. Usable flags are listed below. + * x264_param_t.analyse.b_mb_info must be set to use this, since x264 needs to track + * extra data internally to make full use of this information. + * + * Out: if b_mb_info_update is set, x264 will update this array as a result of encoding. + * + * For "MBINFO_CONSTANT", it will remove this flag on any macroblock whose decoded + * pixels have changed. This can be useful for e.g. noting which areas of the + * frame need to actually be blitted. Note: this intentionally ignores the effects + * of deblocking for the current frame, which should be fine unless one needs exact + * pixel-perfect accuracy. + * + * Results for MBINFO_CONSTANT are currently only set for P-frames, and are not + * guaranteed to enumerate all blocks which haven't changed. (There may be false + * negatives, but no false positives.) + */ + uint8_t *mb_info; + /* In: optional callback to free mb_info when used. */ + void (*mb_info_free)( void* ); + + /* The macroblock is constant and remains unchanged from the previous frame. */ + #define X264_MBINFO_CONSTANT (1<<0) + /* More flags may be added in the future. */ + + /* Out: SSIM of the the frame luma (if x264_param_t.b_ssim is set) */ + double f_ssim; + /* Out: Average PSNR of the frame (if x264_param_t.b_psnr is set) */ + double f_psnr_avg; + /* Out: PSNR of Y, U, and V (if x264_param_t.b_psnr is set) */ + double f_psnr[3]; + + /* Out: Average effective CRF of the encoded frame */ + double f_crf_avg; +} x264_image_properties_t; + +typedef struct x264_picture_t +{ + /* In: force picture type (if not auto) + * If x264 encoding parameters are violated in the forcing of picture types, + * x264 will correct the input picture type and log a warning. + * Out: type of the picture encoded */ + int i_type; + /* In: force quantizer for != X264_QP_AUTO */ + int i_qpplus1; + /* In: pic_struct, for pulldown/doubling/etc...used only if b_pic_struct=1. + * use pic_struct_e for pic_struct inputs + * Out: pic_struct element associated with frame */ + int i_pic_struct; + /* Out: whether this frame is a keyframe. Important when using modes that result in + * SEI recovery points being used instead of IDR frames. */ + int b_keyframe; + /* In: user pts, Out: pts of encoded picture (user)*/ + int64_t i_pts; + /* Out: frame dts. When the pts of the first frame is close to zero, + * initial frames may have a negative dts which must be dealt with by any muxer */ + int64_t i_dts; + /* In: custom encoding parameters to be set from this frame forwards + (in coded order, not display order). If NULL, continue using + parameters from the previous frame. Some parameters, such as + aspect ratio, can only be changed per-GOP due to the limitations + of H.264 itself; in this case, the caller must force an IDR frame + if it needs the changed parameter to apply immediately. */ + x264_param_t *param; + /* In: raw image data */ + /* Out: reconstructed image data. x264 may skip part of the reconstruction process, + e.g. deblocking, in frames where it isn't necessary. To force complete + reconstruction, at a small speed cost, set b_full_recon. */ + x264_image_t img; + /* In: optional information to modify encoder decisions for this frame + * Out: information about the encoded frame */ + x264_image_properties_t prop; + /* Out: HRD timing information. Output only when i_nal_hrd is set. */ + x264_hrd_t hrd_timing; + /* In: arbitrary user SEI (e.g subtitles, AFDs) */ + x264_sei_t extra_sei; + /* private user data. copied from input to output frames. */ + void *opaque; +} x264_picture_t; + +/* x264_picture_init: + * initialize an x264_picture_t. Needs to be done if the calling application + * allocates its own x264_picture_t as opposed to using x264_picture_alloc. */ +void x264_picture_init( x264_picture_t *pic ); + +/* x264_picture_alloc: + * alloc data for a picture. You must call x264_picture_clean on it. + * returns 0 on success, or -1 on malloc failure or invalid colorspace. */ +int x264_picture_alloc( x264_picture_t *pic, int i_csp, int i_width, int i_height ); + +/* x264_picture_clean: + * free associated resource for a x264_picture_t allocated with + * x264_picture_alloc ONLY */ +void x264_picture_clean( x264_picture_t *pic ); + +/**************************************************************************** + * Encoder functions + ****************************************************************************/ + +/* Force a link error in the case of linking against an incompatible API version. + * Glue #defines exist to force correct macro expansion; the final output of the macro + * is x264_encoder_open_##X264_BUILD (for purposes of dlopen). */ +#define x264_encoder_glue1(x,y) x##y +#define x264_encoder_glue2(x,y) x264_encoder_glue1(x,y) +#define x264_encoder_open x264_encoder_glue2(x264_encoder_open_,X264_BUILD) + +/* x264_encoder_open: + * create a new encoder handler, all parameters from x264_param_t are copied */ +x264_t *x264_encoder_open( x264_param_t * ); + +/* x264_encoder_reconfig: + * various parameters from x264_param_t are copied. + * this takes effect immediately, on whichever frame is encoded next; + * due to delay, this may not be the next frame passed to encoder_encode. + * if the change should apply to some particular frame, use x264_picture_t->param instead. + * returns 0 on success, negative on parameter validation error. + * not all parameters can be changed; see the actual function for a detailed breakdown. + * + * since not all parameters can be changed, moving from preset to preset may not always + * fully copy all relevant parameters, but should still work usably in practice. however, + * more so than for other presets, many of the speed shortcuts used in ultrafast cannot be + * switched out of; using reconfig to switch between ultrafast and other presets is not + * recommended without a more fine-grained breakdown of parameters to take this into account. */ +int x264_encoder_reconfig( x264_t *, x264_param_t * ); +/* x264_encoder_parameters: + * copies the current internal set of parameters to the pointer provided + * by the caller. useful when the calling application needs to know + * how x264_encoder_open has changed the parameters, or the current state + * of the encoder after multiple x264_encoder_reconfig calls. + * note that the data accessible through pointers in the returned param struct + * (e.g. filenames) should not be modified by the calling application. */ +void x264_encoder_parameters( x264_t *, x264_param_t * ); +/* x264_encoder_headers: + * return the SPS and PPS that will be used for the whole stream. + * *pi_nal is the number of NAL units outputted in pp_nal. + * returns the number of bytes in the returned NALs. + * returns negative on error. + * the payloads of all output NALs are guaranteed to be sequential in memory. */ +int x264_encoder_headers( x264_t *, x264_nal_t **pp_nal, int *pi_nal ); +/* x264_encoder_encode: + * encode one picture. + * *pi_nal is the number of NAL units outputted in pp_nal. + * returns the number of bytes in the returned NALs. + * returns negative on error and zero if no NAL units returned. + * the payloads of all output NALs are guaranteed to be sequential in memory. */ +int x264_encoder_encode( x264_t *, x264_nal_t **pp_nal, int *pi_nal, x264_picture_t *pic_in, x264_picture_t *pic_out ); +/* x264_encoder_close: + * close an encoder handler */ +void x264_encoder_close( x264_t * ); +/* x264_encoder_delayed_frames: + * return the number of currently delayed (buffered) frames + * this should be used at the end of the stream, to know when you have all the encoded frames. */ +int x264_encoder_delayed_frames( x264_t * ); +/* x264_encoder_maximum_delayed_frames( x264_t *h ): + * return the maximum number of delayed (buffered) frames that can occur with the current + * parameters. */ +int x264_encoder_maximum_delayed_frames( x264_t *h ); +/* x264_encoder_intra_refresh: + * If an intra refresh is not in progress, begin one with the next P-frame. + * If an intra refresh is in progress, begin one as soon as the current one finishes. + * Requires that b_intra_refresh be set. + * + * Useful for interactive streaming where the client can tell the server that packet loss has + * occurred. In this case, keyint can be set to an extremely high value so that intra refreshes + * only occur when calling x264_encoder_intra_refresh. + * + * In multi-pass encoding, if x264_encoder_intra_refresh is called differently in each pass, + * behavior is undefined. + * + * Should not be called during an x264_encoder_encode. */ +void x264_encoder_intra_refresh( x264_t * ); +/* x264_encoder_invalidate_reference: + * An interactive error resilience tool, designed for use in a low-latency one-encoder-few-clients + * system. When the client has packet loss or otherwise incorrectly decodes a frame, the encoder + * can be told with this command to "forget" the frame and all frames that depend on it, referencing + * only frames that occurred before the loss. This will force a keyframe if no frames are left to + * reference after the aforementioned "forgetting". + * + * It is strongly recommended to use a large i_dpb_size in this case, which allows the encoder to + * keep around extra, older frames to fall back on in case more recent frames are all invalidated. + * Unlike increasing i_frame_reference, this does not increase the number of frames used for motion + * estimation and thus has no speed impact. It is also recommended to set a very large keyframe + * interval, so that keyframes are not used except as necessary for error recovery. + * + * x264_encoder_invalidate_reference is not currently compatible with the use of B-frames or intra + * refresh. + * + * In multi-pass encoding, if x264_encoder_invalidate_reference is called differently in each pass, + * behavior is undefined. + * + * Should not be called during an x264_encoder_encode, but multiple calls can be made simultaneously. + * + * Returns 0 on success, negative on failure. */ +int x264_encoder_invalidate_reference( x264_t *, int64_t pts ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c.go b/vendor/github.com/gen2brain/x264-go/x264c/x264c.go new file mode 100644 index 00000000..f3542115 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/x264c.go @@ -0,0 +1,959 @@ +// Package x264c implements cgo bindings for [x264](https://www.videolan.org/developers/x264.html) library. +package x264c + +/* +#include "stdint.h" +#include "x264.h" +#include +*/ +import "C" + +import "unsafe" + +// Constants. +const ( + // CPU flags. + CpuMmx = (1 << 0) + // MMX2 aka MMXEXT aka ISSE. + CpuMmx2 = (1 << 1) + CpuMmxext = CpuMmx2 + CpuSse = (1 << 2) + CpuSse2 = (1 << 3) + CpuLzcnt = (1 << 4) + CpuSse3 = (1 << 5) + CpuSsse3 = (1 << 6) + // SSE4.1 + CpuSse4 = (1 << 7) + // SSE4.2 + CpuSse42 = (1 << 8) + // Requires OS support even if YMM registers aren't used. + CpuAvx = (1 << 9) + // AMD XOP. + CpuXop = (1 << 10) + // AMD FMA4. + CpuFma4 = (1 << 11) + CpuFma3 = (1 << 12) + CpuBmi1 = (1 << 13) + CpuBmi2 = (1 << 14) + CpuAvx2 = (1 << 15) + // AVX-512 {F, CD, BW, DQ, VL}, requires OS support. + CpuAvx512 = (1 << 16) + + // X86 modifiers. + // Avoid memory loads that span the border between two cachelines. + CpuCacheline32 = (1 << 17) + // 32/64 is the size of a cacheline in bytes. + CpuCacheline64 = (1 << 18) + // Avoid most SSE2 functions on Athlon64. + CpuSse2IsSlow = (1 << 19) + // A few functions are only faster on Core2 and Phenom. + CpuSse2IsFast = (1 << 20) + // The Conroe has a slow shuffle unit (relative to overall SSE performance). + CpuSlowShuffle = (1 << 21) + // If stack is only mod4 and not mod16. + CpuStackMod4 = (1 << 22) + // The Atom is terrible: slow SSE unaligned loads, slow SIMD multiplies, slow SIMD variable shifts, slow pshufb, + // cacheline split penalties -- gather everything here that isn't shared by other CPUs to avoid making half a dozen new SLOW flags. + CpuSlowAtom = (1 << 23) + // Auch as on the Intel Atom. + CpuSlowPshufb = (1 << 24) + // Such as on the AMD Bobcat. + CpuSlowPalignr = (1 << 25) + // PowerPC. + CpuAltivec = 0x0000001 + // ARM and AArch64. + CpuArmv6 = 0x0000001 + // ARM NEON. + CpuNeon = 0x0000002 + // Transfer from NEON to ARM register is fast (Cortex-A9). + CpuFastNeonMrc = 0x0000004 + CpuArmv8 = 0x0000008 + // MIPS MSA. + CpuMsa = 0x0000001 + + // Analyse i4x4 + AnalyseI4x4 = 0x0001 + // Analyse i8x8 (requires 8x8 transform) + AnalyseI8x8 = 0x0002 + // Analyse p16x8, p8x16 and p8x8 + AnalysePsub16x16 = 0x0010 + // Analyse p8x4, p4x8, p4x4 + AnalysePsub8x8 = 0x0020 + // Analyse b16x8, b8x16 and b8x8 + AnalyseBsub16x16 = 0x0100 + + // Analyse flags. + DirectPredNone = 0 + DirectPredSpatial = 1 + DirectPredTemporal = 2 + DirectPredAuto = 3 + MeDia = 0 + MeHex = 1 + MeUmh = 2 + MeEsa = 3 + MeTesa = 4 + CqmFlat = 0 + CqmJvt = 1 + CqmCustom = 2 + RcCqp = 0 + RcCrf = 1 + RcAbr = 2 + QpAuto = 0 + AqNone = 0 + AqVariance = 1 + AqAutovariance = 2 + AqAutovarianceBiased = 3 + BAdaptNone = 0 + BAdaptFast = 1 + BAdaptTrellis = 2 + WeightpNone = 0 + WeightpSimple = 1 + WeightpSmart = 2 + BPyramidNone = 0 + BPyramidStrict = 1 + BPyramidNormal = 2 + KeyintMinAuto = 0 + KeyintMaxInfinite = (1 << 30) + + // Colorspace type. + CspMask = 0x00ff + // Invalid mode. + CspNone = 0x0000 + // Yuv 4:2:0 planar. + CspI420 = 0x0001 + // Yvu 4:2:0 planar. + CspYv12 = 0x0002 + // Yuv 4:2:0, with one y plane and one packed u+v. + CspNv12 = 0x0003 + // Yuv 4:2:0, with one y plane and one packed v+u. + CspNv21 = 0x0004 + // Yuv 4:2:2 planar. + CspI422 = 0x0005 + // Yvu 4:2:2 planar. + CspYv16 = 0x0006 + // Yuv 4:2:2, with one y plane and one packed u+v. + CspNv16 = 0x0007 + // Yuyv 4:2:2 packed. + CspYuyv = 0x0008 + // Uyvy 4:2:2 packed. + CspUyvy = 0x0009 + // 10-bit yuv 4:2:2 packed in 32. + CspV210 = 0x000a + // Yuv 4:4:4 planar. + CspI444 = 0x000b + // Yvu 4:4:4 planar. + CspYv24 = 0x000c + // Packed bgr 24bits. + CspBgr = 0x000d + // Packed bgr 32bits. + CspBgra = 0x000e + // Packed rgb 24bits. + CspRgb = 0x000f + // End of list. + CspMax = 0x0010 + // The csp is vertically flipped. + CspVflip = 0x1000 + // The csp has a depth of 16 bits per pixel component. + CspHighDepth = 0x2000 + + // Slice type. + // Let x264 choose the right type. + TypeAuto = 0x0000 + TypeIdr = 0x0001 + TypeI = 0x0002 + TypeP = 0x0003 + // Non-disposable B-frame + TypeBref = 0x0004 + TypeB = 0x0005 + // IDR or I depending on BOpenGop option. + TypeKeyframe = 0x0006 + + // Log level. + LogNone = (-1) + LogError = 0 + LogWarning = 1 + LogInfo = 2 + LogDebug = 3 + + // Threading. + // Automatically select optimal number of threads. + ThreadsAuto = 0 + // Automatically select optimal lookahead thread buffer size + SyncLookaheadAuto = (-1) + + // HRD + NalHrdNone = 0 + NalHrdVbr = 1 + NalHrdCbr = 2 + + ParamBadName = (-1) + ParamBadValue = (-2) + + // MbinfoConstant. + MbinfoConstant = (1 << 0) +) + +// NalUnitType enumeration. +const ( + NalUnknown = int32(iota) + NalSlice + NalSliceDpa + NalSliceDpb + NalSliceDpc + NalSliceIdr + NalSei + NalSps + NalPps + NalAud + NalFiller +) + +// NalPriority enumeration. +const ( + NalPriorityDisposable = int32(iota) + NalPriorityLow + NalPriorityHigh + NalPriorityHighest +) + +// PicStruct enumeration. +const ( + PicStructAuto = int32(iota) // automatically decide (default) + PicStructProgressive // progressive frame + + // "TOP" and "BOTTOM" are not supported in x264 (PAFF only) + PicStructTopBottom // top field followed by bottom + PicStructBottomTop // bottom field followed by top + PicStructTopBottomTop // top field, bottom field, top field repeated + PicStructBottomTopBottom // bottom field, top field, bottom field repeated + PicStructDouble // double frame + PicStructTriple // triple frame +) + +// T opaque handler for encoder. +type T struct{} + +// cptr return C pointer. +func (t *T) cptr() *C.x264_t { + return (*C.x264_t)(unsafe.Pointer(t)) +} + +// Nal type. +// The data within the payload is already NAL-encapsulated; the ref_idc and type are merely in the struct for easy access by the calling application. +// All data returned in an Nal, including the data in PPayload, is no longer valid after the next call to EncoderEncode. +// Thus it must be used or copied before calling EncoderEncode or EncoderHeaders again. +type Nal struct { + // NalPriority. + IRefIdc int32 + // NalUnitType. + IType int32 + // Start code. + BLongStartcode int32 + // If this NAL is a slice, the index of the first MB in the slice. + IFirstMb int32 + // If this NAL is a slice, the index of the last MB in the slice. + ILastMb int32 + // Size of payload (including any padding) in bytes. + IPayload int32 + // If param.BAnnexb is set, Annex-B bytestream with startcode. + // Otherwise, startcode is replaced with a 4-byte size. + // This size is the size used in mp4/similar muxing; it is equal to IPayload-4. + PPayload unsafe.Pointer + // Size of padding in bytes. + IPadding int32 +} + +// cptr return C pointer. +func (n *Nal) cptr() *C.x264_nal_t { + return (*C.x264_nal_t)(unsafe.Pointer(n)) +} + +// Vui type. +type Vui struct { + // They will be reduced to be 0 < x <= 65535 and prime. + ISarHeight int32 + ISarWidth int32 + + // 0=undef, 1=no overscan, 2=overscan. + IOverscan int32 + + // See h264 annex E for the values of the following. + IVidformat int32 + BFullrange int32 + IColorprim int32 + ITransfer int32 + IColmatrix int32 + + // Both top & bottom. + IChromaLoc int32 +} + +// Analyse (encoder analyser parameters) type. +type Analyse struct { + // Intra partitions. + Intra uint32 + // Inter partitions. + Inter uint32 + + BTransform8x8 int32 + // Weighting for P-frames. + IWeightedPred int32 + // Implicit weighting for B-frames. + BWeightedBipred int32 + // Spatial vs temporal mv prediction. + IDirectMvPred int32 + IChromaQpOffset int32 + + // Motion estimation algorithm to use (X264_ME_*). + IMeMethod int32 + // Integer pixel motion estimation search range (from predicted mv). + IMeRange int32 + // Maximum length of a mv (in pixels). -1 = auto, based on level. + IMvRange int32 + // Minimum space between threads. -1 = auto, based on number of threads. + IMvRangeThread int32 + // Subpixel motion estimation quality. + ISubpelRefine int32 + // Chroma ME for subpel and mode decision in P-frames. + BChromaMe int32 + // Allow each mb partition to have its own reference number. + BMixedReferences int32 + // Trellis RD quantization. + ITrellis int32 + // Early SKIP detection on P-frames. + BFastPskip int32 + // Transform coefficient thresholding on P-frames. + BDctDecimate int32 + // Adaptive pseudo-deadzone. + INoiseReduction int32 + // Psy RD strength. + FPsyRd float32 + // Psy trellis strength. + FPsyTrellis float32 + // Toggle all psy optimizations. + BPsy int32 + + // Use input MbInfo data in Picture + BMbInfo int32 + // Update the values in mb_info according to the results of encoding. + BMbInfoUpdate int32 + + // The deadzone size that will be used in luma quantization {inter, intra} + ILumaDeadzone [2]int32 + + // compute and print PSNR stats + BPsnr int32 + // compute and print SSIM stats + BSsim int32 +} + +// Rc (rate control parameters) type. +type Rc struct { + // X264_RC_* + IRcMethod int32 + + // 0 to (51 + 6*(x264_bit_depth-8)). 0=lossless. + IQpConstant int32 + // Min allowed QP value. + IQpMin int32 + // Max allowed QP value. + IQpMax int32 + // Max QP step between frames. + IQpStep int32 + + IBitrate int32 + // 1pass VBR, nominal QP. + FRfConstant float32 + // In CRF mode, maximum CRF as caused by VBV. + FRfConstantMax float32 + FRateTolerance float32 + IVbvMaxBitrate int32 + IVbvBufferSize int32 + // <=1: fraction of buffer_size. >1: kbit. + FVbvBufferInit float32 + FIpFactor float32 + FPbFactor float32 + + // VBV filler: force CBR VBV and use filler bytes to ensure hard-CBR. Implied by NAL-HRD CBR. + BFiller int32 + + // Psy adaptive QP. (X264_AQ_*). + IAqMode int32 + FAqStrength float32 + // Macroblock-tree ratecontrol. + BMbTree int32 + ILookahead int32 + + // 2pass + // Enable stat writing in psz_stat_out. + BStatWrite int32 + // Output filename (in UTF-8) of the 2pass stats file. + PszStatOut *int8 + // Read stat from psz_stat_in and use it. + BStatRead int32 + _ [4]byte + // Input filename (in UTF-8) of the 2pass stats file. + PszStatIn *int8 + + // 2pass params (same as ffmpeg ones). + // 0.0 => cbr, 1.0 => constant qp. + FQcompress float32 + // Temporally blur quants. + FQblur float32 + // Temporally blur complexity. + FComplexityBlur float32 + _ [4]byte + // Ratecontrol overrides. + Zones *Zone + // Number of Zone's. + IZones int32 + _ [4]byte + // Alternate method of specifying zones. + PszZones *int8 +} + +// CropRect (cropping rectangle parameters) type. +// Added to those implicitly defined by non-mod16 video resolutions. +type CropRect struct { + Left uint32 + Top uint32 + Right uint32 + Bottom uint32 +} + +// Zone type. +// Zones: override ratecontrol or other options for specific sections of the video. +// See EncoderReconfig() for which options can be changed. +// If zones overlap, whichever comes later in the list takes precedence. +type Zone struct { + // Range of frame numbers. + IStart int32 + // Range of frame numbers. + IEnd int32 + // Whether to use qp vs bitrate factor. + BForceQp int32 + IQp int32 + FBitrateFactor float32 + _ [4]byte + Param *Param +} + +// Level (H.264 level restriction information) type. +type Level struct { + LevelIdc byte + _ [3]byte + // Max macroblock processing rate (macroblocks/sec). + Mbps uint32 + // Max frame size (macroblocks). + FrameSize uint32 + // Max decoded picture buffer (mbs). + Dpb uint32 + // Max bitrate (kbit/sec). + Bitrate uint32 + // Max vbv buffer (kbit). + Cpb uint32 + // Max vertical mv component range (pixels). + MvRange uint16 + // Max mvs per 2 consecutive mbs. + MvsPer2mb byte + SliceRate byte + // Min compression ratio. + Mincr byte + // Limit bipred to >=8x8. + Bipred8x8 byte + // Limit b_direct to >=8x8. + Direct8x8 byte + // Forbid interlacing. + FrameOnly byte +} + +// Param type. +type Param struct { + // CPU flags. + Cpu uint32 + // Encode multiple frames in parallel. + IThreads int32 + // Multiple threads for lookahead analysis. + ILookaheadThreads int32 + // Whether to use slice-based threading. + BSlicedThreads int32 + // Whether to allow non-deterministic optimizations when threaded. + BDeterministic int32 + // Force canonical behavior rather than cpu-dependent optimal algorithms. + BCpuIndependent int32 + // Threaded lookahead buffer. + ISyncLookahead int32 + + // Video Properties. + IWidth int32 + IHeight int32 + // CSP of encoded bitstream. + ICsp int32 + ILevelIdc int32 + // Number of frames to encode if known, else 0. + IFrameTotal int32 + + // NAL HRD. + // Uses Buffering and Picture Timing SEIs to signal HRD. The HRD in H.264 was not designed with VFR in mind. + // It is therefore not recommendeded to use NAL HRD with VFR. + // Furthermore, reconfiguring the VBV (via x264_encoder_reconfig) will currently generate invalid HRD. + INalHrd int32 + + Vui Vui + + // Bitstream parameters. + // Maximum number of reference frames. + IFrameReference int32 + // Force a DPB size larger than that implied by B-frames and reference frames. + // Useful in combination with interactive error resilience. + IDpbSize int32 + // Force an IDR keyframe at this interval. + IKeyintMax int32 + // Scenecuts closer together than this are coded as I, not IDR. + IKeyintMin int32 + // How aggressively to insert extra I frames. + IScenecutThreshold int32 + // Whether or not to use periodic intra refresh instead of IDR frames. + BIntraRefresh int32 + + // How many b-frame between 2 references pictures. + IBframe int32 + IBframeAdaptive int32 + IBframeBias int32 + // Keep some B-frames as references: 0=off, 1=strict hierarchical, 2=normal. + IBframePyramid int32 + BOpenGop int32 + BBlurayCompat int32 + IAvcintraClass int32 + + BDeblockingFilter int32 + // [-6, 6] -6 light filter, 6 strong. + IDeblockingFilterAlphac0 int32 + // [-6, 6] idem. + IDeblockingFilterBeta int32 + + BCabac int32 + ICabacInitIdc int32 + + BInterlaced int32 + BConstrainedIntra int32 + + ICqmPreset int32 + _ [4]byte + // Filename (in UTF-8) of CQM file, JM format. + PszCqmFile *int8 + + // Used only if i_cqm_preset == X264_CQM_CUSTOM. + Cqm4iy [16]byte + Cqm4py [16]byte + Cqm4ic [16]byte + Cqm4pc [16]byte + Cqm8iy [64]byte + Cqm8py [64]byte + Cqm8ic [64]byte + Cqm8pc [64]byte + + // Log. + PfLog *[0]byte + PLogPrivate unsafe.Pointer + ILogLevel int32 + // Fully reconstruct frames, even when not necessary for encoding. Implied by psz_dump_yuv. + BFullRecon int32 + // Filename (in UTF-8) for reconstructed frames. + PszDumpYuv *int8 + + // Encoder analyser parameters. + Analyse Analyse + + _ [4]byte + + // Rate control parameters. + Rc Rc + + // Cropping Rectangle parameters: added to those implicitly defined by non-mod16 video resolutions. + CropRect CropRect + + // Frame packing arrangement flag. + IFramePacking int32 + + // Muxing parameters. + // Generate access unit delimiters. + BAud int32 + // Put SPS/PPS before each keyframe. + BRepeatHeaders int32 + // If set, place start codes (4 bytes) before NAL units, otherwise place size (4 bytes) before NAL units. + BAnnexb int32 + // SPS and PPS id number. + ISpsId int32 + // VFR input. If 1, use timebase and timestamps for ratecontrol purposes. If 0, use fps only. + BVfrInput int32 + // Use explicitly set timebase for CFR. + BPulldown int32 + IFpsNum uint32 + IFpsDen uint32 + // Timebase numerator. + ITimebaseNum uint32 + // Timebase denominator. + ITimebaseDen uint32 + + BTff int32 + + // The correct pic_struct must be passed with each input frame. + // The input timebase should be the timebase corresponding to the output framerate. This should be constant. + // e.g. for 3:2 pulldown timebase should be 1001/30000. + // The PTS passed with each frame must be the PTS of the frame after pulldown is applied. + // Frame doubling and tripling require BVfrInput set to zero (see H.264 Table D-1) + // + // Pulldown changes are not clearly defined in H.264. Therefore, it is the calling app's responsibility to manage this. + BPicStruct int32 + + // Used only when b_interlaced=0. Setting this flag makes it possible to flag the stream as PAFF interlaced yet + // encode all frames progessively. It is useful for encoding 25p and 30p Blu-Ray streams. + BFakeInterlaced int32 + + // Don't optimize header parameters based on video content, e.g. ensure that splitting an input video, compressing + // each part, and stitching them back together will result in identical SPS/PPS. This is necessary for stitching + // with container formats that don't allow multiple SPS/PPS. + BStitchable int32 + + // Use OpenCL when available. + BOpencl int32 + // Specify count of GPU devices to skip, for CLI users. + IOpenclDevice int32 + _ [4]byte + // Pass explicit cl_device_id as void*, for API users. + OpenclDeviceId unsafe.Pointer + // Filename (in UTF-8) of the compiled OpenCL kernel cache file. + PszClbinFile *int8 + + // Slicing parameters + // Max size per slice in bytes; includes estimated NAL overhead. + ISliceMaxSize int32 + // Max number of MBs per slice; overrides i_slice_count. + ISliceMaxMbs int32 + // Min number of MBs per slice. + ISliceMinMbs int32 + // Number of slices per frame: forces rectangular slices. + ISliceCount int32 + // Absolute cap on slices per frame; stops applying slice-max-size and slice-max-mbs if this is reached. + ISliceCountMax int32 + + _ [4]byte + ParamFree *[0]byte + NaluProcess *[0]byte +} + +// cptr return C pointer. +func (p *Param) cptr() *C.x264_param_t { + return (*C.x264_param_t)(unsafe.Pointer(p)) +} + +// Hrd type. +type Hrd struct { + CpbInitialArrivalTime float64 + CpbFinalArrivalTime float64 + CpbRemovalTime float64 + DpbOutputTime float64 +} + +// SeiPayload type. +type SeiPayload struct { + PayloadSize int32 + PayloadType int32 + Payload *uint8 +} + +// Sei type. +type Sei struct { + NumPayloads int32 + _ [4]byte + Payloads *SeiPayload + SeiFree *[0]byte +} + +// Image type. +type Image struct { + // Colorspace. + ICsp int32 + // Number of image planes. + IPlane int32 + // Strides for each plane. + IStride [4]int32 + // Pointers to each plane. + Plane [4]unsafe.Pointer +} + +// ImageProperties type. +type ImageProperties struct { + // In: an array of quantizer offsets to be applied to this image during encoding. + QuantOffsets *float32 + // In: optional callback to free quant_offsets when used. + // Useful if one wants to use a different quant_offset array for each frame. + QuantOffsetsFree *[0]byte + + // In: optional array of flags for each macroblock. + // Out: if b_mb_info_update is set, x264 will update this array as a result of encoding. + MbInfo *uint8 + // In: optional callback to free mb_info when used. + MbInfoFree *[0]byte + + // Out: SSIM of the the frame luma (if x264_param_t.b_ssim is set). + FSsim float64 + // Out: Average PSNR of the frame (if x264_param_t.b_psnr is set). + FPsnrAvg float64 + // Out: PSNR of Y, U, and V (if x264_param_t.b_psnr is set). + FPsnr [3]float64 + + // Out: Average effective CRF of the encoded frame. + FCrfAvg float64 +} + +// Picture type. +type Picture struct { + // In: force picture type (if not auto). + // Out: type of the picture encoded. + IType int32 + // In: force quantizer for != X264_QP_AUTO. + IQpplus1 int32 + // In: pic_struct, for pulldown/doubling/etc...used only if b_pic_struct=1. + // Out: pic_struct element associated with frame. + IPicStruct int32 + // Out: whether this frame is a keyframe. + // Important when using modes that result in SEI recovery points being used instead of IDR frames. + BKeyframe int32 + // In: user pts, Out: pts of encoded picture (user). + IPts int64 + // Out: frame dts. When the pts of the first frame is close to zero, + // initial frames may have a negative dts which must be dealt with by any muxer. + IDts int64 + // In: custom encoding parameters to be set from this frame forwards (in coded order, not display order). + // If nil, continue using parameters from the previous frame. + Param *Param + // In: raw image data. + // Out: reconstructed image data. + Img Image + // In: optional information to modify encoder decisions for this frame. + // Out: information about the encoded frame. + Prop ImageProperties + // Out: HRD timing information. Output only when i_nal_hrd is set. + Hrdiming Hrd + // In: arbitrary user SEI (e.g subtitles, AFDs). + ExtraSei Sei + // Private user data. copied from input to output frames. + Opaque *byte +} + +// cptr return C pointer. +func (p *Picture) cptr() *C.x264_picture_t { + return (*C.x264_picture_t)(unsafe.Pointer(p)) +} + +// NalEncode - encode Nal. +func NalEncode(h *T, dst []byte, nal *Nal) { + ch := h.cptr() + cdst := (*C.uint8_t)(unsafe.Pointer(&dst[0])) + cnal := nal.cptr() + + C.x264_nal_encode(ch, cdst, cnal) +} + +// ParamDefault - fill Param with default values and do CPU detection. +func ParamDefault(param *Param) { + C.x264_param_default(param.cptr()) +} + +// ParamParse - set one parameter by name. Returns 0 on success. +func ParamParse(param *Param, name string, value string) int32 { + cparam := param.cptr() + + cname := C.CString(name) + defer C.free(unsafe.Pointer(cname)) + + cvalue := C.CString(value) + defer C.free(unsafe.Pointer(cvalue)) + + ret := C.x264_param_parse(cparam, cname, cvalue) + v := (int32)(ret) + return v +} + +// ParamDefaultPreset - the same as ParamDefault, but also use the passed preset and tune to modify the default settings +// (either can be nil, which implies no preset or no tune, respectively). +// +// Currently available presets are, ordered from fastest to slowest: +// "ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo". +// +// Currently available tunings are: +// "film", "animation", "grain", "stillimage", "psnr", "ssim", "fastdecode", "zerolatency". +// +// Returns 0 on success, negative on failure (e.g. invalid preset/tune name). +func ParamDefaultPreset(param *Param, preset string, tune string) int32 { + cparam := param.cptr() + + cpreset := C.CString(preset) + defer C.free(unsafe.Pointer(cpreset)) + + ctune := C.CString(tune) + defer C.free(unsafe.Pointer(ctune)) + + ret := C.x264_param_default_preset(cparam, cpreset, ctune) + v := (int32)(ret) + return v +} + +// ParamApplyFastfirstpass - if first-pass mode is set (rc.b_stat_read == 0, rc.b_stat_write == 1), +// modify the encoder settings to disable options generally not useful on the first pass. +func ParamApplyFastfirstpass(param *Param) { + cparam := param.cptr() + C.x264_param_apply_fastfirstpass(cparam) +} + +// ParamApplyProfile - applies the restrictions of the given profile. +// +// Currently available profiles are, from most to least restrictive: +// "baseline", "main", "high", "high10", "high422", "high444". +// (can be nil, in which case the function will do nothing). +// +// Returns 0 on success, negative on failure (e.g. invalid profile name). +func ParamApplyProfile(param *Param, profile string) int32 { + cparam := param.cptr() + + cprofile := C.CString(profile) + defer C.free(unsafe.Pointer(cprofile)) + + ret := C.x264_param_apply_profile(cparam, cprofile) + v := (int32)(ret) + return v +} + +// PictureInit - initialize an Picture. Needs to be done if the calling application +// allocates its own Picture as opposed to using PictureAlloc. +func PictureInit(pic *Picture) { + cpic := pic.cptr() + C.x264_picture_init(cpic) +} + +// PictureAlloc - alloc data for a Picture. You must call PictureClean on it. +// Returns 0 on success, or -1 on malloc failure or invalid colorspace. +func PictureAlloc(pic *Picture, iCsp int32, iWidth int32, iHeight int32) int32 { + cpic := pic.cptr() + + ciCsp := (C.int)(iCsp) + ciWidth := (C.int)(iWidth) + ciHeight := (C.int)(iHeight) + + ret := C.x264_picture_alloc(cpic, ciCsp, ciWidth, ciHeight) + v := (int32)(ret) + return v +} + +// PictureClean - free associated resource for a Picture allocated with PictureAlloc ONLY. +func PictureClean(pic *Picture) { + cpic := pic.cptr() + C.x264_picture_clean(cpic) +} + +// EncoderOpen - create a new encoder handler, all parameters from Param are copied. +func EncoderOpen(param *Param) *T { + cparam := param.cptr() + + ret := C.x264_encoder_open(cparam) + v := *(**T)(unsafe.Pointer(&ret)) + return v +} + +// EncoderReconfig - various parameters from Param are copied. +// Returns 0 on success, negative on parameter validation error. +func EncoderReconfig(enc *T, param *Param) int32 { + cenc := enc.cptr() + cparam := param.cptr() + + ret := C.x264_encoder_reconfig(cenc, cparam) + v := (int32)(ret) + return v +} + +// EncoderParameters - copies the current internal set of parameters to the pointer provided. +func EncoderParameters(enc *T, param *Param) { + cenc := enc.cptr() + cparam := param.cptr() + + C.x264_encoder_parameters(cenc, cparam) +} + +// EncoderHeaders - return the SPS and PPS that will be used for the whole stream. +// Returns the number of bytes in the returned NALs or negative on error. +func EncoderHeaders(enc *T, ppNal []*Nal, piNal *int32) int32 { + cenc := enc.cptr() + + cppNal := (**C.x264_nal_t)(unsafe.Pointer(&ppNal[0])) + cpiNal := (*C.int)(unsafe.Pointer(piNal)) + + ret := C.x264_encoder_headers(cenc, cppNal, cpiNal) + v := (int32)(ret) + return v +} + +// EncoderEncode - encode one picture. +// Returns the number of bytes in the returned NALs, negative on error and zero if no NAL units returned. +func EncoderEncode(enc *T, ppNal []*Nal, piNal *int32, picIn *Picture, picOut *Picture) int32 { + cenc := enc.cptr() + + cppNal := (**C.x264_nal_t)(unsafe.Pointer(&ppNal[0])) + cpiNal := (*C.int)(unsafe.Pointer(piNal)) + + cpicIn := picIn.cptr() + cpicOut := picOut.cptr() + + ret := C.x264_encoder_encode(cenc, cppNal, cpiNal, cpicIn, cpicOut) + v := (int32)(ret) + return v +} + +// EncoderClose - close an encoder handler. +func EncoderClose(enc *T) { + cenc := enc.cptr() + C.x264_encoder_close(cenc) +} + +// EncoderDelayedFrames - return the number of currently delayed (buffered) frames. +// This should be used at the end of the stream, to know when you have all the encoded frames. +func EncoderDelayedFrames(enc *T) int32 { + cenc := enc.cptr() + + ret := C.x264_encoder_delayed_frames(cenc) + v := (int32)(ret) + return v +} + +// EncoderMaximumDelayedFrames - return the maximum number of delayed (buffered) frames that can occur with the current parameters. +func EncoderMaximumDelayedFrames(enc *T) int32 { + cenc := enc.cptr() + + ret := C.x264_encoder_maximum_delayed_frames(cenc) + v := (int32)(ret) + return v +} + +// EncoderIntraRefresh - If an intra refresh is not in progress, begin one with the next P-frame. +// If an intra refresh is in progress, begin one as soon as the current one finishes. +// Requires that BIntraRefresh be set. +// +// Should not be called during an x264_encoder_encode. +func EncoderIntraRefresh(enc *T) { + cenc := enc.cptr() + C.x264_encoder_intra_refresh(cenc) +} + +// EncoderInvalidateReference - An interactive error resilience tool, designed for use in a low-latency one-encoder-few-clients system. +// Should not be called during an EncoderEncode, but multiple calls can be made simultaneously. +// +// Returns 0 on success, negative on failure. +func EncoderInvalidateReference(enc *T, pts int) int32 { + cenc := enc.cptr() + cpts := (C.int64_t)(pts) + + ret := C.x264_encoder_invalidate_reference(cenc, cpts) + v := (int32)(ret) + return v +} diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_android_arm.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_android_arm.syso new file mode 100644 index 00000000..784e8b28 Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_android_arm.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_android_arm64.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_android_arm64.syso new file mode 100644 index 00000000..d0728b21 Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_android_arm64.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_darwin_amd64.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_darwin_amd64.syso new file mode 100644 index 00000000..3901d91c Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_darwin_amd64.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_386.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_386.syso new file mode 100644 index 00000000..14c061c0 Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_386.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_amd64.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_amd64.syso new file mode 100644 index 00000000..67a94ebe Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_amd64.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_arm.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_arm.syso new file mode 100644 index 00000000..36ccf6c6 Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_arm.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_arm64.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_arm64.syso new file mode 100644 index 00000000..54911a32 Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_linux_arm64.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_windows_386.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_windows_386.syso new file mode 100644 index 00000000..906d1978 Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_windows_386.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_windows_amd64.syso b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_windows_amd64.syso new file mode 100644 index 00000000..f39778fd Binary files /dev/null and b/vendor/github.com/gen2brain/x264-go/x264c/x264c_analyse_windows_amd64.syso differ diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_cgo.go b/vendor/github.com/gen2brain/x264-go/x264c/x264c_cgo.go new file mode 100644 index 00000000..53cc0537 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/x264c_cgo.go @@ -0,0 +1,61 @@ +// +build !extlib + +package x264c + +/* +#include "external/x264/common/mc.c" +#include "external/x264/common/predict.c" +#include "external/x264/common/pixel.c" +#include "external/x264/common/macroblock.c" +#include "external/x264/common/frame.c" +#include "external/x264/common/dct.c" +#include "external/x264/common/cpu.c" +#include "external/x264/common/cabac.c" +#include "external/x264/common/common.c" +#include "external/x264/common/osdep.c" +#include "external/x264/common/rectangle.c" +#include "external/x264/common/set.c" +#include "external/x264/common/quant.c" +#include "external/x264/common/deblock.c" +#include "external/x264/common/vlc.c" +#include "external/x264/common/mvpred.c" +#include "external/x264/common/bitstream.c" + +//#include "external/x264/encoder/analyse.c" +#include "external/x264/encoder/me.c" +#include "external/x264/encoder/ratecontrol.c" +#include "external/x264/encoder/set.c" +#include "external/x264/encoder/macroblock.c" +#include "external/x264/encoder/cabac.c" +#include "external/x264/encoder/cavlc.c" +#include "external/x264/encoder/encoder.c" +#include "external/x264/encoder/lookahead.c" + +#include "external/x264/common/threadpool.c" + +#ifdef HAVE_WIN32THREAD +#include "external/x264/common/win32thread.c" +#endif + +#cgo android LDFLAGS: -lm +#cgo windows LDFLAGS: +#cgo linux,!android LDFLAGS: -lpthread -lm +#cgo darwin LDFLAGS: -lpthread -lm + +#cgo linux,386 CFLAGS: -DSYS_LINUX=1 -DARCH_X86=1 -DHAVE_POSIXTHREAD=1 -DSTACK_ALIGNMENT=64 -DHAVE_MALLOC_H=1 -DHAVE_CPU_COUNT=1 -DTHP=1 +#cgo linux,amd64 CFLAGS: -DSYS_LINUX=1 -DARCH_X86_64=1 -DHAVE_POSIXTHREAD=1 -DSTACK_ALIGNMENT=64 -DHAVE_MALLOC_H=1 -DHAVE_CPU_COUNT=1 -DTHP=1 +#cgo linux,!android,arm CFLAGS: -DSYS_LINUX=1 -DARCH_ARM=1 -DHAVE_POSIXTHREAD=1 -DSTACK_ALIGNMENT=4 -DHAVE_MALLOC_H=1 -DHAVE_CPU_COUNT=1 -DTHP=1 +#cgo linux,!android,arm64 CFLAGS: -DSYS_LINUX=1 -DARCH_AARCH64=1 -DHAVE_POSIXTHREAD=1 -DSTACK_ALIGNMENT=16 -DHAVE_MALLOC_H=1 -DHAVE_CPU_COUNT=1 -DTHP=1 +#cgo windows,386 CFLAGS: -DSYS_WINDOWS=1 -DARCH_X86=1 -DHAVE_WIN32THREAD=1 -DSTACK_ALIGNMENT=64 -DHAVE_MALLOC_H=0 -DHAVE_CPU_COUNT=0 -DTHP=0 +#cgo windows,amd64 CFLAGS: -DSYS_WINDOWS=1 -DARCH_X86_64=1 -DHAVE_WIN32THREAD=1 -DSTACK_ALIGNMENT=16 -DHAVE_MALLOC_H=0 -DHAVE_CPU_COUNT=0 -DTHP=0 +#cgo darwin,amd64 CFLAGS: -DSYS_MACOSX=1 -DARCH_X86_64=1 -DHAVE_POSIXTHREAD=1 -DSTACK_ALIGNMENT=16 -DHAVE_MALLOC_H=0 -DHAVE_CPU_COUNT=0 -DTHP=1 +#cgo android,arm CFLAGS: -DSYS_LINUX=1 -DARCH_ARM=1 -DHAVE_THREAD=1 -DHAVE_POSIXTHREAD=1 -DSTACK_ALIGNMENT=4 -DHAVE_MALLOC_H=1 -DHAVE_CPU_COUNT=0 -DTHP=1 +#cgo android,arm64 CFLAGS: -DSYS_LINUX=1 -DARCH_AARCH64=1 -DHAVE_THREAD=1 -DHAVE_POSIXTHREAD=1 -DSTACK_ALIGNMENT=16 -DHAVE_MALLOC_H=1 -DHAVE_CPU_COUNT=1 -DTHP=1 + +#cgo CFLAGS: -std=gnu99 -Iexternal/x264 -D_GNU_SOURCE -fomit-frame-pointer -Wshadow -O3 +#cgo CFLAGS: -DHAVE_THREAD=1 -DHAVE_LOG2F=1 -DHAVE_STRTOK_R=1 -DHAVE_MMAP=1 -DHAVE_GPL=1 -DHAVE_INTERLACED=1 +#cgo CFLAGS: -DHAVE_SWSCALE=0 -DHAVE_LAVF=0 -DHAVE_AVS=0 -DUSE_AVXSYNTH=0 -DHAVE_VECTOREXT=1 -DHAVE_BITDEPTH8=1 -DHIGH_BIT_DEPTH=0 +#cgo CFLAGS: -DHAVE_OPENCL=0 -DHAVE_ALTIVEC=0 -DHAVE_ALTIVEC_H=0 -DHAVE_FFMS=0 -DHAVE_GPAC=0 -DHAVE_LSMASH=0 +#cgo CFLAGS: -DX264_BIT_DEPTH=8 -DX264_GPL=11 -DX264_INTERLACED=1 -DX264_CHROMA_FORMAT=0 +*/ +import "C" diff --git a/vendor/github.com/gen2brain/x264-go/x264c/x264c_cgo_extlib.go b/vendor/github.com/gen2brain/x264-go/x264c/x264c_cgo_extlib.go new file mode 100644 index 00000000..c5e8d0a0 --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/x264c/x264c_cgo_extlib.go @@ -0,0 +1,11 @@ +// +build extlib + +package x264c + +/* +#cgo android LDFLAGS: -lx264 -lm +#cgo windows LDFLAGS: -lx264 +#cgo linux LDFLAGS: -lx264 -lm +#cgo darwin LDFLAGS: -lx264 -lm +*/ +import "C" diff --git a/vendor/github.com/gen2brain/x264-go/ycbcr.go b/vendor/github.com/gen2brain/x264-go/ycbcr.go new file mode 100644 index 00000000..a008f3da --- /dev/null +++ b/vendor/github.com/gen2brain/x264-go/ycbcr.go @@ -0,0 +1,41 @@ +package x264 + +import ( + "image" + "image/color" + "image/draw" +) + +// YCbCr is an in-memory image of Y'CbCr colors. +type YCbCr struct { + *image.YCbCr +} + +// NewYCbCr returns a new YCbCr image with the given bounds and subsample ratio. +func NewYCbCr(r image.Rectangle) *YCbCr { + return &YCbCr{image.NewYCbCr(r, image.YCbCrSubsampleRatio420)} +} + +// Set sets pixel color. +func (p *YCbCr) Set(x, y int, c color.Color) { + p.setYCbCr(x, y, p.ColorModel().Convert(c).(color.YCbCr)) +} + +func (p *YCbCr) setYCbCr(x, y int, c color.YCbCr) { + if !image.Pt(x, y).In(p.Rect) { + return + } + + yi := p.YOffset(x, y) + ci := p.COffset(x, y) + + p.Y[yi] = c.Y + p.Cb[ci] = c.Cb + p.Cr[ci] = c.Cr +} + +// ToYCbCr converts image.Image to YCbCr. +func (p *YCbCr) ToYCbCr(src image.Image) { + bounds := src.Bounds() + draw.Draw(p, bounds, src, bounds.Min, draw.Src) +} diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go index 79668ff5..a4b8c0cd 100644 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ b/vendor/github.com/golang/protobuf/proto/properties.go @@ -38,7 +38,6 @@ package proto import ( "fmt" "log" - "os" "reflect" "sort" "strconv" @@ -194,7 +193,7 @@ func (p *Properties) Parse(s string) { // "bytes,49,opt,name=foo,def=hello!" fields := strings.Split(s, ",") // breaks def=, but handled below. if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) + log.Printf("proto: tag has too few fields: %q", s) return } @@ -214,7 +213,7 @@ func (p *Properties) Parse(s string) { p.WireType = WireBytes // no numeric converter for non-numeric types default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) + log.Printf("proto: tag has unknown wire type: %q", s) return } diff --git a/vendor/github.com/googleapis/gax-go/v2/gax.go b/vendor/github.com/googleapis/gax-go/v2/gax.go index 8040dcb0..3fd1b0b8 100644 --- a/vendor/github.com/googleapis/gax-go/v2/gax.go +++ b/vendor/github.com/googleapis/gax-go/v2/gax.go @@ -36,4 +36,4 @@ package gax // Version specifies the gax-go version being used. -const Version = "2.0.3" +const Version = "2.0.4" diff --git a/vendor/github.com/googleapis/gax-go/v2/go.mod b/vendor/github.com/googleapis/gax-go/v2/go.mod index 0c91100b..9cdfaf44 100644 --- a/vendor/github.com/googleapis/gax-go/v2/go.mod +++ b/vendor/github.com/googleapis/gax-go/v2/go.mod @@ -1,5 +1,3 @@ module github.com/googleapis/gax-go/v2 -go 1.12 - require google.golang.org/grpc v1.19.0 diff --git a/vendor/github.com/gortc/turn/.codecov.yml b/vendor/github.com/gortc/turn/.codecov.yml deleted file mode 100644 index 2b54d956..00000000 --- a/vendor/github.com/gortc/turn/.codecov.yml +++ /dev/null @@ -1,9 +0,0 @@ -coverage: - status: - patch: off - project: - default: - # basic - target: 90 - threshold: null - base: auto diff --git a/vendor/github.com/gortc/turn/.gitignore b/vendor/github.com/gortc/turn/.gitignore deleted file mode 100644 index e8907fdc..00000000 --- a/vendor/github.com/gortc/turn/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -cmd/turn-client/turn-client -*.zip - - -# go tests -*.test -*.out -coverage.txt - -.idea - - diff --git a/vendor/github.com/gortc/turn/.golangci.yml b/vendor/github.com/gortc/turn/.golangci.yml deleted file mode 100644 index 245056e2..00000000 --- a/vendor/github.com/gortc/turn/.golangci.yml +++ /dev/null @@ -1,98 +0,0 @@ -linters-settings: - govet: - check-shadowing: true - golint: - min-confidence: 0 - gocyclo: - min-complexity: 15 - maligned: - suggest-new: true - dupl: - threshold: 100 - goconst: - min-len: 3 - min-occurrences: 3 - misspell: - locale: US - lll: - line-length: 140 - goimports: - local-prefixes: github.com/gortc - gocritic: - enabled-tags: - - performance - - style - - experimental - disabled-checks: - - commentedOutCode - - sloppyReassign - -issues: - exclude: - - "`assertHMACSize` - `blocksize` always receives `64`" - exclude-rules: - - text: "string ``" - linters: - - goconst - - # Exclude some linters from running on tests files. - - path: _test\.go - linters: - - gocyclo - - errcheck - - dupl - - gosec - - goconst - - # Ease some gocritic warnings on test files. - - path: testutil\.go - text: "(rangeValCopy)" - linters: - - gocritic - - # Ease some gocritic warnings on test files. - - path: _test\.go - text: "(unnamedResult|exitAfterDefer|unlambda)" - linters: - - gocritic - - # Exclude known linters from partially hard-vendored code, - # which is impossible to exclude via "nolint" comments. - - path: internal/hmac/ - text: "weak cryptographic primitive" - linters: - - gosec - - path: internal/hmac/ - text: "Write\\` is not checked" - linters: - - errcheck - - # Ease linting on benchmarking code. - - path: cmd/stun-bench/ - linters: - - gosec - - errcheck - - unparam - - - path: ^cmd/ - linters: - - gocyclo - - path: ^cmd/ - text: "(unnamedResult|exitAfterDefer)" - linters: - - gocritic - -linters: - enable-all: true - disable: - - prealloc - - gochecknoglobals - - scopelint - - dupl - -run: - skip-dirs: - - e2e - - fuzz - - testdata - - api diff --git a/vendor/github.com/gortc/turn/.travis.yml b/vendor/github.com/gortc/turn/.travis.yml deleted file mode 100644 index fe395476..00000000 --- a/vendor/github.com/gortc/turn/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: go - -sudo: false - -env: - - GO111MODULE=on - -go: - - stable - -install: true - -script: - - ./go.test.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/gortc/turn/Makefile b/vendor/github.com/gortc/turn/Makefile deleted file mode 100644 index 205601e2..00000000 --- a/vendor/github.com/gortc/turn/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -GO_VERSION=$(shell gobuild -v) -GO := $(or $(GOROOT),/usr/lib/go)/bin/go -PROCS := $(shell nproc) -cores: - @echo "cores: $(PROCS)" -test: - @./go.test.sh -bench: - go test -bench . -bench-record: - $(GO) test -bench . > "benchmarks/turn-go-$(GO_VERSION).txt" -fuzz-prepare-setters: - go-fuzz-build -func FuzzSetters -o turn-setters-fuzz.zip github.com/gortc/turn -fuzz-setters: - go-fuzz -bin=./turn-setters-fuzz.zip -workdir=fuzz/turn-setters -fuzz-test: - go test -tags gofuzz -run TestFuzz -v . -fuzz-prepare-chandata: - go-fuzz-build -func FuzzChannelData -o turn-chandata-fuzz.zip github.com/gortc/turn -fuzz-chandata: - go-fuzz -bin=./turn-chandata-fuzz.zip -workdir=fuzz/turn-chandata -lint: - @golangci-lint run ./... - @echo "ok" -escape: - @echo "Not escapes, except autogenerated:" - @go build -gcflags '-m -l' 2>&1 \ - | grep -v "" \ - | grep escapes -format: - goimports -w . -docker-build: - docker build -t gortc/turn . -test-integration: - @cd e2e && ./test.sh -check-api: - api -c api/turn1.txt github.com/gortc/turn -write-api: - api github.com/gortc/turn > api/turn1.txt - diff --git a/vendor/github.com/gortc/turn/README.md b/vendor/github.com/gortc/turn/README.md deleted file mode 100644 index 7a1675e5..00000000 --- a/vendor/github.com/gortc/turn/README.md +++ /dev/null @@ -1,58 +0,0 @@ -[![Build Status](https://travis-ci.com/gortc/turn.svg?branch=master)](https://travis-ci.com/gortc/turn) -[![Master status](https://tc.gortc.io/app/rest/builds/buildType:(id:stun_MasterStatus)/statusIcon.svg)](https://tc.gortc.io/project.html?projectId=turn&tab=projectOverview&guest=1) -[![Build status](https://ci.appveyor.com/api/projects/status/bodd3l5hgu1agxpf/branch/master?svg=true)](https://ci.appveyor.com/project/ernado/turn-gvuk2/branch/master) -[![GoDoc](https://godoc.org/github.com/gortc/turn?status.svg)](http://godoc.org/github.com/gortc/turn) -[![codecov](https://codecov.io/gh/gortc/turn/branch/master/graph/badge.svg)](https://codecov.io/gh/gortc/turn) -[![Go Report](https://goreportcard.com/badge/github.com/gortc/turn)](http://goreportcard.com/report/gortc/turn) -[![stability-beta](https://img.shields.io/badge/stability-beta-33bbff.svg)](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#beta) -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fgortc%2Fturn.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fgortc%2Fturn?ref=badge_shield) - -# TURN - -Package turn implements TURN [[RFC5766](https://tools.ietf.org/html/rfc5766)] Traversal Using Relays around NAT. -Based on [pion/stun](https://github.com/pion/stun) package. -See [gortcd](https://github.com/gortc/gortcd) for TURN server and [stunc](https://github.com/pion/turnc) for TURN client. - -## Supported RFCs - -- [x] [RFC 5766](https://tools.ietf.org/html/rfc5766) — Traversal Using Relays around NAT - - [x] UDP transport for client - - [ ] TCP or TLS transport for client -- [x] [RFC 6156](https://tools.ietf.org/html/rfc6156) — TURN Extension for IPv6 -- [x] [RFC 7065](https://tools.ietf.org/html/rfc7065) — TURN URI -- [ ] [RFC 5928](https://tools.ietf.org/html/rfc5928) — TURN Resolution Mechanism [#13](https://github.com/gortc/turn/issues/13) -- [ ] [RFC 6062](https://tools.ietf.org/html/rfc6062) — TURN Extension for TCP Allocations [#14](https://github.com/gortc/turn/issues/14) - -# Testing -Client behavior is tested and verified in many ways: - * End-To-End with long-term credentials - * **coturn**: The coturn [server](https://github.com/coturn/coturn/wiki/turnserver) (linux) - * **gortcd**: The [gortcd](https://github.com/gortc/gortcd) server (windows) - * Bunch of code static checkers (linters) - * Unit-tests (linux {amd64, **arm**64}, windows} - * Explicit API backward compatibility [check](https://github.com/gortc/api), see `api` directory (relaxed until v1) - -See [TeamCity project](https://tc.gortc.io/project.html?projectId=turn&guest=1) and `e2e` directory -for more information. Also the Wireshark `.pcap` files are available for some of e2e tests in -artifacts for build. - -## Benchmarks - -``` -goos: linux -goarch: amd64 -pkg: github.com/gortc/turn -PASS -benchmark iter time/iter throughput bytes alloc allocs ---------- ---- --------- ---------- ----------- ------ -BenchmarkIsChannelData-12 2000000000 1.64 ns/op 6694.29 MB/s 0 B/op 0 allocs/op -BenchmarkChannelData_Encode-12 200000000 9.11 ns/op 1317.35 MB/s 0 B/op 0 allocs/op -BenchmarkChannelData_Decode-12 500000000 3.92 ns/op 3061.45 MB/s 0 B/op 0 allocs/op -BenchmarkChannelNumber/AddTo-12 100000000 12.60 ns/op 0 B/op 0 allocs/op -BenchmarkChannelNumber/GetFrom-12 200000000 7.23 ns/op 0 B/op 0 allocs/op -BenchmarkData/AddTo-12 100000000 18.80 ns/op 0 B/op 0 allocs/op -BenchmarkData/AddToRaw-12 100000000 16.80 ns/op 0 B/op 0 allocs/op -BenchmarkLifetime/AddTo-12 100000000 13.70 ns/op 0 B/op 0 allocs/op -BenchmarkLifetime/GetFrom-12 200000000 7.10 ns/op 0 B/op 0 allocs/op -ok github.com/gortc/turn 19.110s -``` diff --git a/vendor/github.com/gortc/turn/appveyor.yml b/vendor/github.com/gortc/turn/appveyor.yml deleted file mode 100644 index 8b83506b..00000000 --- a/vendor/github.com/gortc/turn/appveyor.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: "{build}" - -platform: x64 - -branches: - only: - - master - -skip_tags: true - -clone_folder: c:\src\gortc\turn - -environment: - GOPATH: c:\gopath - GOVERSION: 1.12 - -install: - - go version - -build_script: - - go test -v . diff --git a/vendor/github.com/gortc/turn/go.mod b/vendor/github.com/gortc/turn/go.mod deleted file mode 100644 index 56207741..00000000 --- a/vendor/github.com/gortc/turn/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/gortc/turn - -go 1.12 - -require github.com/pion/stun v0.3.1 diff --git a/vendor/github.com/gortc/turn/go.sum b/vendor/github.com/gortc/turn/go.sum deleted file mode 100644 index 7a340c9d..00000000 --- a/vendor/github.com/gortc/turn/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/pion/stun v0.3.1 h1:d09JJzOmOS8ZzIp8NppCMgrxGZpJ4Ix8qirfNYyI3BA= -github.com/pion/stun v0.3.1/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/vendor/github.com/gortc/turn/go.test.sh b/vendor/github.com/gortc/turn/go.test.sh deleted file mode 100644 index 1f311274..00000000 --- a/vendor/github.com/gortc/turn/go.test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -e -touch coverage.txt - -# test fuzz inputs -go test -tags gofuzz -run TestFuzz -v . - -# quick-test without -race -go test ./... - -# quick-test with "debug" -go test -tags debug ./... - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/vendor/github.com/pion/datachannel/.travis.yml b/vendor/github.com/pion/datachannel/.travis.yml index 3d7987db..701d3468 100644 --- a/vendor/github.com/pion/datachannel/.travis.yml +++ b/vendor/github.com/pion/datachannel/.travis.yml @@ -13,12 +13,11 @@ notifications: before_script: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.13 - - go get github.com/mattn/goveralls script: - golangci-lint run ./... - go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... - - goveralls -coverprofile=cover.out -service=travis-ci + - bash <(curl -s https://codecov.io/bash) - bash .github/assert-contributors.sh - bash .github/lint-disallowed-functions-in-library.sh - bash .github/lint-commit-message.sh diff --git a/vendor/github.com/pion/datachannel/README.md b/vendor/github.com/pion/datachannel/README.md index f7229380..439520ea 100644 --- a/vendor/github.com/pion/datachannel/README.md +++ b/vendor/github.com/pion/datachannel/README.md @@ -11,7 +11,7 @@
Build Status GoDoc - Coverage Status + Coverage Status Go Report Card License: MIT @@ -37,6 +37,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [Sean DuBois](https://github.com/Sean-Der) - *Original Author* * [Michiel De Backker](https://github.com/backkem) - *Public API* * [Yutaka Takeda](https://github.com/enobufs) - *PR-SCTP* +* [Hugo Arregui](https://github.com/hugoArregui) ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/vendor/github.com/pion/datachannel/datachannel.go b/vendor/github.com/pion/datachannel/datachannel.go index 93dde750..e1209f85 100644 --- a/vendor/github.com/pion/datachannel/datachannel.go +++ b/vendor/github.com/pion/datachannel/datachannel.go @@ -3,6 +3,7 @@ package datachannel import ( "fmt" "io" + "sync/atomic" "github.com/pion/logging" "github.com/pion/sctp" @@ -36,6 +37,13 @@ type ReadWriteCloser interface { // DataChannel represents a data channel type DataChannel struct { Config + + // stats + messagesSent uint32 + messagesReceived uint32 + bytesSent uint64 + bytesReceived uint64 + stream *sctp.Stream log logging.LeveledLogger } @@ -199,10 +207,34 @@ func (c *DataChannel) ReadDataChannel(p []byte) (int, bool, error) { case sctp.PayloadTypeWebRTCString, sctp.PayloadTypeWebRTCStringEmpty: isString = true } + + atomic.AddUint32(&c.messagesReceived, 1) + atomic.AddUint64(&c.bytesReceived, uint64(n)) + return n, isString, err } } +// MessagesSent returns the number of messages sent +func (c *DataChannel) MessagesSent() uint32 { + return atomic.LoadUint32(&c.messagesSent) +} + +// MessagesReceived returns the number of messages received +func (c *DataChannel) MessagesReceived() uint32 { + return atomic.LoadUint32(&c.messagesReceived) +} + +// BytesSent returns the number of bytes sent +func (c *DataChannel) BytesSent() uint64 { + return atomic.LoadUint64(&c.bytesSent) +} + +// BytesReceived returns the number of bytes received +func (c *DataChannel) BytesReceived() uint64 { + return atomic.LoadUint64(&c.bytesReceived) +} + // StreamIdentifier returns the Stream identifier associated to the stream. func (c *DataChannel) StreamIdentifier() uint16 { return c.stream.StreamIdentifier() @@ -259,6 +291,9 @@ func (c *DataChannel) WriteDataChannel(p []byte, isString bool) (n int, err erro ppi = sctp.PayloadTypeWebRTCStringEmpty } + atomic.AddUint32(&c.messagesSent, 1) + atomic.AddUint64(&c.bytesSent, uint64(len(p))) + return c.stream.WriteSCTP(p, ppi) } diff --git a/vendor/github.com/pion/dtls/README.md b/vendor/github.com/pion/dtls/README.md index 57e80ce8..9073f77a 100644 --- a/vendor/github.com/pion/dtls/README.md +++ b/vendor/github.com/pion/dtls/README.md @@ -28,10 +28,29 @@ We would love contributes that fall under the 'Planned Features' and fixing any #### Current features * DTLS 1.2 Client/Server -* Forward secrecy using ECDHE; with curve25519 and nistp256 (non-PFS will not be supported) -* AES_128_GCM, AES_256_CBC +* Key Exchange via ECDHE(curve25519 and nistp256) and PSK * Packet loss and re-ordering is handled during handshaking -* Key export (RFC5705) +* Key export ([RFC 5705][rfc5705]) +* Serialization and Resumption of sessions + +[rfc5705]: https://tools.ietf.org/html/rfc5705 + +#### Supported ciphers + +##### ECDHE +* TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ([RFC 5289][rfc5289]) +* TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ([RFC 5289][rfc5289]) +* TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA ([RFC 8422][rfc8422]) +* TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA ([RFC 8422][rfc8422]) + +##### PSK +* TLS_PSK_WITH_AES_128_CCM_8 ([RFC 6655][rfc6655]) +* TLS_PSK_WITH_AES_128_GCM_SHA256 ([RFC 5487][rfc5487]) + +[rfc5289]: https://tools.ietf.org/html/rfc5289 +[rfc8422]: https://tools.ietf.org/html/rfc8422 +[rfc6655]: https://tools.ietf.org/html/rfc6655 +[rfc5487]: https://tools.ietf.org/html/rfc5487 #### Planned Features * Extended master secret support (RFC7627) @@ -42,7 +61,9 @@ We would love contributes that fall under the 'Planned Features' and fixing any * Renegotiation * Compression -### Pion DTLS +### Using + +#### Pion DTLS For a DTLS 1.2 Server that listens on 127.0.0.1:4444 ```sh go run examples/listen/main.go @@ -53,7 +74,7 @@ For a DTLS 1.2 Client that connects to 127.0.0.1:4444 go run examples/dial/main.go ``` -### OpenSSL +#### OpenSSL Pion DTLS can connect to itself and OpenSSL. ``` // Generate a certificate @@ -68,13 +89,35 @@ Pion DTLS can connect to itself and OpenSSL. openssl s_client -dtls1_2 -connect 127.0.0.1:4444 -debug -cert cert.pem -key key.pem ``` +### Using with PSK +Pion DTLS also comes with examples that do key exchange via PSK + + +#### Pion DTLS +```sh +go run examples/listen-psk/main.go +``` + +```sh +go run examples/dial-psk/main.go +``` + +#### OpenSSL +``` + // Use with examples/dial-psk/main.go + openssl s_server -dtls1_2 -accept 4444 -nocert -psk abc123 -cipher PSK-AES128-CCM8 + + // Use with examples/listen-psk/main.go + openssl s_client -dtls1_2 -connect 127.0.0.1:4444 -psk abc123 -cipher PSK-AES128-CCM8 +``` + ### Contributing Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contributing)** to join the group of amazing people making this project possible: * [Sean DuBois](https://github.com/Sean-Der) - *Original Author* * [Michiel De Backker](https://github.com/backkem) - *Public API* * [Chris Hiszpanski](https://github.com/thinkski) - *Support Signature Algorithms Extension* -* [Iñigo Garcia Olaizola](https://github.com/igolaizola) - *Support serialization and resumption"* +* [Iñigo Garcia Olaizola](https://github.com/igolaizola) - *Serialization & resumption, cert verification* * [Daniele Sluijters](https://github.com/daenney) - *AES-CCM support* * [Jin Lei](https://github.com/jinleileiking) - *Logging* * [Hugo Arregui](https://github.com/hugoArregui) diff --git a/vendor/github.com/pion/dtls/cipher_suite.go b/vendor/github.com/pion/dtls/cipher_suite.go index 162d51ce..9892c192 100644 --- a/vendor/github.com/pion/dtls/cipher_suite.go +++ b/vendor/github.com/pion/dtls/cipher_suite.go @@ -18,6 +18,9 @@ const ( // AES-256-CBC-SHA TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA CipherSuiteID = 0xc00a TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA CipherSuiteID = 0x0035 + + TLS_PSK_WITH_AES_128_CCM_8 CipherSuiteID = 0xc0a8 + TLS_PSK_WITH_AES_128_GCM_SHA256 CipherSuiteID = 0x00a8 ) type cipherSuite interface { @@ -47,8 +50,11 @@ func cipherSuiteForID(id CipherSuiteID) cipherSuite { return &cipherSuiteTLSEcdheEcdsaWithAes256CbcSha{} case cipherSuiteTLSEcdheRsaWithAes256CbcSha{}.ID(): return &cipherSuiteTLSEcdheRsaWithAes256CbcSha{} + case cipherSuiteTLSPskWithAes128Ccm8{}.ID(): + return &cipherSuiteTLSPskWithAes128Ccm8{} + case cipherSuiteTLSPskWithAes128GcmSha256{}.ID(): + return &cipherSuiteTLSPskWithAes128GcmSha256{} } - return nil } diff --git a/vendor/github.com/pion/dtls/cipher_suite_tls_psk_with_aes_128_ccm8.go b/vendor/github.com/pion/dtls/cipher_suite_tls_psk_with_aes_128_ccm8.go new file mode 100644 index 00000000..49927fa5 --- /dev/null +++ b/vendor/github.com/pion/dtls/cipher_suite_tls_psk_with_aes_128_ccm8.go @@ -0,0 +1,67 @@ +package dtls + +import ( + "crypto/sha256" + "errors" + "hash" +) + +type cipherSuiteTLSPskWithAes128Ccm8 struct { + ccm *cryptoCCM +} + +func (c cipherSuiteTLSPskWithAes128Ccm8) certificateType() clientCertificateType { + return clientCertificateType(0) +} + +func (c cipherSuiteTLSPskWithAes128Ccm8) ID() CipherSuiteID { + return TLS_PSK_WITH_AES_128_CCM_8 +} + +func (c cipherSuiteTLSPskWithAes128Ccm8) String() string { + return "TLS_PSK_WITH_AES_128_CCM_8" +} + +func (c cipherSuiteTLSPskWithAes128Ccm8) hashFunc() func() hash.Hash { + return sha256.New +} + +func (c cipherSuiteTLSPskWithAes128Ccm8) isPSK() bool { + return true +} + +func (c *cipherSuiteTLSPskWithAes128Ccm8) init(masterSecret, clientRandom, serverRandom []byte, isClient bool) error { + const ( + prfMacLen = 0 + prfKeyLen = 16 + prfIvLen = 4 + ) + + keys, err := prfEncryptionKeys(masterSecret, clientRandom, serverRandom, prfMacLen, prfKeyLen, prfIvLen, c.hashFunc()) + if err != nil { + return err + } + + if isClient { + c.ccm, err = newCryptoCCM(keys.clientWriteKey, keys.clientWriteIV, keys.serverWriteKey, keys.serverWriteIV) + } else { + c.ccm, err = newCryptoCCM(keys.serverWriteKey, keys.serverWriteIV, keys.clientWriteKey, keys.clientWriteIV) + } + return err +} + +func (c *cipherSuiteTLSPskWithAes128Ccm8) encrypt(pkt *recordLayer, raw []byte) ([]byte, error) { + if c.ccm == nil { + return nil, errors.New("CipherSuite has not been initalized, unable to encrypt") + } + + return c.ccm.encrypt(pkt, raw) +} + +func (c *cipherSuiteTLSPskWithAes128Ccm8) decrypt(raw []byte) ([]byte, error) { + if c.ccm == nil { + return nil, errors.New("CipherSuite has not been initalized, unable to decrypt ") + } + + return c.ccm.decrypt(raw) +} diff --git a/vendor/github.com/pion/dtls/cipher_suite_tls_psk_with_aes_128_gcm_sha256.go b/vendor/github.com/pion/dtls/cipher_suite_tls_psk_with_aes_128_gcm_sha256.go new file mode 100644 index 00000000..d66422a9 --- /dev/null +++ b/vendor/github.com/pion/dtls/cipher_suite_tls_psk_with_aes_128_gcm_sha256.go @@ -0,0 +1,21 @@ +package dtls + +type cipherSuiteTLSPskWithAes128GcmSha256 struct { + cipherSuiteTLSEcdheEcdsaWithAes128GcmSha256 +} + +func (c cipherSuiteTLSPskWithAes128GcmSha256) certificateType() clientCertificateType { + return clientCertificateType(0) +} + +func (c cipherSuiteTLSPskWithAes128GcmSha256) ID() CipherSuiteID { + return TLS_PSK_WITH_AES_128_GCM_SHA256 +} + +func (c cipherSuiteTLSPskWithAes128GcmSha256) String() string { + return "TLS_PSK_WITH_AES_128_GCM_SHA256" +} + +func (c cipherSuiteTLSPskWithAes128GcmSha256) isPSK() bool { + return true +} diff --git a/vendor/github.com/pion/dtls/client_handlers.go b/vendor/github.com/pion/dtls/client_handlers.go index e23e9f4f..e734f894 100644 --- a/vendor/github.com/pion/dtls/client_handlers.go +++ b/vendor/github.com/pion/dtls/client_handlers.go @@ -6,6 +6,63 @@ import ( ) func clientHandshakeHandler(c *Conn) error { + initalizeCipherSuite := func(h *handshakeMessageServerKeyExchange) error { + clientRandom, err := c.state.localRandom.Marshal() + if err != nil { + return err + } + serverRandom, err := c.state.remoteRandom.Marshal() + if err != nil { + return err + } + + var preMasterSecret []byte + if c.localPSKCallback != nil { + var psk []byte + if psk, err = c.localPSKCallback(h.identityHint); err != nil { + return err + } + + preMasterSecret = prfPSKPreMasterSecret(psk) + + } else { + if c.localKeypair, err = generateKeypair(h.namedCurve); err != nil { + return err + } + + if preMasterSecret, err = prfPreMasterSecret(h.publicKey, c.localKeypair.privateKey, c.localKeypair.curve); err != nil { + return err + } + } + + c.state.masterSecret, err = prfMasterSecret(preMasterSecret, clientRandom, serverRandom, c.state.cipherSuite.hashFunc()) + if err != nil { + return err + } + + if err := c.state.cipherSuite.init(c.state.masterSecret, clientRandom, serverRandom /* isClient */, true); err != nil { + return err + } + + if c.localPSKCallback == nil { + if !c.insecureSkipVerify { + expectedHash := valueKeySignature(clientRandom, serverRandom, h.publicKey, h.namedCurve, h.hashAlgorithm) + if err := verifyKeySignature(expectedHash, h.signature, h.hashAlgorithm, c.state.remoteCertificate); err != nil { + return err + } + if err := verifyServerCert(c.state.remoteCertificate, c.rootCAs, c.serverName); err != nil { + return err + } + } + if c.verifyPeerCertificate != nil { + if err := c.verifyPeerCertificate(c.state.remoteCertificate, !c.insecureSkipVerify); err != nil { + return err + } + } + } + return nil + } + handleSingleHandshake := func(buf []byte) error { rawHandshake := &handshake{} if err := rawHandshake.Unmarshal(buf); err != nil { @@ -42,41 +99,9 @@ func clientHandshakeHandler(c *Conn) error { c.state.remoteCertificate = h.certificate case *handshakeMessageServerKeyExchange: - c.remoteKeypair = &namedCurveKeypair{h.namedCurve, h.publicKey, nil} - - clientRandom, err := c.state.localRandom.Marshal() - if err != nil { + if err := initalizeCipherSuite(h); err != nil { return err } - serverRandom, err := c.state.remoteRandom.Marshal() - if err != nil { - return err - } - - c.localKeypair, err = generateKeypair(h.namedCurve) - if err != nil { - return err - } - - preMasterSecret, err := prfPreMasterSecret(c.remoteKeypair.publicKey, c.localKeypair.privateKey, c.localKeypair.curve) - if err != nil { - return err - } - - c.state.masterSecret, err = prfMasterSecret(preMasterSecret, clientRandom, serverRandom, c.state.cipherSuite.hashFunc()) - if err != nil { - return err - } - - if err := c.state.cipherSuite.init(c.state.masterSecret, clientRandom, serverRandom /* isClient */, true); err != nil { - return err - } - - expectedHash := valueKeySignature(clientRandom, serverRandom, h.publicKey, h.namedCurve, h.hashAlgorithm) - if err := verifyKeySignature(expectedHash, h.signature, h.hashAlgorithm, c.state.remoteCertificate); err != nil { - return err - } - case *handshakeMessageCertificateRequest: c.remoteRequestedCertificate = true case *handshakeMessageServerHelloDone: @@ -150,7 +175,11 @@ func clientHandshakeHandler(c *Conn) error { expectedSeqnum := expectedMessages[0].messageSequence for i, msg := range expectedMessages { switch { - // handshakeMessageCertificateRequest can be nil, just make sure we have no gaps + // handshakeTypeCertificate and handshakeTypeServerKeyExchange can be nil + // when doing PSK + case c.localPSKCallback != nil && (i == 1 || i == 2) && msg == nil: + continue + // handshakeMessageCertificateRequest can be nil case i == 3 && msg == nil: continue case msg == nil: @@ -168,6 +197,14 @@ func clientHandshakeHandler(c *Conn) error { } } } + + // handshakeMessageServerKeyExchange is optional for PSK + if c.state.masterSecret == nil { + if err := initalizeCipherSuite(&handshakeMessageServerKeyExchange{}); err != nil { + return err + } + } + c.state.localSequenceNumber++ c.log.Tracef("[handshake] Flight 3 changed to %s", flight5.String()) if err := c.currFlight.set(flight5); err != nil { @@ -203,12 +240,6 @@ func clientFlightHandler(c *Conn) (bool, error) { fallthrough case flight3: extensions := []extension{ - &extensionSupportedEllipticCurves{ - ellipticCurves: []namedCurve{namedCurveX25519, namedCurveP256}, - }, - &extensionSupportedPointFormats{ - pointFormats: []ellipticCurvePointFormat{ellipticCurvePointFormatUncompressed}, - }, &extensionSupportedSignatureAlgorithms{ signatureHashAlgorithms: []signatureHashAlgorithm{ {HashAlgorithmSHA256, signatureAlgorithmECDSA}, @@ -220,6 +251,17 @@ func clientFlightHandler(c *Conn) (bool, error) { }, }, } + if c.localPSKCallback == nil { + extensions = append(extensions, []extension{ + &extensionSupportedEllipticCurves{ + ellipticCurves: []namedCurve{namedCurveX25519, namedCurveP256}, + }, + &extensionSupportedPointFormats{ + pointFormats: []ellipticCurvePointFormat{ellipticCurvePointFormatUncompressed}, + }, + }...) + } + if len(c.localSRTPProtectionProfiles) > 0 { extensions = append(extensions, &extensionUseSRTP{ protectionProfiles: c.localSRTPProtectionProfiles, @@ -271,6 +313,13 @@ func clientFlightHandler(c *Conn) (bool, error) { sequenceNumber++ } + clientKeyExchange := &handshakeMessageClientKeyExchange{} + if c.localPSKCallback == nil { + clientKeyExchange.publicKey = c.localKeypair.publicKey + } else { + clientKeyExchange.identityHint = c.localPSKIdentityHint + } + c.internalSend(&recordLayer{ recordLayerHeader: recordLayerHeader{ sequenceNumber: sequenceNumber, @@ -281,13 +330,16 @@ func clientFlightHandler(c *Conn) (bool, error) { handshakeHeader: handshakeHeader{ messageSequence: uint16(sequenceNumber), }, - handshakeMessage: &handshakeMessageClientKeyExchange{ - publicKey: c.localKeypair.publicKey, - }}, + handshakeMessage: clientKeyExchange, + }, }, false) + sequenceNumber++ - if c.remoteRequestedCertificate { + // If the client has sent a certificate with signing ability, a digitally-signed + // CertificateVerify message is sent to explicitly verify possession of the + // private key in the certificate. + if c.remoteRequestedCertificate && c.localCertificate != nil { if len(c.localCertificateVerify) == 0 { plainText := c.handshakeCache.pullAndMerge( handshakeCachePullRule{handshakeTypeClientHello, true}, diff --git a/vendor/github.com/pion/dtls/config.go b/vendor/github.com/pion/dtls/config.go index 77162210..3aa5ce61 100644 --- a/vendor/github.com/pion/dtls/config.go +++ b/vendor/github.com/pion/dtls/config.go @@ -42,6 +42,36 @@ type Config struct { PSK PSKCallback PSKIdentityHint []byte + // InsecureSkipVerify controls whether a client verifies the + // server's certificate chain and host name. + // If InsecureSkipVerify is true, TLS accepts any certificate + // presented by the server and any host name in that certificate. + // In this mode, TLS is susceptible to man-in-the-middle attacks. + // This should be used only for testing. + InsecureSkipVerify bool + + // VerifyPeerCertificate, if not nil, is called after normal + // certificate verification by either a client or server. It + // receives the certificate provided by the peer and also a flag + // that tells if normal verification has succeedded. If it returns a + // non-nil error, the handshake is aborted and that error results. + // + // If normal verification fails then the handshake will abort before + // considering this callback. If normal verification is disabled by + // setting InsecureSkipVerify, or (for a server) when ClientAuth is + // RequestClientCert or RequireAnyClientCert, then this callback will + // be considered but the verified flag will always be false. + VerifyPeerCertificate func(cer *x509.Certificate, verified bool) error + + // RootCAs defines the set of root certificate authorities + // that one peer uses when verifying the other peer's certificates. + // If RootCAs is nil, TLS uses the host's root CA set. + RootCAs *x509.CertPool + + // ServerName is used to verify the hostname on the returned + // certificates unless InsecureSkipVerify is given. + ServerName string + LoggerFactory logging.LoggerFactory } @@ -58,4 +88,6 @@ const ( NoClientCert ClientAuthType = iota RequestClientCert RequireAnyClientCert + VerifyClientCertIfGiven + RequireAndVerifyClientCert ) diff --git a/vendor/github.com/pion/dtls/conn.go b/vendor/github.com/pion/dtls/conn.go index e5668279..ce812ea8 100644 --- a/vendor/github.com/pion/dtls/conn.go +++ b/vendor/github.com/pion/dtls/conn.go @@ -49,12 +49,12 @@ type Conn struct { clientAuth ClientAuthType // If we are a client should we request a client certificate - currFlight *flight - namedCurve namedCurve - localCertificate *x509.Certificate - localPrivateKey crypto.PrivateKey - localKeypair, remoteKeypair *namedCurveKeypair - cookie []byte + currFlight *flight + namedCurve namedCurve + localCertificate *x509.Certificate + localPrivateKey crypto.PrivateKey + localKeypair *namedCurveKeypair + cookie []byte localPSKCallback PSKCallback localPSKIdentityHint []byte @@ -64,6 +64,11 @@ type Conn struct { localKeySignature []byte // cached keySignature remoteCertificateVerified bool + insecureSkipVerify bool + verifyPeerCertificate func(cer *x509.Certificate, verified bool) error + rootCAs *x509.CertPool + serverName string + handshakeMessageHandler handshakeMessageHandler flightHandler flightHandler handshakeCompleted chan bool @@ -78,8 +83,10 @@ func createConn(nextConn net.Conn, flightHandler flightHandler, handshakeMessage return nil, errNoConfigProvided case nextConn == nil: return nil, errNilNextConn - case config.Certificate != nil && (config.PSK != nil || config.PSKIdentityHint != nil): + case config.Certificate != nil && config.PSK != nil: return nil, errPSKAndCertificate + case config.PSKIdentityHint != nil && config.PSK == nil: + return nil, errIdentityNoPSK } if config.PrivateKey != nil { @@ -113,6 +120,10 @@ func createConn(nextConn net.Conn, flightHandler flightHandler, handshakeMessage localCertificate: config.Certificate, localPrivateKey: config.PrivateKey, clientAuth: config.ClientAuth, + insecureSkipVerify: config.InsecureSkipVerify, + verifyPeerCertificate: config.VerifyPeerCertificate, + rootCAs: config.RootCAs, + serverName: config.ServerName, localSRTPProtectionProfiles: config.SRTPProtectionProfiles, localCipherSuites: cipherSuites, namedCurve: defaultNamedCurve, @@ -126,6 +137,17 @@ func createConn(nextConn net.Conn, flightHandler flightHandler, handshakeMessage log: loggerFactory.NewLogger("dtls"), } + // Use host from conn address when serverName is not provided + if isClient && c.serverName == "" && nextConn.RemoteAddr() != nil { + remoteAddr := nextConn.RemoteAddr().String() + var host string + host, _, err = net.SplitHostPort(remoteAddr) + if err != nil { + c.serverName = remoteAddr + } + c.serverName = host + } + var zeroEpoch uint16 c.state.localEpoch.Store(zeroEpoch) c.state.remoteEpoch.Store(zeroEpoch) @@ -163,14 +185,22 @@ func Dial(network string, raddr *net.UDPAddr, config *Config) (*Conn, error) { // Client establishes a DTLS connection over an existing conn func Client(conn net.Conn, config *Config) (*Conn, error) { + switch { + case config == nil: + return nil, errNoConfigProvided + case config.PSK != nil && config.PSKIdentityHint == nil: + return nil, errPSKAndIdentityMustBeSetForClient + } + return createConn(conn, clientFlightHandler, clientHandshakeHandler, config, true) } // Server listens for incoming DTLS connections func Server(conn net.Conn, config *Config) (*Conn, error) { - if config == nil { + switch { + case config == nil: return nil, errNoConfigProvided - } else if config.PSK == nil && config.Certificate == nil { + case config.PSK == nil && config.Certificate == nil: return nil, errServerMustHaveCertificate } diff --git a/vendor/github.com/pion/dtls/crypto.go b/vendor/github.com/pion/dtls/crypto.go index 451d3146..01f91480 100644 --- a/vendor/github.com/pion/dtls/crypto.go +++ b/vendor/github.com/pion/dtls/crypto.go @@ -10,6 +10,7 @@ import ( "encoding/asn1" "encoding/binary" "math/big" + "time" ) type ecdsaSignature struct { @@ -120,3 +121,43 @@ func verifyCertificateVerify(handshakeBodies []byte, hashAlgorithm HashAlgorithm return errKeySignatureVerifyUnimplemented } + +func verifyClientCert(cert *x509.Certificate, roots *x509.CertPool) error { + opts := x509.VerifyOptions{ + Roots: roots, + CurrentTime: time.Now(), + Intermediates: x509.NewCertPool(), + KeyUsages: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + } + if _, err := cert.Verify(opts); err != nil { + return err + } + return nil +} + +func verifyServerCert(cert *x509.Certificate, roots *x509.CertPool, serverName string) error { + opts := x509.VerifyOptions{ + Roots: roots, + CurrentTime: time.Now(), + DNSName: serverName, + Intermediates: x509.NewCertPool(), + } + if _, err := cert.Verify(opts); err != nil { + return err + } + return nil +} + +func generateAEADAdditionalData(h *recordLayerHeader, payloadLen int) []byte { + var additionalData [13]byte + // SequenceNumber MUST be set first + // we only want uint48, clobbering an extra 2 (using uint64, Golang doesn't have uint48) + binary.BigEndian.PutUint64(additionalData[:], h.sequenceNumber) + binary.BigEndian.PutUint16(additionalData[:], h.epoch) + additionalData[8] = byte(h.contentType) + additionalData[9] = h.protocolVersion.major + additionalData[10] = h.protocolVersion.minor + binary.BigEndian.PutUint16(additionalData[len(additionalData)-2:], uint16(payloadLen)) + + return additionalData[:] +} diff --git a/vendor/github.com/pion/dtls/crypto_ccm.go b/vendor/github.com/pion/dtls/crypto_ccm.go new file mode 100644 index 00000000..3facb24b --- /dev/null +++ b/vendor/github.com/pion/dtls/crypto_ccm.go @@ -0,0 +1,92 @@ +package dtls + +import ( + "crypto/aes" + "crypto/rand" + "encoding/binary" + "fmt" + + "github.com/pion/dtls/internal/crypto/ccm" +) + +const ( + cryptoCCMTagLength = 8 + cryptoCCMNonceLength = 12 +) + +// State needed to handle encrypted input/output +type cryptoCCM struct { + localCCM, remoteCCM ccm.CCM + localWriteIV, remoteWriteIV []byte +} + +func newCryptoCCM(localKey, localWriteIV, remoteKey, remoteWriteIV []byte) (*cryptoCCM, error) { + localBlock, err := aes.NewCipher(localKey) + if err != nil { + return nil, err + } + localCCM, err := ccm.NewCCM(localBlock, cryptoCCMTagLength, cryptoCCMNonceLength) + if err != nil { + return nil, err + } + + remoteBlock, err := aes.NewCipher(remoteKey) + if err != nil { + return nil, err + } + remoteCCM, err := ccm.NewCCM(remoteBlock, cryptoCCMTagLength, cryptoCCMNonceLength) + if err != nil { + return nil, err + } + + return &cryptoCCM{ + localCCM: localCCM, + localWriteIV: localWriteIV, + remoteCCM: remoteCCM, + remoteWriteIV: remoteWriteIV, + }, nil +} + +func (c *cryptoCCM) encrypt(pkt *recordLayer, raw []byte) ([]byte, error) { + payload := raw[recordLayerHeaderSize:] + raw = raw[:recordLayerHeaderSize] + + nonce := append(append([]byte{}, c.localWriteIV[:4]...), make([]byte, 8)...) + if _, err := rand.Read(nonce[4:]); err != nil { + return nil, err + } + + additionalData := generateAEADAdditionalData(&pkt.recordLayerHeader, len(payload)) + encryptedPayload := c.localCCM.Seal(nil, nonce, payload, additionalData) + + encryptedPayload = append(nonce[4:], encryptedPayload...) + raw = append(raw, encryptedPayload...) + + // Update recordLayer size to include explicit nonce + binary.BigEndian.PutUint16(raw[recordLayerHeaderSize-2:], uint16(len(raw)-recordLayerHeaderSize)) + return raw, nil +} + +func (c *cryptoCCM) decrypt(in []byte) ([]byte, error) { + var h recordLayerHeader + err := h.Unmarshal(in) + switch { + case err != nil: + return nil, err + case h.contentType == contentTypeChangeCipherSpec: + // Nothing to encrypt with ChangeCipherSpec + return in, nil + case len(in) <= (8 + recordLayerHeaderSize): + return nil, errNotEnoughRoomForNonce + } + + nonce := append(append([]byte{}, c.remoteWriteIV[:4]...), in[recordLayerHeaderSize:recordLayerHeaderSize+8]...) + out := in[recordLayerHeaderSize+8:] + + additionalData := generateAEADAdditionalData(&h, len(out)-cryptoCCMTagLength) + out, err = c.remoteCCM.Open(out[:0], nonce, out, additionalData) + if err != nil { + return nil, fmt.Errorf("decryptPacket: %v", err) + } + return append(in[:recordLayerHeaderSize], out...), nil +} diff --git a/vendor/github.com/pion/dtls/crypto_gcm.go b/vendor/github.com/pion/dtls/crypto_gcm.go index 58034c02..02c03f3e 100644 --- a/vendor/github.com/pion/dtls/crypto_gcm.go +++ b/vendor/github.com/pion/dtls/crypto_gcm.go @@ -52,17 +52,8 @@ func (c *cryptoGCM) encrypt(pkt *recordLayer, raw []byte) ([]byte, error) { return nil, err } - var additionalData [13]byte - // SequenceNumber MUST be set first - // we only want uint48, clobbering an extra 2 (using uint64, Golang doesn't have uint48) - binary.BigEndian.PutUint64(additionalData[:], pkt.recordLayerHeader.sequenceNumber) - binary.BigEndian.PutUint16(additionalData[:], pkt.recordLayerHeader.epoch) - additionalData[8] = byte(pkt.content.contentType()) - additionalData[9] = pkt.recordLayerHeader.protocolVersion.major - additionalData[10] = pkt.recordLayerHeader.protocolVersion.minor - binary.BigEndian.PutUint16(additionalData[len(additionalData)-2:], uint16(len(payload))) - encryptedPayload := c.localGCM.Seal(nil, nonce, payload, additionalData[:]) - + additionalData := generateAEADAdditionalData(&pkt.recordLayerHeader, len(payload)) + encryptedPayload := c.localGCM.Seal(nil, nonce, payload, additionalData) encryptedPayload = append(nonce[4:], encryptedPayload...) raw = append(raw, encryptedPayload...) @@ -88,16 +79,8 @@ func (c *cryptoGCM) decrypt(in []byte) ([]byte, error) { nonce := append(append([]byte{}, c.remoteWriteIV[:4]...), in[recordLayerHeaderSize:recordLayerHeaderSize+8]...) out := in[recordLayerHeaderSize+8:] - var additionalData [13]byte - // SequenceNumber MUST be set first - // we only want uint48, clobbering an extra 2 (using uint64, Golang doesn't have uint48) - binary.BigEndian.PutUint64(additionalData[:], h.sequenceNumber) - binary.BigEndian.PutUint16(additionalData[:], h.epoch) - additionalData[8] = byte(h.contentType) - additionalData[9] = h.protocolVersion.major - additionalData[10] = h.protocolVersion.minor - binary.BigEndian.PutUint16(additionalData[len(additionalData)-2:], uint16(len(out)-cryptoGCMTagLength)) - out, err = c.remoteGCM.Open(out[:0], nonce, out, additionalData[:]) + additionalData := generateAEADAdditionalData(&h, len(out)-cryptoGCMTagLength) + out, err = c.remoteGCM.Open(out[:0], nonce, out, additionalData) if err != nil { return nil, fmt.Errorf("decryptPacket: %v", err) } diff --git a/vendor/github.com/pion/dtls/errors.go b/vendor/github.com/pion/dtls/errors.go index 5c0e4733..f8fdecde 100644 --- a/vendor/github.com/pion/dtls/errors.go +++ b/vendor/github.com/pion/dtls/errors.go @@ -7,13 +7,12 @@ var ( ErrConnClosed = errors.New("dtls: conn is closed") errBufferTooSmall = errors.New("dtls: buffer is too small") - errCertificateUnset = errors.New("dtls: handshakeMessageCertificate can not be marshalled without a certificate") errClientCertificateRequired = errors.New("dtls: server required client verification, but got none") errClientCertificateNotVerified = errors.New("dtls: client sent certificate but did not verify it") errCertificateVerifyNoCertificate = errors.New("dtls: client sent certificate verify but we have no certificate to verify") errCipherSuiteNoIntersection = errors.New("dtls: Client+Server do not support any shared cipher suites") errCipherSuiteUnset = errors.New("dtls: server hello can not be created without a cipher suite") - errCompressionmethodUnset = errors.New("dtls: server hello can not be created without a compression method") + errCompressionMethodUnset = errors.New("dtls: server hello can not be created without a compression method") errContextUnsupported = errors.New("dtls: context is not supported for ExportKeyingMaterial") errCookieMismatch = errors.New("dtls: Client+Server cookie does not match") errCookieTooLong = errors.New("dtls: cookie must not be longer then 255 bytes") @@ -45,6 +44,9 @@ var ( errUnableToMarshalFragmented = errors.New("dtls: unable to marshal fragmented handshakes") errVerifyDataMismatch = errors.New("dtls: Expected and actual verify data does not match") errNoConfigProvided = errors.New("dtls: No config provided") - errPSKAndCertificate = errors.New("dtls: Certificate and PSK or PSK Identity Hint provided") + errPSKAndCertificate = errors.New("dtls: Certificate and PSK provided") + errPSKAndIdentityMustBeSetForClient = errors.New("dtls: PSK and PSK Identity Hint must both be set for client") + errIdentityNoPSK = errors.New("dtls: Identity Hint provided but PSK is nil") errNoAvailableCipherSuites = errors.New("dtls: Connection can not be created, no CipherSuites satisfy this Config") + errInvalidClientKeyExchange = errors.New("dtls: Unable to determine if ClientKeyExchange is a public key or PSK Identity") ) diff --git a/vendor/github.com/pion/dtls/handshake_message_certificate.go b/vendor/github.com/pion/dtls/handshake_message_certificate.go index 36270131..485b3997 100644 --- a/vendor/github.com/pion/dtls/handshake_message_certificate.go +++ b/vendor/github.com/pion/dtls/handshake_message_certificate.go @@ -13,15 +13,16 @@ func (h handshakeMessageCertificate) handshakeType() handshakeType { } func (h *handshakeMessageCertificate) Marshal() ([]byte, error) { - if h.certificate == nil { - return nil, errCertificateUnset + var raw []byte + if h.certificate != nil { + raw = h.certificate.Raw } out := make([]byte, 6) - putBigEndianUint24(out, uint32(len(h.certificate.Raw))+3) - putBigEndianUint24(out[3:], uint32(len(h.certificate.Raw))) + putBigEndianUint24(out, uint32(len(raw))+3) + putBigEndianUint24(out[3:], uint32(len(raw))) - return append(out, h.certificate.Raw...), nil + return append(out, raw...), nil } func (h *handshakeMessageCertificate) Unmarshal(data []byte) error { @@ -37,11 +38,12 @@ func (h *handshakeMessageCertificate) Unmarshal(data []byte) error { return errLengthMismatch } - cert, err := x509.ParseCertificate(data[6:]) - if err != nil { - return err + if len(data) > 6 { + cert, err := x509.ParseCertificate(data[6:]) + if err != nil { + return err + } + h.certificate = cert } - h.certificate = cert - return nil } diff --git a/vendor/github.com/pion/dtls/handshake_message_client_key_exchange.go b/vendor/github.com/pion/dtls/handshake_message_client_key_exchange.go index e2bea327..b2ab2099 100644 --- a/vendor/github.com/pion/dtls/handshake_message_client_key_exchange.go +++ b/vendor/github.com/pion/dtls/handshake_message_client_key_exchange.go @@ -1,7 +1,12 @@ package dtls +import ( + "encoding/binary" +) + type handshakeMessageClientKeyExchange struct { - publicKey []byte + identityHint []byte + publicKey []byte } func (h handshakeMessageClientKeyExchange) handshakeType() handshakeType { @@ -9,17 +14,33 @@ func (h handshakeMessageClientKeyExchange) handshakeType() handshakeType { } func (h *handshakeMessageClientKeyExchange) Marshal() ([]byte, error) { - return append([]byte{byte(len(h.publicKey))}, h.publicKey...), nil + switch { + case (h.identityHint != nil && h.publicKey != nil) || (h.identityHint == nil && h.publicKey == nil): + return nil, errInvalidClientKeyExchange + case h.publicKey != nil: + return append([]byte{byte(len(h.publicKey))}, h.publicKey...), nil + default: + out := append([]byte{0x00, 0x00}, h.identityHint...) + binary.BigEndian.PutUint16(out, uint16(len(out)-2)) + return out, nil + } } func (h *handshakeMessageClientKeyExchange) Unmarshal(data []byte) error { - if len(data) < 1 { + if len(data) < 2 { return errBufferTooSmall } - publicKeyLength := int(data[0]) - if len(data) <= publicKeyLength { + + // If parsed as PSK return early and only populate PSK Identity Hint + if pskLength := binary.BigEndian.Uint16(data); len(data) == int(pskLength+2) { + h.identityHint = append([]byte{}, data[2:]...) + return nil + } + + if publicKeyLength := int(data[0]); len(data) != publicKeyLength+1 { return errBufferTooSmall } + h.publicKey = append([]byte{}, data[1:]...) return nil } diff --git a/vendor/github.com/pion/dtls/handshake_message_server_hello.go b/vendor/github.com/pion/dtls/handshake_message_server_hello.go index 4837abc9..b5b4e009 100644 --- a/vendor/github.com/pion/dtls/handshake_message_server_hello.go +++ b/vendor/github.com/pion/dtls/handshake_message_server_hello.go @@ -30,7 +30,7 @@ func (h *handshakeMessageServerHello) Marshal() ([]byte, error) { if h.cipherSuite == nil { return nil, errCipherSuiteUnset } else if h.compressionMethod == nil { - return nil, errCompressionmethodUnset + return nil, errCompressionMethodUnset } out := make([]byte, handshakeMessageServerHelloVariableWidthStart) diff --git a/vendor/github.com/pion/dtls/handshake_message_server_key_exchange.go b/vendor/github.com/pion/dtls/handshake_message_server_key_exchange.go index debf11f5..fd5427c8 100644 --- a/vendor/github.com/pion/dtls/handshake_message_server_key_exchange.go +++ b/vendor/github.com/pion/dtls/handshake_message_server_key_exchange.go @@ -4,8 +4,10 @@ import ( "encoding/binary" ) -// Structure only supports ECDH +// Structure supports ECDH and PSK type handshakeMessageServerKeyExchange struct { + identityHint []byte + ellipticCurveType ellipticCurveType namedCurve namedCurve publicKey []byte @@ -19,6 +21,12 @@ func (h handshakeMessageServerKeyExchange) handshakeType() handshakeType { } func (h *handshakeMessageServerKeyExchange) Marshal() ([]byte, error) { + if h.identityHint != nil { + out := append([]byte{0x00, 0x00}, h.identityHint...) + binary.BigEndian.PutUint16(out, uint16(len(out)-2)) + return out, nil + } + out := []byte{byte(h.ellipticCurveType), 0x00, 0x00} binary.BigEndian.PutUint16(out[1:], uint16(h.namedCurve)) @@ -34,9 +42,16 @@ func (h *handshakeMessageServerKeyExchange) Marshal() ([]byte, error) { } func (h *handshakeMessageServerKeyExchange) Unmarshal(data []byte) error { - if len(data) < 1 { + if len(data) < 2 { return errBufferTooSmall } + + // If parsed as PSK return early and only populate PSK Identity Hint + if pskLength := binary.BigEndian.Uint16(data); len(data) == int(pskLength+2) { + h.identityHint = append([]byte{}, data[2:]...) + return nil + } + if _, ok := ellipticCurveTypes[ellipticCurveType(data[0])]; ok { h.ellipticCurveType = ellipticCurveType(data[0]) } else { @@ -53,25 +68,34 @@ func (h *handshakeMessageServerKeyExchange) Unmarshal(data []byte) error { publicKeyLength := int(data[3]) offset := 4 + publicKeyLength - if len(data) <= publicKeyLength { + if len(data) < offset { return errBufferTooSmall } h.publicKey = append([]byte{}, data[4:offset]...) - + if len(data) <= offset { + return errBufferTooSmall + } h.hashAlgorithm = HashAlgorithm(data[offset]) if _, ok := hashAlgorithms[h.hashAlgorithm]; !ok { return errInvalidHashAlgorithm } offset++ - + if len(data) <= offset { + return errBufferTooSmall + } h.signatureAlgorithm = signatureAlgorithm(data[offset]) if _, ok := signatureAlgorithms[h.signatureAlgorithm]; !ok { return errInvalidSignatureAlgorithm } offset++ - + if len(data) < offset+2 { + return errBufferTooSmall + } signatureLength := int(binary.BigEndian.Uint16(data[offset:])) offset += 2 + if len(data) < offset+signatureLength { + return errBufferTooSmall + } h.signature = append([]byte{}, data[offset:offset+signatureLength]...) return nil } diff --git a/vendor/github.com/pion/dtls/internal/crypto/ccm/ccm.go b/vendor/github.com/pion/dtls/internal/crypto/ccm/ccm.go new file mode 100644 index 00000000..3bc33742 --- /dev/null +++ b/vendor/github.com/pion/dtls/internal/crypto/ccm/ccm.go @@ -0,0 +1,239 @@ +// Package ccm implements a CCM, Counter with CBC-MAC +// as per RFC 3610. +// +// See https://tools.ietf.org/html/rfc3610 +// +// This code was lifted from https://github.com/bocajim/dtls/blob/a3300364a283fcb490d28a93d7fcfa7ba437fbbe/ccm/ccm.go +// and as such was not written by the Pions authors. Like Pions this +// code is licensed under MIT. +// +// A request for including CCM into the Go standard library +// can be found as issue #27484 on the https://github.com/golang/go/ +// repository. +package ccm + +import ( + "crypto/cipher" + "crypto/subtle" + "encoding/binary" + "errors" + "math" +) + +// ccm represents a Counter with CBC-MAC with a specific key. +type ccm struct { + b cipher.Block + M uint8 + L uint8 +} + +const ccmBlockSize = 16 + +// CCM is a block cipher in Counter with CBC-MAC mode. +// Providing authenticated encryption with associated data via the cipher.AEAD interface. +type CCM interface { + cipher.AEAD + // MaxLength returns the maxium length of plaintext in calls to Seal. + // The maximum length of ciphertext in calls to Open is MaxLength()+Overhead(). + // The maximum length is related to CCM's `L` parameter (15-noncesize) and + // is 1<<(8*L) - 1 (but also limited by the maxium size of an int). + MaxLength() int +} + +// NewCCM returns the given 128-bit block cipher wrapped in CCM. +// The tagsize must be an even integer between 4 and 16 inclusive +// and is used as CCM's `M` parameter. +// The noncesize must be an integer between 7 and 13 inclusive, +// 15-noncesize is used as CCM's `L` parameter. +func NewCCM(b cipher.Block, tagsize, noncesize int) (CCM, error) { + if b.BlockSize() != ccmBlockSize { + return nil, errors.New("ccm: NewCCM requires 128-bit block cipher") + } + if tagsize < 4 || tagsize > 16 || tagsize&1 != 0 { + return nil, errors.New("ccm: tagsize must be 4, 6, 8, 10, 12, 14, or 16") + } + lensize := 15 - noncesize + if lensize < 2 || lensize > 8 { + return nil, errors.New("ccm: invalid noncesize") + } + c := &ccm{b: b, M: uint8(tagsize), L: uint8(lensize)} + return c, nil +} + +func (c *ccm) NonceSize() int { return 15 - int(c.L) } +func (c *ccm) Overhead() int { return int(c.M) } +func (c *ccm) MaxLength() int { return maxlen(c.L, c.Overhead()) } + +func maxlen(L uint8, tagsize int) int { + max := (uint64(1) << (8 * L)) - 1 + if m64 := uint64(math.MaxInt64) - uint64(tagsize); L > 8 || max > m64 { + max = m64 // The maximum lentgh on a 64bit arch + } + if max != uint64(int(max)) { + return math.MaxInt32 - tagsize // We have only 32bit int's + } + return int(max) +} + +// MaxNonceLength returns the maximum nonce length for a given plaintext length. +// A return value <= 0 indicates that plaintext length is too large for +// any nonce length. +func MaxNonceLength(pdatalen int) int { + const tagsize = 16 + for L := 2; L <= 8; L++ { + if maxlen(uint8(L), tagsize) >= pdatalen { + return 15 - L + } + } + return 0 +} + +func (c *ccm) cbcRound(mac, data []byte) { + for i := 0; i < ccmBlockSize; i++ { + mac[i] ^= data[i] + } + c.b.Encrypt(mac, mac) +} + +func (c *ccm) cbcData(mac, data []byte) { + for len(data) >= ccmBlockSize { + c.cbcRound(mac, data[:ccmBlockSize]) + data = data[ccmBlockSize:] + } + if len(data) > 0 { + var block [ccmBlockSize]byte + copy(block[:], data) + c.cbcRound(mac, block[:]) + } +} + +func (c *ccm) tag(nonce, plaintext, adata []byte) ([]byte, error) { + var mac [ccmBlockSize]byte + + if len(adata) > 0 { + mac[0] |= 1 << 6 + } + mac[0] |= (c.M - 2) << 2 + mac[0] |= c.L - 1 + if len(nonce) != c.NonceSize() { + return nil, errors.New("ccm: Invalid nonce size") + } + if len(plaintext) > c.MaxLength() { + return nil, errors.New("ccm: plaintext too large") + } + binary.BigEndian.PutUint64(mac[ccmBlockSize-8:], uint64(len(plaintext))) + copy(mac[1:ccmBlockSize-c.L], nonce) + c.b.Encrypt(mac[:], mac[:]) + + var block [ccmBlockSize]byte + if n := uint64(len(adata)); n > 0 { + // First adata block includes adata length + i := 2 + if n <= 0xfeff { + binary.BigEndian.PutUint16(block[:i], uint16(n)) + } else { + block[0] = 0xfe + block[1] = 0xff + if n < uint64(1<<32) { + i = 2 + 4 + binary.BigEndian.PutUint32(block[2:i], uint32(n)) + } else { + i = 2 + 8 + binary.BigEndian.PutUint64(block[2:i], n) + } + } + i = copy(block[i:], adata) + c.cbcRound(mac[:], block[:]) + c.cbcData(mac[:], adata[i:]) + } + + if len(plaintext) > 0 { + c.cbcData(mac[:], plaintext) + } + + return mac[:c.M], nil +} + +// sliceForAppend takes a slice and a requested number of bytes. It returns a +// slice with the contents of the given slice followed by that many bytes and a +// second slice that aliases into it and contains only the extra bytes. If the +// original slice has sufficient capacity then no allocation is performed. +// From crypto/cipher/gcm.go +func sliceForAppend(in []byte, n int) (head, tail []byte) { + if total := len(in) + n; cap(in) >= total { + head = in[:total] + } else { + head = make([]byte, total) + copy(head, in) + } + tail = head[len(in):] + return +} + +// Seal encrypts and authenticates plaintext, authenticates the +// additional data and appends the result to dst, returning the updated +// slice. The nonce must be NonceSize() bytes long and unique for all +// time, for a given key. +// The plaintext must be no longer than MaxLength() bytes long. +// +// The plaintext and dst may alias exactly or not at all. +func (c *ccm) Seal(dst, nonce, plaintext, adata []byte) []byte { + tag, err := c.tag(nonce, plaintext, adata) + if err != nil { + // The cipher.AEAD interface doesn't allow for an error return. + panic(err) + } + + var iv, s0 [ccmBlockSize]byte + iv[0] = c.L - 1 + copy(iv[1:ccmBlockSize-c.L], nonce) + c.b.Encrypt(s0[:], iv[:]) + for i := 0; i < int(c.M); i++ { + tag[i] ^= s0[i] + } + iv[len(iv)-1] |= 1 + stream := cipher.NewCTR(c.b, iv[:]) + ret, out := sliceForAppend(dst, len(plaintext)+int(c.M)) + stream.XORKeyStream(out, plaintext) + copy(out[len(plaintext):], tag) + return ret +} + +var errOpen = errors.New("ccm: message authentication failed") + +func (c *ccm) Open(dst, nonce, ciphertext, adata []byte) ([]byte, error) { + if len(ciphertext) < int(c.M) { + return nil, errors.New("ccm: ciphertext too short") + } + if len(ciphertext) > c.MaxLength()+c.Overhead() { + return nil, errors.New("ccm: ciphertext too long") + } + + var tag = make([]byte, int(c.M)) + copy(tag, ciphertext[len(ciphertext)-int(c.M):]) + ciphertextWithoutTag := ciphertext[:len(ciphertext)-int(c.M)] + + var iv, s0 [ccmBlockSize]byte + iv[0] = c.L - 1 + copy(iv[1:ccmBlockSize-c.L], nonce) + c.b.Encrypt(s0[:], iv[:]) + for i := 0; i < int(c.M); i++ { + tag[i] ^= s0[i] + } + iv[len(iv)-1] |= 1 + stream := cipher.NewCTR(c.b, iv[:]) + + // Cannot decrypt directly to dst since we're not supposed to + // reveal the plaintext to the caller if authentication fails. + plaintext := make([]byte, len(ciphertextWithoutTag)) + stream.XORKeyStream(plaintext, ciphertextWithoutTag) + expectedTag, err := c.tag(nonce, plaintext, adata) + if err != nil { + return nil, err + } + + if subtle.ConstantTimeCompare(tag, expectedTag) != 1 { + return nil, errOpen + } + return append(dst, plaintext...), nil +} diff --git a/vendor/github.com/pion/dtls/prf.go b/vendor/github.com/pion/dtls/prf.go index 72442388..e085c509 100644 --- a/vendor/github.com/pion/dtls/prf.go +++ b/vendor/github.com/pion/dtls/prf.go @@ -50,6 +50,21 @@ func (e *encryptionKeys) String() string { e.serverWriteIV) } +// The premaster secret is formed as follows: if the PSK is N octets +// long, concatenate a uint16 with the value N, N zero octets, a second +// uint16 with the value N, and the PSK itself. +// +// https://tools.ietf.org/html/rfc4279#section-2 +func prfPSKPreMasterSecret(psk []byte) []byte { + pskLen := uint16(len(psk)) + + out := append(make([]byte, 2+pskLen+2), psk...) + binary.BigEndian.PutUint16(out, pskLen) + binary.BigEndian.PutUint16(out[2+pskLen:], pskLen) + + return out +} + func prfPreMasterSecret(publicKey, privateKey []byte, curve namedCurve) ([]byte, error) { switch curve { case namedCurveX25519: diff --git a/vendor/github.com/pion/dtls/server_handlers.go b/vendor/github.com/pion/dtls/server_handlers.go index c2cb7120..321789c9 100644 --- a/vendor/github.com/pion/dtls/server_handlers.go +++ b/vendor/github.com/pion/dtls/server_handlers.go @@ -73,17 +73,29 @@ func serverHandshakeHandler(c *Conn) error { handshakeCachePullRule{handshakeTypeClientKeyExchange, true}, ) - if err := verifyCertificateVerify(plainText, h.hashAlgorithm, h.signature, c.state.remoteCertificate); err != nil { - return err + verified := false + if !c.insecureSkipVerify && c.clientAuth >= RequireAnyClientCert { + if err := verifyCertificateVerify(plainText, h.hashAlgorithm, h.signature, c.state.remoteCertificate); err != nil { + return err + } + if c.clientAuth >= VerifyClientCertIfGiven { + if err := verifyClientCert(c.state.remoteCertificate, c.rootCAs); err != nil { + return err + } + verified = true + } } - c.remoteCertificateVerified = true + if c.verifyPeerCertificate != nil { + if err := c.verifyPeerCertificate(c.state.remoteCertificate, verified); err != nil { + return err + } + } + c.remoteCertificateVerified = verified case *handshakeMessageCertificate: c.state.remoteCertificate = h.certificate case *handshakeMessageClientKeyExchange: - c.remoteKeypair = &namedCurveKeypair{c.namedCurve, h.publicKey, nil} - serverRandom, err := c.state.localRandom.Marshal() if err != nil { return err @@ -93,9 +105,19 @@ func serverHandshakeHandler(c *Conn) error { return err } - preMasterSecret, err := prfPreMasterSecret(c.remoteKeypair.publicKey, c.localKeypair.privateKey, c.localKeypair.curve) - if err != nil { - return err + var preMasterSecret []byte + if c.localPSKCallback != nil { + var psk []byte + if psk, err = c.localPSKCallback(h.identityHint); err != nil { + return err + } + + preMasterSecret = prfPSKPreMasterSecret(psk) + } else { + preMasterSecret, err = prfPreMasterSecret(h.publicKey, c.localKeypair.privateKey, c.localKeypair.curve) + if err != nil { + return err + } } c.state.masterSecret, err = prfMasterSecret(preMasterSecret, clientRandom, serverRandom, c.state.cipherSuite.hashFunc()) @@ -106,7 +128,6 @@ func serverHandshakeHandler(c *Conn) error { if err := c.state.cipherSuite.init(c.state.masterSecret, clientRandom, serverRandom /* isClient */, false); err != nil { return err } - case *handshakeMessageFinished: plainText := c.handshakeCache.pullAndMerge( handshakeCachePullRule{handshakeTypeClientHello, true}, @@ -193,15 +214,32 @@ func serverHandshakeHandler(c *Conn) error { return err } - if c.clientAuth == RequireAnyClientCert && c.state.remoteCertificate == nil { - return errClientCertificateRequired - } else if c.state.remoteCertificate != nil && !c.remoteCertificateVerified { - return errClientCertificateNotVerified + switch c.clientAuth { + case RequireAnyClientCert: + if c.state.remoteCertificate == nil { + return errClientCertificateRequired + } + case VerifyClientCertIfGiven: + if c.state.remoteCertificate != nil && !c.remoteCertificateVerified { + return errClientCertificateNotVerified + } + case RequireAndVerifyClientCert: + if c.state.remoteCertificate == nil { + return errClientCertificateRequired + } + if !c.remoteCertificateVerified { + return errClientCertificateNotVerified + } } - if c.clientAuth > NoClientCert { + switch { + case c.localPSKIdentityHint != nil: + c.state.localSequenceNumber = 4 + case c.localPSKCallback != nil: + c.state.localSequenceNumber = 3 + case c.clientAuth > NoClientCert: c.state.localSequenceNumber = 6 - } else { + default: c.state.localSequenceNumber = 5 } c.setLocalEpoch(1) @@ -239,19 +277,22 @@ func serverFlightHandler(c *Conn) (bool, error) { }, false) case flight4: - extensions := []extension{ - &extensionSupportedEllipticCurves{ - ellipticCurves: []namedCurve{namedCurveX25519, namedCurveP256}, - }, - &extensionSupportedPointFormats{ - pointFormats: []ellipticCurvePointFormat{ellipticCurvePointFormatUncompressed}, - }, - } + extensions := []extension{} if c.state.srtpProtectionProfile != 0 { extensions = append(extensions, &extensionUseSRTP{ protectionProfiles: []SRTPProtectionProfile{c.state.srtpProtectionProfile}, }) } + if c.localPSKCallback == nil { + extensions = append(extensions, []extension{ + &extensionSupportedEllipticCurves{ + ellipticCurves: []namedCurve{namedCurveX25519, namedCurveP256}, + }, + &extensionSupportedPointFormats{ + pointFormats: []ellipticCurvePointFormat{ellipticCurvePointFormatUncompressed}, + }, + }...) + } sequenceNumber := c.state.localSequenceNumber c.internalSend(&recordLayer{ @@ -274,61 +315,7 @@ func serverFlightHandler(c *Conn) (bool, error) { }, false) sequenceNumber++ - c.internalSend(&recordLayer{ - recordLayerHeader: recordLayerHeader{ - sequenceNumber: sequenceNumber, - protocolVersion: protocolVersion1_2, - }, - content: &handshake{ - // sequenceNumber and messageSequence line up, may need to be re-evaluated - handshakeHeader: handshakeHeader{ - messageSequence: uint16(sequenceNumber), - }, - handshakeMessage: &handshakeMessageCertificate{ - certificate: c.localCertificate, - }}, - }, false) - sequenceNumber++ - - if len(c.localKeySignature) == 0 { - serverRandom, err := c.state.localRandom.Marshal() - if err != nil { - return false, err - } - clientRandom, err := c.state.remoteRandom.Marshal() - if err != nil { - return false, err - } - - signature, err := generateKeySignature(clientRandom, serverRandom, c.localKeypair.publicKey, c.namedCurve, c.localPrivateKey, HashAlgorithmSHA256) - if err != nil { - return false, err - } - c.localKeySignature = signature - } - - c.internalSend(&recordLayer{ - recordLayerHeader: recordLayerHeader{ - sequenceNumber: sequenceNumber, - protocolVersion: protocolVersion1_2, - }, - content: &handshake{ - // sequenceNumber and messageSequence line up, may need to be re-evaluated - handshakeHeader: handshakeHeader{ - messageSequence: uint16(sequenceNumber), - }, - handshakeMessage: &handshakeMessageServerKeyExchange{ - ellipticCurveType: ellipticCurveTypeNamedCurve, - namedCurve: c.namedCurve, - publicKey: c.localKeypair.publicKey, - hashAlgorithm: HashAlgorithmSHA256, - signatureAlgorithm: signatureAlgorithmECDSA, - signature: c.localKeySignature, - }}, - }, false) - sequenceNumber++ - - if c.clientAuth > NoClientCert { + if c.localPSKCallback == nil { c.internalSend(&recordLayer{ recordLayerHeader: recordLayerHeader{ sequenceNumber: sequenceNumber, @@ -339,18 +326,96 @@ func serverFlightHandler(c *Conn) (bool, error) { handshakeHeader: handshakeHeader{ messageSequence: uint16(sequenceNumber), }, - handshakeMessage: &handshakeMessageCertificateRequest{ - certificateTypes: []clientCertificateType{clientCertificateTypeRSASign, clientCertificateTypeECDSASign}, - signatureHashAlgorithms: []signatureHashAlgorithm{ - {HashAlgorithmSHA256, signatureAlgorithmRSA}, - {HashAlgorithmSHA384, signatureAlgorithmRSA}, - {HashAlgorithmSHA512, signatureAlgorithmRSA}, - {HashAlgorithmSHA256, signatureAlgorithmECDSA}, - {HashAlgorithmSHA384, signatureAlgorithmECDSA}, - {HashAlgorithmSHA512, signatureAlgorithmECDSA}, + handshakeMessage: &handshakeMessageCertificate{ + certificate: c.localCertificate, + }}, + }, false) + sequenceNumber++ + + if len(c.localKeySignature) == 0 { + serverRandom, err := c.state.localRandom.Marshal() + if err != nil { + return false, err + } + clientRandom, err := c.state.remoteRandom.Marshal() + if err != nil { + return false, err + } + + signature, err := generateKeySignature(clientRandom, serverRandom, c.localKeypair.publicKey, c.namedCurve, c.localPrivateKey, HashAlgorithmSHA256) + if err != nil { + return false, err + } + c.localKeySignature = signature + } + + c.internalSend(&recordLayer{ + recordLayerHeader: recordLayerHeader{ + sequenceNumber: sequenceNumber, + protocolVersion: protocolVersion1_2, + }, + content: &handshake{ + // sequenceNumber and messageSequence line up, may need to be re-evaluated + handshakeHeader: handshakeHeader{ + messageSequence: uint16(sequenceNumber), + }, + handshakeMessage: &handshakeMessageServerKeyExchange{ + ellipticCurveType: ellipticCurveTypeNamedCurve, + namedCurve: c.namedCurve, + publicKey: c.localKeypair.publicKey, + hashAlgorithm: HashAlgorithmSHA256, + signatureAlgorithm: signatureAlgorithmECDSA, + signature: c.localKeySignature, + }}, + }, false) + sequenceNumber++ + + if c.clientAuth > NoClientCert { + c.internalSend(&recordLayer{ + recordLayerHeader: recordLayerHeader{ + sequenceNumber: sequenceNumber, + protocolVersion: protocolVersion1_2, + }, + content: &handshake{ + // sequenceNumber and messageSequence line up, may need to be re-evaluated + handshakeHeader: handshakeHeader{ + messageSequence: uint16(sequenceNumber), + }, + handshakeMessage: &handshakeMessageCertificateRequest{ + certificateTypes: []clientCertificateType{clientCertificateTypeRSASign, clientCertificateTypeECDSASign}, + signatureHashAlgorithms: []signatureHashAlgorithm{ + {HashAlgorithmSHA256, signatureAlgorithmRSA}, + {HashAlgorithmSHA384, signatureAlgorithmRSA}, + {HashAlgorithmSHA512, signatureAlgorithmRSA}, + {HashAlgorithmSHA256, signatureAlgorithmECDSA}, + {HashAlgorithmSHA384, signatureAlgorithmECDSA}, + {HashAlgorithmSHA512, signatureAlgorithmECDSA}, + }, }, }, + }, false) + sequenceNumber++ + } + } else if c.localPSKIdentityHint != nil { + /* To help the client in selecting which identity to use, the server + * can provide a "PSK identity hint" in the ServerKeyExchange message. + * If no hint is provided, the ServerKeyExchange message is omitted. + * + * https://tools.ietf.org/html/rfc4279#section-2 + */ + c.internalSend(&recordLayer{ + recordLayerHeader: recordLayerHeader{ + sequenceNumber: sequenceNumber, + protocolVersion: protocolVersion1_2, }, + content: &handshake{ + // sequenceNumber and messageSequence line up, may need to be re-evaluated + handshakeHeader: handshakeHeader{ + messageSequence: uint16(sequenceNumber), + }, + handshakeMessage: &handshakeMessageServerKeyExchange{ + identityHint: c.localPSKIdentityHint, + }}, }, false) sequenceNumber++ } diff --git a/vendor/github.com/pion/ice/README.md b/vendor/github.com/pion/ice/README.md index 2d4951a0..79298b8d 100644 --- a/vendor/github.com/pion/ice/README.md +++ b/vendor/github.com/pion/ice/README.md @@ -39,6 +39,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [Adam Kiss](https://github.com/masterada) * [Aleksandr Razumov](https://github.com/ernado) * [Yutaka Takeda](https://github.com/enobufs) +* [Atsushi Watanabe](https://github.com/at-wat) ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/vendor/github.com/pion/ice/agent.go b/vendor/github.com/pion/ice/agent.go index a434e3c9..d6d68c13 100644 --- a/vendor/github.com/pion/ice/agent.go +++ b/vendor/github.com/pion/ice/agent.go @@ -16,6 +16,7 @@ import ( "github.com/pion/mdns" "github.com/pion/stun" "github.com/pion/transport/packetio" + "github.com/pion/transport/vnet" "golang.org/x/net/ipv4" ) @@ -78,8 +79,8 @@ type Agent struct { onConnected chan struct{} onConnectedOnce sync.Once - connectivityChan <-chan time.Time - // force candidate to be contacted immediately (instead of waiting for connectivityChan) + connectivityTicker *time.Ticker + // force candidate to be contacted immediately (instead of waiting for connectivityTicker) forceCandidateContact chan bool trickle bool @@ -141,7 +142,10 @@ type Agent struct { done chan struct{} err atomicError - log logging.LeveledLogger + loggerFactory logging.LoggerFactory + log logging.LeveledLogger + + net *vnet.Net } func (a *Agent) ok() error { @@ -219,6 +223,10 @@ type AgentConfig struct { PrflxAcceptanceMinWait *time.Duration // HostAcceptanceMinWait specify a minimum wait time before selecting relay candidates RelayAcceptanceMinWait *time.Duration + + // Net is the our abstracted network interface for internal development purpose only + // (see github.com/pion/transport/vnet) + Net *vnet.Net } // NewAgent creates a new Agent @@ -237,34 +245,44 @@ func NewAgent(config *AgentConfig) (*Agent, error) { mDNSMode = MulticastDNSModeQueryOnly } + loggerFactory := config.LoggerFactory + if loggerFactory == nil { + loggerFactory = logging.NewDefaultLoggerFactory() + } + log := loggerFactory.NewLogger("ice") + var mDNSConn *mdns.Conn - if mDNSMode != MulticastDNSModeDisabled { - addr, err := net.ResolveUDPAddr("udp4", mdns.DefaultAddress) - if err != nil { - return nil, err + mDNSConn, err = func() (*mdns.Conn, error) { + if mDNSMode == MulticastDNSModeDisabled { + return nil, nil } - l, err := net.ListenUDP("udp4", addr) - if err != nil { - return nil, err + addr, mdnsErr := net.ResolveUDPAddr("udp4", mdns.DefaultAddress) + if mdnsErr != nil { + return nil, mdnsErr + } + + l, mdnsErr := net.ListenUDP("udp4", addr) + if mdnsErr != nil { + // If ICE fails to start MulticastDNS server just warn the user and continue + log.Errorf("Failed to enable mDNS, continuing in mDNS disabled mode: (%s)", mdnsErr) + mDNSMode = MulticastDNSModeDisabled + return nil, nil } switch mDNSMode { case MulticastDNSModeQueryOnly: - mDNSConn, err = mdns.Server(ipv4.NewPacketConn(l), &mdns.Config{}) + return mdns.Server(ipv4.NewPacketConn(l), &mdns.Config{}) case MulticastDNSModeQueryAndGather: - mDNSConn, err = mdns.Server(ipv4.NewPacketConn(l), &mdns.Config{ + return mdns.Server(ipv4.NewPacketConn(l), &mdns.Config{ LocalNames: []string{mDNSName}, }) + default: + return nil, nil } - if err != nil { - return nil, err - } - } - - loggerFactory := config.LoggerFactory - if loggerFactory == nil { - loggerFactory = logging.NewDefaultLoggerFactory() + }() + if err != nil { + return nil, err } a := &Agent{ @@ -278,16 +296,18 @@ func NewAgent(config *AgentConfig) (*Agent, error) { urls: config.Urls, networkTypes: config.NetworkTypes, - localUfrag: randSeq(16), - localPwd: randSeq(32), - taskChan: make(chan task), - onConnected: make(chan struct{}), - buffer: packetio.NewBuffer(), - done: make(chan struct{}), - portmin: config.PortMin, - portmax: config.PortMax, - trickle: config.Trickle, - log: loggerFactory.NewLogger("ice"), + localUfrag: randSeq(16), + localPwd: randSeq(32), + taskChan: make(chan task), + onConnected: make(chan struct{}), + buffer: packetio.NewBuffer(), + done: make(chan struct{}), + portmin: config.PortMin, + portmax: config.PortMax, + trickle: config.Trickle, + loggerFactory: loggerFactory, + log: log, + net: config.Net, mDNSMode: mDNSMode, mDNSName: mDNSName, @@ -297,6 +317,15 @@ func NewAgent(config *AgentConfig) (*Agent, error) { } a.haveStarted.Store(false) + if a.net == nil { + a.net = vnet.NewNet(nil) + } else { + a.log.Warn("vnet is enabled") + if a.mDNSMode != MulticastDNSModeDisabled { + a.log.Warn("vnet does not support mDNS yet") + } + } + if config.MaxBindingRequests == nil { a.maxBindingRequests = defaultMaxBindingRequests } else { @@ -432,9 +461,8 @@ func (a *Agent) startConnectivityChecks(isControlling bool, remoteUfrag, remoteP agent.updateConnectionState(ConnectionStateChecking) // TODO this should be dynamic, and grow when the connection is stable - agent.forceCandidateContact <- true - t := time.NewTicker(a.taskLoopInterval) - agent.connectivityChan = t.C + a.requestConnectivityCheck() + agent.connectivityTicker = time.NewTicker(a.taskLoopInterval) }) } @@ -457,6 +485,7 @@ func (a *Agent) setSelectedPair(p *candidatePair) { a.onSelectedCandidatePairChange(p) a.selectedPair = p + a.selectedPair.nominated = true a.updateConnectionState(ConnectionStateConnected) // Close mDNS Conn. We don't need to do anymore querying @@ -469,13 +498,16 @@ func (a *Agent) setSelectedPair(p *candidatePair) { func (a *Agent) pingAllCandidates() { for _, p := range a.checklist { - if p.state != candidatePairStateChecking { + + if p.state == CandidatePairStateWaiting { + p.state = CandidatePairStateInProgress + } else if p.state != CandidatePairStateInProgress { continue } if p.bindingRequestCount > a.maxBindingRequests { a.log.Tracef("max requests reached for pair %s, marking it as failed\n", p) - p.state = candidatePairStateFailed + p.state = CandidatePairStateFailed } else { a.selector.PingCandidate(p.local, p.remote) p.bindingRequestCount++ @@ -486,7 +518,7 @@ func (a *Agent) pingAllCandidates() { func (a *Agent) getBestAvailableCandidatePair() *candidatePair { var best *candidatePair for _, p := range a.checklist { - if p.state == candidatePairStateFailed { + if p.state == CandidatePairStateFailed { continue } @@ -502,7 +534,7 @@ func (a *Agent) getBestAvailableCandidatePair() *candidatePair { func (a *Agent) getBestValidCandidatePair() *candidatePair { var best *candidatePair for _, p := range a.checklist { - if p.state != candidatePairStateValid { + if p.state != CandidatePairStateSucceeded { continue } @@ -553,7 +585,7 @@ func (a *Agent) taskLoop() { select { case <-a.forceCandidateContact: a.selector.ContactCandidates() - case <-a.connectivityChan: + case <-a.connectivityTicker.C: a.selector.ContactCandidates() case t := <-a.taskChan: // Run the task @@ -614,6 +646,7 @@ func (a *Agent) AddRemoteCandidate(c Candidate) error { // If we have a mDNS Candidate lets fully resolve it before adding it locally if c.Type() == CandidateTypeHost && strings.HasSuffix(c.Address(), ".local") { if a.mDNSMode == MulticastDNSModeDisabled { + a.log.Warnf("remote mDNS candidate added, but mDNS is disabled: (%s)", c.Address()) return nil } @@ -658,6 +691,13 @@ func (a *Agent) resolveAndAddMulticastCandidate(c *CandidateHost) { } } +func (a *Agent) requestConnectivityCheck() { + select { + case a.forceCandidateContact <- true: + default: + } +} + // addRemoteCandidate assumes you are holding the lock (must be execute using a.run) func (a *Agent) addRemoteCandidate(c Candidate) { set := a.remoteCandidates[c.NetworkType()] @@ -671,19 +711,13 @@ func (a *Agent) addRemoteCandidate(c Candidate) { set = append(set, c) a.remoteCandidates[c.NetworkType()] = set - for _, l := range a.localCandidates[NetworkTypeUDP4] { - if localRelay, ok := l.(*CandidateRelay); ok { - if err := localRelay.addPermission(c); err != nil { - a.log.Errorf("Failed to create TURN permission %v", err) - } - } - } - if localCandidates, ok := a.localCandidates[c.NetworkType()]; ok { for _, localCandidate := range localCandidates { a.addPair(localCandidate, c) } } + + a.requestConnectivityCheck() } // addCandidate assumes you are holding the lock (must be execute using a.run) @@ -761,6 +795,10 @@ func (a *Agent) Close() error { a.log.Warnf("failed to close buffer: %v", err) } + if a.connectivityTicker != nil { + a.connectivityTicker.Stop() + } + a.closeMulticastConn() }) if err != nil { @@ -905,7 +943,16 @@ func (a *Agent) handleInbound(m *stun.Message, local Candidate, remote net.Addr) return } - prflxCandidate, err := NewCandidatePeerReflexive(networkType.String(), ip.String(), port, local.Component(), "", 0) + prflxCandidateConfig := CandidatePeerReflexiveConfig{ + Network: networkType.String(), + Address: ip.String(), + Port: port, + Component: local.Component(), + RelAddr: "", + RelPort: 0, + } + + prflxCandidate, err := NewCandidatePeerReflexive(&prflxCandidateConfig) if err != nil { a.log.Errorf("Failed to create new remote prflx candidate (%s)", err) return @@ -970,6 +1017,113 @@ func (a *Agent) closeMulticastConn() { } } +// GetCandidatePairsStats returns a list of candidate pair stats +func (a *Agent) GetCandidatePairsStats() []CandidatePairStats { + resultChan := make(chan []CandidatePairStats) + err := a.run(func(agent *Agent) { + result := make([]CandidatePairStats, 0, len(agent.checklist)) + for _, cp := range agent.checklist { + stat := CandidatePairStats{ + Timestamp: time.Now(), + LocalCandidateID: cp.local.ID(), + RemoteCandidateID: cp.remote.ID(), + State: cp.state, + Nominated: cp.nominated, + // PacketsSent uint32 + // PacketsReceived uint32 + // BytesSent uint64 + // BytesReceived uint64 + // LastPacketSentTimestamp time.Time + // LastPacketReceivedTimestamp time.Time + // FirstRequestTimestamp time.Time + // LastRequestTimestamp time.Time + // LastResponseTimestamp time.Time + // TotalRoundTripTime float64 + // CurrentRoundTripTime float64 + // AvailableOutgoingBitrate float64 + // AvailableIncomingBitrate float64 + // CircuitBreakerTriggerCount uint32 + // RequestsReceived uint64 + // RequestsSent uint64 + // ResponsesReceived uint64 + // ResponsesSent uint64 + // RetransmissionsReceived uint64 + // RetransmissionsSent uint64 + // ConsentRequestsSent uint64 + // ConsentExpiredTimestamp time.Time + } + result = append(result, stat) + } + resultChan <- result + }) + if err != nil { + a.log.Errorf("error getting candidate pairs stats %v", err) + return []CandidatePairStats{} + } + return <-resultChan +} + +// GetLocalCandidatesStats returns a list of local candidates stats +func (a *Agent) GetLocalCandidatesStats() []CandidateStats { + resultChan := make(chan []CandidateStats) + err := a.run(func(agent *Agent) { + result := make([]CandidateStats, 0, len(agent.localCandidates)) + for networkType, localCandidates := range agent.localCandidates { + for _, c := range localCandidates { + stat := CandidateStats{ + Timestamp: time.Now(), + ID: c.ID(), + NetworkType: networkType, + IP: c.Address(), + Port: c.Port(), + CandidateType: c.Type(), + Priority: c.Priority(), + // URL string + RelayProtocol: "udp", + // Deleted bool + } + result = append(result, stat) + } + } + resultChan <- result + }) + if err != nil { + a.log.Errorf("error getting candidate pairs stats %v", err) + return []CandidateStats{} + } + return <-resultChan +} + +// GetRemoteCandidatesStats returns a list of remote candidates stats +func (a *Agent) GetRemoteCandidatesStats() []CandidateStats { + resultChan := make(chan []CandidateStats) + err := a.run(func(agent *Agent) { + result := make([]CandidateStats, 0, len(agent.remoteCandidates)) + for networkType, localCandidates := range agent.remoteCandidates { + for _, c := range localCandidates { + stat := CandidateStats{ + Timestamp: time.Now(), + ID: c.ID(), + NetworkType: networkType, + IP: c.Address(), + Port: c.Port(), + CandidateType: c.Type(), + Priority: c.Priority(), + // URL string + RelayProtocol: "udp", + } + result = append(result, stat) + } + } + resultChan <- result + }) + if err != nil { + a.log.Errorf("error getting candidate pairs stats %v", err) + return []CandidateStats{} + } + return <-resultChan +} + // Role represents ICE agent role, which can be controlling or controlled. type Role byte diff --git a/vendor/github.com/pion/ice/candidate.go b/vendor/github.com/pion/ice/candidate.go index 2f38a70e..9ae95d03 100644 --- a/vendor/github.com/pion/ice/candidate.go +++ b/vendor/github.com/pion/ice/candidate.go @@ -17,6 +17,7 @@ const ( // Candidate represents an ICE candidate type Candidate interface { + ID() string Component() uint16 Address() string LastReceived() time.Time diff --git a/vendor/github.com/pion/ice/candidate_base.go b/vendor/github.com/pion/ice/candidate_base.go index 77937801..b5cb2164 100644 --- a/vendor/github.com/pion/ice/candidate_base.go +++ b/vendor/github.com/pion/ice/candidate_base.go @@ -11,6 +11,7 @@ import ( ) type candidateBase struct { + id string networkType NetworkType candidateType CandidateType @@ -31,6 +32,11 @@ type candidateBase struct { closedCh chan struct{} } +// ID returns Candidate ID +func (c *candidateBase) ID() string { + return c.id +} + // Address returns Candidate Address func (c *candidateBase) Address() string { return c.address diff --git a/vendor/github.com/pion/ice/candidate_host.go b/vendor/github.com/pion/ice/candidate_host.go index 3a590bf1..6a80198c 100644 --- a/vendor/github.com/pion/ice/candidate_host.go +++ b/vendor/github.com/pion/ice/candidate_host.go @@ -12,20 +12,40 @@ type CandidateHost struct { network string } +// CandidateHostConfig is the config required to create a new CandidateHost +type CandidateHostConfig struct { + CandidateID string + Network string + Address string + Port int + Component uint16 +} + // NewCandidateHost creates a new host candidate -func NewCandidateHost(network string, address string, port int, component uint16) (*CandidateHost, error) { - c := &CandidateHost{ - candidateBase: candidateBase{ - address: address, - candidateType: CandidateTypeHost, - component: component, - port: port, - }, - network: network, +func NewCandidateHost(config *CandidateHostConfig) (*CandidateHost, error) { + candidateID := config.CandidateID + + if candidateID == "" { + var err error + candidateID, err = generateCandidateID() + if err != nil { + return nil, err + } } - if !strings.HasSuffix(address, ".local") { - ip := net.ParseIP(address) + c := &CandidateHost{ + candidateBase: candidateBase{ + id: candidateID, + address: config.Address, + candidateType: CandidateTypeHost, + component: config.Component, + port: config.Port, + }, + network: config.Network, + } + + if !strings.HasSuffix(config.Address, ".local") { + ip := net.ParseIP(config.Address) if ip == nil { return nil, ErrAddressParseFailed } diff --git a/vendor/github.com/pion/ice/candidate_peer_reflexive.go b/vendor/github.com/pion/ice/candidate_peer_reflexive.go index c6ddd397..b9417c23 100644 --- a/vendor/github.com/pion/ice/candidate_peer_reflexive.go +++ b/vendor/github.com/pion/ice/candidate_peer_reflexive.go @@ -1,3 +1,5 @@ +// Package ice ... +//nolint:dupl package ice import "net" @@ -7,29 +9,50 @@ type CandidatePeerReflexive struct { candidateBase } +// CandidatePeerReflexiveConfig is the config required to create a new CandidatePeerReflexive +type CandidatePeerReflexiveConfig struct { + CandidateID string + Network string + Address string + Port int + Component uint16 + RelAddr string + RelPort int +} + // NewCandidatePeerReflexive creates a new peer reflective candidate -func NewCandidatePeerReflexive(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidatePeerReflexive, error) { - ip := net.ParseIP(address) +func NewCandidatePeerReflexive(config *CandidatePeerReflexiveConfig) (*CandidatePeerReflexive, error) { + ip := net.ParseIP(config.Address) if ip == nil { return nil, ErrAddressParseFailed } - networkType, err := determineNetworkType(network, ip) + networkType, err := determineNetworkType(config.Network, ip) if err != nil { return nil, err } + candidateID := config.CandidateID + if candidateID == "" { + var err error + candidateID, err = generateCandidateID() + if err != nil { + return nil, err + } + } + return &CandidatePeerReflexive{ candidateBase: candidateBase{ + id: candidateID, networkType: networkType, candidateType: CandidateTypePeerReflexive, - address: address, - port: port, - resolvedAddr: &net.UDPAddr{IP: ip, Port: port}, - component: component, + address: config.Address, + port: config.Port, + resolvedAddr: &net.UDPAddr{IP: ip, Port: config.Port}, + component: config.Component, relatedAddress: &CandidateRelatedAddress{ - Address: relAddr, - Port: relPort, + Address: config.RelAddr, + Port: config.RelPort, }, }, }, nil diff --git a/vendor/github.com/pion/ice/candidate_relay.go b/vendor/github.com/pion/ice/candidate_relay.go index 92c41c5c..0cc01ff2 100644 --- a/vendor/github.com/pion/ice/candidate_relay.go +++ b/vendor/github.com/pion/ice/candidate_relay.go @@ -1,107 +1,73 @@ package ice import ( - "errors" - "io" "net" - - "github.com/pion/turnc" ) // CandidateRelay ... type CandidateRelay struct { candidateBase - allocation *turnc.Allocation - client io.Closer - permissions map[string]*turnc.Permission + onClose func() error +} + +// CandidateRelayConfig is the config required to create a new CandidateRelay +type CandidateRelayConfig struct { + CandidateID string + Network string + Address string + Port int + Component uint16 + RelAddr string + RelPort int + OnClose func() error } // NewCandidateRelay creates a new relay candidate -func NewCandidateRelay(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidateRelay, error) { - ip := net.ParseIP(address) +func NewCandidateRelay(config *CandidateRelayConfig) (*CandidateRelay, error) { + candidateID := config.CandidateID + + if candidateID == "" { + var err error + candidateID, err = generateCandidateID() + if err != nil { + return nil, err + } + } + + ip := net.ParseIP(config.Address) if ip == nil { return nil, ErrAddressParseFailed } - networkType, err := determineNetworkType(network, ip) + networkType, err := determineNetworkType(config.Network, ip) if err != nil { return nil, err } return &CandidateRelay{ candidateBase: candidateBase{ + id: candidateID, networkType: networkType, candidateType: CandidateTypeRelay, - address: address, - port: port, - resolvedAddr: &net.UDPAddr{IP: ip, Port: port}, - component: component, + address: config.Address, + port: config.Port, + resolvedAddr: &net.UDPAddr{IP: ip, Port: config.Port}, + component: config.Component, relatedAddress: &CandidateRelatedAddress{ - Address: relAddr, - Port: relPort, + Address: config.RelAddr, + Port: config.RelPort, }, }, - permissions: map[string]*turnc.Permission{}, + onClose: config.OnClose, }, nil } -func (c *CandidateRelay) setAllocation(client io.Closer, a *turnc.Allocation) { - c.allocation = a - c.client = client -} - -func (c *CandidateRelay) start(a *Agent, conn net.PacketConn) { - c.currAgent = a -} - func (c *CandidateRelay) close() error { - c.lock.Lock() - defer c.lock.Unlock() - for _, p := range c.permissions { - if err := p.Close(); err != nil { - return err - } + err := c.candidateBase.close() + if c.onClose != nil { + err = c.onClose() + c.onClose = nil } - if c.client == nil { - return nil - } - return c.client.Close() -} - -func (c *CandidateRelay) addPermission(dst Candidate) error { - permission, err := c.allocation.Create(dst.addr()) - if err != nil { - return err - } - - c.lock.Lock() - c.permissions[dst.String()] = permission - if err = c.permissions[dst.String()].Bind(); err != nil { - c.agent().log.Warnf("Failed to Create ChannelBind for %v: %v", dst.String, err) - } - c.lock.Unlock() - - go func(remoteAddr net.Addr) { - log := c.agent().log - buffer := make([]byte, receiveMTU) - for { - n, err := permission.Read(buffer) - if err != nil { - return - } - - handleInboundCandidateMsg(c, buffer[:n], remoteAddr, log) - } - }(dst.addr()) - return nil -} - -func (c *CandidateRelay) writeTo(raw []byte, dst Candidate) (int, error) { - permission, ok := c.permissions[dst.String()] - if !ok { - return 0, errors.New("no permission created for remote candidate") - } - - return permission.Write(raw) + return err } diff --git a/vendor/github.com/pion/ice/candidate_server_reflexive.go b/vendor/github.com/pion/ice/candidate_server_reflexive.go index 8ff5ec3e..e50e5e35 100644 --- a/vendor/github.com/pion/ice/candidate_server_reflexive.go +++ b/vendor/github.com/pion/ice/candidate_server_reflexive.go @@ -7,29 +7,49 @@ type CandidateServerReflexive struct { candidateBase } +// CandidateServerReflexiveConfig is the config required to create a new CandidateServerReflexive +type CandidateServerReflexiveConfig struct { + CandidateID string + Network string + Address string + Port int + Component uint16 + RelAddr string + RelPort int +} + // NewCandidateServerReflexive creates a new server reflective candidate -func NewCandidateServerReflexive(network string, address string, port int, component uint16, relAddr string, relPort int) (*CandidateServerReflexive, error) { - ip := net.ParseIP(address) +func NewCandidateServerReflexive(config *CandidateServerReflexiveConfig) (*CandidateServerReflexive, error) { + ip := net.ParseIP(config.Address) if ip == nil { return nil, ErrAddressParseFailed } - networkType, err := determineNetworkType(network, ip) + networkType, err := determineNetworkType(config.Network, ip) if err != nil { return nil, err } + candidateID := config.CandidateID + if candidateID == "" { + candidateID, err = generateCandidateID() + if err != nil { + return nil, err + } + } + return &CandidateServerReflexive{ candidateBase: candidateBase{ + id: candidateID, networkType: networkType, candidateType: CandidateTypeServerReflexive, - address: address, - port: port, - resolvedAddr: &net.UDPAddr{IP: ip, Port: port}, - component: component, + address: config.Address, + port: config.Port, + resolvedAddr: &net.UDPAddr{IP: ip, Port: config.Port}, + component: config.Component, relatedAddress: &CandidateRelatedAddress{ - Address: relAddr, - Port: relPort, + Address: config.RelAddr, + Port: config.RelPort, }, }, }, nil diff --git a/vendor/github.com/pion/ice/candidatepair.go b/vendor/github.com/pion/ice/candidatepair.go index 6907285d..00f904eb 100644 --- a/vendor/github.com/pion/ice/candidatepair.go +++ b/vendor/github.com/pion/ice/candidatepair.go @@ -6,32 +6,12 @@ import ( "github.com/pion/stun" ) -type candidatePairState int - -const ( - candidatePairStateChecking candidatePairState = iota + 1 - candidatePairStateFailed - candidatePairStateValid -) - -func (c candidatePairState) String() string { - switch c { - case candidatePairStateChecking: - return "checking" - case candidatePairStateFailed: - return "failed" - case candidatePairStateValid: - return "valid" - } - return "Unknown candidate pair state" -} - func newCandidatePair(local, remote Candidate, controlling bool) *candidatePair { return &candidatePair{ iceRoleControlling: controlling, remote: remote, local: local, - state: candidatePairStateChecking, + state: CandidatePairStateWaiting, } } @@ -41,7 +21,8 @@ type candidatePair struct { remote Candidate local Candidate bindingRequestCount uint16 - state candidatePairState + state CandidatePairState + nominated bool } func (p *candidatePair) String() string { diff --git a/vendor/github.com/pion/ice/candidatepair_state.go b/vendor/github.com/pion/ice/candidatepair_state.go new file mode 100644 index 00000000..f76396c1 --- /dev/null +++ b/vendor/github.com/pion/ice/candidatepair_state.go @@ -0,0 +1,37 @@ +package ice + +// CandidatePairState represent the ICE candidate pair state +type CandidatePairState int + +const ( + // CandidatePairStateWaiting means a check has not been performed for + // this pair + CandidatePairStateWaiting = iota + 1 + + // CandidatePairStateInProgress means a check has been sent for this pair, + // but the transaction is in progress. + CandidatePairStateInProgress + + // CandidatePairStateFailed means a check for this pair was already done + // and failed, either never producing any response or producing an unrecoverable + // failure response. + CandidatePairStateFailed + + // CandidatePairStateSucceeded means a check for this pair was already + // done and produced a successful result. + CandidatePairStateSucceeded +) + +func (c CandidatePairState) String() string { + switch c { + case CandidatePairStateWaiting: + return "waiting" + case CandidatePairStateInProgress: + return "in-progress" + case CandidatePairStateFailed: + return "failed" + case CandidatePairStateSucceeded: + return "succeded" + } + return "Unknown candidate pair state" +} diff --git a/vendor/github.com/pion/ice/gather.go b/vendor/github.com/pion/ice/gather.go index 5f8d16e8..64c8c9e5 100644 --- a/vendor/github.com/pion/ice/gather.go +++ b/vendor/github.com/pion/ice/gather.go @@ -7,17 +7,19 @@ import ( "time" "github.com/pion/stun" - "github.com/pion/turnc" + "github.com/pion/transport/vnet" + "github.com/pion/turn" ) const ( stunGatherTimeout = time.Second * 5 ) -func localInterfaces(networkTypes []NetworkType) (ips []net.IP) { - ifaces, err := net.Interfaces() +func (a *Agent) localInterfaces(networkTypes []NetworkType) ([]net.IP, error) { + ips := []net.IP{} + ifaces, err := a.net.Interfaces() if err != nil { - return ips + return ips, err } var IPv4Requested, IPv6Requested bool @@ -41,7 +43,7 @@ func localInterfaces(networkTypes []NetworkType) (ips []net.IP) { addrs, err := iface.Addrs() if err != nil { - return ips + continue } for _, addr := range addrs { @@ -70,12 +72,12 @@ func localInterfaces(networkTypes []NetworkType) (ips []net.IP) { ips = append(ips, ip) } } - return ips + return ips, nil } -func listenUDP(portMax, portMin int, network string, laddr *net.UDPAddr) (*net.UDPConn, error) { +func (a *Agent) listenUDP(portMax, portMin int, network string, laddr *net.UDPAddr) (vnet.UDPPacketConn, error) { if (laddr.Port != 0) || ((portMin == 0) && (portMax == 0)) { - return net.ListenUDP(network, laddr) + return a.net.ListenUDP(network, laddr) } var i, j int i = portMin @@ -87,10 +89,12 @@ func listenUDP(portMax, portMin int, network string, laddr *net.UDPAddr) (*net.U j = 0xFFFF } for i <= j { - c, e := net.ListenUDP(network, &net.UDPAddr{IP: laddr.IP, Port: i}) + laddr = &net.UDPAddr{IP: laddr.IP, Port: i} + c, e := a.net.ListenUDP(network, laddr) if e == nil { return c, e } + a.log.Debugf("failed to listen %s: %v", laddr.String(), e) i++ } return nil, ErrPort @@ -164,13 +168,18 @@ func (a *Agent) gatherCandidatesLocal(networkTypes []NetworkType) { var wg sync.WaitGroup defer wg.Wait() - localIPs := localInterfaces(networkTypes) + localIPs, err := a.localInterfaces(networkTypes) + if err != nil { + a.log.Warnf("failed to iterate local interfaces, host candidates will not be gathered %s", err) + return + } + wg.Add(len(localIPs) * len(supportedNetworks)) for _, ip := range localIPs { for _, network := range supportedNetworks { go func(network string, ip net.IP) { defer wg.Done() - conn, err := listenUDP(int(a.portmax), int(a.portmin), network, &net.UDPAddr{IP: ip, Port: 0}) + conn, err := a.listenUDP(int(a.portmax), int(a.portmin), network, &net.UDPAddr{IP: ip, Port: 0}) if err != nil { a.log.Warnf("could not listen %s %s\n", network, ip) return @@ -182,7 +191,15 @@ func (a *Agent) gatherCandidatesLocal(networkTypes []NetworkType) { } port := conn.LocalAddr().(*net.UDPAddr).Port - c, err := NewCandidateHost(network, address, port, ComponentRTP) + + hostConfig := CandidateHostConfig{ + Network: network, + Address: address, + Port: port, + Component: ComponentRTP, + } + + c, err := NewCandidateHost(&hostConfig) if err != nil { a.log.Warnf("Failed to create host candidate: %s %s %d: %v\n", network, ip, port, err) return @@ -226,13 +243,13 @@ func (a *Agent) gatherCandidatesSrflx(urls []*URL, networkTypes []NetworkType) { } hostPort := fmt.Sprintf("%s:%d", url.Host, url.Port) - serverAddr, err := net.ResolveUDPAddr(network, hostPort) + serverAddr, err := a.net.ResolveUDPAddr(network, hostPort) if err != nil { a.log.Warnf("failed to resolve stun host: %s: %v", hostPort, err) continue } - conn, err := listenUDP(int(a.portmax), int(a.portmin), network, &net.UDPAddr{IP: nil, Port: 0}) + conn, err := a.listenUDP(int(a.portmax), int(a.portmin), network, &net.UDPAddr{IP: nil, Port: 0}) if err != nil { a.log.Warnf("Failed to listen on %s for %s: %v\n", conn.LocalAddr().String(), serverAddr.String(), err) continue @@ -249,7 +266,16 @@ func (a *Agent) gatherCandidatesSrflx(urls []*URL, networkTypes []NetworkType) { port := xoraddr.Port relIP := laddr.IP.String() relPort := laddr.Port - c, err := NewCandidateServerReflexive(network, ip.String(), port, ComponentRTP, relIP, relPort) + + srflxConfig := CandidateServerReflexiveConfig{ + Network: network, + Address: ip.String(), + Port: port, + Component: ComponentRTP, + RelAddr: relIP, + RelPort: relPort, + } + c, err := NewCandidateServerReflexive(&srflxConfig) if err != nil { a.log.Warnf("Failed to create server reflexive candidate: %s %s %d: %v\n", network, ip, port, err) continue @@ -289,40 +315,57 @@ func (a *Agent) gatherCandidatesRelay(urls []*URL) error { return ErrPasswordEmpty } - raddr, err := net.ResolveUDPAddr(network, fmt.Sprintf("%s:%d", url.Host, url.Port)) + locConn, err := a.net.ListenPacket(network, "0.0.0.0:0") if err != nil { return err } - c, err := net.DialUDP(network, nil, raddr) - if err != nil { - return err - } - client, clientErr := turnc.New(turnc.Options{ - Conn: c, - Username: url.Username, - Password: url.Password, + + client, err := turn.NewClient(&turn.ClientConfig{ + TURNServerAddr: fmt.Sprintf("%s:%d", url.Host, url.Port), + Conn: locConn, + Username: url.Username, + Password: url.Password, + LoggerFactory: a.loggerFactory, + Net: a.net, }) - if clientErr != nil { - return clientErr - } - allocation, allocErr := client.Allocate() - if allocErr != nil { - return allocErr - } - - laddr := c.LocalAddr().(*net.UDPAddr) - ip := allocation.Relayed().IP - port := allocation.Relayed().Port - - candidate, err := NewCandidateRelay(network, ip.String(), port, ComponentRTP, laddr.IP.String(), laddr.Port) if err != nil { - a.log.Warnf("Failed to create server reflexive candidate: %s %s %d: %v\n", network, ip, port, err) + return err + } + + err = client.Listen() + if err != nil { + return err + } + + relayConn, err := client.Allocate() + if err != nil { + return err + } + + laddr := locConn.LocalAddr().(*net.UDPAddr) + raddr := relayConn.LocalAddr().(*net.UDPAddr) + + relayConfig := CandidateRelayConfig{ + Network: network, + Component: ComponentRTP, + Address: raddr.IP.String(), + Port: raddr.Port, + RelAddr: laddr.IP.String(), + RelPort: laddr.Port, + OnClose: func() error { + client.Close() + return locConn.Close() + }, + } + candidate, err := NewCandidateRelay(&relayConfig) + if err != nil { + a.log.Warnf("Failed to create relay candidate: %s %s: %v\n", + network, raddr.String(), err) continue } - candidate.setAllocation(client, allocation) a.addCandidate(candidate) - candidate.start(a, nil) + candidate.start(a, relayConn) } return nil @@ -332,7 +375,7 @@ func (a *Agent) gatherCandidatesRelay(urls []*URL) error { // the XORMappedAddress returned by the stun server. // // Adapted from stun v0.2. -func getXORMappedAddr(conn *net.UDPConn, serverAddr net.Addr, deadline time.Duration) (*stun.XORMappedAddress, error) { +func getXORMappedAddr(conn net.PacketConn, serverAddr net.Addr, deadline time.Duration) (*stun.XORMappedAddress, error) { if deadline > 0 { if err := conn.SetReadDeadline(time.Now().Add(deadline)); err != nil { return nil, err @@ -344,7 +387,10 @@ func getXORMappedAddr(conn *net.UDPConn, serverAddr net.Addr, deadline time.Dura } }() resp, err := stunRequest( - conn.Read, + func(p []byte) (int, error) { + n, _, errr := conn.ReadFrom(p) + return n, errr + }, func(b []byte) (int, error) { return conn.WriteTo(b, serverAddr) }, diff --git a/vendor/github.com/pion/ice/go.mod b/vendor/github.com/pion/ice/go.mod index e4d97218..4758617c 100644 --- a/vendor/github.com/pion/ice/go.mod +++ b/vendor/github.com/pion/ice/go.mod @@ -3,12 +3,12 @@ module github.com/pion/ice go 1.12 require ( - github.com/pion/logging v0.2.1 - github.com/pion/mdns v0.0.2 + github.com/pion/logging v0.2.2 + github.com/pion/mdns v0.0.3 github.com/pion/stun v0.3.1 - github.com/pion/transport v0.7.0 - github.com/pion/turn v1.1.4 - github.com/pion/turnc v0.0.6 + github.com/pion/transport v0.8.6 + github.com/pion/turn v1.3.3 github.com/stretchr/testify v1.3.0 - golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b + golang.org/x/net v0.0.0-20190628185345-da137c7871d7 + golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 // indirect ) diff --git a/vendor/github.com/pion/ice/go.sum b/vendor/github.com/pion/ice/go.sum index e654dfcf..a3884b90 100644 --- a/vendor/github.com/pion/ice/go.sum +++ b/vendor/github.com/pion/ice/go.sum @@ -1,21 +1,19 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gortc/turn v0.7.1/go.mod h1:3FZ+LvCZKCKu6YYgwuYPqEi3FqCtdjfSFnFqVQNwfjk= -github.com/gortc/turn v0.7.3 h1:CE72C79erbcsfa6L/QDhKztcl2kDq1UK20ImrJWDt/w= -github.com/gortc/turn v0.7.3/go.mod h1:gvguwaGAFyv5/9KrcW9MkCgHALYD+e99mSM7pSCYYho= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pion/logging v0.2.1 h1:LwASkBKZ+2ysGJ+jLv1E/9H1ge0k1nTfi1X+5zirkDk= github.com/pion/logging v0.2.1/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= -github.com/pion/mdns v0.0.2 h1:T22Gg4dSuYVYsZ21oRFh9z7twzAm27+5PEKiABbjCvM= -github.com/pion/mdns v0.0.2/go.mod h1:VrN3wefVgtfL8QgpEblPUC46ag1reLIfpqekCnKunLE= -github.com/pion/stun v0.3.0/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/mdns v0.0.3 h1:DxdOYd0pgwLKiDlIIxfU0qdG5iWh1Xn6CsS9vc6cMAY= +github.com/pion/mdns v0.0.3/go.mod h1:VrN3wefVgtfL8QgpEblPUC46ag1reLIfpqekCnKunLE= github.com/pion/stun v0.3.1 h1:d09JJzOmOS8ZzIp8NppCMgrxGZpJ4Ix8qirfNYyI3BA= github.com/pion/stun v0.3.1/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M= -github.com/pion/transport v0.7.0 h1:EsXN8TglHMlKZMo4ZGqwK6QgXBu0WYg7wfGMWIXsS+w= -github.com/pion/transport v0.7.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE= -github.com/pion/turn v1.1.4 h1:yGxcasBvge4idNjxjowePn8oW43C4v70bXroBBKLyKY= -github.com/pion/turn v1.1.4/go.mod h1:2O2GFDGO6+hJ5gsyExDhoNHtVcacPB1NOyc81gkq0WA= -github.com/pion/turnc v0.0.6 h1:FHsmwYvdJ8mhT1/ZtWWer9L0unEb7AyRgrymfWy6mEY= -github.com/pion/turnc v0.0.6/go.mod h1:4MSFv5i0v3MRkDLdo5eF9cD/xJtj1pxSphHNnxKL2W8= +github.com/pion/transport v0.8.6 h1:xHQq2mxAjB+UrFs90aUBaXwlmIACfQAZnOiVAX3uqMw= +github.com/pion/transport v0.8.6/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno= +github.com/pion/turn v1.3.3 h1:jO8bYTgUZ7ls6BCVa5lIQhxu56UFc5afX1A50vfxFio= +github.com/pion/turn v1.3.3/go.mod h1:zGPB7YYB/HTE9MWn0Sbznz8NtyfeVeanZ834cG/MXu0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -24,10 +22,12 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b h1:/zjbcJPEGAyu6Is/VBOALsgdi4z9+kz/Vtdm6S+beD0= -golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b h1:lkjdUzSyJ5P1+eal9fxXX9Xg2BTfswsonKUse48C0uE= golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 h1:LepdCS8Gf/MVejFIt8lsiexZATdoGVyp5bcyS+rYoUI= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/pion/ice/mdns.go b/vendor/github.com/pion/ice/mdns.go index 908a4fe9..3b06781d 100644 --- a/vendor/github.com/pion/ice/mdns.go +++ b/vendor/github.com/pion/ice/mdns.go @@ -2,7 +2,6 @@ package ice import ( "crypto/rand" - "fmt" ) // MulticastDNSMode represents the different Multicast modes ICE can run in @@ -28,5 +27,5 @@ func generateMulticastDNSName() (string, error) { return "", err } - return fmt.Sprintf("%X-%X-%X-%X-%X.local", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]), nil + return generateRandString("", ".local") } diff --git a/vendor/github.com/pion/ice/selection.go b/vendor/github.com/pion/ice/selection.go index c20c57c8..8560a8e4 100644 --- a/vendor/github.com/pion/ice/selection.go +++ b/vendor/github.com/pion/ice/selection.go @@ -82,6 +82,7 @@ func (s *controllingSelector) ContactCandidates() { p := s.agent.getBestValidCandidatePair() if p != nil && s.isNominatable(p.local) && s.isNominatable(p.remote) { s.log.Tracef("Nominatable pair found, nominating (%s, %s)", p.local.String(), p.remote.String()) + p.nominated = true s.nominatedPair = p s.nominatePair(p) return @@ -126,7 +127,7 @@ func (s *controllingSelector) HandleBindingRequest(m *stun.Message, local, remot return } - if p.state == candidatePairStateValid && s.nominatedPair == nil && s.agent.selectedPair == nil { + if p.state == CandidatePairStateSucceeded && s.nominatedPair == nil && s.agent.selectedPair == nil { bestPair := s.agent.getBestAvailableCandidatePair() if bestPair == nil { s.log.Tracef("No best pair available\n") @@ -164,7 +165,7 @@ func (s *controllingSelector) HandleSucessResponse(m *stun.Message, local, remot return } - p.state = candidatePairStateValid + p.state = CandidatePairStateSucceeded s.log.Tracef("Found valid candidate pair: %s", p) if pendingRequest.isUseCandidate && s.agent.selectedPair == nil { s.agent.setSelectedPair(p) @@ -256,7 +257,7 @@ func (s *controlledSelector) HandleSucessResponse(m *stun.Message, local, remote return } - p.state = candidatePairStateValid + p.state = CandidatePairStateSucceeded s.log.Tracef("Found valid candidate pair: %s", p) } @@ -272,7 +273,7 @@ func (s *controlledSelector) HandleBindingRequest(m *stun.Message, local, remote if useCandidate { // https://tools.ietf.org/html/rfc8445#section-7.3.1.5 - if p.state == candidatePairStateValid { + if p.state == CandidatePairStateSucceeded { // If the state of this pair is Succeeded, it means that the check // previously sent by this pair produced a successful response and // generated a valid pair (Section 7.2.5.3.2). The agent sets the diff --git a/vendor/github.com/pion/ice/stats.go b/vendor/github.com/pion/ice/stats.go new file mode 100644 index 00000000..f59d89ff --- /dev/null +++ b/vendor/github.com/pion/ice/stats.go @@ -0,0 +1,177 @@ +package ice + +import ( + "time" +) + +// CandidatePairStats contains ICE candidate pair statistics +type CandidatePairStats struct { + // Timestamp is the timestamp associated with this object. + Timestamp time.Time + + // LocalCandidateID is the ID of the local candidate + LocalCandidateID string + + // RemoteCandidateID is the ID of the remote candidate + RemoteCandidateID string + + // State represents the state of the checklist for the local and remote + // candidates in a pair. + State CandidatePairState + + // Nominated is true when this valid pair that should be used for media + // if it is the highest-priority one amongst those whose nominated flag is set + Nominated bool + + // PacketsSent represents the total number of packets sent on this candidate pair. + PacketsSent uint32 + + // PacketsReceived represents the total number of packets received on this candidate pair. + PacketsReceived uint32 + + // BytesSent represents the total number of payload bytes sent on this candidate pair + // not including headers or padding. + BytesSent uint64 + + // BytesReceived represents the total number of payload bytes received on this candidate pair + // not including headers or padding. + BytesReceived uint64 + + // LastPacketSentTimestamp represents the timestamp at which the last packet was + // sent on this particular candidate pair, excluding STUN packets. + LastPacketSentTimestamp time.Time + + // LastPacketReceivedTimestamp represents the timestamp at which the last packet + // was received on this particular candidate pair, excluding STUN packets. + LastPacketReceivedTimestamp time.Time + + // FirstRequestTimestamp represents the timestamp at which the first STUN request + // was sent on this particular candidate pair. + FirstRequestTimestamp time.Time + + // LastRequestTimestamp represents the timestamp at which the last STUN request + // was sent on this particular candidate pair. The average interval between two + // consecutive connectivity checks sent can be calculated with + // (LastRequestTimestamp - FirstRequestTimestamp) / RequestsSent. + LastRequestTimestamp time.Time + + // LastResponseTimestamp represents the timestamp at which the last STUN response + // was received on this particular candidate pair. + LastResponseTimestamp time.Time + + // TotalRoundTripTime represents the sum of all round trip time measurements + // in seconds since the beginning of the session, based on STUN connectivity + // check responses (ResponsesReceived), including those that reply to requests + // that are sent in order to verify consent. The average round trip time can + // be computed from TotalRoundTripTime by dividing it by ResponsesReceived. + TotalRoundTripTime float64 + + // CurrentRoundTripTime represents the latest round trip time measured in seconds, + // computed from both STUN connectivity checks, including those that are sent + // for consent verification. + CurrentRoundTripTime float64 + + // AvailableOutgoingBitrate is calculated by the underlying congestion control + // by combining the available bitrate for all the outgoing RTP streams using + // this candidate pair. The bitrate measurement does not count the size of the + // IP or other transport layers like TCP or UDP. It is similar to the TIAS defined + // in RFC 3890, i.e., it is measured in bits per second and the bitrate is calculated + // over a 1 second window. + AvailableOutgoingBitrate float64 + + // AvailableIncomingBitrate is calculated by the underlying congestion control + // by combining the available bitrate for all the incoming RTP streams using + // this candidate pair. The bitrate measurement does not count the size of the + // IP or other transport layers like TCP or UDP. It is similar to the TIAS defined + // in RFC 3890, i.e., it is measured in bits per second and the bitrate is + // calculated over a 1 second window. + AvailableIncomingBitrate float64 + + // CircuitBreakerTriggerCount represents the number of times the circuit breaker + // is triggered for this particular 5-tuple, ceasing transmission. + CircuitBreakerTriggerCount uint32 + + // RequestsReceived represents the total number of connectivity check requests + // received (including retransmissions). It is impossible for the receiver to + // tell whether the request was sent in order to check connectivity or check + // consent, so all connectivity checks requests are counted here. + RequestsReceived uint64 + + // RequestsSent represents the total number of connectivity check requests + // sent (not including retransmissions). + RequestsSent uint64 + + // ResponsesReceived represents the total number of connectivity check responses received. + ResponsesReceived uint64 + + // ResponsesSent epresents the total number of connectivity check responses sent. + // Since we cannot distinguish connectivity check requests and consent requests, + // all responses are counted. + ResponsesSent uint64 + + // RetransmissionsReceived represents the total number of connectivity check + // request retransmissions received. + RetransmissionsReceived uint64 + + // RetransmissionsSent represents the total number of connectivity check + // request retransmissions sent. + RetransmissionsSent uint64 + + // ConsentRequestsSent represents the total number of consent requests sent. + ConsentRequestsSent uint64 + + // ConsentExpiredTimestamp represents the timestamp at which the latest valid + // STUN binding response expired. + ConsentExpiredTimestamp time.Time +} + +// CandidateStats contains ICE candidate statistics related to the ICETransport objects. +type CandidateStats struct { + // Timestamp is the timestamp associated with this object. + Timestamp time.Time + + // ID is the candidate ID + ID string + + // NetworkType represents the type of network interface used by the base of a + // local candidate (the address the ICE agent sends from). Only present for + // local candidates; it's not possible to know what type of network interface + // a remote candidate is using. + // + // Note: + // This stat only tells you about the network interface used by the first "hop"; + // it's possible that a connection will be bottlenecked by another type of network. + // For example, when using Wi-Fi tethering, the networkType of the relevant candidate + // would be "wifi", even when the next hop is over a cellular connection. + NetworkType NetworkType + + // IP is the IP address of the candidate, allowing for IPv4 addresses and + // IPv6 addresses, but fully qualified domain names (FQDNs) are not allowed. + IP string + + // Port is the port number of the candidate. + Port int + + // CandidateType is the "Type" field of the ICECandidate. + CandidateType CandidateType + + // Priority is the "Priority" field of the ICECandidate. + Priority uint32 + + // URL is the URL of the TURN or STUN server indicated in the that translated + // this IP address. It is the URL address surfaced in an PeerConnectionICEEvent. + URL string + + // RelayProtocol is the protocol used by the endpoint to communicate with the + // TURN server. This is only present for local candidates. Valid values for + // the TURN URL protocol is one of udp, tcp, or tls. + RelayProtocol string + + // Deleted is true if the candidate has been deleted/freed. For host candidates, + // this means that any network resources (typically a socket) associated with the + // candidate have been released. For TURN candidates, this means the TURN allocation + // is no longer active. + // + // Only defined for local candidates. For remote candidates, this property is not applicable. + Deleted bool +} diff --git a/vendor/github.com/pion/ice/util.go b/vendor/github.com/pion/ice/util.go index 7691e99e..152922a0 100644 --- a/vendor/github.com/pion/ice/util.go +++ b/vendor/github.com/pion/ice/util.go @@ -1,6 +1,7 @@ package ice import ( + "fmt" "math/rand" "net" "sync/atomic" @@ -73,3 +74,18 @@ func addrEqual(a, b net.Addr) bool { return aType == bType && aIP.Equal(bIP) && aPort == bPort } + +func generateCandidateID() (string, error) { + return generateRandString("candidate:", "") +} + +func generateRandString(prefix, sufix string) (string, error) { + b := make([]byte, 16) + _, err := rand.Read(b) //nolint + + if err != nil { + return "", err + } + + return fmt.Sprintf("%s%X-%X-%X-%X-%X%s", prefix, b[0:4], b[4:6], b[6:8], b[8:10], b[10:], sufix), nil +} diff --git a/vendor/github.com/pion/logging/.travis.yml b/vendor/github.com/pion/logging/.travis.yml index 515a03c5..b96a1edb 100644 --- a/vendor/github.com/pion/logging/.travis.yml +++ b/vendor/github.com/pion/logging/.travis.yml @@ -8,13 +8,12 @@ env: before_script: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0 - - go get github.com/mattn/goveralls script: - golangci-lint run ./... # - rm -rf examples # Remove examples, no test coverage for them - go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... - - goveralls -coverprofile=cover.out -service=travis-ci + - bash <(curl -s https://codecov.io/bash) - bash .github/assert-contributors.sh - bash .github/lint-disallowed-functions-in-library.sh - bash .github/lint-commit-message.sh diff --git a/vendor/github.com/pion/logging/README.md b/vendor/github.com/pion/logging/README.md index 98f646f5..c15471d6 100644 --- a/vendor/github.com/pion/logging/README.md +++ b/vendor/github.com/pion/logging/README.md @@ -7,11 +7,10 @@

Pion transport Slack Widget - Waffle board
Build Status GoDoc - Coverage Status + Coverage Status Go Report Card License: MIT

@@ -36,6 +35,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [Woodrow Douglass](https://github.com/wdouglass) - *Test coverage* * [Michiel De Backker](https://github.com/backkem) - *Docs* * [Hugo Arregui](https://github.com/hugoArregui) - *Custom Logs* +* [Justin Okamoto](https://github.com/justinokamoto) - *Disabled Logs Update* ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/vendor/github.com/pion/logging/logger.go b/vendor/github.com/pion/logging/logger.go index d3c01569..35f65058 100644 --- a/vendor/github.com/pion/logging/logger.go +++ b/vendor/github.com/pion/logging/logger.go @@ -181,15 +181,21 @@ func NewDefaultLoggerFactory() *DefaultLoggerFactory { factory.Writer = os.Stdout logLevels := map[string]LogLevel{ - "ERROR": LogLevelError, - "WARN": LogLevelWarn, - "INFO": LogLevelInfo, - "DEBUG": LogLevelDebug, - "TRACE": LogLevelTrace, + "DISABLE": LogLevelDisabled, + "ERROR": LogLevelError, + "WARN": LogLevelWarn, + "INFO": LogLevelInfo, + "DEBUG": LogLevelDebug, + "TRACE": LogLevelTrace, } for name, level := range logLevels { - env := os.Getenv(fmt.Sprintf("PIONS_LOG_%s", name)) + env := os.Getenv(fmt.Sprintf("PION_LOG_%s", name)) + + if env == "" { + env = os.Getenv(fmt.Sprintf("PIONS_LOG_%s", name)) + } + if env == "" { continue } diff --git a/vendor/github.com/pion/mdns/conn.go b/vendor/github.com/pion/mdns/conn.go index 52130352..d00c26f5 100644 --- a/vendor/github.com/pion/mdns/conn.go +++ b/vendor/github.com/pion/mdns/conn.go @@ -22,11 +22,16 @@ type Conn struct { queryInterval time.Duration localNames []string - queries map[string]chan queryResult + queries []query closed chan interface{} } +type query struct { + nameWithSuffix string + queryResultChan chan queryResult +} + type queryResult struct { answer dnsmessage.ResourceHeader addr net.Addr @@ -78,7 +83,7 @@ func Server(conn *ipv4.PacketConn, config *Config) (*Conn, error) { c := &Conn{ queryInterval: defaultQueryInterval, - queries: map[string]chan queryResult{}, + queries: []query{}, socket: conn, dstAddr: dstAddr, localNames: localNames, @@ -122,7 +127,7 @@ func (c *Conn) Query(ctx context.Context, name string) (dnsmessage.ResourceHeade queryChan := make(chan queryResult, 1) c.mu.Lock() - c.queries[nameWithSuffix] = queryChan + c.queries = append(c.queries, query{nameWithSuffix, queryChan}) ticker := time.NewTicker(c.queryInterval) c.mu.Unlock() @@ -297,11 +302,12 @@ func (c *Conn) start() { continue } - if resChan, ok := c.queries[a.Name.String()]; ok { - resChan <- queryResult{a, src} - delete(c.queries, a.Name.String()) + for i := len(c.queries) - 1; i >= 0; i-- { + if c.queries[i].nameWithSuffix == a.Name.String() { + c.queries[i].queryResultChan <- queryResult{a, src} + c.queries = append(c.queries[:i], c.queries[i+1:]...) + } } - } }() } diff --git a/vendor/github.com/pion/rtcp/.travis.yml b/vendor/github.com/pion/rtcp/.travis.yml index 77559d0b..ba761e10 100644 --- a/vendor/github.com/pion/rtcp/.travis.yml +++ b/vendor/github.com/pion/rtcp/.travis.yml @@ -11,12 +11,11 @@ notifications: before_script: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.13 - - go get github.com/mattn/goveralls script: - golangci-lint run ./... - go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... - - goveralls -coverprofile=cover.out -service=travis-ci + - bash <(curl -s https://codecov.io/bash) - bash .github/assert-contributors.sh - bash .github/lint-disallowed-functions-in-library.sh - bash .github/lint-commit-message.sh diff --git a/vendor/github.com/pion/rtcp/README.md b/vendor/github.com/pion/rtcp/README.md index 9eff398c..3fc0ba29 100644 --- a/vendor/github.com/pion/rtcp/README.md +++ b/vendor/github.com/pion/rtcp/README.md @@ -8,11 +8,10 @@ Pion RTCP Sourcegraph Widget Slack Widget - Waffle board
Build Status GoDoc - Coverage Status + Coverage Status Go Report Card License: MIT

diff --git a/vendor/github.com/pion/rtcp/packet.go b/vendor/github.com/pion/rtcp/packet.go index cd5539b0..f2e33ad7 100644 --- a/vendor/github.com/pion/rtcp/packet.go +++ b/vendor/github.com/pion/rtcp/packet.go @@ -63,6 +63,9 @@ func unmarshal(rawData []byte) (packet Packet, bytesprocessed int, err error) { } bytesprocessed = int(h.Length+1) * 4 + if bytesprocessed > len(rawData) { + return nil, 0, errPacketTooShort + } inPacket := rawData[:bytesprocessed] switch h.Type { diff --git a/vendor/github.com/pion/rtp/.travis.yml b/vendor/github.com/pion/rtp/.travis.yml index 77559d0b..ba761e10 100644 --- a/vendor/github.com/pion/rtp/.travis.yml +++ b/vendor/github.com/pion/rtp/.travis.yml @@ -11,12 +11,11 @@ notifications: before_script: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.13 - - go get github.com/mattn/goveralls script: - golangci-lint run ./... - go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... - - goveralls -coverprofile=cover.out -service=travis-ci + - bash <(curl -s https://codecov.io/bash) - bash .github/assert-contributors.sh - bash .github/lint-disallowed-functions-in-library.sh - bash .github/lint-commit-message.sh diff --git a/vendor/github.com/gortc/turn/LICENSE b/vendor/github.com/pion/rtp/LICENSE similarity index 98% rename from vendor/github.com/gortc/turn/LICENSE rename to vendor/github.com/pion/rtp/LICENSE index 15bc72f8..ab602974 100644 --- a/vendor/github.com/gortc/turn/LICENSE +++ b/vendor/github.com/pion/rtp/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 +Copyright (c) 2018 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/github.com/pion/rtp/README.md b/vendor/github.com/pion/rtp/README.md index 7242eac4..bb0264c9 100644 --- a/vendor/github.com/pion/rtp/README.md +++ b/vendor/github.com/pion/rtp/README.md @@ -11,14 +11,12 @@
Build Status GoDoc - Coverage Status + Coverage Status Go Report Card License: MIT


-See [DESIGN.md](DESIGN.md) for an overview of features and future goals. - ### Roadmap The library is used as a part of our WebRTC implementation. Please refer to that [roadmap](https://github.com/pion/webrtc/issues/9) to track our major milestones. @@ -39,6 +37,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [Luke Curley](https://github.com/kixelated) *Performance* * [Antoine Baché](https://github.com/Antonito) *Fixed crashes* * [Hugo Arregui](https://github.com/hugoArregui) +* [Raphael Derosso Pereira](https://github.com/raphaelpereira) ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/vendor/github.com/pion/rtp/codecs/opus_packet.go b/vendor/github.com/pion/rtp/codecs/opus_packet.go index 68af893d..2dc676a2 100644 --- a/vendor/github.com/pion/rtp/codecs/opus_packet.go +++ b/vendor/github.com/pion/rtp/codecs/opus_packet.go @@ -31,5 +31,6 @@ func (p *OpusPacket) Unmarshal(packet []byte) ([]byte, error) { if len(packet) == 0 { return nil, fmt.Errorf("Payload is not large enough") } + p.Payload = packet return packet, nil } diff --git a/vendor/github.com/pion/sctp/.travis.yml b/vendor/github.com/pion/sctp/.travis.yml index 3d7987db..701d3468 100644 --- a/vendor/github.com/pion/sctp/.travis.yml +++ b/vendor/github.com/pion/sctp/.travis.yml @@ -13,12 +13,11 @@ notifications: before_script: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.13 - - go get github.com/mattn/goveralls script: - golangci-lint run ./... - go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... - - goveralls -coverprofile=cover.out -service=travis-ci + - bash <(curl -s https://codecov.io/bash) - bash .github/assert-contributors.sh - bash .github/lint-disallowed-functions-in-library.sh - bash .github/lint-commit-message.sh diff --git a/vendor/github.com/pion/sctp/README.md b/vendor/github.com/pion/sctp/README.md index 1562b28c..0d0929e3 100644 --- a/vendor/github.com/pion/sctp/README.md +++ b/vendor/github.com/pion/sctp/README.md @@ -11,7 +11,7 @@
Build Status GoDoc - Coverage Status + Coverage Status Go Report Card License: MIT @@ -42,6 +42,7 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [Michael MacDonald](https://github.com/mjmac) - *Fix races* * [Yutaka Takeda](https://github.com/enobufs) - *PR-SCTP, Retransmissions, Congestion Control* * [Antoine Baché](https://github.com/Antonito) - *SCTP Profiling* +* [Cecylia Bocovich](https://github.com/cohosh) - *Fix SCTP reads* ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/vendor/github.com/pion/sctp/stream.go b/vendor/github.com/pion/sctp/stream.go index cd022560..0419360c 100644 --- a/vendor/github.com/pion/sctp/stream.go +++ b/vendor/github.com/pion/sctp/stream.go @@ -2,6 +2,7 @@ package sctp import ( "fmt" + "io" "math" "sync" @@ -94,6 +95,8 @@ func (s *Stream) ReadSCTP(p []byte) (int, PayloadProtocolIdentifier, error) { n, ppi, err := s.reassemblyQueue.read(p) if err == nil { return n, ppi, nil + } else if err == io.ErrShortBuffer { + return 0, PayloadProtocolIdentifier(0), err } err = s.readErr diff --git a/vendor/github.com/pion/sdp/v2/common_description.go b/vendor/github.com/pion/sdp/v2/common_description.go index 57379c2d..1a728c5e 100644 --- a/vendor/github.com/pion/sdp/v2/common_description.go +++ b/vendor/github.com/pion/sdp/v2/common_description.go @@ -117,6 +117,6 @@ func (a *Attribute) IsICECandidate() bool { // ToICECandidate parses the attribute as an ICE Candidate. func (a *Attribute) ToICECandidate() (ICECandidate, error) { var parsed ICECandidate - err := parsed.unmarshalString(a.Value) + err := parsed.Unmarshal(a.Value) return parsed, err } diff --git a/vendor/github.com/pion/sdp/v2/ice.go b/vendor/github.com/pion/sdp/v2/ice.go index 40ff8b75..2c5139ed 100644 --- a/vendor/github.com/pion/sdp/v2/ice.go +++ b/vendor/github.com/pion/sdp/v2/ice.go @@ -38,7 +38,8 @@ type ICECandidateAttribute struct { // *(SP extension-att-name SP // extension-att-value) -func (c ICECandidate) marshalString() string { +// Marshal returns the string representation of the ICECandidate +func (c ICECandidate) Marshal() string { val := fmt.Sprintf("%s %d %s %d %s %d typ %s", c.Foundation, c.Component, @@ -64,7 +65,8 @@ func (c ICECandidate) marshalString() string { return val } -func (c *ICECandidate) unmarshalString(raw string) error { +// Unmarshal popuulates the ICECandidate from its string representation +func (c *ICECandidate) Unmarshal(raw string) error { split := strings.Fields(raw) if len(split) < 8 { return fmt.Errorf("attribute not long enough to be ICE candidate (%d)", len(split)) diff --git a/vendor/github.com/pion/sdp/v2/jsep.go b/vendor/github.com/pion/sdp/v2/jsep.go index c6948c68..ebf5321a 100644 --- a/vendor/github.com/pion/sdp/v2/jsep.go +++ b/vendor/github.com/pion/sdp/v2/jsep.go @@ -160,5 +160,5 @@ func (d *MediaDescription) WithCandidate(value string) *MediaDescription { // WithICECandidate adds an ICE candidate to the media description func (d *MediaDescription) WithICECandidate(c ICECandidate) *MediaDescription { - return d.WithValueAttribute("candidate", c.marshalString()) + return d.WithValueAttribute("candidate", c.Marshal()) } diff --git a/vendor/github.com/pion/srtp/.travis.yml b/vendor/github.com/pion/srtp/.travis.yml index 77559d0b..ba761e10 100644 --- a/vendor/github.com/pion/srtp/.travis.yml +++ b/vendor/github.com/pion/srtp/.travis.yml @@ -11,12 +11,11 @@ notifications: before_script: - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.13 - - go get github.com/mattn/goveralls script: - golangci-lint run ./... - go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... - - goveralls -coverprofile=cover.out -service=travis-ci + - bash <(curl -s https://codecov.io/bash) - bash .github/assert-contributors.sh - bash .github/lint-disallowed-functions-in-library.sh - bash .github/lint-commit-message.sh diff --git a/vendor/github.com/pion/srtp/README.md b/vendor/github.com/pion/srtp/README.md index f77a439d..064422fb 100644 --- a/vendor/github.com/pion/srtp/README.md +++ b/vendor/github.com/pion/srtp/README.md @@ -11,7 +11,7 @@
Build Status GoDoc - Coverage Status + Coverage Status Go Report Card License: MIT

diff --git a/vendor/github.com/pion/srtp/go.mod b/vendor/github.com/pion/srtp/go.mod index 1eb44e0b..14e29828 100644 --- a/vendor/github.com/pion/srtp/go.mod +++ b/vendor/github.com/pion/srtp/go.mod @@ -5,8 +5,8 @@ go 1.12 require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pion/logging v0.2.1 - github.com/pion/rtcp v1.2.0 - github.com/pion/rtp v1.1.2 + github.com/pion/rtcp v1.2.1 + github.com/pion/rtp v1.1.3 github.com/pion/transport v0.6.0 github.com/pkg/errors v0.8.1 github.com/stretchr/testify v1.3.0 diff --git a/vendor/github.com/pion/srtp/go.sum b/vendor/github.com/pion/srtp/go.sum index 6097c1ce..fdc778ef 100644 --- a/vendor/github.com/pion/srtp/go.sum +++ b/vendor/github.com/pion/srtp/go.sum @@ -4,10 +4,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pion/logging v0.2.1 h1:LwASkBKZ+2ysGJ+jLv1E/9H1ge0k1nTfi1X+5zirkDk= github.com/pion/logging v0.2.1/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= -github.com/pion/rtcp v1.2.0 h1:rT2FptW5YHIern+4XlbGYnnsT26XGxurnkNLnzhtDXg= -github.com/pion/rtcp v1.2.0/go.mod h1:a5dj2d6BKIKHl43EnAOIrCczcjESrtPuMgfmL6/K6QM= -github.com/pion/rtp v1.1.2 h1:ERNugzYHW9F2ldpwoARbeFGKRoq1REe5Jxdjvm/rOx8= -github.com/pion/rtp v1.1.2/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE= +github.com/pion/rtcp v1.2.1 h1:S3yG4KpYAiSmBVqKAfgRa5JdwBNj4zK3RLUa8JYdhak= +github.com/pion/rtcp v1.2.1/go.mod h1:a5dj2d6BKIKHl43EnAOIrCczcjESrtPuMgfmL6/K6QM= +github.com/pion/rtp v1.1.3 h1:GTYSTsSLF5vH+UqShGYQEBdoYasWjTTC9UeYglnUO+o= +github.com/pion/rtp v1.1.3/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE= github.com/pion/transport v0.6.0 h1:WAoyJg/6OI8dhCVFl/0JHTMd1iu2iHgGUXevptMtJ3U= github.com/pion/transport v0.6.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= diff --git a/vendor/github.com/pion/transport/vnet/.gitignore b/vendor/github.com/pion/transport/vnet/.gitignore new file mode 100644 index 00000000..d39fb86a --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/.gitignore @@ -0,0 +1 @@ +*.sw[poe] diff --git a/vendor/github.com/pion/transport/vnet/README.md b/vendor/github.com/pion/transport/vnet/README.md new file mode 100644 index 00000000..ab626481 --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/README.md @@ -0,0 +1,239 @@ +# vnet +A virtual network layer for pion. + +## Overview + +### Goals +* To make NAT traversal tests easy. +* To emulate packet impairment at application level for testing. +* To monitor packets at specified arbitrary interfaces. + +### Features +* Configurable virtual LAN and WAN +* Virtually hosted ICE servers + +### Virtual network components + +#### Top View +``` + ...................................... + : Virtual Network (vnet) : + : : + +-------+ * 1 +----+ +--------+ : + | :App |------------>|:Net|--o<-----|:Router | : + +-------+ +----+ | | : + +-----------+ * 1 +----+ | | : + |:STUNServer|-------->|:Net|--o<-----| | : + +-----------+ +----+ | | : + +-----------+ * 1 +----+ | | : + |:TURNServer|-------->|:Net|--o<-----| | : + +-----------+ +----+ [1] | | : + : 1 | | 1 <> : + : +---<>| |<>----+ [2] : + : | +--------+ | : + To form | *| v 0..1 : + a subnet tree | o [3] +-----+ : + : | ^ |:NAT | : + : | | +-----+ : + : +-------+ : + ...................................... + Note: + o: NIC (Netork Interface Controller) + [1]: Net implments NIC interface. + [2]: Root router has no NAT. All child routers have a NAT always. + [3]: Router implements NIC interface for accesses from the + parent router. +``` + +#### Net +Net provides 3 interfaces: +* Configuration API (direct) +* Network API via Net (equivalent to net.Xxx()) +* Router access via NIC interface +``` + (Pion module/app, ICE servers, etc.) + +-----------+ + | :App | + +-----------+ + * | + | <> + 1 v + +---------+ 1 * +-----------+ 1 * +-----------+ 1 * +------+ + ..| :Router |----+------>o--| :Net |<>------|:Interface |<>------|:Addr | + +---------+ | NIC +-----------+ +-----------+ +------+ + | <> (vnet.Interface) (net.Addr) + | + | * +-----------+ 1 * +-----------+ 1 * +------+ + +------>o--| :Router |<>------|:Interface |<>------|:Addr | + NIC +-----------+ +-----------+ +------+ + <> (vnet.Interface) (net.Addr) +``` + +> The instance of `Net` will be the one passed around the project. +> Net class has public methods for configuration and for application use. + + +## Implementation + +### Design Policy +* Each pion package should have config object which has `Net` (of type vnet.Net) property. (just like how + we distribute `LoggerFactory` throughout the pion project. +* DNS => a simple dictionary (global)? +* Each Net has routing capability (a goroutine) +* Use interface provided net package as much as possible +* Routers are connected in a tree structure (no loop is allowed) + - To simplify routing + - Easy to control / monitor (stats, etc) +* Root router has no NAT (== Internet / WAN) +* Non-root router has a NAT always +* When a Net is instantiated, it will automatically add `lo0` and `eth0` interface, and `lo0` will +have one IP address, 127.0.0.1. (this is not used in pion/ice, however) +* When a Net is added to a router, the router automatically assign an IP address for `eth0` +interface. + - For simplicity +* User data won't fragment, but optionally drop chunk larger than MTU +* IPv6 is not supported + +### Basic steps for setting up virtual network +1. Create a root router (WAN) +1. Create child routers and add to its parent (forms a tree, don't create a loop!) +1. Add instances of Net to each routers +1. Call Stop(), or Stop(), on the top router, which propages all other routers + +#### Example: WAN with one endpoint (vnet) +```go +import ( + "net" + + "github.com/pion/transport/vnet" + "github.com/pion/logging" +) + +// Create WAN (a root router). +wan, err := vnet.NewRouter(&RouterConfig{ + CIDR: "0.0.0.0/0", + LoggerFactory: logging.NewDefaultLoggerFactory(), +}) + +// Create a network. +// You can specify a static IP for the instance of Net to use. If not specified, +// router will assign an IP address that is contained in the router's CIDR. +nw := vnet.NewNet(&vnet.NetConfig{ + StaticIP: "27.1.2.3", +}) + +// Add the network to the router. +// The router will assign an IP address to `nw`. +if err = wan.AddNet(nw); err != nil { + // handle error +} + +// Start router. +// This will start internal goroutine to route packets. +// If you set child routers (using AddRouter), the call on the root router +// will start the rest of routers for you. +if err = wan.Start(); err != nil { + // handle error +} + +// +// Your application runs here using `nw`. +// + +// Stop the router. +// This will stop all internal goroutines in the router tree. +// (No need to call Stop() on child routers) +if err = wan.Stop(); err != nil { + // handle error +} +``` + +#### Example of how to pass around the instance of vnet.Net +The instance of vnet.Net wraps a subset of net package to enable operations +on the virtual network. Your project must be able to pass the instance to +all your routines that do network operation with net package. A typical way +is to use a config param to create your instances with the virtual network +instance (`nw` in the above example) like this: + +```go +type AgentConfig struct { + : + Net: *vnet.Net, +} + +type Agent struct { + : + net: *vnet.Net, +} + +func NetAgent(config *AgentConfig) *Agent { + if config.Net == nil { + config.Net = vnet.NewNet(nil) // defaults to native operation + } + + return &Agent { + : + net: config.Net, + } +} +``` + +```go +// a.net is the instance of vnet.Net class +func (a *Agent) listenUDP(...) error { + conn, err := a.net.ListenPacket("udp", ...) + if err != nil { + return nil, err + } + : +} +``` + + +### Compatibility and Support Status + +|`net`
(built-in)|`vnet`|Note| +|---|---|---| +|net.Interfaces()|a.net.Interfaces()|| +|net.InterfaceByName()|a.net.InterfaceByName()|| +|net.ResolveUDPAddr()|a.net.ResolveUDPAddr()|| +|net.ListenPacket()|a.net.ListenPacket()|| +|net.ListenUDP()|a.net.ListenUDP()|(ListenPacket() is recommended)| +|net.Listen()|a.net.Listen()|(TODO)| +|net.ListenTCP()|(not supported)|(Listen() would be recommended)| +|net.Dial()|a.net.Dial()|| +|net.DialUDP()|a.net.DialUDP()|| +|net.DialTCP()|(not supported)|| +|net.Interface|vnet.Interface|| +|net.PacketConn|(use it as-is)|| +|net.UDPConn|vnet.UDPConn|Use vnet.UDPPacketConn in your code| +|net.TCPConn|vnet.TCPConn|(TODO)|Use net.Conn in your code| +|net.Dialer|vnet.Dialer|Use a.net.CreateDialer() to create it.
The use of vnet.Dialer is currently experimental.| + +> `a.net` is an instance of Net class, and types are defined under the package name `vnet` + +> Most of other `interface` types in net package can be used as is. + +> Please post a github issue when other types/methods need to be added to vnet/vnet.Net. + +## TODO / Next Step +* Implement TCP (TCPConn, Listen) +* Support of IPv6 +* Write a bunch of examples for building virtual networks. +* Add network impairment features (on Router) + - Introduce lantecy / jitter + - Packet filtering handler (allow selectively drop packets, etc.) +* Add statistics data retrieval + - Total number of packets forward by each router + - Total number of packet loss + - Total number of connection failure (TCP) + +## References +* [Comparing Simulated Packet Loss and RealWorld Network Congestion](https://www.riverbed.com/document/fpo/WhitePaper-Riverbed-SimulatedPacketLoss.pdf) + +### Code experiments +* [CIDR and IPMask](https://play.golang.org/p/B7OBhkZqjmj) +* [Test with net.IP](https://play.golang.org/p/AgXd23wKY4W) +* [ListenPacket](https://play.golang.org/p/d4vasbnRimQ) +* [isDottedIP()](https://play.golang.org/p/t4aZ47TgJfO) +* [SplitHostPort](https://play.golang.org/p/JtvurlcMbhn) diff --git a/vendor/github.com/pion/transport/vnet/chunk.go b/vendor/github.com/pion/transport/vnet/chunk.go new file mode 100644 index 00000000..4bd9af8c --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/chunk.go @@ -0,0 +1,278 @@ +package vnet + +import ( + "fmt" + "net" + "strconv" + "strings" + "sync/atomic" + "time" +) + +type tcpFlag uint8 + +const ( + tcpFIN tcpFlag = 0x01 + tcpSYN tcpFlag = 0x02 + tcpRST tcpFlag = 0x04 + tcpPSH tcpFlag = 0x08 + tcpACK tcpFlag = 0x10 +) + +func (f tcpFlag) String() string { + var sa []string + if f&tcpFIN != 0 { + sa = append(sa, "FIN") + } + if f&tcpSYN != 0 { + sa = append(sa, "SYN") + } + if f&tcpRST != 0 { + sa = append(sa, "RST") + } + if f&tcpPSH != 0 { + sa = append(sa, "PSH") + } + if f&tcpACK != 0 { + sa = append(sa, "ACK") + } + + return strings.Join(sa, "-") +} + +// Generate a base36-encoded unique tag +// See: https://play.golang.org/p/0ZaAID1q-HN +var assignChunkTag = func() func() string { + var tagCtr uint64 + + return func() string { + n := atomic.AddUint64(&tagCtr, 1) + return strconv.FormatUint(n, 36) + } +}() + +// Chunk represents a packet passed around in the vnet +type Chunk interface { + setTimestamp() time.Time // used by router + getTimestamp() time.Time // used by router + getSourceIP() net.IP // used by router + getDestinationIP() net.IP // used by router + setSourceAddr(address string) error // used by nat + setDestinationAddr(address string) error // used by nat + + SourceAddr() net.Addr + DestinationAddr() net.Addr + UserData() []byte + Clone() Chunk + Network() string // returns "udp" or "tcp" + String() string +} + +type chunkIP struct { + timestamp time.Time + sourceIP net.IP + destinationIP net.IP + tag string +} + +func (c *chunkIP) setTimestamp() time.Time { + c.timestamp = time.Now() + return c.timestamp +} + +func (c *chunkIP) getTimestamp() time.Time { + return c.timestamp +} + +func (c *chunkIP) getDestinationIP() net.IP { + return c.destinationIP +} + +func (c *chunkIP) getSourceIP() net.IP { + return c.sourceIP +} + +type chunkUDP struct { + chunkIP + sourcePort int + destinationPort int + userData []byte +} + +func newChunkUDP(srcAddr, dstAddr *net.UDPAddr) *chunkUDP { + return &chunkUDP{ + chunkIP: chunkIP{ + sourceIP: srcAddr.IP, + destinationIP: dstAddr.IP, + tag: assignChunkTag(), + }, + sourcePort: srcAddr.Port, + destinationPort: dstAddr.Port, + } +} + +func (c *chunkUDP) SourceAddr() net.Addr { + return &net.UDPAddr{ + IP: c.sourceIP, + Port: c.sourcePort, + } +} + +func (c *chunkUDP) DestinationAddr() net.Addr { + return &net.UDPAddr{ + IP: c.destinationIP, + Port: c.destinationPort, + } +} + +func (c *chunkUDP) UserData() []byte { + return c.userData +} + +func (c *chunkUDP) Clone() Chunk { + var userData []byte + if c.userData != nil { + userData = make([]byte, len(c.userData)) + copy(userData, c.userData) + } + + return &chunkUDP{ + chunkIP: chunkIP{ + timestamp: c.timestamp, + sourceIP: c.sourceIP, + destinationIP: c.destinationIP, + tag: c.tag, + }, + sourcePort: c.sourcePort, + destinationPort: c.destinationPort, + userData: userData, + } +} + +func (c *chunkUDP) Network() string { + return "udp" +} + +func (c *chunkUDP) String() string { + src := c.SourceAddr() + dst := c.DestinationAddr() + return fmt.Sprintf("%s chunk %s %s => %s", + src.Network(), + c.tag, + src.String(), + dst.String(), + ) +} + +func (c *chunkUDP) setSourceAddr(address string) error { + addr, err := net.ResolveUDPAddr("udp", address) + if err != nil { + return err + } + c.sourceIP = addr.IP + c.sourcePort = addr.Port + return nil +} + +func (c *chunkUDP) setDestinationAddr(address string) error { + addr, err := net.ResolveUDPAddr("udp", address) + if err != nil { + return err + } + c.destinationIP = addr.IP + c.destinationPort = addr.Port + return nil +} + +type chunkTCP struct { + chunkIP + sourcePort int + destinationPort int + flags tcpFlag // control bits + userData []byte // only with PSH flag + //seq uint32 // always starts with 0 + //ack uint32 // always starts with 0 +} + +func newChunkTCP(srcAddr, dstAddr *net.TCPAddr, flags tcpFlag) *chunkTCP { + return &chunkTCP{ + chunkIP: chunkIP{ + sourceIP: srcAddr.IP, + destinationIP: dstAddr.IP, + tag: assignChunkTag(), + }, + sourcePort: srcAddr.Port, + destinationPort: dstAddr.Port, + flags: flags, + } +} + +func (c *chunkTCP) SourceAddr() net.Addr { + return &net.TCPAddr{ + IP: c.sourceIP, + Port: c.sourcePort, + } +} + +func (c *chunkTCP) DestinationAddr() net.Addr { + return &net.TCPAddr{ + IP: c.destinationIP, + Port: c.destinationPort, + } +} + +func (c *chunkTCP) UserData() []byte { + return c.userData +} + +func (c *chunkTCP) Clone() Chunk { + userData := make([]byte, len(c.userData)) + copy(userData, c.userData) + + return &chunkTCP{ + chunkIP: chunkIP{ + timestamp: c.timestamp, + sourceIP: c.sourceIP, + destinationIP: c.destinationIP, + }, + sourcePort: c.sourcePort, + destinationPort: c.destinationPort, + userData: userData, + } +} + +func (c *chunkTCP) Network() string { + return "tcp" +} + +func (c *chunkTCP) String() string { + src := c.SourceAddr() + dst := c.DestinationAddr() + return fmt.Sprintf("%s %s chunk %s %s => %s", + src.Network(), + c.flags.String(), + c.tag, + src.String(), + dst.String(), + ) +} + +func (c *chunkTCP) setSourceAddr(address string) error { + addr, err := net.ResolveTCPAddr("tcp", address) + if err != nil { + return err + } + c.sourceIP = addr.IP + c.sourcePort = addr.Port + return nil +} + +func (c *chunkTCP) setDestinationAddr(address string) error { + addr, err := net.ResolveTCPAddr("tcp", address) + if err != nil { + return err + } + c.destinationIP = addr.IP + c.destinationPort = addr.Port + return nil +} diff --git a/vendor/github.com/pion/transport/vnet/chunk_queue.go b/vendor/github.com/pion/transport/vnet/chunk_queue.go new file mode 100644 index 00000000..7b244622 --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/chunk_queue.go @@ -0,0 +1,52 @@ +package vnet + +import ( + "sync" +) + +type chunkQueue struct { + chunks []Chunk + maxSize int // 0 or negative value: unlimited + mutex sync.RWMutex +} + +func newChunkQueue(maxSize int) *chunkQueue { + return &chunkQueue{maxSize: maxSize} +} + +func (q *chunkQueue) push(c Chunk) bool { + q.mutex.Lock() + defer q.mutex.Unlock() + + if q.maxSize > 0 && len(q.chunks) >= q.maxSize { + return false // dropped + } + + q.chunks = append(q.chunks, c) + return true +} + +func (q *chunkQueue) pop() (Chunk, bool) { + q.mutex.Lock() + defer q.mutex.Unlock() + + if len(q.chunks) == 0 { + return nil, false + } + + c := q.chunks[0] + q.chunks = q.chunks[1:] + + return c, true +} + +func (q *chunkQueue) peek() Chunk { + q.mutex.RLock() + defer q.mutex.RUnlock() + + if len(q.chunks) == 0 { + return nil + } + + return q.chunks[0] +} diff --git a/vendor/github.com/pion/transport/vnet/conn.go b/vendor/github.com/pion/transport/vnet/conn.go new file mode 100644 index 00000000..1422cd0f --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/conn.go @@ -0,0 +1,239 @@ +package vnet + +import ( + "fmt" + "io" + "math" + "net" + "sync" + "time" +) + +const ( + maxReadQueueSize = 1024 +) + +var noDeadline time.Time + +// UDPPacketConn is packet-oriented connection for UDP. +type UDPPacketConn interface { + net.PacketConn + Read(b []byte) (int, error) + RemoteAddr() net.Addr + Write(b []byte) (int, error) +} + +// vNet implements this +type connObserver interface { + write(c Chunk) error + onClosed(addr net.Addr) + determineSourceIP(locIP, dstIP net.IP) net.IP +} + +// UDPConn is the implementation of the Conn and PacketConn interfaces for UDP network connections. +// comatible with net.PacketConn and net.Conn +type UDPConn struct { + locAddr *net.UDPAddr // read-only + remAddr *net.UDPAddr // read-only + obs connObserver // read-only + readCh chan Chunk // requires mutex for writers + muReadCh sync.Mutex // to mutex readCh writers + readTimer *time.Timer // thread-safe +} + +func newUDPConn(locAddr, remAddr *net.UDPAddr, obs connObserver) (*UDPConn, error) { + if obs == nil { + return nil, fmt.Errorf("obs cannot be nil") + } + + return &UDPConn{ + locAddr: locAddr, + remAddr: remAddr, + obs: obs, + readCh: make(chan Chunk, maxReadQueueSize), + readTimer: time.NewTimer(time.Duration(math.MaxInt64)), + }, nil +} + +// ReadFrom reads a packet from the connection, +// copying the payload into p. It returns the number of +// bytes copied into p and the return address that +// was on the packet. +// It returns the number of bytes read (0 <= n <= len(p)) +// and any error encountered. Callers should always process +// the n > 0 bytes returned before considering the error err. +// ReadFrom can be made to time out and return +// an Error with Timeout() == true after a fixed time limit; +// see SetDeadline and SetReadDeadline. +func (c *UDPConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) { +loop: + for { + select { + case chunk, ok := <-c.readCh: + if !ok { + break loop + } + var err error + n := copy(p, chunk.UserData()) + addr := chunk.SourceAddr() + if n < len(chunk.UserData()) { + err = io.ErrShortBuffer + } + + if c.remAddr != nil { + if addr.String() != c.remAddr.String() { + break // discard (shouldn't happen) + } + } + return n, addr, err + + case <-c.readTimer.C: + return 0, nil, &net.OpError{ + Op: "read", + Net: c.locAddr.Network(), + Addr: c.locAddr, + Err: newTimeoutError("i/o timeout"), + } + } + } + + return 0, nil, &net.OpError{ + Op: "read", + Net: c.locAddr.Network(), + Addr: c.locAddr, + Err: fmt.Errorf("use of closed network connection"), + } +} + +// WriteTo writes a packet with payload p to addr. +// WriteTo can be made to time out and return +// an Error with Timeout() == true after a fixed time limit; +// see SetDeadline and SetWriteDeadline. +// On packet-oriented connections, write timeouts are rare. +func (c *UDPConn) WriteTo(p []byte, addr net.Addr) (n int, err error) { + dstAddr, ok := addr.(*net.UDPAddr) + if !ok { + return 0, fmt.Errorf("addr is not a net.UDPAddr") + } + + srcIP := c.obs.determineSourceIP(c.locAddr.IP, dstAddr.IP) + if srcIP == nil { + return 0, fmt.Errorf("something went wrong with locAddr") + } + srcAddr := &net.UDPAddr{ + IP: srcIP, + Port: c.locAddr.Port, + } + + chunk := newChunkUDP(srcAddr, dstAddr) + chunk.userData = make([]byte, len(p)) + copy(chunk.userData, p) + if err := c.obs.write(chunk); err != nil { + return 0, err + } + return len(p), nil +} + +// Close closes the connection. +// Any blocked ReadFrom or WriteTo operations will be unblocked and return errors. +// See: https://play.golang.org/p/GrCRAII0VSN +func (c *UDPConn) Close() error { +loop: + for { + select { + case _, ok := <-c.readCh: + if !ok { + return fmt.Errorf("already closed") + } + default: + c.muReadCh.Lock() + close(c.readCh) + c.muReadCh.Unlock() + c.obs.onClosed(c.locAddr) + break loop + } + } + return nil +} + +// LocalAddr returns the local network address. +func (c *UDPConn) LocalAddr() net.Addr { + return c.locAddr +} + +// SetDeadline sets the read and write deadlines associated +// with the connection. It is equivalent to calling both +// SetReadDeadline and SetWriteDeadline. +// +// A deadline is an absolute time after which I/O operations +// fail with a timeout (see type Error) instead of +// blocking. The deadline applies to all future and pending +// I/O, not just the immediately following call to ReadFrom or +// WriteTo. After a deadline has been exceeded, the connection +// can be refreshed by setting a deadline in the future. +// +// An idle timeout can be implemented by repeatedly extending +// the deadline after successful ReadFrom or WriteTo calls. +// +// A zero value for t means I/O operations will not time out. +func (c *UDPConn) SetDeadline(t time.Time) error { + return c.SetReadDeadline(t) +} + +// SetReadDeadline sets the deadline for future ReadFrom calls +// and any currently-blocked ReadFrom call. +// A zero value for t means ReadFrom will not time out. +func (c *UDPConn) SetReadDeadline(t time.Time) error { + var d time.Duration + if t == noDeadline { + d = time.Duration(math.MaxInt64) + } else { + d = time.Until(t) + } + c.readTimer.Reset(d) + return nil +} + +// SetWriteDeadline sets the deadline for future WriteTo calls +// and any currently-blocked WriteTo call. +// Even if write times out, it may return n > 0, indicating that +// some of the data was successfully written. +// A zero value for t means WriteTo will not time out. +func (c *UDPConn) SetWriteDeadline(t time.Time) error { + // Write never blocks. + return nil +} + +// Read reads data from the connection. +// Read can be made to time out and return an Error with Timeout() == true +// after a fixed time limit; see SetDeadline and SetReadDeadline. +func (c *UDPConn) Read(b []byte) (int, error) { + n, _, err := c.ReadFrom(b) + return n, err +} + +// RemoteAddr returns the remote network address. +func (c *UDPConn) RemoteAddr() net.Addr { + return c.remAddr +} + +// Write writes data to the connection. +// Write can be made to time out and return an Error with Timeout() == true +// after a fixed time limit; see SetDeadline and SetWriteDeadline. +func (c *UDPConn) Write(b []byte) (int, error) { + if c.remAddr == nil { + return 0, fmt.Errorf("no remAddr defined") + } + + return c.WriteTo(b, c.remAddr) +} + +func (c *UDPConn) onInboundChunk(chunk Chunk) { + c.muReadCh.Lock() + defer c.muReadCh.Unlock() + + select { + case c.readCh <- chunk: + default: + } +} diff --git a/vendor/github.com/pion/transport/vnet/conn_map.go b/vendor/github.com/pion/transport/vnet/conn_map.go new file mode 100644 index 00000000..a124da2d --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/conn_map.go @@ -0,0 +1,130 @@ +package vnet + +import ( + "fmt" + "net" + "sync" +) + +type udpConnMap struct { + portMap map[int][]*UDPConn + mutex sync.RWMutex +} + +func newUDPConnMap() *udpConnMap { + return &udpConnMap{ + portMap: map[int][]*UDPConn{}, + } +} + +func (m *udpConnMap) insert(conn *UDPConn) error { + m.mutex.Lock() + defer m.mutex.Unlock() + + udpAddr := conn.LocalAddr().(*net.UDPAddr) + + // check if the port has a listener + conns, ok := m.portMap[udpAddr.Port] + if ok { + if udpAddr.IP.IsUnspecified() { + return fmt.Errorf("address already in use") + } + + for _, conn := range conns { + laddr := conn.LocalAddr().(*net.UDPAddr) + if laddr.IP.IsUnspecified() || laddr.IP.Equal(udpAddr.IP) { + return fmt.Errorf("address already in use") + } + } + + conns = append(conns, conn) + } else { + conns = []*UDPConn{conn} + } + + m.portMap[udpAddr.Port] = conns + return nil +} + +func (m *udpConnMap) find(addr net.Addr) (*UDPConn, bool) { + m.mutex.Lock() // could be RLock, but we have delete() op + defer m.mutex.Unlock() + + udpAddr := addr.(*net.UDPAddr) + + if conns, ok := m.portMap[udpAddr.Port]; ok { + if udpAddr.IP.IsUnspecified() { + // pick the first one appears in the iteration + if len(conns) == 0 { + // This can't happen! + delete(m.portMap, udpAddr.Port) + return nil, false + } + return conns[0], true + } + + for _, conn := range conns { + laddr := conn.LocalAddr().(*net.UDPAddr) + if laddr.IP.IsUnspecified() || laddr.IP.Equal(udpAddr.IP) { + return conn, ok + } + } + } + + return nil, false +} + +func (m *udpConnMap) delete(addr net.Addr) error { + m.mutex.Lock() + defer m.mutex.Unlock() + + udpAddr := addr.(*net.UDPAddr) + + conns, ok := m.portMap[udpAddr.Port] + if !ok { + return fmt.Errorf("no such UDPConn") + } + + if udpAddr.IP.IsUnspecified() { + // remove all from this port + delete(m.portMap, udpAddr.Port) + return nil + } + + newConns := []*UDPConn{} + + for _, conn := range conns { + laddr := conn.LocalAddr().(*net.UDPAddr) + if laddr.IP.IsUnspecified() { + // This can't happen! + return fmt.Errorf("cannot remove an unspecified IP by the specified IP") + } + + if laddr.IP.Equal(udpAddr.IP) { + continue + } + + newConns = append(newConns, conn) + } + + if len(newConns) == 0 { + delete(m.portMap, udpAddr.Port) + } else { + m.portMap[udpAddr.Port] = newConns + } + + return nil +} + +// size returns the number of UDPConns (UDP listeners) +func (m *udpConnMap) size() int { + m.mutex.RLock() + defer m.mutex.RUnlock() + + n := 0 + for _, conns := range m.portMap { + n += len(conns) + } + + return n +} diff --git a/vendor/github.com/pion/transport/vnet/errors.go b/vendor/github.com/pion/transport/vnet/errors.go new file mode 100644 index 00000000..d0e9394f --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/errors.go @@ -0,0 +1,19 @@ +package vnet + +type timeoutError struct { + msg string +} + +func newTimeoutError(msg string) error { + return &timeoutError{ + msg: msg, + } +} + +func (e *timeoutError) Error() string { + return e.msg +} + +func (e *timeoutError) Timeout() bool { + return true +} diff --git a/vendor/github.com/pion/transport/vnet/interface.go b/vendor/github.com/pion/transport/vnet/interface.go new file mode 100644 index 00000000..f2b8115d --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/interface.go @@ -0,0 +1,38 @@ +package vnet + +import ( + "fmt" + "net" +) + +// See: https://play.golang.org/p/nBO9KGYEziv + +// InterfaceBase ... +type InterfaceBase net.Interface + +// Interface ... +type Interface struct { + InterfaceBase + addrs []net.Addr +} + +// NewInterface ... +func NewInterface(ifc net.Interface) *Interface { + return &Interface{ + InterfaceBase: InterfaceBase(ifc), + addrs: nil, + } +} + +// AddAddr ... +func (ifc *Interface) AddAddr(addr net.Addr) { + ifc.addrs = append(ifc.addrs, addr) +} + +// Addrs ... +func (ifc *Interface) Addrs() ([]net.Addr, error) { + if len(ifc.addrs) == 0 { + return nil, fmt.Errorf("no address assigned") + } + return ifc.addrs, nil +} diff --git a/vendor/github.com/pion/transport/vnet/nat.go b/vendor/github.com/pion/transport/vnet/nat.go new file mode 100644 index 00000000..ae89d3b7 --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/nat.go @@ -0,0 +1,247 @@ +package vnet + +import ( + "fmt" + "sync" + "time" + + "github.com/pion/logging" +) + +// EndpointDependencyType defines a type of behavioral dependendency on the +// remote endpoint's IP address or port number. This is used for the two +// kinds of behaviors: +// - Port mapping behavior +// - Filtering behavior +// See: https://tools.ietf.org/html/rfc4787 +type EndpointDependencyType uint8 + +const ( + // EndpointIndependent means the behavior is independent of the endpoint's address or port + EndpointIndependent EndpointDependencyType = iota + // EndpointAddrDependent means the behavior is dependent on the endpoint's address + EndpointAddrDependent + // EndpointAddrPortDependent means the behavior is dependent on the endpoint's address and port + EndpointAddrPortDependent +) + +const ( + defaultNATMappingLifeTime = 30 * time.Second +) + +// NATType has a set of parameters that define the behavior of NAT. +type NATType struct { + MappingBehavior EndpointDependencyType + FilteringBehavior EndpointDependencyType + Hairpining bool // Not implemented yet + PortPreservation bool // Not implemented yet + MappingLifeTime time.Duration +} + +type natConfig struct { + name string + natType NATType + mappedIP string + loggerFactory logging.LoggerFactory +} + +type mapping struct { + proto string // "udp" or "tcp" + local string // ":" + mapped string // ":" + filter string // ":[[:]]" + expires time.Time // time to expire +} + +type networkAddressTranslator struct { + name string + natType NATType + mappedIP string + outboundMap map[string]*mapping // key: "::[:remote-ip[:remote-port]] + inboundMap map[string]*mapping // key: "::[:remote-ip[:remote-port]]" + udpPortCounter int + mutex sync.RWMutex + log logging.LeveledLogger +} + +func newNAT(config *natConfig) *networkAddressTranslator { + natType := config.natType + if natType.MappingLifeTime == 0 { + natType.MappingLifeTime = defaultNATMappingLifeTime + } + + return &networkAddressTranslator{ + name: config.name, + natType: natType, + mappedIP: config.mappedIP, + outboundMap: map[string]*mapping{}, + inboundMap: map[string]*mapping{}, + log: config.loggerFactory.NewLogger("vnet"), + } + +} + +func (n *networkAddressTranslator) translateOutbound(from Chunk) (Chunk, error) { + n.mutex.Lock() + defer n.mutex.Unlock() + + to := from.Clone() + + if from.Network() == "udp" { + var filter string + switch n.natType.FilteringBehavior { + case EndpointIndependent: + filter = "" + case EndpointAddrDependent: + filter = fmt.Sprintf(":%s", from.getDestinationIP().String()) + case EndpointAddrPortDependent: + filter = fmt.Sprintf(":%s", from.DestinationAddr().String()) + } + + oKey := fmt.Sprintf("udp:%s%s", from.SourceAddr().String(), filter) + + m := n.findOutboundMapping(oKey) + if m == nil { + // Create a new mapping + mappedPort := 0xC000 + n.udpPortCounter + n.udpPortCounter++ + + m = &mapping{ + proto: from.SourceAddr().Network(), + local: from.SourceAddr().String(), + mapped: fmt.Sprintf("%s:%d", n.mappedIP, mappedPort), + filter: filter, + expires: time.Now().Add(n.natType.MappingLifeTime), + } + + n.outboundMap[oKey] = m + + iKey := fmt.Sprintf("udp:%s:%d%s", n.mappedIP, mappedPort, filter) + + n.log.Debugf("[%s] created a new NAT binding oKey=%s iKey=%s\n", + n.name, + oKey, + iKey) + n.inboundMap[iKey] = m + } + + if err := to.setSourceAddr(m.mapped); err != nil { + return nil, err + } + + n.log.Debugf("[%s] translate outbound chunk from %s to %s", n.name, from.String(), to.String()) + + return to, nil + } + + // TODO + //if c.Network() == "tcp" { + //} + + return nil, fmt.Errorf("non-udp translation is not supported yet") +} + +func (n *networkAddressTranslator) translateInbound(from Chunk) (Chunk, error) { + n.mutex.Lock() + defer n.mutex.Unlock() + + to := from.Clone() + + if from.Network() == "udp" { + var iKey string + + switch n.natType.FilteringBehavior { + case EndpointIndependent: + iKey = fmt.Sprintf("udp:%s", + from.DestinationAddr().String(), + ) + case EndpointAddrDependent: + iKey = fmt.Sprintf("udp:%s:%s", + from.DestinationAddr().String(), + from.getSourceIP().String(), + ) + case EndpointAddrPortDependent: + iKey = fmt.Sprintf("udp:%s:%s", + from.DestinationAddr().String(), + from.SourceAddr().String(), + ) + } + + m := n.findInboundMapping(iKey) + if m == nil { + return nil, fmt.Errorf("drop %s as no NAT binding found", from.String()) + } + + if err := to.setDestinationAddr(m.local); err != nil { + return nil, err + } + + n.log.Debugf("[%s] translate inbound chunk from %s to %s", n.name, from.String(), to.String()) + + return to, nil + } + + // TODO + //if c.Network() == "tcp" { + //} + + return nil, fmt.Errorf("non-udp translation is not supported yet") +} + +// caller must hold the mutex +func (n *networkAddressTranslator) findOutboundMapping(oKey string) *mapping { + now := time.Now() + + m, ok := n.outboundMap[oKey] + if ok { + // check if this mapping is expired + if now.After(m.expires) { + n.removeMapping(m) + m = nil // expired + } else { + m.expires = time.Now().Add(n.natType.MappingLifeTime) + } + } + + return m +} + +// caller must hold the mutex +func (n *networkAddressTranslator) findInboundMapping(iKey string) *mapping { + now := time.Now() + + m, ok := n.inboundMap[iKey] + if ok { + // check if this mapping is expired + if now.After(m.expires) { + n.removeMapping(m) + m = nil // expired + } + + // See RFC 4847 Section 4.3. Mapping Refresh + // a) Inbound refresh may be useful for applications with no outgoing + // UDP traffic. However, allowing inbound refresh may allow an + // external attacker or misbehaving application to keep a mapping + // alive indefinitely. This may be a security risk. Also, if the + // process is repeated with different ports, over time, it could + // use up all the ports on the NAT. + } + + return m +} + +// caller must hold the mutex +func (n *networkAddressTranslator) removeMapping(m *mapping) { + oKey := fmt.Sprintf("%s:%s%s", + m.proto, + m.local, + m.filter) + + iKey := fmt.Sprintf("%s:%s%s", + m.proto, + m.mapped, + m.filter) + + delete(n.outboundMap, oKey) + delete(n.inboundMap, iKey) +} diff --git a/vendor/github.com/pion/transport/vnet/net.go b/vendor/github.com/pion/transport/vnet/net.go new file mode 100644 index 00000000..0d16ec06 --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/net.go @@ -0,0 +1,636 @@ +package vnet + +import ( + "encoding/binary" + "fmt" + "math/rand" + "net" + "strconv" + "strings" + "sync" +) + +var macAddrCounter uint64 = 0xBEEFED910200 + +func newMACAddress() net.HardwareAddr { + b := make([]byte, 8) + binary.BigEndian.PutUint64(b, macAddrCounter) + macAddrCounter++ + return b[2:] +} + +type vNet struct { + interfaces []*Interface // read-only + staticIP net.IP // read-only + router *Router // read-only + udpConns *udpConnMap // read-only + mutex sync.RWMutex +} + +func (v *vNet) _getInterfaces() ([]*Interface, error) { + if len(v.interfaces) == 0 { + return nil, fmt.Errorf("no interface is available") + } + + return v.interfaces, nil +} + +func (v *vNet) getInterfaces() ([]*Interface, error) { + v.mutex.RLock() + defer v.mutex.RUnlock() + + return v._getInterfaces() +} + +// caller must hold the mutex (read) +func (v *vNet) _getInterface(ifName string) (*Interface, error) { + ifs, err := v._getInterfaces() + if err != nil { + return nil, err + } + for _, ifc := range ifs { + if ifc.Name == ifName { + return ifc, nil + } + } + + return nil, fmt.Errorf("interface %s not found", ifName) +} + +func (v *vNet) getInterface(ifName string) (*Interface, error) { + v.mutex.RLock() + defer v.mutex.RUnlock() + + return v._getInterface(ifName) +} + +// caller must hold the mutex +func (v *vNet) getAllIPAddrs(ipv6 bool) []net.IP { + ips := []net.IP{} + + for _, ifc := range v.interfaces { + addrs, err := ifc.Addrs() + if err != nil { + continue + } + + for _, addr := range addrs { + var ip net.IP + if ipNet, ok := addr.(*net.IPNet); ok { + ip = ipNet.IP + } else if ipAddr, ok := addr.(*net.IPAddr); ok { + ip = ipAddr.IP + } else { + continue + } + + if !ipv6 { + if ip.To4() != nil { + ips = append(ips, ip) + } + } + } + } + + return ips +} + +func (v *vNet) setRouter(r *Router) error { + v.mutex.Lock() + defer v.mutex.Unlock() + + v.router = r + return nil +} + +func (v *vNet) onInboundChunk(c Chunk) { + v.mutex.Lock() + defer v.mutex.Unlock() + + if c.Network() == "udp" { + if conn, ok := v.udpConns.find(c.DestinationAddr()); ok { + conn.onInboundChunk(c) + } + } +} + +// caller must hold the mutex +func (v *vNet) _dialUDP(network string, locAddr, remAddr *net.UDPAddr) (UDPPacketConn, error) { + // validate network + if network != "udp" && network != "udp4" { + return nil, fmt.Errorf("unexpected network: %s", network) + } + + if locAddr == nil { + locAddr = &net.UDPAddr{ + IP: net.IPv4zero, + } + } else if locAddr.IP == nil { + locAddr.IP = net.IPv4zero + } + + // validate address. do we have that address? + if !v.hasIPAddr(locAddr.IP) { + return nil, &net.OpError{ + Op: "listen", + Net: network, + Addr: locAddr, + Err: fmt.Errorf("bind: can't assign requested address"), + } + } + + if locAddr.Port == 0 { + // choose randomly from the range between 5000 and 5999 + port, err := v.assignPort(locAddr.IP, 5000, 5999) + if err != nil { + return nil, &net.OpError{ + Op: "listen", + Net: network, + Addr: locAddr, + Err: err, + } + } + locAddr.Port = port + } else if _, ok := v.udpConns.find(locAddr); ok { + return nil, &net.OpError{ + Op: "listen", + Net: network, + Addr: locAddr, + Err: fmt.Errorf("bind: address already in use"), + } + } + + conn, err := newUDPConn(locAddr, remAddr, v) + if err != nil { + return nil, err + } + + err = v.udpConns.insert(conn) + if err != nil { + return nil, err + } + + return conn, nil +} + +func (v *vNet) listenPacket(network string, address string) (UDPPacketConn, error) { + v.mutex.Lock() + defer v.mutex.Unlock() + + locAddr, err := v.resolveUDPAddr(network, address) + if err != nil { + return nil, err + } + + return v._dialUDP(network, locAddr, nil) +} + +func (v *vNet) listenUDP(network string, locAddr *net.UDPAddr) (UDPPacketConn, error) { + v.mutex.Lock() + defer v.mutex.Unlock() + + return v._dialUDP(network, locAddr, nil) +} + +func (v *vNet) dialUDP(network string, locAddr, remAddr *net.UDPAddr) (UDPPacketConn, error) { + v.mutex.Lock() + defer v.mutex.Unlock() + + return v._dialUDP(network, locAddr, remAddr) +} + +func (v *vNet) dial(network string, address string) (UDPPacketConn, error) { + v.mutex.Lock() + defer v.mutex.Unlock() + + remAddr, err := v.resolveUDPAddr(network, address) + if err != nil { + return nil, err + } + + // Determine source address + srcIP := v.determineSourceIP(nil, remAddr.IP) + + locAddr := &net.UDPAddr{IP: srcIP, Port: 0} + + return v._dialUDP(network, locAddr, remAddr) +} + +func (v *vNet) resolveUDPAddr(network, address string) (*net.UDPAddr, error) { + if network != "udp" && network != "udp4" { + return nil, fmt.Errorf("unknown network %s", network) + } + + host, sPort, err := net.SplitHostPort(address) + if err != nil { + return nil, err + } + + // Check if host is a domain name + ip := net.ParseIP(host) + if ip == nil { + host = strings.ToLower(host) + if host == "localhost" { + ip = net.IPv4(127, 0, 0, 1) + } else { + // host is a domain name. resolve IP address by the name + if v.router == nil { + return nil, fmt.Errorf("no router linked") + } + + ip, err = v.router.resolver.lookUp(host) + if err != nil { + return nil, err + } + } + } + + port, err := strconv.Atoi(sPort) + if err != nil { + return nil, fmt.Errorf("invalid port number") + } + + udpAddr := &net.UDPAddr{ + IP: ip, + Port: port, + } + + return udpAddr, nil +} + +func (v *vNet) write(c Chunk) error { + if c.Network() == "udp" { + if udp, ok := c.(*chunkUDP); ok { + if c.getDestinationIP().IsLoopback() { + if conn, ok := v.udpConns.find(udp.DestinationAddr()); ok { + conn.onInboundChunk(udp) + } + return nil + } + } else { + return fmt.Errorf("unexpected type-switch failure") + } + } + + if v.router == nil { + return fmt.Errorf("no router linked") + } + + v.router.push(c) + return nil +} + +func (v *vNet) onClosed(addr net.Addr) { + if addr.Network() == "udp" { + //nolint:errcheck + v.udpConns.delete(addr) // #nosec + } +} + +// This method determines the srcIP based on the dstIP when locIP +// is any IP address ("0.0.0.0" or "::"). If locIP is a non-any addr, +// this method simply returns locIP. +// caller must hold the mutex +func (v *vNet) determineSourceIP(locIP, dstIP net.IP) net.IP { + if locIP != nil && !locIP.IsUnspecified() { + return locIP + } + + var srcIP net.IP + + if dstIP.IsLoopback() { + srcIP = net.ParseIP("127.0.0.1") + } else { + ifc, err2 := v._getInterface("eth0") + if err2 != nil { + return nil + } + + addrs, err2 := ifc.Addrs() + if err2 != nil { + return nil + } + + if len(addrs) == 0 { + return nil + } + + var findIPv4 bool + if locIP != nil { + findIPv4 = (locIP.To4() != nil) + } else { + findIPv4 = (dstIP.To4() != nil) + } + + for _, addr := range addrs { + ip := addr.(*net.IPNet).IP + if findIPv4 { + if ip.To4() != nil { + srcIP = ip + break + } + } else { + if ip.To4() == nil { + srcIP = ip + break + } + } + } + } + + return srcIP +} + +// caller must hold the mutex +func (v *vNet) hasIPAddr(ip net.IP) bool { + for _, ifc := range v.interfaces { + if addrs, err := ifc.Addrs(); err == nil { + for _, addr := range addrs { + var locIP net.IP + if ipNet, ok := addr.(*net.IPNet); ok { + locIP = ipNet.IP + } else if ipAddr, ok := addr.(*net.IPAddr); ok { + locIP = ipAddr.IP + } else { + continue + } + + switch ip.String() { + case "0.0.0.0": + if locIP.To4() != nil { + return true + } + case "::": + if locIP.To4() == nil { + return true + } + default: + if locIP.Equal(ip) { + return true + } + } + } + } + } + + return false +} + +// caller must hold the mutex +func (v *vNet) allocateLocalAddr(ip net.IP, port int) error { + // gather local IP addresses to bind + var ips []net.IP + if ip.IsUnspecified() { + ips = v.getAllIPAddrs(ip.To4() == nil) + } else if v.hasIPAddr(ip) { + ips = []net.IP{ip} + } + + if len(ips) == 0 { + return fmt.Errorf("bind failed for %s", ip.String()) + } + + // check if all these transport addresses are not in use + for _, ip2 := range ips { + addr := &net.UDPAddr{ + IP: ip2, + Port: port, + } + if _, ok := v.udpConns.find(addr); ok { + return &net.OpError{ + Op: "bind", + Net: "udp", + Addr: addr, + Err: fmt.Errorf("bind: address already in use"), + } + } + } + + return nil +} + +// caller must hold the mutex +func (v *vNet) assignPort(ip net.IP, start, end int) (int, error) { + // choose randomly from the range between start and end (inclusive) + if end < start { + return -1, fmt.Errorf("end port is less than the start") + } + + space := end + 1 - start + offset := rand.Intn(space) + for i := 0; i < space; i++ { + port := ((offset + i) % space) + start + + err := v.allocateLocalAddr(ip, port) + if err == nil { + return port, nil + } + } + + return -1, fmt.Errorf("port space exhausted") +} + +// NetConfig is a bag of configuration parameters passed to NewNet(). +type NetConfig struct { + // StaticIP is a static IP address to be assigned for this Net. If nil, + // the router will automatically assign an IP address. + StaticIP string +} + +// Net represents a local network stack euivalent to a set of layers from NIC +// up to the transport (UDP / TCP) layer. +type Net struct { + v *vNet + ifs []*Interface +} + +// NewNet creates an instance of Net. +// If config is nil, the virtual network is disabled. (uses corresponding +// net.Xxxx() operations. +// By design, it always have lo0 and eth0 interfaces. +// The lo0 has the address 127.0.0.1 assigned by default. +// IP address for eth0 will be assigned when this Net is added to a router. +func NewNet(config *NetConfig) *Net { + if config == nil { + ifs := []*Interface{} + if orgIfs, err := net.Interfaces(); err == nil { + for _, orgIfc := range orgIfs { + ifc := NewInterface(orgIfc) + if addrs, err := orgIfc.Addrs(); err == nil { + for _, addr := range addrs { + ifc.AddAddr(addr) + } + } + + ifs = append(ifs, ifc) + } + } + + return &Net{ifs: ifs} + } + + lo0 := NewInterface(net.Interface{ + Index: 1, + MTU: 16384, + Name: "lo0", + HardwareAddr: nil, + Flags: net.FlagUp | net.FlagLoopback | net.FlagMulticast, + }) + lo0.AddAddr(&net.IPNet{ + IP: net.ParseIP("127.0.0.1"), + Mask: net.CIDRMask(8, 32), + }) + + eth0 := NewInterface(net.Interface{ + Index: 2, + MTU: 1500, + Name: "eth0", + HardwareAddr: newMACAddress(), + Flags: net.FlagUp | net.FlagMulticast, + }) + + v := &vNet{ + interfaces: []*Interface{lo0, eth0}, + staticIP: net.ParseIP(config.StaticIP), + udpConns: newUDPConnMap(), + } + + return &Net{ + v: v, + } +} + +// Interfaces returns a list of the system's network interfaces. +func (n *Net) Interfaces() ([]*Interface, error) { + if n.v == nil { + return n.ifs, nil + } + + return n.v.getInterfaces() +} + +// InterfaceByName returns the interface specified by name. +func (n *Net) InterfaceByName(name string) (*Interface, error) { + if n.v == nil { + for _, ifc := range n.ifs { + if ifc.Name == name { + return ifc, nil + } + } + + return nil, fmt.Errorf("interface %s not found", name) + } + + return n.v.getInterface(name) +} + +// ListenPacket announces on the local network address. +func (n *Net) ListenPacket(network string, address string) (net.PacketConn, error) { + if n.v == nil { + return net.ListenPacket(network, address) + } + + return n.v.listenPacket(network, address) +} + +// ListenUDP acts like ListenPacket for UDP networks. +func (n *Net) ListenUDP(network string, locAddr *net.UDPAddr) (UDPPacketConn, error) { + if n.v == nil { + return net.ListenUDP(network, locAddr) + } + + return n.v.listenUDP(network, locAddr) +} + +// Dial connects to the address on the named network. +func (n *Net) Dial(network, address string) (net.Conn, error) { + if n.v == nil { + return net.Dial(network, address) + } + + return n.v.dial(network, address) +} + +// CreateDialer creates an instance of vnet.Dialer +func (n *Net) CreateDialer(dialer *net.Dialer) Dialer { + if n.v == nil { + return &vDialer{ + dialer: dialer, + } + } + + return &vDialer{ + dialer: dialer, + v: n.v, + } +} + +// DialUDP acts like Dial for UDP networks. +func (n *Net) DialUDP(network string, laddr, raddr *net.UDPAddr) (UDPPacketConn, error) { + if n.v == nil { + return net.DialUDP(network, laddr, raddr) + } + + return n.v.dialUDP(network, laddr, raddr) +} + +// ResolveUDPAddr returns an address of UDP end point. +func (n *Net) ResolveUDPAddr(network, address string) (*net.UDPAddr, error) { + if n.v == nil { + return net.ResolveUDPAddr(network, address) + } + + return n.v.resolveUDPAddr(network, address) +} + +func (n *Net) getInterface(ifName string) (*Interface, error) { + if n.v == nil { + return nil, fmt.Errorf("vnet is not enabled") + } + + return n.v.getInterface(ifName) +} + +func (n *Net) setRouter(r *Router) error { + if n.v == nil { + return fmt.Errorf("vnet is not enabled") + } + + return n.v.setRouter(r) +} + +func (n *Net) onInboundChunk(c Chunk) { + if n.v == nil { + return + } + + n.v.onInboundChunk(c) +} + +func (n *Net) getStaticIP() net.IP { + if n.v == nil { + return nil + } + + return n.v.staticIP +} + +// Dialer is identical to net.Dialer excepts that its methods +// (Dial, DialContext) are overridden to use virtual network. +// Use vnet.CreateDialer() to create an instance of this Dialer. +type Dialer interface { + Dial(network, address string) (net.Conn, error) +} + +type vDialer struct { + dialer *net.Dialer + v *vNet +} + +func (d *vDialer) Dial(network, address string) (net.Conn, error) { + if d.v == nil { + return d.dialer.Dial(network, address) + } + + return d.v.dial(network, address) +} diff --git a/vendor/github.com/pion/transport/vnet/resolver.go b/vendor/github.com/pion/transport/vnet/resolver.go new file mode 100644 index 00000000..5c799d9e --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/resolver.go @@ -0,0 +1,83 @@ +package vnet + +import ( + "fmt" + "net" + "sync" + + "github.com/pion/logging" +) + +type resolverConfig struct { + LoggerFactory logging.LoggerFactory +} + +type resolver struct { + parent *resolver // read-only + hosts map[string]net.IP // requires mutex + mutex sync.RWMutex // thread-safe + log logging.LeveledLogger // read-only +} + +func newResolver(config *resolverConfig) *resolver { + r := &resolver{ + hosts: map[string]net.IP{}, + log: config.LoggerFactory.NewLogger("vnet"), + } + + if err := r.addHost("localhost", "127.0.0.1"); err != nil { + r.log.Warn("failed to add localhost to resolver") + } + return r +} + +func (r *resolver) setParent(parent *resolver) { + r.mutex.Lock() + defer r.mutex.Unlock() + + r.parent = parent +} + +func (r *resolver) addHost(name string, ipAddr string) error { + r.mutex.Lock() + defer r.mutex.Unlock() + + if len(name) == 0 { + return fmt.Errorf("host name must not be empty") + } + ip := net.ParseIP(ipAddr) + if ip == nil { + return fmt.Errorf("failed to parse IP address \"%s\"", ipAddr) + } + r.hosts[name] = ip + return nil +} + +func (r *resolver) lookUp(hostName string) (net.IP, error) { + ip := func() net.IP { + r.mutex.RLock() + defer r.mutex.RUnlock() + + if ip2, ok := r.hosts[hostName]; ok { + return ip2 + } + return nil + }() + if ip != nil { + return ip, nil + } + + // mutex must be unlocked before calling into parent resolver + + if r.parent != nil { + return r.parent.lookUp(hostName) + } + + return nil, &net.DNSError{ + Err: "host not found", + Name: hostName, + Server: "vnet resolver", + IsTimeout: false, + IsTemporary: false, + } +} diff --git a/vendor/github.com/pion/transport/vnet/router.go b/vendor/github.com/pion/transport/vnet/router.go new file mode 100644 index 00000000..821fe802 --- /dev/null +++ b/vendor/github.com/pion/transport/vnet/router.go @@ -0,0 +1,450 @@ +package vnet + +import ( + "fmt" + "net" + "sync" + "sync/atomic" + "time" + + "github.com/pion/logging" +) + +const ( + defaultRouterQueueSize = 0 // unlimited +) + +// Generate a unique router name +var assignRouterName = func() func() string { + var routerIDCtr uint64 + + return func() string { + n := atomic.AddUint64(&routerIDCtr, 1) + return fmt.Sprintf("router%d", n) + } +}() + +// RouterConfig ... +type RouterConfig struct { + // Name of router. If not specified, a unique name will be assigned. + Name string + // CIDR notation, like "192.0.2.0/24" + CIDR string + // StaticIP is a static IP address to be assigned for this external network. + // This will be ignored if this router is the root. + StaticIP string + // Internal queue size + QueueSize int + // Effective only when this router has a parent router + NATType *NATType + // Logger factory + LoggerFactory logging.LoggerFactory +} + +// NIC is a nework inerface controller that interfaces Router +type NIC interface { + getInterface(ifName string) (*Interface, error) + onInboundChunk(c Chunk) + getStaticIP() net.IP + setRouter(r *Router) error +} + +// Router ... +type Router struct { + name string // read-only + interfaces []*Interface // read-only + ipv4Net *net.IPNet // read-only + staticIP net.IP // read-only + lastID byte // requires mutex [x], used to assign the last digit of IPv4 address + queue *chunkQueue // read-only + parent *Router // read-only + children []*Router // read-only + natType *NATType // read-only + nat *networkAddressTranslator // read-only + nics map[string]NIC // read-only + stopFunc func() // requires mutex [x] + resolver *resolver // read-only + mutex sync.RWMutex // thread-safe + pushCh chan struct{} // writer requires mutex + loggerFactory logging.LoggerFactory // read-only + log logging.LeveledLogger // read-only +} + +// NewRouter ... +func NewRouter(config *RouterConfig) (*Router, error) { + _, ipNet, err := net.ParseCIDR(config.CIDR) + if err != nil { + return nil, err + } + + queueSize := defaultRouterQueueSize + if config.QueueSize > 0 { + queueSize = config.QueueSize + } + + // set up network interface, lo0 + lo0 := NewInterface(net.Interface{ + Index: 1, + MTU: 16384, + Name: "lo0", + HardwareAddr: nil, + Flags: net.FlagUp | net.FlagLoopback | net.FlagMulticast, + }) + lo0.AddAddr(&net.IPAddr{IP: net.ParseIP("127.0.0.1"), Zone: ""}) + + // set up network interface, eth0 + eth0 := NewInterface(net.Interface{ + Index: 2, + MTU: 1500, + Name: "eth0", + HardwareAddr: newMACAddress(), + Flags: net.FlagUp | net.FlagMulticast, + }) + + // local host name resolver + resolver := newResolver(&resolverConfig{ + LoggerFactory: config.LoggerFactory, + }) + + name := config.Name + if len(name) == 0 { + name = assignRouterName() + } + + return &Router{ + name: name, + interfaces: []*Interface{lo0, eth0}, + ipv4Net: ipNet, + staticIP: net.ParseIP(config.StaticIP), + queue: newChunkQueue(queueSize), + natType: config.NATType, + nics: map[string]NIC{}, + resolver: resolver, + pushCh: make(chan struct{}, 1), + loggerFactory: config.LoggerFactory, + log: config.LoggerFactory.NewLogger("vnet"), + }, nil +} + +// caller must hold the mutex +func (r *Router) getInterfaces() ([]*Interface, error) { + if len(r.interfaces) == 0 { + return nil, fmt.Errorf("no interface is available") + } + + return r.interfaces, nil +} + +func (r *Router) getInterface(ifName string) (*Interface, error) { + r.mutex.RLock() + defer r.mutex.RUnlock() + + ifs, err := r.getInterfaces() + if err != nil { + return nil, err + } + for _, ifc := range ifs { + if ifc.Name == ifName { + return ifc, nil + } + } + + return nil, fmt.Errorf("interface %s not found", ifName) +} + +// Start ... +func (r *Router) Start() error { + r.mutex.Lock() + defer r.mutex.Unlock() + + if r.stopFunc != nil { + return fmt.Errorf("router already staretd") + } + + cancelCh := make(chan struct{}) + + go func() { + loop: + for { + err := r.onProcessChunks() + if err != nil { + r.log.Warnf("[%s] %s", r.name, err.Error()) + } + select { + case <-r.pushCh: + case <-cancelCh: + break loop + } + } + }() + + r.stopFunc = func() { + close(cancelCh) + } + + for _, child := range r.children { + if err := child.Start(); err != nil { + return err + } + } + + return nil +} + +// Stop ... +func (r *Router) Stop() error { + r.mutex.Lock() + defer r.mutex.Unlock() + + if r.stopFunc == nil { + return fmt.Errorf("router already stopped") + } + + for _, router := range r.children { + r.mutex.Unlock() + err := router.Stop() + r.mutex.Lock() + + if err != nil { + return err + } + } + + r.stopFunc() + r.stopFunc = nil + return nil +} + +// caller must hold the mutex +func (r *Router) addNIC(nic NIC) error { + ifc, err := nic.getInterface("eth0") + if err != nil { + return err + } + + var ip net.IP + if ip = nic.getStaticIP(); ip != nil { + if !r.ipv4Net.Contains(ip) { + return fmt.Errorf("static IP is beyond subnet: %s", r.ipv4Net.String()) + } + } else { + // assign an IP address + ip, err = r.assignIPAddress() + if err != nil { + return err + } + } + + ifc.AddAddr(&net.IPNet{ + IP: ip, + Mask: r.ipv4Net.Mask, + }) + + if err = nic.setRouter(r); err != nil { + return err + } + + r.nics[ip.String()] = nic + return nil +} + +// AddRouter adds a chile Router. +func (r *Router) AddRouter(router *Router) error { + r.mutex.Lock() + defer r.mutex.Unlock() + + // Router is a NIC. Add it as a NIC so that packets are routed to this child + // router. + err := r.addNIC(router) + if err != nil { + return err + } + + if err = router.setRouter(r); err != nil { + return err + } + + r.children = append(r.children, router) + return nil +} + +// AddNet ... +func (r *Router) AddNet(nic NIC) error { + r.mutex.Lock() + defer r.mutex.Unlock() + + return r.addNIC(nic) +} + +// AddHost adds a mapping of hostname and an IP address to the local resolver. +func (r *Router) AddHost(hostName string, ipAddr string) error { + return r.resolver.addHost(hostName, ipAddr) +} + +// caller should hold the mutex +func (r *Router) assignIPAddress() (net.IP, error) { + // See: https://stackoverflow.com/questions/14915188/ip-address-ending-with-zero + + if r.lastID == 0xfe { + return nil, fmt.Errorf("address space exhausted") + } + + ip := make(net.IP, 4) + copy(ip, r.ipv4Net.IP[:3]) + r.lastID++ + ip[3] = r.lastID + return ip, nil +} + +func (r *Router) push(c Chunk) { + r.mutex.Lock() + defer r.mutex.Unlock() + + r.log.Debugf("[%s] route %s", r.name, c.String()) + if r.stopFunc != nil { + c.setTimestamp() + if r.queue.push(c) { + select { + case r.pushCh <- struct{}{}: + default: + } + } else { + r.log.Warnf("[%s] queue was full. dropped a chunk", r.name) + } + } +} + +func (r *Router) onProcessChunks() error { + r.mutex.Lock() + defer r.mutex.Unlock() + + for { + c := r.queue.peek() + if c == nil { + break // no more chunk in the queue + } + + // TODO: check timestamp to decide whether to delay the chunks + + var ok bool + if c, ok = r.queue.pop(); !ok { + break // no more chunk in the queue + } + + dstIP := c.getDestinationIP() + + // check if the desination is in our subnet + if r.ipv4Net.Contains(dstIP) { + // search for the destination NIC + var nic NIC + if nic, ok = r.nics[dstIP.String()]; !ok { + // NIC not found. drop it. + r.log.Debugf("[%s] %s unreachable", r.name, c.String()) + continue + } + + // found the NIC, forward the chunk to the NIC. + // call to NIC must unlock mutex + r.mutex.Unlock() + nic.onInboundChunk(c) + r.mutex.Lock() + continue + } + + // the destination is outside of this subnet + // is this WAN? + if r.parent == nil { + // this WAN. No route for this chunk + r.log.Debugf("[%s] no route found for %s", r.name, c.String()) + continue + } + + // Pass it to the parent via NAT + toParent, err := r.nat.translateOutbound(c) + if err != nil { + return err + } + + /* FIXME: this implementation would introduce a duplicate packet! + if r.nat.natType.Hairpining { + hairpinned, err := r.nat.translateInbound(toParent) + if err != nil { + r.log.Warnf("[%s] %s", r.name, err.Error()) + } else { + go func() { + r.push(hairpinned) + }() + } + } + */ + + // call to parent router mutex unlock mutex + r.mutex.Unlock() + r.parent.push(toParent) + r.mutex.Lock() + } + + return nil +} + +// caller must hold the mutex +func (r *Router) setRouter(parent *Router) error { + r.parent = parent + r.resolver.setParent(parent.resolver) + + // when this method is called, an IP address has already been assigned by + // the parent router. + ifc, err := r.getInterface("eth0") + if err != nil { + return err + } + + if len(ifc.addrs) == 0 { + return fmt.Errorf("no IP address is assigned for eth0") + } + + var ip net.IP + switch addr := ifc.addrs[0].(type) { + case *net.IPNet: + ip = addr.IP + case *net.IPAddr: // Do we really need this case? + ip = addr.IP + default: + return fmt.Errorf("unexpected address type for eth0") + } + + mappedIP := ip.String() + + // Set up NAT here + if r.natType == nil { + r.natType = &NATType{ + MappingBehavior: EndpointIndependent, + FilteringBehavior: EndpointAddrPortDependent, + Hairpining: false, + PortPreservation: false, + MappingLifeTime: 30 * time.Second, + } + } + r.nat = newNAT(&natConfig{ + name: r.name, + natType: *r.natType, + mappedIP: mappedIP, + loggerFactory: r.loggerFactory, + }) + + return nil +} + +func (r *Router) onInboundChunk(c Chunk) { + fromParent, err := r.nat.translateInbound(c) + if err != nil { + r.log.Warnf("[%s] %s", r.name, err.Error()) + return + } + + r.push(fromParent) +} + +func (r *Router) getStaticIP() net.IP { + return r.staticIP +} diff --git a/vendor/github.com/pion/turn/.gitignore b/vendor/github.com/pion/turn/.gitignore new file mode 100644 index 00000000..dfe1d9d3 --- /dev/null +++ b/vendor/github.com/pion/turn/.gitignore @@ -0,0 +1,3 @@ +*.sw[poe] +examples/turn-client/turn-client +examples/turn-server/turn-server diff --git a/vendor/github.com/pion/turn/.golangci.yml b/vendor/github.com/pion/turn/.golangci.yml new file mode 100644 index 00000000..08b4eca7 --- /dev/null +++ b/vendor/github.com/pion/turn/.golangci.yml @@ -0,0 +1,26 @@ +linters-settings: + govet: + check-shadowing: true + misspell: + locale: US + +linters: + enable-all: true + disable: + - lll + +issues: + exclude-use-default: false + max-per-linter: 0 + max-same-issues: 50 + + exclude-rules: + - path: internal/proto/.+_test + linters: + - scopelint + - gosec + - errcheck + - prealloc + - path: internal/proto + linters: + - gochecknoglobals diff --git a/vendor/github.com/pion/turn/.travis.yml b/vendor/github.com/pion/turn/.travis.yml new file mode 100644 index 00000000..8c5db64c --- /dev/null +++ b/vendor/github.com/pion/turn/.travis.yml @@ -0,0 +1,24 @@ +language: go + +go: + - "1.x" # use the latest Go release + +env: + - GO111MODULE=on + +notifications: + email: false + slack: + secure: IYjXoe03KykZ3v4GgUwGzfWRepO5DnJdxB87lSQ2IMsF6PBFSc3CaOX3GUclHIlzTdchR+PHj1jtEZZVSkgfp9amZBCcqbJTBOPG1YA6hxOvTpgeWIttMH0cmMxSCuCa4RfkuRH2+UXbjREMJ3ENau2CTMKReyW4Jddh9dREZohVmYuqN6uuBqCndYpt3Lm1Hv+T+vqxwTDdE/q0hwGMiwgvQm7N3K397e1q1mg+o4tMGwqyUIPnEPjaSKcEuOBa8Rqyl96nn+HGZK0zvNqUOxlzeRMM0VBcxe2s+zY/SuLj4OwNl1zEmIfY6Qj70t2cmT3xJvJprB4pCwR7q78b4lfpNu6rqCJPIZG/qDFT+XSuhDCmLlCO/+Uhtu11pgjV8UMNLTKJth+7hurH7oLNb7jYk9VYsiKhs41LICyDjJNzS5yPatF5xj0HOujb6Uh/pfI+9a+IpPSeXv1gBo8H3oWa6TfRhuTUS3Jc48p/jriZmgWgbKa1HKTaY9ENvAdZFfxJdrRg3Y4SKnjZcAPw7ijRIx1oaM3rHYbOTm/dj4ggho7EgTO3k8toQ5PKohrbBG5RERqHJvC47SXDt0fEjeGnAfN7Xtj0Pq8YyaFIj7CmCCGoI//2sWkK3AmjnwIuW0hUMsL3GsED+p0lsu6FX9wysJwy2Z2mTfIX/CXmB6w= + +before_script: + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.15.0 + +script: + - golangci-lint run ./... + - rm -rf cmd # Remove examples, no test coverage for them + - go test -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... + - bash <(curl -s https://codecov.io/bash) + - bash .github/assert-contributors.sh + - bash .github/lint-disallowed-functions-in-library.sh + - bash .github/lint-commit-message.sh diff --git a/vendor/github.com/pion/turn/DESIGN.md b/vendor/github.com/pion/turn/DESIGN.md new file mode 100644 index 00000000..2c524669 --- /dev/null +++ b/vendor/github.com/pion/turn/DESIGN.md @@ -0,0 +1,31 @@ +# Why Pion TURN +TURN servers aren't exactly a hot technology, they are usually an after thought when building something. Most of the time +beginners build an interesting WebRTC application, but at the very end realize they need a TURN server. It is really frustrating when you +want to share your cool new project, only to realize you have to run another service. + +Then you find yourself building from source, fighting with config files and making changes you don't fully understand. Pion TURN was born +hoping to solve these frustrations. These are the guiding principals/features that define pion-turn. + +## Easy setup +simple-turn is a statically built TURN server, configured by environment variables. The entire install setup is 5 commands, on any platform! +The goal is that anyone should be able to run a TURN server on any platform. + +## Integration first +pion-turn makes no assumptions about how you authenticate users, how you log, or even your topology! Instead of running a dedicated TURN server you +can inherit from github.com/pion/turn and set whatever logger you want. + +## Embeddable +You can add this to an existing service. This means all your config files stay homogeneous instead of having the mismatch that makes it harder to manage your services. +For small setups it is usually an overkill to deploy dedicated TURN servers, this makes it easier to solve the problems you care about. + +## Safe +Golang provides a great foundation to build safe network services. Especially when running a networked service that is highly concurrent bugs can be devastating. + +## Readable +All network interaction is commented with a link to the spec. This makes learning and debugging easier, the TURN server was written to also serve as a guide for others. + +## Tested +Every commit is tested via travis-ci Go provides fantastic facilities for testing, and more will be added as time goes on. + +## Shared libraries +Every pion product is built using shared libraries, allowing others to build things using existing tested STUN and TURN tools. diff --git a/vendor/github.com/pion/turn/LICENSE.md b/vendor/github.com/pion/turn/LICENSE.md new file mode 100644 index 00000000..5cc9cbdc --- /dev/null +++ b/vendor/github.com/pion/turn/LICENSE.md @@ -0,0 +1,7 @@ +Copyright 2018 Pion LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/pion/turn/README.md b/vendor/github.com/pion/turn/README.md new file mode 100644 index 00000000..c2aa9f2d --- /dev/null +++ b/vendor/github.com/pion/turn/README.md @@ -0,0 +1,116 @@ +

+ Pion TURN +
+ Pion TURN +
+

+

An extendable TURN server written in Go

+

+ Pion TURN + Slack Widget + Waffle board +
+ Build Status + GoDoc + Coverage Status + Go Report Card + Codacy Badge + License: MIT +

+
+ +A TURN server written in Go that is designed to be scalable, extendable and embeddable out of the box. +For simple use cases it only requires downloading 1 static binary, and setting 3 options. + +See [DESIGN.md](DESIGN.md) for the the features it offers, and future goals. + +### Quick Start +If you want just a simple TURN server with a few static usernames `simple-turn` will perfectly suit your purposes. If you have +custom requirements such as a database proceed to extending. + +`simple-turn` is a single static binary, and all config is driven by environment variables. On a fresh Linux AWS instance these are all the steps you would need. +``` +$ wget -q https://github.com/pion/turn/releases/download/1.0.3/simple-turn-linux-amd64 +$ chmod +x simple-turn-linux-amd64 +$ export USERS='user=password foo=bar' +$ export REALM=my-server.com +$ export UDP_PORT=3478 +$ ./simple-turn-linux-amd64 +```` + +To explain what every step does +* Download simple-turn for Linux x64, see [release](https://github.com/pion/turn/releases) for other platforms +* Make it executable +* Configure auth, in the form of `USERNAME=PASSWORD USERNAME=PASSWORD` with no limits +* Set your realm, this is the public URL or name of your server +* Set the port you listen on, 3478 is the default port for TURN + +That is it! Then to use your new TURN server your WebRTC config would look like +``` +{ iceServers: [{ + urls: "turn:YOUR_SERVER" + username: "user", + credential: "password" +}] +``` +--- + +If you are using Windows you would set these values in Powershell by doing. Also make sure your firewall is configured properly. +``` +> $env:USERS = "user=password foo=bar" +> $env:REALM = "my-server.com" +> $env:UDP_PORT = 3478 +``` +### Extending +See [simple-turn](https://github.com/pion/turn/blob/master/cmd/simple-turn/main.go) + +pion-turn can be configured by implementing [these callbacks](https://github.com/pion/turn/blob/master/turn.go#L11) and by passing [these arguments](https://github.com/pion/turn/blob/master/turn.go#L11) + +All that `simple-turn` does is take environment variables, and then uses the same API. + + +### Developing +For developing a Dockerfile is available with features like hot-reloads, and is meant to be volume mounted. +Make sure you also have github.com/pion/pkg in your path, or you can exclude the second volume mount. + +This is only meant for development, see [demo-conference](https://github.com/pion/demo-conference) +to see TURN usage as a user. +``` +docker build -t turn . +docker run -v $(pwd):/usr/local/src/github.com/pion/turn -v $(pwd)/../pkg:/usr/local/src/github.com/pion/pkg turn +``` + +Currently only Linux is supported until Docker supports full (host <-> container) networking on Windows/OSX + +### RFCs +#### Implemented +* [RFC 5389: Session Traversal Utilities for NAT (STUN)](https://tools.ietf.org/html/rfc5389) +* [RFC 5766: Traversal Using Relays around NAT (TURN)](https://tools.ietf.org/html/rfc5766) + +#### Planned +* [RFC 6062: Traversal Using Relays around NAT (TURN) Extensions for TCP Allocations](https://tools.ietf.org/html/rfc6062) +* [RFC 6156: Traversal Using Relays around NAT (TURN) Extension for IPv6](https://tools.ietf.org/html/rfc6156) + +### Community +Pion has an active community on the [Golang Slack](https://invite.slack.golangbridge.org/). Sign up and join the **#pion** channel for discussions and support. You can also use [Pion mailing list](https://groups.google.com/forum/#!forum/pion). + +We are always looking to support **your projects**. Please reach out if you have something to build! + +### Contributing +Check out the [CONTRIBUTING.md](CONTRIBUTING.md) to join the group of amazing people making this project possible: + +* [Michiel De Backker](https://github.com/backkem) - *Documentation* +* [Ingmar Wittkau](https://github.com/iwittkau) - *STUN client* +* [John Bradley](https://github.com/kc5nra) - *Original Author* +* [jose nazario](https://github.com/paralax) - *Documentation* +* [Mészáros Mihály](https://github.com/misi) - *Documentation* +* [Mike Santry](https://github.com/santrym) - *Mascot* +* [Sean DuBois](https://github.com/Sean-Der) - *Original Author* +* [winds2016](https://github.com/winds2016) - *Windows platform testing* +* [songjiayang](https://github.com/songjiayang) - *SongJiaYang* +* [Yutaka Takeda](https://github.com/enobufs) - *vnet* +* [namreg](https://github.com/namreg) - *Igor German* +* [Aleksandr Razumov](https://github.com/ernado) - *protocol* + +### License +MIT License - see [LICENSE.md](LICENSE.md) for full text diff --git a/vendor/github.com/pion/turn/client.go b/vendor/github.com/pion/turn/client.go new file mode 100644 index 00000000..81b32d4e --- /dev/null +++ b/vendor/github.com/pion/turn/client.go @@ -0,0 +1,558 @@ +package turn + +import ( + b64 "encoding/base64" + "fmt" + "math" + "net" + "sync" + "time" + + "github.com/pion/logging" + "github.com/pion/stun" + "github.com/pion/transport/vnet" + "github.com/pion/turn/internal/client" + "github.com/pion/turn/internal/proto" + "github.com/pkg/errors" +) + +const ( + defaultRTO = 200 * time.Millisecond + maxRtxCount = 7 // total 7 requests (Rc) + maxDataBufferSize = math.MaxUint16 //message size limit for Chromium +) + +// interval [msec] +// 0: 0 ms +500 +// 1: 500 ms +1000 +// 2: 1500 ms +2000 +// 3: 3500 ms +4000 +// 4: 7500 ms +8000 +// 5: 15500 ms +16000 +// 6: 31500 ms +32000 +// -: 63500 ms failed + +// ClientConfig is a bag of config parameters for Client. +type ClientConfig struct { + STUNServerAddr string // STUN server address (e.g. "stun.abc.com:3478") + TURNServerAddr string // TURN server addrees (e.g. "turn.abc.com:3478") + Username string + Password string + Realm string + Software string + RTO time.Duration + Conn net.PacketConn // Listening socket (net.PacketConn) + LoggerFactory logging.LoggerFactory + Net *vnet.Net +} + +// Client is a STUN server client +type Client struct { + conn net.PacketConn // read-only + stunServ net.Addr // read-only + turnServ net.Addr // read-only + stunServStr string // read-only, used for dmuxing + turnServStr string // read-only, used for dmuxing + username stun.Username // read-only + password string // read-only + realm stun.Realm // read-only + integrity stun.MessageIntegrity // read-only + software stun.Software // read-only + trMap *client.TransactionMap // thread-safe + rto time.Duration // read-only + relayedConn *client.UDPConn // protected by mutex *** + allocTryLock client.TryLock // thread-safe + listenTryLock client.TryLock // thread-safe + net *vnet.Net // read-only + mutex sync.RWMutex // thread-safe + log logging.LeveledLogger // read-only +} + +// NewClient returns a new Client instance. listeningAddress is the address and port to listen on, default "0.0.0.0:0" +func NewClient(config *ClientConfig) (*Client, error) { + log := config.LoggerFactory.NewLogger("turnc") + + if config.Conn == nil { + return nil, fmt.Errorf("conn cannot not be nil") + } + + if config.Net == nil { + config.Net = vnet.NewNet(nil) // defaults to native operation + } else { + log.Warn("vnet is enabled") + } + + var stunServ, turnServ net.Addr + var stunServStr, turnServStr string + var err error + if len(config.STUNServerAddr) > 0 { + log.Debugf("resolving %s", config.STUNServerAddr) + stunServ, err = config.Net.ResolveUDPAddr("udp4", config.STUNServerAddr) + if err != nil { + return nil, err + } + stunServStr = stunServ.String() + log.Debugf("stunServ: %s", stunServStr) + } + if len(config.TURNServerAddr) > 0 { + log.Debugf("resolving %s", config.TURNServerAddr) + turnServ, err = config.Net.ResolveUDPAddr("udp4", config.TURNServerAddr) + if err != nil { + return nil, err + } + turnServStr = turnServ.String() + log.Debugf("turnServ: %s", turnServStr) + } + + rto := defaultRTO + if config.RTO > 0 { + rto = config.RTO + } + + c := &Client{ + conn: config.Conn, + stunServ: stunServ, + turnServ: turnServ, + stunServStr: stunServStr, + turnServStr: turnServStr, + username: stun.NewUsername(config.Username), + password: config.Password, + realm: stun.NewRealm(config.Realm), + software: stun.NewSoftware(config.Software), + net: config.Net, + trMap: client.NewTransactionMap(), + rto: rto, + log: log, + } + + return c, nil +} + +// TURNServerAddr return the TURN server address +func (c *Client) TURNServerAddr() net.Addr { + return c.turnServ +} + +// STUNServerAddr return the STUN server address +func (c *Client) STUNServerAddr() net.Addr { + return c.stunServ +} + +// Username returns username +func (c *Client) Username() stun.Username { + return c.username +} + +// Realm return realm +func (c *Client) Realm() stun.Realm { + return c.realm +} + +// WriteTo sends data to the specified destination using the base socket. +func (c *Client) WriteTo(data []byte, to net.Addr) (int, error) { + return c.conn.WriteTo(data, to) +} + +// Listen will have this client start listening on the conn provided via the config. +// This is optional. If not used, you will need to call HandleInbound method +// to supply incoming data, instead. +func (c *Client) Listen() error { + if err := c.listenTryLock.Lock(); err != nil { + return fmt.Errorf("already listening: %s", err.Error()) + } + + go func() { + buf := make([]byte, maxDataBufferSize) + for { + n, from, err := c.conn.ReadFrom(buf) + if err != nil { + c.log.Debugf("exiting read loop: %s", err.Error()) + break + } + + _, err = c.HandleInbound(buf[:n], from) + if err != nil { + c.log.Debugf("exiting read loop: %s", err.Error()) + break + } + } + + c.listenTryLock.Unlock() + }() + + return nil +} + +// Close closes this client +func (c *Client) Close() { + c.trMap.CloseAndDeleteAll() +} + +// TransactionID & Base64: https://play.golang.org/p/EEgmJDI971P + +// SendBindingRequestTo sends a new STUN request to the given transport address +func (c *Client) SendBindingRequestTo(to net.Addr) (net.Addr, error) { + attrs := []stun.Setter{stun.TransactionID, stun.BindingRequest} + if len(c.software) > 0 { + attrs = append(attrs, c.software) + } + + msg, err := stun.Build(attrs...) + if err != nil { + return nil, err + } + trRes, err := c.PerformTransaction(msg, to, false) + if err != nil { + return nil, err + } + + var reflAddr stun.XORMappedAddress + if err := reflAddr.GetFrom(trRes.Msg); err != nil { + return nil, err + } + + //return fmt.Sprintf("pkt_size=%d src_addr=%s refl_addr=%s:%d", size, addr, reflAddr.IP, reflAddr.Port), nil + return &net.UDPAddr{ + IP: reflAddr.IP, + Port: reflAddr.Port, + }, nil +} + +// SendBindingRequest sends a new STUN request to the STUN server +func (c *Client) SendBindingRequest() (net.Addr, error) { + if c.stunServ == nil { + return nil, fmt.Errorf("STUN server address is not set for the client") + } + return c.SendBindingRequestTo(c.stunServ) +} + +// Allocate sends a TURN allocation request to the given transport address +func (c *Client) Allocate() (net.PacketConn, error) { + if err := c.allocTryLock.Lock(); err != nil { + return nil, fmt.Errorf("only one Allocate() caller is allowed: %s", err.Error()) + } + defer c.allocTryLock.Unlock() + + relayedConn := c.relayedUDPConn() + if relayedConn != nil { + return nil, fmt.Errorf("already allocated at %s", relayedConn.LocalAddr().String()) + } + + msg, err := stun.Build( + stun.TransactionID, + stun.NewType(stun.MethodAllocate, stun.ClassRequest), + proto.RequestedTransportUDP, + stun.Fingerprint, + ) + if err != nil { + return nil, err + } + + trRes, err := c.PerformTransaction(msg, c.turnServ, false) + if err != nil { + return nil, err + } + + res := trRes.Msg + + // Anonymous allocate failed, trying to authenticate. + var nonce stun.Nonce + if err = nonce.GetFrom(res); err != nil { + return nil, err + } + if err = c.realm.GetFrom(res); err != nil { + return nil, err + } + c.realm = append([]byte(nil), c.realm...) + c.integrity = stun.NewLongTermIntegrity( + c.username.String(), c.realm.String(), c.password, + ) + // Trying to authorize. + msg, err = stun.Build( + stun.TransactionID, + stun.NewType(stun.MethodAllocate, stun.ClassRequest), + proto.RequestedTransportUDP, + &c.username, + &c.realm, + &nonce, + &c.integrity, + stun.Fingerprint, + ) + if err != nil { + return nil, err + } + + trRes, err = c.PerformTransaction(msg, c.turnServ, false) + if err != nil { + return nil, err + } + res = trRes.Msg + + if res.Type.Class == stun.ClassErrorResponse { + var code stun.ErrorCodeAttribute + if err = code.GetFrom(res); err == nil { + return nil, fmt.Errorf("%s (error %s)", res.Type, code) + } + return nil, fmt.Errorf("%s", res.Type) + } + + // Getting relayed addresses from response. + var relayed proto.RelayedAddress + if err := relayed.GetFrom(res); err != nil { + return nil, err + } + relayedAddr := &net.UDPAddr{ + IP: relayed.IP, + Port: relayed.Port, + } + + // Getting lifetime from response + var lifetime proto.Lifetime + if err := lifetime.GetFrom(res); err != nil { + return nil, err + } + + relayedConn = client.NewUDPConn(&client.UDPConnConfig{ + Observer: c, + RelayedAddr: relayedAddr, + Integrity: c.integrity, + Nonce: nonce, + Lifetime: lifetime.Duration, + Log: c.log, + }) + + c.setRelayedUDPConn(relayedConn) + + return relayedConn, nil +} + +// PerformTransaction performs STUN transaction +func (c *Client) PerformTransaction(msg *stun.Message, to net.Addr, dontWait bool) (client.TransactionResult, error) { + trKey := b64.StdEncoding.EncodeToString(msg.TransactionID[:]) + + raw := make([]byte, len(msg.Raw)) + copy(raw, msg.Raw) + + tr := client.NewTransaction(&client.TransactionConfig{ + Key: trKey, + Raw: raw, + To: to, + Interval: c.rto, + }) + + c.trMap.Insert(trKey, tr) + + c.log.Tracef("start %s transaction %s to %s", msg.Type, trKey, tr.To.String()) + _, err := c.conn.WriteTo(tr.Raw, to) + if err != nil { + return client.TransactionResult{}, err + } + + tr.StartRtxTimer(c.onRtxTimeout) + + // If dontWait is true, get the transaction going and return immediately + if dontWait { + return client.TransactionResult{}, nil + } + + res := tr.WaitForResult() + if res.Err != nil { + return res, res.Err + } + return res, nil +} + +// OnDeallocated is called when deallocation of relay address has been complete. +// (Called by UDPConn) +func (c *Client) OnDeallocated(relayedAddr net.Addr) { + c.setRelayedUDPConn(nil) +} + +// HandleInbound handles data received. +// This method handles incoming packet demultiplex it by the source address +// and the types of the message. +// This return a booleen (handled or not) and if there was an error. +// Caller should check if the packet was handled by this client or not. +// If not handled, it is assumed that the packet is application data. +// If an error is returned, the caller should discard the packet regardless. +func (c *Client) HandleInbound(data []byte, from net.Addr) (bool, error) { + + // +-------------------+-------------------------------+ + // | Return Values | | + // +-------------------+ Meaning / Action | + // | handled | error | | + // |=========+=========+===============================+ + // | false | nil | Handle the packet as app data | + // |---------+---------+-------------------------------+ + // | true | nil | Nothing to do | + // |---------+---------+-------------------------------+ + // | false | error | (shouldn't happen) | + // |---------+---------+-------------------------------+ + // | true | error | Error occurred while handling | + // +---------+---------+-------------------------------+ + // Possible causes of the error: + // - Malformed packet (parse error) + // - STUN message was a request + // - Non-STUN message from the STUN server + + switch { + case stun.IsMessage(data): + return true, c.handleSTUNMessage(data, from) + case len(c.turnServStr) != 0 && from.String() == c.turnServStr: + // received from TURN server + if proto.IsChannelData(data) { + return true, c.handleChannelData(data) + } + return true, fmt.Errorf("unexpected packet from TURN server") + case len(c.stunServStr) != 0 && from.String() == c.stunServStr: + // received from STUN server but it is not a STUN message + return true, fmt.Errorf("non-STUN message from STUN server") + default: + // assume, this is an application data + c.log.Tracef("non-STUN/TURN packect, unhandled") + } + + return false, nil +} + +func (c *Client) handleSTUNMessage(data []byte, from net.Addr) error { + raw := make([]byte, len(data)) + copy(raw, data) + + msg := &stun.Message{Raw: raw} + if err := msg.Decode(); err != nil { + return errors.Wrap(err, "failed to decode STUN message") + } + + if msg.Type.Class == stun.ClassRequest { + return fmt.Errorf("unpexpected STUN request message: %s", msg.String()) + } + + if msg.Type.Class == stun.ClassIndication { + if msg.Type.Method == stun.MethodData { + var peerAddr proto.PeerAddress + if err := peerAddr.GetFrom(msg); err != nil { + return err + } + from = &net.UDPAddr{ + IP: peerAddr.IP, + Port: peerAddr.Port, + } + + var data proto.Data + if err := data.GetFrom(msg); err != nil { + return err + } + + c.log.Debugf("data indication received from %s", from.String()) + + relayedConn := c.relayedUDPConn() + if relayedConn == nil { + c.log.Debug("no relayed conn allocated") + return nil // silently discard + } + + relayedConn.HandleInbound(data, from) + } + return nil + } + + // This is a STUN response message (transactional) + // The type is either: + // - stun.ClassSuccessResponse + // - stun.ClassErrorResponse + + trKey := b64.StdEncoding.EncodeToString(msg.TransactionID[:]) + tr, ok := c.trMap.Find(trKey) + if !ok { + // silently discard + c.log.Debugf("no transaction for %s", msg.String()) + return nil + } + + // End the transaction + tr.StopRtxTimer() + c.trMap.Delete(trKey) + + if !tr.WriteResult(client.TransactionResult{ + Msg: msg, + From: from, + Retries: tr.Retries(), + }) { + c.log.Debugf("no listener for %s", msg.String()) + } + + return nil +} + +func (c *Client) handleChannelData(data []byte) error { + chData := &proto.ChannelData{ + Raw: make([]byte, len(data)), + } + copy(chData.Raw, data) + if err := chData.Decode(); err != nil { + return err + } + + relayedConn := c.relayedUDPConn() + if relayedConn == nil { + c.log.Debug("no relayed conn allocated") + return nil // silently discard + } + + addr, ok := relayedConn.FindAddrByChannelNumber(uint16(chData.Number)) + if !ok { + return fmt.Errorf("binding with channel %d not found", int(chData.Number)) + } + + c.log.Tracef("channel data received from %s (ch=%d)", addr.String(), int(chData.Number)) + + relayedConn.HandleInbound(chData.Data, addr) + return nil +} + +func (c *Client) onRtxTimeout(trKey string, nRtx int) { + tr, ok := c.trMap.Find(trKey) + if !ok { + return // already gone + } + + if nRtx == maxRtxCount { + // all retransmisstions failed + c.trMap.Delete(trKey) + if !tr.WriteResult(client.TransactionResult{ + Err: fmt.Errorf("all retransmissions for %s failed", trKey), + }) { + c.log.Debug("no listener for transaction") + } + return + } + + c.log.Tracef("retransmitting transaction %s to %s (nRtx=%d)", + trKey, tr.To.String(), nRtx) + _, err := c.conn.WriteTo(tr.Raw, tr.To) + if err != nil { + c.trMap.Delete(trKey) + if !tr.WriteResult(client.TransactionResult{ + Err: fmt.Errorf("failed to retransmit transaction %s", trKey), + }) { + c.log.Debug("no listener for transaction") + } + return + } + tr.StartRtxTimer(c.onRtxTimeout) +} + +func (c *Client) setRelayedUDPConn(conn *client.UDPConn) { + c.mutex.Lock() + defer c.mutex.Unlock() + + c.relayedConn = conn +} + +func (c *Client) relayedUDPConn() *client.UDPConn { + c.mutex.RLock() + defer c.mutex.RUnlock() + + return c.relayedConn +} diff --git a/vendor/github.com/pion/turn/go.mod b/vendor/github.com/pion/turn/go.mod new file mode 100644 index 00000000..9e07a57c --- /dev/null +++ b/vendor/github.com/pion/turn/go.mod @@ -0,0 +1,12 @@ +module github.com/pion/turn + +go 1.12 + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pion/logging v0.2.2 + github.com/pion/stun v0.3.1 + github.com/pion/transport v0.8.6 + github.com/pkg/errors v0.8.1 + github.com/stretchr/testify v1.3.0 +) diff --git a/vendor/github.com/pion/turn/go.sum b/vendor/github.com/pion/turn/go.sum new file mode 100644 index 00000000..418417a8 --- /dev/null +++ b/vendor/github.com/pion/turn/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pion/logging v0.2.1 h1:LwASkBKZ+2ysGJ+jLv1E/9H1ge0k1nTfi1X+5zirkDk= +github.com/pion/logging v0.2.1/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/stun v0.3.1 h1:d09JJzOmOS8ZzIp8NppCMgrxGZpJ4Ix8qirfNYyI3BA= +github.com/pion/stun v0.3.1/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M= +github.com/pion/transport v0.8.6 h1:xHQq2mxAjB+UrFs90aUBaXwlmIACfQAZnOiVAX3uqMw= +github.com/pion/transport v0.8.6/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/pion/turn/internal/allocation/allocation.go b/vendor/github.com/pion/turn/internal/allocation/allocation.go new file mode 100644 index 00000000..acd464d4 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/allocation/allocation.go @@ -0,0 +1,268 @@ +package allocation + +import ( + "encoding/binary" + "net" + "sync" + "time" + + "github.com/pion/logging" + "github.com/pion/stun" + "github.com/pion/turn/internal/ipnet" + "github.com/pion/turn/internal/proto" + "github.com/pkg/errors" +) + +// Allocation is tied to a FiveTuple and relays traffic +// use CreateAllocation and GetAllocation to operate +type Allocation struct { + RelayAddr net.Addr + Protocol Protocol + TurnSocket net.PacketConn + RelaySocket net.PacketConn + fiveTuple *FiveTuple + permissionsLock sync.RWMutex + permissions map[string]*Permission + channelBindingsLock sync.RWMutex + channelBindings []*ChannelBind + lifetimeTimer *time.Timer + closed chan interface{} + log logging.LeveledLogger +} + +func addr2IPFingerprint(addr net.Addr) string { + switch a := addr.(type) { + case *net.UDPAddr: + return a.IP.String() + case *net.TCPAddr: // Do we really need this case? + return a.IP.String() + } + return "" // shoud never happen +} + +// NewAllocation creates a new instance of NewAllocation. +func NewAllocation(turnSocket net.PacketConn, fiveTuple *FiveTuple, log logging.LeveledLogger) *Allocation { + return &Allocation{ + TurnSocket: turnSocket, + fiveTuple: fiveTuple, + permissions: make(map[string]*Permission, 64), + closed: make(chan interface{}), + log: log, + } +} + +// GetPermission gets the Permission from the allocation +func (a *Allocation) GetPermission(addr net.Addr) *Permission { + a.permissionsLock.RLock() + defer a.permissionsLock.RUnlock() + + fingerprint := addr2IPFingerprint(addr) + return a.permissions[fingerprint] +} + +// AddPermission adds a new permission to the allocation +func (a *Allocation) AddPermission(p *Permission) { + fingerprint := addr2IPFingerprint(p.Addr) + + a.permissionsLock.RLock() + existedPermission, ok := a.permissions[fingerprint] + a.permissionsLock.RUnlock() + if ok { + existedPermission.refresh(permissionTimeout) + return + } + + p.allocation = a + a.permissionsLock.Lock() + a.permissions[fingerprint] = p + a.permissionsLock.Unlock() + + p.start(permissionTimeout) +} + +// RemovePermission removes the net.Addr's fingerprint from the allocation's permissions +func (a *Allocation) RemovePermission(addr net.Addr) { + a.permissionsLock.Lock() + defer a.permissionsLock.Unlock() + fingerprint := addr2IPFingerprint(addr) + delete(a.permissions, fingerprint) +} + +// AddChannelBind adds a new ChannelBind to the allocation, it also updates the +// permissions needed for this ChannelBind +func (a *Allocation) AddChannelBind(c *ChannelBind, lifetime time.Duration) error { + // Check that this channel id isn't bound to another transport address, and + // that this transport address isn't bound to another channel number. + channelByNumber := a.GetChannelByNumber(c.Number) + channelByPeer := a.GetChannelByAddr(c.Peer) + if channelByNumber != channelByPeer { + return errors.Errorf("You cannot use the same channel number with different peer") + } + + // Add or refresh this channel. + if channelByNumber == nil { + a.channelBindingsLock.Lock() + defer a.channelBindingsLock.Unlock() + + c.allocation = a + a.channelBindings = append(a.channelBindings, c) + c.start(lifetime) + + // Channel binds also refresh permissions. + a.AddPermission(NewPermission(c.Peer, a.log)) + } else { + channelByNumber.refresh(lifetime) + + // Channel binds also refresh permissions. + a.AddPermission(NewPermission(channelByNumber.Peer, a.log)) + } + + return nil +} + +// RemoveChannelBind removes the ChannelBind from this allocation by id +func (a *Allocation) RemoveChannelBind(number proto.ChannelNumber) bool { + a.channelBindingsLock.Lock() + defer a.channelBindingsLock.Unlock() + + for i := len(a.channelBindings) - 1; i >= 0; i-- { + if a.channelBindings[i].Number == number { + a.channelBindings = append(a.channelBindings[:i], a.channelBindings[i+1:]...) + return true + } + } + + return false +} + +// GetChannelByNumber gets the ChannelBind from this allocation by id +func (a *Allocation) GetChannelByNumber(number proto.ChannelNumber) *ChannelBind { + a.channelBindingsLock.RLock() + defer a.channelBindingsLock.RUnlock() + for _, cb := range a.channelBindings { + if cb.Number == number { + return cb + } + } + return nil +} + +// GetChannelByAddr gets the ChannelBind from this allocation by net.Addr +func (a *Allocation) GetChannelByAddr(addr net.Addr) *ChannelBind { + a.channelBindingsLock.RLock() + defer a.channelBindingsLock.RUnlock() + for _, cb := range a.channelBindings { + if ipnet.AddrEqual(cb.Peer, addr) { + return cb + } + } + return nil +} + +// Refresh updates the allocations lifetime +func (a *Allocation) Refresh(lifetime time.Duration) { + if lifetime == 0 { + if !a.lifetimeTimer.Stop() { + a.log.Errorf("Failed to stop allocation timer for %v", a.fiveTuple) + } + return + } + if !a.lifetimeTimer.Reset(lifetime) { + a.log.Errorf("Failed to reset allocation timer for %v", a.fiveTuple) + } +} + +// Close closes the allocation +func (a *Allocation) Close() error { + select { + case <-a.closed: + return nil + default: + } + close(a.closed) + + a.lifetimeTimer.Stop() + + a.permissionsLock.RLock() + for _, p := range a.permissions { + p.lifetimeTimer.Stop() + } + a.permissionsLock.RUnlock() + + a.channelBindingsLock.RLock() + for _, c := range a.channelBindings { + c.lifetimeTimer.Stop() + } + a.channelBindingsLock.RUnlock() + + return a.RelaySocket.Close() +} + +// https://tools.ietf.org/html/rfc5766#section-10.3 +// When the server receives a UDP datagram at a currently allocated +// relayed transport address, the server looks up the allocation +// associated with the relayed transport address. The server then +// checks to see whether the set of permissions for the allocation allow +// the relaying of the UDP datagram as described in Section 8. +// +// If relaying is permitted, then the server checks if there is a +// channel bound to the peer that sent the UDP datagram (see +// Section 11). If a channel is bound, then processing proceeds as +// described in Section 11.7. +// +// If relaying is permitted but no channel is bound to the peer, then +// the server forms and sends a Data indication. The Data indication +// MUST contain both an XOR-PEER-ADDRESS and a DATA attribute. The DATA +// attribute is set to the value of the 'data octets' field from the +// datagram, and the XOR-PEER-ADDRESS attribute is set to the source +// transport address of the received UDP datagram. The Data indication +// is then sent on the 5-tuple associated with the allocation. + +const rtpMTU = 1500 + +func (a *Allocation) packetHandler(m *Manager) { + buffer := make([]byte, rtpMTU) + + for { + n, srcAddr, err := a.RelaySocket.ReadFrom(buffer) + if err != nil { + m.DeleteAllocation(a.fiveTuple) + return + } + + a.log.Debugf("relay socket %s received %d bytes from %s", + a.RelaySocket.LocalAddr().String(), + n, + srcAddr.String()) + + if channel := a.GetChannelByAddr(srcAddr); channel != nil { + channelData := make([]byte, 4) + binary.BigEndian.PutUint16(channelData[0:], uint16(channel.Number)) + binary.BigEndian.PutUint16(channelData[2:], uint16(n)) + channelData = append(channelData, buffer[:n]...) + + if _, err = a.TurnSocket.WriteTo(channelData, a.fiveTuple.SrcAddr); err != nil { + a.log.Errorf("Failed to send ChannelData from allocation %v %v", srcAddr, err) + } + } else if p := a.GetPermission(srcAddr); p != nil { + udpAddr := srcAddr.(*net.UDPAddr) + peerAddressAttr := proto.PeerAddress{IP: udpAddr.IP, Port: udpAddr.Port} + dataAttr := proto.Data(buffer[:n]) + + msg, err := stun.Build(stun.TransactionID, stun.NewType(stun.MethodData, stun.ClassIndication), peerAddressAttr, dataAttr) + if err != nil { + a.log.Errorf("Failed to send DataIndication from allocation %v %v", srcAddr, err) + } + a.log.Debugf("relaying message from %s to client at %s", + srcAddr.String(), + a.fiveTuple.SrcAddr.String()) + if _, err = a.TurnSocket.WriteTo(msg.Raw, a.fiveTuple.SrcAddr); err != nil { + a.log.Errorf("Failed to send DataIndication from allocation %v %v", srcAddr, err) + } + + } else { + a.log.Errorf("Packet unhandled in relay src %v", srcAddr) + } + } + +} diff --git a/vendor/github.com/pion/turn/internal/allocation/allocation_manager.go b/vendor/github.com/pion/turn/internal/allocation/allocation_manager.go new file mode 100644 index 00000000..5509b512 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/allocation/allocation_manager.go @@ -0,0 +1,130 @@ +package allocation + +import ( + "fmt" + "net" + "sync" + "time" + + "github.com/pion/logging" + "github.com/pion/transport/vnet" + "github.com/pkg/errors" +) + +// ManagerConfig a bag of config params for Manager. +type ManagerConfig struct { + LeveledLogger logging.LeveledLogger + Net *vnet.Net +} + +// Manager is used to hold active allocations +type Manager struct { + lock sync.RWMutex + allocations map[string]*Allocation + log logging.LeveledLogger + net *vnet.Net +} + +// NewManager creates a new instance of Manager. +func NewManager(config *ManagerConfig) *Manager { + if config.Net == nil { + config.Net = vnet.NewNet(nil) // defaults to native operation + } + return &Manager{ + log: config.LeveledLogger, + net: config.Net, + allocations: make(map[string]*Allocation, 64), + } +} + +// GetAllocation fetches the allocation matching the passed FiveTuple +func (m *Manager) GetAllocation(fiveTuple *FiveTuple) *Allocation { + m.lock.RLock() + defer m.lock.RUnlock() + return m.allocations[fiveTuple.Fingerprint()] +} + +// Close closes the manager and closes all allocations it manages +func (m *Manager) Close() error { + m.lock.Lock() + defer m.lock.Unlock() + + for _, a := range m.allocations { + if err := a.Close(); err != nil { + return err + } + + } + return nil +} + +// CreateAllocation creates a new allocation and starts relaying +func (m *Manager) CreateAllocation( + fiveTuple *FiveTuple, + turnSocket net.PacketConn, + relayIP net.IP, // nolint:interfacer + requestedPort int, + lifetime time.Duration) (*Allocation, error) { + + if fiveTuple == nil { + return nil, errors.Errorf("Allocations must not be created with nil FivTuple") + } + if fiveTuple.SrcAddr == nil { + return nil, errors.Errorf("Allocations must not be created with nil FiveTuple.SrcAddr") + } + if fiveTuple.DstAddr == nil { + return nil, errors.Errorf("Allocations must not be created with nil FiveTuple.DstAddr") + } + if a := m.GetAllocation(fiveTuple); a != nil { + return nil, errors.Errorf("Allocation attempt created with duplicate FiveTuple %v", fiveTuple) + } + if turnSocket == nil { + return nil, errors.Errorf("Allocations must not be created with nil turnSocket") + } + if lifetime == 0 { + return nil, errors.Errorf("Allocations must not be created with a lifetime of 0") + } + + a := NewAllocation(turnSocket, fiveTuple, m.log) + + network := "udp4" + relayAddr := fmt.Sprintf("%s:%d", relayIP.String(), requestedPort) + conn, err := m.net.ListenPacket(network, relayAddr) + if err != nil { + return nil, err + } + + m.log.Debugf("listening on relay addr: %s", conn.LocalAddr().String()) + + a.RelaySocket = conn + a.RelayAddr = conn.LocalAddr() + + a.lifetimeTimer = time.AfterFunc(lifetime, func() { + m.DeleteAllocation(a.fiveTuple) + }) + + m.lock.Lock() + m.allocations[fiveTuple.Fingerprint()] = a + m.lock.Unlock() + + go a.packetHandler(m) + return a, nil +} + +// DeleteAllocation removes an allocation +func (m *Manager) DeleteAllocation(fiveTuple *FiveTuple) { + fingerprint := fiveTuple.Fingerprint() + + m.lock.Lock() + allocation := m.allocations[fingerprint] + delete(m.allocations, fingerprint) + m.lock.Unlock() + + if allocation == nil { + return + } + + if err := allocation.Close(); err != nil { + m.log.Errorf("Failed to close allocation: %v", err) + } +} diff --git a/vendor/github.com/pion/turn/internal/allocation/channel_bind.go b/vendor/github.com/pion/turn/internal/allocation/channel_bind.go new file mode 100644 index 00000000..f01c5f5b --- /dev/null +++ b/vendor/github.com/pion/turn/internal/allocation/channel_bind.go @@ -0,0 +1,43 @@ +package allocation + +import ( + "net" + "time" + + "github.com/pion/logging" + "github.com/pion/turn/internal/proto" +) + +// ChannelBind represents a TURN Channel +// https://tools.ietf.org/html/rfc5766#section-2.5 +type ChannelBind struct { + Peer net.Addr + Number proto.ChannelNumber + + allocation *Allocation + lifetimeTimer *time.Timer + log logging.LeveledLogger +} + +// NewChannelBind creates a new ChannelBind +func NewChannelBind(number proto.ChannelNumber, peer net.Addr, log logging.LeveledLogger) *ChannelBind { + return &ChannelBind{ + Number: number, + Peer: peer, + log: log, + } +} + +func (c *ChannelBind) start(lifetime time.Duration) { + c.lifetimeTimer = time.AfterFunc(lifetime, func() { + if !c.allocation.RemoveChannelBind(c.Number) { + c.log.Errorf("Failed to remove ChannelBind for %v %x %v", c.Number, c.Peer, c.allocation.fiveTuple) + } + }) +} + +func (c *ChannelBind) refresh(lifetime time.Duration) { + if !c.lifetimeTimer.Reset(lifetime) { + c.log.Errorf("Failed to reset ChannelBind timer for %v %x %v", c.Number, c.Peer, c.allocation.fiveTuple) + } +} diff --git a/vendor/github.com/pion/turn/internal/allocation/five_tuple.go b/vendor/github.com/pion/turn/internal/allocation/five_tuple.go new file mode 100644 index 00000000..1f2b3b5b --- /dev/null +++ b/vendor/github.com/pion/turn/internal/allocation/five_tuple.go @@ -0,0 +1,36 @@ +package allocation + +import ( + "fmt" + "net" +) + +// Protocol is an enum for relay protocol +type Protocol uint8 + +// Network protocols for relay +const ( + UDP Protocol = iota + TCP +) + +// FiveTuple is the combination (client IP address and port, server IP +// address and port, and transport protocol (currently one of UDP, +// TCP, or TLS)) used to communicate between the client and the +// server. The 5-tuple uniquely identifies this communication +// stream. The 5-tuple also uniquely identifies the Allocation on +// the server. +type FiveTuple struct { + Protocol + SrcAddr, DstAddr net.Addr +} + +// Equal asserts if two FiveTuples are equal +func (f *FiveTuple) Equal(b *FiveTuple) bool { + return f.Fingerprint() == b.Fingerprint() +} + +// Fingerprint is the identity of a FiveTuple +func (f *FiveTuple) Fingerprint() string { + return fmt.Sprintf("%d_%s_%s", f.Protocol, f.SrcAddr.String(), f.DstAddr.String()) +} diff --git a/vendor/github.com/pion/turn/internal/allocation/permission.go b/vendor/github.com/pion/turn/internal/allocation/permission.go new file mode 100644 index 00000000..03538eb5 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/allocation/permission.go @@ -0,0 +1,40 @@ +package allocation + +import ( + "net" + "time" + + "github.com/pion/logging" +) + +const permissionTimeout = time.Duration(5) * time.Minute + +// Permission represents a TURN permission. TURN permissions mimic the address-restricted +// filtering mechanism of NATs that comply with [RFC4787]. +// https://tools.ietf.org/html/rfc5766#section-2.3 +type Permission struct { + Addr net.Addr + allocation *Allocation + lifetimeTimer *time.Timer + log logging.LeveledLogger +} + +// NewPermission create a new Permission +func NewPermission(addr net.Addr, log logging.LeveledLogger) *Permission { + return &Permission{ + Addr: addr, + log: log, + } +} + +func (p *Permission) start(lifetime time.Duration) { + p.lifetimeTimer = time.AfterFunc(lifetime, func() { + p.allocation.RemovePermission(p.Addr) + }) +} + +func (p *Permission) refresh(lifetime time.Duration) { + if !p.lifetimeTimer.Reset(lifetime) { + p.log.Errorf("Failed to reset permission timer for %v %v", p.Addr, p.allocation.fiveTuple) + } +} diff --git a/vendor/github.com/pion/turn/internal/allocation/reservation_manager.go b/vendor/github.com/pion/turn/internal/allocation/reservation_manager.go new file mode 100644 index 00000000..f05bcbab --- /dev/null +++ b/vendor/github.com/pion/turn/internal/allocation/reservation_manager.go @@ -0,0 +1,72 @@ +package allocation + +import ( + "fmt" + "net" + "sync" + "time" +) + +type reservation struct { + token string + port int +} + +// ReservationManager is used to manage reservations +type ReservationManager struct { + lock sync.RWMutex + reservations []*reservation +} + +// CreateReservation stores the reservation for the token+port +func (m *ReservationManager) CreateReservation(reservationToken string, port int) { + time.AfterFunc(30*time.Second, func() { + m.lock.Lock() + defer m.lock.Unlock() + for i := len(m.reservations) - 1; i >= 0; i-- { + if m.reservations[i].token == reservationToken { + m.reservations = append(m.reservations[:i], m.reservations[i+1:]...) + return + } + } + }) + + m.lock.Lock() + m.reservations = append(m.reservations, &reservation{ + token: reservationToken, + port: port, + }) + m.lock.Unlock() +} + +// GetReservation returns the port for a given reservation if it exists +func (m *ReservationManager) GetReservation(reservationToken string) (int, bool) { + m.lock.RLock() + defer m.lock.RUnlock() + + for _, r := range m.reservations { + if r.token == reservationToken { + return r.port, true + } + } + return 0, false +} + +// GetRandomEvenPort returns a random un-allocated udp4 port +func GetRandomEvenPort() (int, error) { + listener, err := net.ListenPacket("udp4", "0.0.0.0:0") + if err != nil { + return 0, err + } + + addr, ok := listener.LocalAddr().(*net.UDPAddr) + if !ok { + return 0, fmt.Errorf("failed to cast net.Addr to *net.UDPAddr") + } else if err := listener.Close(); err != nil { + return 0, err + } else if addr.Port%2 == 1 { + return GetRandomEvenPort() + } + + return addr.Port, nil +} diff --git a/vendor/github.com/pion/turn/internal/client/atomic_bool.go b/vendor/github.com/pion/turn/internal/client/atomic_bool.go new file mode 100644 index 00000000..f4dbdda9 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/atomic_bool.go @@ -0,0 +1,39 @@ +package client + +import ( + "sync/atomic" +) + +// AtomicBool is an atomic boolean struct +type AtomicBool struct { + n int32 +} + +// NewAtomicBool creates a new instance of AtomicBool +func NewAtomicBool(initiallyTrue bool) *AtomicBool { + var n int32 + if initiallyTrue { + n = 1 + } + return &AtomicBool{n: n} +} + +// SetToTrue sets this value to true +func (b *AtomicBool) SetToTrue() { + atomic.StoreInt32(&b.n, 1) +} + +// SetToFalse sets this value to false +func (b *AtomicBool) SetToFalse() { + atomic.StoreInt32(&b.n, 0) +} + +// True returns true if it is set to true +func (b *AtomicBool) True() bool { + return atomic.LoadInt32(&b.n) != int32(0) +} + +// False return true if it is set to false +func (b *AtomicBool) False() bool { + return atomic.LoadInt32(&b.n) == int32(0) +} diff --git a/vendor/github.com/pion/turn/internal/client/binding.go b/vendor/github.com/pion/turn/internal/client/binding.go new file mode 100644 index 00000000..ee52053c --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/binding.go @@ -0,0 +1,151 @@ +package client + +import ( + "net" + "sync" + "sync/atomic" + "time" +) + +// Chanel number: +// 0x4000 through 0x7FFF: These values are the allowed channel +// numbers (16,383 possible values). +const ( + minChannelNumber uint16 = 0x4000 + maxChannelNumber uint16 = 0x7fff +) + +type bindingState int32 + +const ( + bindingStateIdle bindingState = iota + bindingStateRequest + bindingStateReady + bindingStateRefresh + bindingStateFailed +) + +type binding struct { + number uint16 // read-only + st bindingState // thread-safe (atomic op) + addr net.Addr // read-only + mgr *bindingManager // read-only + muBind sync.Mutex // thread-safe, for ChannelBind ops + _refreshedAt time.Time // protected by mutex + mutex sync.RWMutex // thread-safe +} + +func (b *binding) setState(state bindingState) { + atomic.StoreInt32((*int32)(&b.st), int32(state)) +} + +func (b *binding) state() bindingState { + return bindingState(atomic.LoadInt32((*int32)(&b.st))) +} + +func (b *binding) setRefreshedAt(at time.Time) { + b.mutex.Lock() + defer b.mutex.Unlock() + + b._refreshedAt = at +} + +func (b *binding) refreshedAt() time.Time { + b.mutex.RLock() + defer b.mutex.RUnlock() + + return b._refreshedAt +} + +// Thread-safe binding map +type bindingManager struct { + chanMap map[uint16]*binding + addrMap map[string]*binding + next uint16 + mutex sync.RWMutex +} + +func newBindingManager() *bindingManager { + return &bindingManager{ + chanMap: map[uint16]*binding{}, + addrMap: map[string]*binding{}, + next: minChannelNumber, + } +} + +func (mgr *bindingManager) assignChannelNumber() uint16 { + n := mgr.next + if mgr.next == maxChannelNumber { + mgr.next = minChannelNumber + } else { + mgr.next++ + } + return n +} + +func (mgr *bindingManager) create(addr net.Addr) *binding { + mgr.mutex.Lock() + defer mgr.mutex.Unlock() + + b := &binding{ + number: mgr.assignChannelNumber(), + addr: addr, + mgr: mgr, + _refreshedAt: time.Now(), + } + + mgr.chanMap[b.number] = b + mgr.addrMap[b.addr.String()] = b + return b +} + +func (mgr *bindingManager) findByAddr(addr net.Addr) (*binding, bool) { + mgr.mutex.RLock() + defer mgr.mutex.RUnlock() + + b, ok := mgr.addrMap[addr.String()] + return b, ok +} + +func (mgr *bindingManager) findByNumber(number uint16) (*binding, bool) { + mgr.mutex.RLock() + defer mgr.mutex.RUnlock() + + b, ok := mgr.chanMap[number] + return b, ok +} + +func (mgr *bindingManager) deleteByAddr(addr net.Addr) bool { + mgr.mutex.Lock() + defer mgr.mutex.Unlock() + + b, ok := mgr.addrMap[addr.String()] + if !ok { + return false + } + + delete(mgr.addrMap, addr.String()) + delete(mgr.chanMap, b.number) + return true +} + +func (mgr *bindingManager) deleteByNumber(number uint16) bool { + mgr.mutex.Lock() + defer mgr.mutex.Unlock() + + b, ok := mgr.chanMap[number] + if !ok { + return false + } + + delete(mgr.addrMap, b.addr.String()) + delete(mgr.chanMap, number) + return true +} + +func (mgr *bindingManager) size() int { + mgr.mutex.RLock() + defer mgr.mutex.RUnlock() + + return len(mgr.chanMap) +} diff --git a/vendor/github.com/pion/turn/internal/client/conn.go b/vendor/github.com/pion/turn/internal/client/conn.go new file mode 100644 index 00000000..a3628b65 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/conn.go @@ -0,0 +1,593 @@ +package client + +import ( + "fmt" + "io" + "math" + "net" + "sync" + "time" + + "github.com/pion/logging" + "github.com/pion/stun" + "github.com/pion/turn/internal/proto" +) + +const ( + maxReadQueueSize = 1024 + permRefreshInterval = 120 * time.Second +) + +const ( + timerIDRefreshAlloc int = iota + timerIDRefreshPerms +) + +func noDeadline() time.Time { + return time.Time{} +} + +type inboundData struct { + data []byte + from net.Addr +} + +// UDPConnObserver is an interface to UDPConn observer +type UDPConnObserver interface { + TURNServerAddr() net.Addr + Username() stun.Username + Realm() stun.Realm + WriteTo(data []byte, to net.Addr) (int, error) + PerformTransaction(msg *stun.Message, to net.Addr, dontWait bool) (TransactionResult, error) + OnDeallocated(relayedAddr net.Addr) +} + +// UDPConnConfig is a set of configuration params use by NewUDPConn +type UDPConnConfig struct { + Observer UDPConnObserver + RelayedAddr net.Addr + Integrity stun.MessageIntegrity + Nonce stun.Nonce + Lifetime time.Duration + Log logging.LeveledLogger +} + +// UDPConn is the implementation of the Conn and PacketConn interfaces for UDP network connections. +// comatible with net.PacketConn and net.Conn +type UDPConn struct { + obs UDPConnObserver // read-only + relayedAddr net.Addr // read-only + permMap *permissionMap // thread-safe + bindingMgr *bindingManager // thread-safe + integrity stun.MessageIntegrity // read-only + _nonce stun.Nonce // needs mutex x + _lifetime time.Duration // needs mutex x + readCh chan *inboundData // thread-safe + closeCh chan struct{} // thread-safe + closed *AtomicBool // thread-safe + readTimer *time.Timer // thread-safe + refreshAllocTimer *PeriodicTimer // thread-safe + refreshPermsTimer *PeriodicTimer // thread-safe + mutex sync.RWMutex // thread-safe + log logging.LeveledLogger // read-only +} + +// NewUDPConn creates a new instance of UDPConn +func NewUDPConn(config *UDPConnConfig) *UDPConn { + c := &UDPConn{ + obs: config.Observer, + relayedAddr: config.RelayedAddr, + permMap: newPermissionMap(), + bindingMgr: newBindingManager(), + integrity: config.Integrity, + _nonce: config.Nonce, + _lifetime: config.Lifetime, + readCh: make(chan *inboundData, maxReadQueueSize), + closeCh: make(chan struct{}), + closed: NewAtomicBool(false), + readTimer: time.NewTimer(time.Duration(math.MaxInt64)), + log: config.Log, + } + + c.log.Debugf("initial lifetime: %d seconds", int(c.lifetime().Seconds())) + + c.refreshAllocTimer = NewPeriodicTimer( + timerIDRefreshAlloc, + c.onRefreshTimers, + c.lifetime()/2, + ) + + c.refreshPermsTimer = NewPeriodicTimer( + timerIDRefreshPerms, + c.onRefreshTimers, + permRefreshInterval, + ) + + if c.refreshAllocTimer.Start() { + c.log.Debugf("refreshAllocTimer started") + } + if c.refreshPermsTimer.Start() { + c.log.Debugf("refreshPermsTimer started") + } + + return c +} + +// ReadFrom reads a packet from the connection, +// copying the payload into p. It returns the number of +// bytes copied into p and the return address that +// was on the packet. +// It returns the number of bytes read (0 <= n <= len(p)) +// and any error encountered. Callers should always process +// the n > 0 bytes returned before considering the error err. +// ReadFrom can be made to time out and return +// an Error with Timeout() == true after a fixed time limit; +// see SetDeadline and SetReadDeadline. +func (c *UDPConn) ReadFrom(p []byte) (n int, addr net.Addr, err error) { + for c.closed.False() { + select { + case ibData := <-c.readCh: + n := copy(p, ibData.data) + if n < len(ibData.data) { + return 0, nil, io.ErrShortBuffer + } + return n, ibData.from, nil + + case <-c.readTimer.C: + return 0, nil, &net.OpError{ + Op: "read", + Net: c.LocalAddr().Network(), + Addr: c.LocalAddr(), + Err: newTimeoutError("i/o timeout"), + } + + case <-c.closeCh: + c.closed.SetToTrue() + } + } + + return 0, nil, &net.OpError{ + Op: "read", + Net: c.LocalAddr().Network(), + Addr: c.LocalAddr(), + Err: fmt.Errorf("use of closed network connection"), + } +} + +// WriteTo writes a packet with payload p to addr. +// WriteTo can be made to time out and return +// an Error with Timeout() == true after a fixed time limit; +// see SetDeadline and SetWriteDeadline. +// On packet-oriented connections, write timeouts are rare. +func (c *UDPConn) WriteTo(p []byte, addr net.Addr) (int, error) { + _, ok := addr.(*net.UDPAddr) + if !ok { + return 0, fmt.Errorf("addr is not a net.UDPAddr") + } + + // check if we have a permission for the destination IP addr + perm, ok := c.permMap.find(addr) + if !ok { + perm = &permission{} + c.permMap.insert(addr, perm) + } + + // This func-block would block, per destination IP (, or perm), until + // the perm state becomes "requested". Purpose of this is to guarantee + // the order of packets (within the same perm). + // Note that CreatePermission transaction may not be complete before + // all the data transmission. This is done assuming that the request + // will be mostly likely successful and we can tolerate some loss of + // UDP packet (or reorder), inorder to minimize the latency in most cases. + err := func() error { + perm.mutex.Lock() + defer perm.mutex.Unlock() + + if perm.state() == permStateIdle { + // punch a hole! (this would block a bit..) + if err := c.createPermissions(addr); err != nil { + c.permMap.delete(addr) + return err + } + perm.setState(permStatePermitted) + } + return nil + }() + if err != nil { + return 0, err + } + + // bind channel + + b, ok := c.bindingMgr.findByAddr(addr) + if !ok { + b = c.bindingMgr.create(addr) + } + + bindSt := b.state() + + if bindSt == bindingStateIdle || bindSt == bindingStateRequest || bindSt == bindingStateFailed { + func() { + // block only callers with the same binding until + // the binding transaction has been complete + b.muBind.Lock() + defer b.muBind.Unlock() + + // binding state may have been changed while waiting. check again. + if b.state() == bindingStateIdle { + b.setState(bindingStateRequest) + go func() { + err2 := c.bind(b) + if err2 != nil { + c.log.Warnf("bind() failed: %s", err2.Error()) + b.setState(bindingStateFailed) + // keep going... + // TODO: consider try binding again after a while + } else { + b.setState(bindingStateReady) + } + }() + } + }() + + // send data using SendIndication + peerAddr := addr2PeerAddress(addr) + var msg *stun.Message + msg, err = stun.Build( + stun.TransactionID, + stun.NewType(stun.MethodSend, stun.ClassIndication), + proto.Data(p), + peerAddr, + stun.Fingerprint, + ) + if err != nil { + return 0, err + } + + // indication has no transaction (fire-and-forget) + + return c.obs.WriteTo(msg.Raw, c.obs.TURNServerAddr()) + } + + // binding is either ready + + // check if the binding needs a refresh + func() { + b.muBind.Lock() + defer b.muBind.Unlock() + + if b.state() == bindingStateReady && time.Since(b.refreshedAt()) > 5*time.Minute { + b.setState(bindingStateRefresh) + go func() { + err = c.bind(b) + if err != nil { + c.log.Warnf("bind() for refresh failed: %s", err.Error()) + b.setState(bindingStateFailed) + // keep going... + // TODO: consider try binding again after a while + } else { + b.setRefreshedAt(time.Now()) + b.setState(bindingStateReady) + } + }() + } + }() + + // send via ChannelData + return c.sendChannelData(p, b.number) +} + +// Close closes the connection. +// Any blocked ReadFrom or WriteTo operations will be unblocked and return errors. +func (c *UDPConn) Close() error { + c.refreshAllocTimer.Stop() + c.refreshPermsTimer.Stop() + + select { + case <-c.closeCh: + return fmt.Errorf("already closed") + default: + close(c.closeCh) + } + + c.obs.OnDeallocated(c.relayedAddr) + return c.refreshAllocation(0, true /* dontWait=true */) +} + +// LocalAddr returns the local network address. +func (c *UDPConn) LocalAddr() net.Addr { + return c.relayedAddr +} + +// SetDeadline sets the read and write deadlines associated +// with the connection. It is equivalent to calling both +// SetReadDeadline and SetWriteDeadline. +// +// A deadline is an absolute time after which I/O operations +// fail with a timeout (see type Error) instead of +// blocking. The deadline applies to all future and pending +// I/O, not just the immediately following call to ReadFrom or +// WriteTo. After a deadline has been exceeded, the connection +// can be refreshed by setting a deadline in the future. +// +// An idle timeout can be implemented by repeatedly extending +// the deadline after successful ReadFrom or WriteTo calls. +// +// A zero value for t means I/O operations will not time out. +func (c *UDPConn) SetDeadline(t time.Time) error { + return c.SetReadDeadline(t) +} + +// SetReadDeadline sets the deadline for future ReadFrom calls +// and any currently-blocked ReadFrom call. +// A zero value for t means ReadFrom will not time out. +func (c *UDPConn) SetReadDeadline(t time.Time) error { + var d time.Duration + if t == noDeadline() { + d = time.Duration(math.MaxInt64) + } else { + d = time.Until(t) + } + c.readTimer.Reset(d) + return nil +} + +// SetWriteDeadline sets the deadline for future WriteTo calls +// and any currently-blocked WriteTo call. +// Even if write times out, it may return n > 0, indicating that +// some of the data was successfully written. +// A zero value for t means WriteTo will not time out. +func (c *UDPConn) SetWriteDeadline(t time.Time) error { + // Write never blocks. + return nil +} + +func addr2PeerAddress(addr net.Addr) proto.PeerAddress { + var peerAddr proto.PeerAddress + switch a := addr.(type) { + case *net.UDPAddr: + peerAddr.IP = a.IP + peerAddr.Port = a.Port + case *net.TCPAddr: + peerAddr.IP = a.IP + peerAddr.Port = a.Port + } + + return peerAddr +} + +func (c *UDPConn) createPermissions(addrs ...net.Addr) error { + setters := []stun.Setter{ + stun.TransactionID, + stun.NewType(stun.MethodCreatePermission, stun.ClassRequest), + } + + for _, addr := range addrs { + setters = append(setters, addr2PeerAddress(addr)) + } + + setters = append(setters, + c.obs.Username(), + c.obs.Realm(), + c.nonce(), + c.integrity, + stun.Fingerprint) + + msg, err := stun.Build(setters...) + if err != nil { + return err + } + + trRes, err := c.obs.PerformTransaction(msg, c.obs.TURNServerAddr(), false) + if err != nil { + return err + } + + res := trRes.Msg + + if res.Type.Class == stun.ClassErrorResponse { + var code stun.ErrorCodeAttribute + if err = code.GetFrom(res); err == nil { + err = fmt.Errorf("%s (error %s)", res.Type, code) + } else { + err = fmt.Errorf("%s", res.Type) + } + return err + } + + return nil +} + +// HandleInbound passes inbound data in UDPConn +func (c *UDPConn) HandleInbound(data []byte, from net.Addr) { + // copy data + copied := make([]byte, len(data)) + copy(copied, data) + + select { + case c.readCh <- &inboundData{data: copied, from: from}: + default: + c.log.Warnf("receive buffer full") + } +} + +// FindAddrByChannelNumber returns a peer address associated with the +// channel number on this UDPConn +func (c *UDPConn) FindAddrByChannelNumber(chNum uint16) (net.Addr, bool) { + b, ok := c.bindingMgr.findByNumber(chNum) + if !ok { + return nil, false + } + return b.addr, true +} + +func (c *UDPConn) refreshAllocation(lifetime time.Duration, dontWait bool) error { + msg, err := stun.Build( + stun.TransactionID, + stun.NewType(stun.MethodRefresh, stun.ClassRequest), + proto.Lifetime{Duration: lifetime}, + c.obs.Username(), + c.obs.Realm(), + c.nonce(), + c.integrity, + stun.Fingerprint, + ) + if err != nil { + return fmt.Errorf("failed to build refresh request: %s", err.Error()) + } + + c.log.Debugf("send refresh request (dontWait=%v)", dontWait) + trRes, err := c.obs.PerformTransaction(msg, c.obs.TURNServerAddr(), dontWait) + if err != nil { + return fmt.Errorf("failed to refresh refresh: %s", err.Error()) + } + + if dontWait { + c.log.Debug("refresh request sent") + return nil + } + + c.log.Debug("refresh request sent, and waiting response") + + res := trRes.Msg + if res.Type.Class == stun.ClassErrorResponse { + var code stun.ErrorCodeAttribute + if err = code.GetFrom(res); err == nil { + if code.Code == stun.CodeStaleNonce { + // Update nonce + var nonce stun.Nonce + if err = nonce.GetFrom(res); err == nil { + c.setNonce(nonce) + c.log.Debug("refresh allocation: 438, got new nonce.") + } else { + c.log.Warn("refresh allocation: 438 but no nonce.") + } + + return errTryAgain + } + + return err + } + return fmt.Errorf("%s", res.Type) + } + + // Getting lifetime from response + var updatedLifetime proto.Lifetime + if err := updatedLifetime.GetFrom(res); err != nil { + return fmt.Errorf("failed to get lifetime from refresh response: %s", err.Error()) + } + + c.mutex.Lock() + c.setLifetime(updatedLifetime.Duration) + c.log.Debugf("updated lifetime: %d seconds", int(c.lifetime().Seconds())) + c.mutex.Unlock() + return nil +} + +func (c *UDPConn) refreshPermissions() { + addrs := c.permMap.addrs() + if len(addrs) == 0 { + c.log.Debug("no permission to refresh") + return + } + if err := c.createPermissions(addrs...); err != nil { + c.log.Errorf("fail to refresh permissions: %s", err.Error()) + return + } + c.log.Debug("refresh permissions successful") +} + +func (c *UDPConn) bind(b *binding) error { + setters := []stun.Setter{ + stun.TransactionID, + stun.NewType(stun.MethodChannelBind, stun.ClassRequest), + addr2PeerAddress(b.addr), + proto.ChannelNumber(b.number), + c.obs.Username(), + c.obs.Realm(), + c.nonce(), + c.integrity, + stun.Fingerprint, + } + + msg, err := stun.Build(setters...) + if err != nil { + return err + } + + trRes, err := c.obs.PerformTransaction(msg, c.obs.TURNServerAddr(), false) + if err != nil { + c.bindingMgr.deleteByAddr(b.addr) + } + + res := trRes.Msg + + if res.Type != stun.NewType(stun.MethodChannelBind, stun.ClassSuccessResponse) { + return fmt.Errorf("unexpected response type %s", res.Type) + } + + c.log.Debugf("channel binding successful: %s %d", b.addr.String(), b.number) + + // Success. + return nil +} + +func (c *UDPConn) sendChannelData(data []byte, chNum uint16) (int, error) { + chData := &proto.ChannelData{ + Data: data, + Number: proto.ChannelNumber(chNum), + } + chData.Encode() + return c.obs.WriteTo(chData.Raw, c.obs.TURNServerAddr()) +} + +func (c *UDPConn) onRefreshTimers(id int) { + c.log.Debugf("refresh timer %d expired", id) + switch id { + case timerIDRefreshAlloc: + var err error + lifetime := c.lifetime() + // limit the max retries on errTryAgain to 3 + // when stale nonce returns, sencond retry should succeed + for i := 0; i < 3; i++ { + err = c.refreshAllocation(lifetime, false) + if err != errTryAgain { + break + } + } + if err != nil { + c.log.Warnf("refresh allocation failed") + } + case timerIDRefreshPerms: + c.refreshPermissions() + } +} + +func (c *UDPConn) nonce() stun.Nonce { + c.mutex.RLock() + defer c.mutex.RUnlock() + + return c._nonce +} + +func (c *UDPConn) setNonce(nonce stun.Nonce) { + c.mutex.Lock() + defer c.mutex.Unlock() + + c.log.Debugf("set new nonce with %d bytes", len(nonce)) + c._nonce = nonce +} + +func (c *UDPConn) lifetime() time.Duration { + c.mutex.RLock() + defer c.mutex.RUnlock() + + return c._lifetime +} + +func (c *UDPConn) setLifetime(lifetime time.Duration) { + c.mutex.Lock() + defer c.mutex.Unlock() + + c._lifetime = lifetime +} diff --git a/vendor/github.com/pion/turn/internal/client/errors.go b/vendor/github.com/pion/turn/internal/client/errors.go new file mode 100644 index 00000000..435a7e29 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/errors.go @@ -0,0 +1,25 @@ +package client + +import ( + "errors" +) + +var errTryAgain = errors.New("try again") + +type timeoutError struct { + msg string +} + +func newTimeoutError(msg string) error { + return &timeoutError{ + msg: msg, + } +} + +func (e *timeoutError) Error() string { + return e.msg +} + +func (e *timeoutError) Timeout() bool { + return true +} diff --git a/vendor/github.com/pion/turn/internal/client/periodic_timer.go b/vendor/github.com/pion/turn/internal/client/periodic_timer.go new file mode 100644 index 00000000..fcd56787 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/periodic_timer.go @@ -0,0 +1,82 @@ +package client + +import ( + "sync" + "time" +) + +// PeriodicTimerTimeoutHandler is a handler called on timeout +type PeriodicTimerTimeoutHandler func(timerID int) + +// PeriodicTimer is a periodic timer +type PeriodicTimer struct { + id int + interval time.Duration + timeoutHandler PeriodicTimerTimeoutHandler + stopFunc func() + mutex sync.RWMutex +} + +// NewPeriodicTimer create a new timer +func NewPeriodicTimer(id int, timeoutHandler PeriodicTimerTimeoutHandler, interval time.Duration) *PeriodicTimer { + return &PeriodicTimer{ + id: id, + interval: interval, + timeoutHandler: timeoutHandler, + } +} + +// Start starts the timer. +func (t *PeriodicTimer) Start() bool { + t.mutex.Lock() + defer t.mutex.Unlock() + + // this is a noop if the timer is always running + if t.stopFunc != nil { + return false + } + + cancelCh := make(chan struct{}) + + go func() { + canceling := false + + for !canceling { + timer := time.NewTimer(t.interval) + + select { + case <-timer.C: + t.timeoutHandler(t.id) + case <-cancelCh: + canceling = true + timer.Stop() + } + } + }() + + t.stopFunc = func() { + close(cancelCh) + } + + return true +} + +// Stop stops the timer. +func (t *PeriodicTimer) Stop() { + t.mutex.Lock() + defer t.mutex.Unlock() + + if t.stopFunc != nil { + t.stopFunc() + t.stopFunc = nil + } +} + +// IsRunning tests if the timer is running. +// Debug purpose only +func (t *PeriodicTimer) IsRunning() bool { + t.mutex.RLock() + defer t.mutex.RUnlock() + + return (t.stopFunc != nil) +} diff --git a/vendor/github.com/pion/turn/internal/client/permission.go b/vendor/github.com/pion/turn/internal/client/permission.go new file mode 100644 index 00000000..5546a22e --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/permission.go @@ -0,0 +1,90 @@ +package client + +import ( + "net" + "sync" + "sync/atomic" +) + +type permState int32 + +const ( + permStateIdle permState = iota + permStatePermitted +) + +type permission struct { + st permState // thread-safe (atomic op) + mutex sync.RWMutex // thread-safe +} + +func (p *permission) setState(state permState) { + atomic.StoreInt32((*int32)(&p.st), int32(state)) +} + +func (p *permission) state() permState { + return permState(atomic.LoadInt32((*int32)(&p.st))) +} + +// Thread-safe permission map +type permissionMap struct { + permMap map[string]*permission + mutex sync.RWMutex +} + +func (m *permissionMap) insert(addr net.Addr, p *permission) bool { + m.mutex.Lock() + defer m.mutex.Unlock() + + udpAddr, ok := addr.(*net.UDPAddr) + if !ok { + return false + } + + m.permMap[udpAddr.IP.String()] = p + return true +} + +func (m *permissionMap) find(addr net.Addr) (*permission, bool) { + m.mutex.RLock() + defer m.mutex.RUnlock() + + udpAddr, ok := addr.(*net.UDPAddr) + if !ok { + return nil, false + } + + p, ok := m.permMap[udpAddr.IP.String()] + return p, ok +} + +func (m *permissionMap) delete(addr net.Addr) { + m.mutex.Lock() + defer m.mutex.Unlock() + + udpAddr, ok := addr.(*net.UDPAddr) + if !ok { + return + } + + delete(m.permMap, udpAddr.IP.String()) +} + +func (m *permissionMap) addrs() []net.Addr { + m.mutex.RLock() + defer m.mutex.RUnlock() + + addrs := []net.Addr{} + for k := range m.permMap { + addrs = append(addrs, &net.UDPAddr{ + IP: net.ParseIP(k), + }) + } + return addrs +} + +func newPermissionMap() *permissionMap { + return &permissionMap{ + permMap: map[string]*permission{}, + } +} diff --git a/vendor/github.com/pion/turn/internal/client/transaction.go b/vendor/github.com/pion/turn/internal/client/transaction.go new file mode 100644 index 00000000..052ab180 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/transaction.go @@ -0,0 +1,165 @@ +package client + +import ( + "net" + "sync" + "time" + + "github.com/pion/stun" +) + +const ( + maxRtxInterval time.Duration = 1600 * time.Millisecond +) + +// TransactionResult is a bag of result values of a transaction +type TransactionResult struct { + Msg *stun.Message + From net.Addr + Retries int + Err error +} + +// TransactionConfig is a set of confi params used by NewTransaction +type TransactionConfig struct { + Key string + Raw []byte + To net.Addr + Interval time.Duration +} + +// Transaction represents a transaction +type Transaction struct { + Key string // read-only + Raw []byte // read-only + To net.Addr // read-only + nRtx int // modified only by the timer thread + interval time.Duration // modified only by the timer thread + timer *time.Timer // therad-safe, set only by the creator, and stopper + resultCh chan TransactionResult // thread-safe + mutex sync.RWMutex +} + +// NewTransaction creates a new instance of Transaction +func NewTransaction(config *TransactionConfig) *Transaction { + return &Transaction{ + Key: config.Key, // read-only + Raw: config.Raw, // read-only + To: config.To, // read-only + interval: config.Interval, // modified only by the timer thread + resultCh: make(chan TransactionResult), // thread-safe + } +} + +// StartRtxTimer starts the transaction timer +func (t *Transaction) StartRtxTimer(onTimeout func(trKey string, nRtx int)) { + t.mutex.Lock() + defer t.mutex.Unlock() + + t.timer = time.AfterFunc(t.interval, func() { + t.nRtx++ + t.interval *= 2 + if t.interval > maxRtxInterval { + t.interval = maxRtxInterval + } + onTimeout(t.Key, t.nRtx) + }) +} + +// StopRtxTimer stop the transaction timer +func (t *Transaction) StopRtxTimer() { + t.mutex.Lock() + defer t.mutex.Unlock() + + if t.timer != nil { + t.timer.Stop() + } +} + +// WriteResult writes the result to the result channel +func (t *Transaction) WriteResult(res TransactionResult) bool { + select { + case t.resultCh <- res: + return true + default: + } + return false +} + +// WaitForResult waits for the transaction result +func (t *Transaction) WaitForResult() TransactionResult { + return <-t.resultCh +} + +// Close closes the transaction +func (t *Transaction) Close() { + close(t.resultCh) +} + +// Retries returns the number of retransmission it has made +func (t *Transaction) Retries() int { + t.mutex.RLock() + defer t.mutex.RUnlock() + + return t.nRtx +} + +//////////////////////////////////////////////////////////////////////////////// + +// TransactionMap is a thread-safe transaction map +type TransactionMap struct { + trMap map[string]*Transaction + mutex sync.RWMutex +} + +// NewTransactionMap create a new instance of the transaction map +func NewTransactionMap() *TransactionMap { + return &TransactionMap{ + trMap: map[string]*Transaction{}, + } +} + +// Insert inserts a trasaction to the map +func (m *TransactionMap) Insert(key string, tr *Transaction) bool { + m.mutex.Lock() + defer m.mutex.Unlock() + + m.trMap[key] = tr + return true +} + +// Find looks up a transaction by its key +func (m *TransactionMap) Find(key string) (*Transaction, bool) { + m.mutex.RLock() + defer m.mutex.RUnlock() + + tr, ok := m.trMap[key] + return tr, ok +} + +// Delete deletes a transaction by its key +func (m *TransactionMap) Delete(key string) { + m.mutex.Lock() + defer m.mutex.Unlock() + + delete(m.trMap, key) +} + +// CloseAndDeleteAll closes and deletes all transactions +func (m *TransactionMap) CloseAndDeleteAll() { + m.mutex.Lock() + defer m.mutex.Unlock() + + for trKey, tr := range m.trMap { + tr.Close() + delete(m.trMap, trKey) + } +} + +// Size returns the length of the transaction map +func (m *TransactionMap) Size() int { + m.mutex.RLock() + defer m.mutex.RUnlock() + + return len(m.trMap) +} diff --git a/vendor/github.com/pion/turn/internal/client/trylock.go b/vendor/github.com/pion/turn/internal/client/trylock.go new file mode 100644 index 00000000..4f555345 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/client/trylock.go @@ -0,0 +1,25 @@ +package client + +import ( + "fmt" + "sync/atomic" +) + +// TryLock implement the classic "try-lock" operation. +type TryLock struct { + n int32 +} + +// Lock tries to lock the try-lock. If successful, it returns true. +// Otherwise, it returns false immedidately. +func (c *TryLock) Lock() error { + if !atomic.CompareAndSwapInt32(&c.n, 0, 1) { + return fmt.Errorf("try-lock is already locked") + } + return nil +} + +// Unlock unlocks the try-lock. +func (c *TryLock) Unlock() { + atomic.StoreInt32(&c.n, 0) +} diff --git a/vendor/github.com/pion/turn/internal/ipnet/util.go b/vendor/github.com/pion/turn/internal/ipnet/util.go new file mode 100644 index 00000000..ce40b977 --- /dev/null +++ b/vendor/github.com/pion/turn/internal/ipnet/util.go @@ -0,0 +1,32 @@ +package ipnet + +import ( + "fmt" + "net" +) + +// AddrIPPort extracts the IP and Port from a net.Addr +func AddrIPPort(a net.Addr) (net.IP, int, error) { + aUDP, ok := a.(*net.UDPAddr) + if !ok { + return nil, 0, fmt.Errorf("failed to cast net.Addr to *net.UDPAddr") + } + + return aUDP.IP, aUDP.Port, nil +} + +// AddrEqual asserts that two net.Addrs are equal +// Currently only supprots UDP but will be extended in the future to support others +func AddrEqual(a, b net.Addr) bool { + aUDP, ok := a.(*net.UDPAddr) + if !ok { + return false + } + + bUDP, ok := b.(*net.UDPAddr) + if !ok { + return false + } + + return aUDP.IP.Equal(bUDP.IP) && aUDP.Port == bUDP.Port +} diff --git a/vendor/github.com/gortc/turn/addr.go b/vendor/github.com/pion/turn/internal/proto/addr.go similarity index 98% rename from vendor/github.com/gortc/turn/addr.go rename to vendor/github.com/pion/turn/internal/proto/addr.go index dd17e331..b1d654d9 100644 --- a/vendor/github.com/gortc/turn/addr.go +++ b/vendor/github.com/pion/turn/internal/proto/addr.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "fmt" diff --git a/vendor/github.com/gortc/turn/chandata.go b/vendor/github.com/pion/turn/internal/proto/chandata.go similarity index 99% rename from vendor/github.com/gortc/turn/chandata.go rename to vendor/github.com/pion/turn/internal/proto/chandata.go index ecda5791..69ab77b2 100644 --- a/vendor/github.com/gortc/turn/chandata.go +++ b/vendor/github.com/pion/turn/internal/proto/chandata.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "bytes" diff --git a/vendor/github.com/gortc/turn/chann.go b/vendor/github.com/pion/turn/internal/proto/chann.go similarity index 96% rename from vendor/github.com/gortc/turn/chann.go rename to vendor/github.com/pion/turn/internal/proto/chann.go index baab2428..0bf8d6ca 100644 --- a/vendor/github.com/gortc/turn/chann.go +++ b/vendor/github.com/pion/turn/internal/proto/chann.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "errors" @@ -12,7 +12,7 @@ import ( // The CHANNEL-NUMBER attribute contains the number of the channel. // // RFC 5766 Section 14.1 -type ChannelNumber int // encoded as uint16 +type ChannelNumber uint16 // encoded as uint16 func (n ChannelNumber) String() string { return strconv.Itoa(int(n)) } diff --git a/vendor/github.com/gortc/turn/data.go b/vendor/github.com/pion/turn/internal/proto/data.go similarity index 98% rename from vendor/github.com/gortc/turn/data.go rename to vendor/github.com/pion/turn/internal/proto/data.go index 698afca9..64243e0c 100644 --- a/vendor/github.com/gortc/turn/data.go +++ b/vendor/github.com/pion/turn/internal/proto/data.go @@ -1,4 +1,4 @@ -package turn +package proto import "github.com/pion/stun" diff --git a/vendor/github.com/gortc/turn/dontfrag.go b/vendor/github.com/pion/turn/internal/proto/dontfrag.go similarity index 97% rename from vendor/github.com/gortc/turn/dontfrag.go rename to vendor/github.com/pion/turn/internal/proto/dontfrag.go index 266a4db2..d9e0bf4c 100644 --- a/vendor/github.com/gortc/turn/dontfrag.go +++ b/vendor/github.com/pion/turn/internal/proto/dontfrag.go @@ -1,4 +1,4 @@ -package turn +package proto import "github.com/pion/stun" diff --git a/vendor/github.com/gortc/turn/evenport.go b/vendor/github.com/pion/turn/internal/proto/evenport.go similarity index 98% rename from vendor/github.com/gortc/turn/evenport.go rename to vendor/github.com/pion/turn/internal/proto/evenport.go index a6c31ff5..a5a38825 100644 --- a/vendor/github.com/gortc/turn/evenport.go +++ b/vendor/github.com/pion/turn/internal/proto/evenport.go @@ -1,4 +1,4 @@ -package turn +package proto import "github.com/pion/stun" diff --git a/vendor/github.com/gortc/turn/fuzz.go b/vendor/github.com/pion/turn/internal/proto/fuzz.go similarity index 99% rename from vendor/github.com/gortc/turn/fuzz.go rename to vendor/github.com/pion/turn/internal/proto/fuzz.go index bf785534..905b390d 100644 --- a/vendor/github.com/gortc/turn/fuzz.go +++ b/vendor/github.com/pion/turn/internal/proto/fuzz.go @@ -1,6 +1,6 @@ // +build gofuzz -package turn +package proto import ( "fmt" diff --git a/vendor/github.com/gortc/turn/lifetime.go b/vendor/github.com/pion/turn/internal/proto/lifetime.go similarity index 98% rename from vendor/github.com/gortc/turn/lifetime.go rename to vendor/github.com/pion/turn/internal/proto/lifetime.go index 7fcfebe5..2ee063b6 100644 --- a/vendor/github.com/gortc/turn/lifetime.go +++ b/vendor/github.com/pion/turn/internal/proto/lifetime.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "time" diff --git a/vendor/github.com/gortc/turn/peeraddr.go b/vendor/github.com/pion/turn/internal/proto/peeraddr.go similarity index 74% rename from vendor/github.com/gortc/turn/peeraddr.go rename to vendor/github.com/pion/turn/internal/proto/peeraddr.go index a843d593..b357b823 100644 --- a/vendor/github.com/gortc/turn/peeraddr.go +++ b/vendor/github.com/pion/turn/internal/proto/peeraddr.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "net" @@ -32,4 +32,11 @@ func (a *PeerAddress) GetFrom(m *stun.Message) error { return (*stun.XORMappedAddress)(a).GetFromAs(m, stun.AttrXORPeerAddress) } +// XORPeerAddress implements XOR-PEER-ADDRESS attribute. +// +// The XOR-PEER-ADDRESS specifies the address and port of the peer as +// seen from the TURN server. (For example, the peer's server-reflexive +// transport address if the peer is behind a NAT.) +// +// RFC 5766 Section 14.3 type XORPeerAddress = PeerAddress diff --git a/vendor/github.com/gortc/turn/turn.go b/vendor/github.com/pion/turn/internal/proto/proto.go similarity index 88% rename from vendor/github.com/gortc/turn/turn.go rename to vendor/github.com/pion/turn/internal/proto/proto.go index 73a292bb..e4a3db52 100644 --- a/vendor/github.com/gortc/turn/turn.go +++ b/vendor/github.com/pion/turn/internal/proto/proto.go @@ -1,5 +1,7 @@ -// Package turn implements RFC 5766 Traversal Using Relays around NAT. -package turn +// Package proto implements RFC 5766 Traversal Using Relays around NAT. +// +// Merged from gortc/turn v0.80. +package proto import ( "encoding/binary" diff --git a/vendor/github.com/gortc/turn/relayedaddr.go b/vendor/github.com/pion/turn/internal/proto/relayedaddr.go similarity index 77% rename from vendor/github.com/gortc/turn/relayedaddr.go rename to vendor/github.com/pion/turn/internal/proto/relayedaddr.go index f94aa405..2169cb75 100644 --- a/vendor/github.com/gortc/turn/relayedaddr.go +++ b/vendor/github.com/pion/turn/internal/proto/relayedaddr.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "net" @@ -31,4 +31,10 @@ func (a *RelayedAddress) GetFrom(m *stun.Message) error { return (*stun.XORMappedAddress)(a).GetFromAs(m, stun.AttrXORRelayedAddress) } +// XORRelayedAddress implements XOR-RELAYED-ADDRESS attribute. +// +// It specifies the address and port that the server allocated to the +// client. It is encoded in the same way as XOR-MAPPED-ADDRESS. +// +// RFC 5766 Section 14.5 type XORRelayedAddress = RelayedAddress diff --git a/vendor/github.com/gortc/turn/reqfamily.go b/vendor/github.com/pion/turn/internal/proto/reqfamily.go similarity index 99% rename from vendor/github.com/gortc/turn/reqfamily.go rename to vendor/github.com/pion/turn/internal/proto/reqfamily.go index 6f3cb20a..dae4f3ab 100644 --- a/vendor/github.com/gortc/turn/reqfamily.go +++ b/vendor/github.com/pion/turn/internal/proto/reqfamily.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "errors" diff --git a/vendor/github.com/gortc/turn/reqtrans.go b/vendor/github.com/pion/turn/internal/proto/reqtrans.go similarity index 99% rename from vendor/github.com/gortc/turn/reqtrans.go rename to vendor/github.com/pion/turn/internal/proto/reqtrans.go index e770f80b..01ec93bf 100644 --- a/vendor/github.com/gortc/turn/reqtrans.go +++ b/vendor/github.com/pion/turn/internal/proto/reqtrans.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "strconv" diff --git a/vendor/github.com/gortc/turn/rsrvtoken.go b/vendor/github.com/pion/turn/internal/proto/rsrvtoken.go similarity index 98% rename from vendor/github.com/gortc/turn/rsrvtoken.go rename to vendor/github.com/pion/turn/internal/proto/rsrvtoken.go index ae0a6752..6e2ed4d8 100644 --- a/vendor/github.com/gortc/turn/rsrvtoken.go +++ b/vendor/github.com/pion/turn/internal/proto/rsrvtoken.go @@ -1,4 +1,4 @@ -package turn +package proto import "github.com/pion/stun" diff --git a/vendor/github.com/gortc/turn/uri.go b/vendor/github.com/pion/turn/internal/proto/uri.go similarity index 99% rename from vendor/github.com/gortc/turn/uri.go rename to vendor/github.com/pion/turn/internal/proto/uri.go index 12472177..255fb6ba 100644 --- a/vendor/github.com/gortc/turn/uri.go +++ b/vendor/github.com/pion/turn/internal/proto/uri.go @@ -1,4 +1,4 @@ -package turn +package proto import ( "errors" diff --git a/vendor/github.com/pion/turn/sender.go b/vendor/github.com/pion/turn/sender.go new file mode 100644 index 00000000..bb0bc1c6 --- /dev/null +++ b/vendor/github.com/pion/turn/sender.go @@ -0,0 +1,20 @@ +package turn + +import ( + "net" + + "github.com/pion/stun" +) + +// Sender is responsible for building a message and sending it to the given addr. +type Sender func(conn net.PacketConn, addr net.Addr, attrs ...stun.Setter) error + +// defaultBuildAndSend is a sender default implementation. +func defaultBuildAndSend(conn net.PacketConn, dst net.Addr, attrs ...stun.Setter) error { + msg, err := stun.Build(attrs...) + if err != nil { + return err + } + _, err = conn.WriteTo(msg.Raw, dst) + return err +} diff --git a/vendor/github.com/pion/turn/server.go b/vendor/github.com/pion/turn/server.go new file mode 100644 index 00000000..fea5ad1a --- /dev/null +++ b/vendor/github.com/pion/turn/server.go @@ -0,0 +1,424 @@ +package turn + +import ( + "crypto/md5" // #nosec + "fmt" + "io" + "math/rand" + "net" + "strconv" + "sync" + "time" + + "github.com/pion/logging" + "github.com/pion/stun" + "github.com/pion/transport/vnet" + "github.com/pion/turn/internal/allocation" + "github.com/pion/turn/internal/proto" + "github.com/pkg/errors" +) + +const ( + maxStunMessageSize = 1500 +) + +// AuthHandler is a callback used to handle incoming auth requests, allowing users to customize Pion TURN +// with custom behavior +type AuthHandler func(username string, srcAddr net.Addr) (password string, ok bool) + +// ServerConfig is a bag of config parameters for Server. +type ServerConfig struct { + // Realm sets the realm for this server + Realm string + // AuthHandler is the handler called on each incoming auth requests. + AuthHandler AuthHandler + // ChannelBindTimeout sets the lifetime of channel binding. Defaults to 10 minutes. + ChannelBindTimeout time.Duration + // ListeningPort sets the listening port number. Defaults to 3478. + ListeningPort int + // LoggerFactory must be set for logging from this server. + LoggerFactory logging.LoggerFactory + // Net is used by pion developers. Do not use in your application. + Net *vnet.Net + // Software is the STUN SOFTWARE attribute. Useful for debugging purpose. + Software string + // Sender is a custom implementation of the request Sender. + Sender Sender +} + +type listener struct { + conn net.PacketConn + closeCh chan struct{} +} + +// Server is an instance of the Pion TURN server +type Server struct { + lock sync.RWMutex + listeners []*listener + listenIPs []net.IP + relayIPs []net.IP + listenPort int + realm string + authHandler AuthHandler + manager *allocation.Manager + reservationManager *allocation.ReservationManager + channelBindTimeout time.Duration + log logging.LeveledLogger + net *vnet.Net + software stun.Software + sender Sender +} + +// NewServer creates the Pion TURN server +func NewServer(config *ServerConfig) *Server { + log := config.LoggerFactory.NewLogger("turn") + + if config.Net == nil { + config.Net = vnet.NewNet(nil) // defaults to native operation + } else { + log.Warn("vnet is enabled") + } + + if config.Sender == nil { + config.Sender = defaultBuildAndSend + } + + manager := allocation.NewManager(&allocation.ManagerConfig{ + LeveledLogger: log, + Net: config.Net, + }) + + listenPort := config.ListeningPort + if listenPort == 0 { + listenPort = 3478 + } + + channelBindTimeout := config.ChannelBindTimeout + if channelBindTimeout == 0 { + channelBindTimeout = proto.DefaultLifetime + } + + return &Server{ + listenPort: listenPort, + realm: config.Realm, + authHandler: config.AuthHandler, + manager: manager, + reservationManager: &allocation.ReservationManager{}, + channelBindTimeout: channelBindTimeout, + log: log, + net: config.Net, + software: stun.NewSoftware(config.Software), + sender: config.Sender, + } +} + +// AddListeningIPAddr adds a listening IP address. +// If not specified, it will automatically assigns the listening IP addresses +// from the system. +// This method must be called before calling Start(). +func (s *Server) AddListeningIPAddr(addrStr string) error { + ip := net.ParseIP(addrStr) + if ip.To4() == nil { + return fmt.Errorf("Non-IPv4 address is not supported") + } + + if ip.IsLinkLocalUnicast() { + return fmt.Errorf("link-local unicast address is not allowed") + } + s.listenIPs = append(s.listenIPs, ip) + return nil +} + +// AddRelayIPAddr adds a listening IP address. +// Note: current implementation can have only one relay IP address. +// If not specified, it will automatically assigns the relay IP addresses +// from the system. +// This method must be called before calling Start(). +func (s *Server) AddRelayIPAddr(addrStr string) error { + ip := net.ParseIP(addrStr) + if ip.To4() == nil { + return fmt.Errorf("Non-IPv4 address is not supported") + } + + if ip.IsLinkLocalUnicast() { + return fmt.Errorf("link-local unicast address is not allowed") + } + + if ip.IsUnspecified() { + return fmt.Errorf("unspecified IP is not allowed") + } + s.relayIPs = append(s.relayIPs, ip) + return nil +} + +// caller must hold the mutex +func (s *Server) gatherSystemIPAddrs() ([]net.IP, error) { + s.log.Debug("gathering local IP address...") + + var ips []net.IP + + ifs, err := s.net.Interfaces() + if err != nil { + return nil, err + } + for _, ifc := range ifs { + if ifc.Flags&net.FlagUp == 0 { + continue // skip if interface is not up + } + + if ifc.Flags&net.FlagLoopback != 0 { + continue // skip loopback address + } + + addrs, err := ifc.Addrs() + if err != nil { + continue + } + + for _, addr := range addrs { + var ip net.IP + switch addr := addr.(type) { + case *net.IPNet: + ip = addr.IP + case *net.IPAddr: + ip = addr.IP + } + + if ip == nil { + return nil, fmt.Errorf("invalid IP address: %s", addr.String()) + } + + if ip.To4() == nil { + continue // skip non-IPv4 address + } + + if ip.IsLinkLocalUnicast() { + continue + } + + s.log.Debugf("- found local IP: %s", ip.String()) + ips = append(ips, ip) + } + } + + return ips, nil +} + +// Listen starts listening and handling TURN traffic +// caller must hold the mutex +func (s *Server) listen(localIP net.IP) error { + network := "udp4" + listenAddr := fmt.Sprintf("%s:%d", localIP.String(), s.listenPort) + conn, err := s.net.ListenPacket(network, listenAddr) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("Failed to listen on %s", listenAddr)) + } + + laddr := conn.LocalAddr() + s.log.Infof("Listening on %s:%s", laddr.Network(), laddr.String()) + + closeCh := make(chan struct{}) + s.listeners = append(s.listeners, &listener{ + conn: conn, + closeCh: closeCh, + }) + + go func() { + buf := make([]byte, maxStunMessageSize) + for { + n, addr, err := conn.ReadFrom(buf) + if err != nil { + s.log.Debugf("exit read loop on error: %s", err.Error()) + break + } + + if err := s.handleUDPPacket(conn, addr, buf[:n]); err != nil { + s.log.Error(err.Error()) + } + } + + close(closeCh) + }() + + return nil +} + +// Start starts the server. +func (s *Server) Start() error { + s.lock.Lock() + defer s.lock.Unlock() + + var ips []net.IP + + if len(s.listenIPs) == 0 { + var err error + ips, err = s.gatherSystemIPAddrs() + if err != nil { + return err + } + if len(ips) == 0 { + return fmt.Errorf("no local IP address found") + } + + s.listenIPs = ips + } + + // If s.relayIPs is empty, use s.listenIPs + if len(s.relayIPs) == 0 { + s.relayIPs = s.listenIPs + } + + for _, localIP := range s.listenIPs { + err := s.listen(localIP) + if err != nil { + return err + } + } + + return nil +} + +// Close closes the connection. +func (s *Server) Close() error { + var toJoin []*listener + var err error + + func() { + s.lock.RLock() + defer s.lock.RUnlock() + + if err2 := s.manager.Close(); err2 != nil { + err = err2 + } + + for _, l := range s.listeners { + err2 := l.conn.Close() + if err2 != nil { + s.log.Debugf("Close() returned error: %s", err2.Error()) + continue + } + toJoin = append(toJoin, l) + } + }() + + for _, l := range s.listeners { + <-l.closeCh + } + + return err +} + +// caller must hold the mutex +func (s *Server) handleUDPPacket(conn net.PacketConn, srcAddr net.Addr, buf []byte) error { + s.lock.Lock() + defer s.lock.Unlock() + + s.log.Debugf("received %d bytes of udp from %s on %s", + len(buf), + srcAddr.String(), + conn.LocalAddr().String(), + ) + if proto.IsChannelData(buf) { + return s.handleDataPacket(conn, srcAddr, buf) + } + + return s.handleTURNPacket(conn, srcAddr, buf) +} + +// caller must hold the mutex +func (s *Server) handleDataPacket(conn net.PacketConn, srcAddr net.Addr, buf []byte) error { + s.log.Debugf("received DataPacket from %s", srcAddr.String()) + c := proto.ChannelData{Raw: buf} + if err := c.Decode(); err != nil { + return errors.Wrap(err, "Failed to create channel data from packet") + } + + err := s.handleChannelData(conn, srcAddr, &c) + if err != nil { + err = errors.Errorf("unable to handle ChannelData from %v: %v", srcAddr, err) + } + + return err +} + +// caller must hold the mutex +func (s *Server) handleTURNPacket(conn net.PacketConn, srcAddr net.Addr, buf []byte) error { + s.log.Debug("handleTURNPacket") + m := &stun.Message{Raw: append([]byte{}, buf...)} + if err := m.Decode(); err != nil { + return errors.Wrap(err, "failed to create stun message from packet") + } + + h, err := s.getMessageHandler(m.Type.Class, m.Type.Method) + if err != nil { + return errors.Errorf("unhandled STUN packet %v-%v from %v: %v", m.Type.Method, m.Type.Class, srcAddr, err) + } + + err = h(conn, srcAddr, m) + if err != nil { + return errors.Errorf("failed to handle %v-%v from %v: %v", m.Type.Method, m.Type.Class, srcAddr, err) + } + + return nil +} + +type messageHandler func(conn net.PacketConn, srcAddr net.Addr, m *stun.Message) error + +func (s *Server) getMessageHandler(class stun.MessageClass, method stun.Method) (messageHandler, error) { + switch class { + case stun.ClassIndication: + switch method { + case stun.MethodSend: + return s.handleSendIndication, nil + default: + return nil, errors.Errorf("unexpected method: %s", method) + } + + case stun.ClassRequest: + switch method { + case stun.MethodAllocate: + return s.handleAllocateRequest, nil + case stun.MethodRefresh: + return s.handleRefreshRequest, nil + case stun.MethodCreatePermission: + return s.handleCreatePermissionRequest, nil + case stun.MethodChannelBind: + return s.handleChannelBindRequest, nil + case stun.MethodBinding: + return s.handleBindingRequest, nil + default: + return nil, errors.Errorf("unexpected method: %s", method) + } + + default: + return nil, errors.Errorf("unexpected class: %s", class) + } +} + +func randSeq(n int) string { + letters := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") + b := make([]rune, n) + for i := range b { + b[i] = letters[rand.Intn(len(letters))] + } + return string(b) +} + +// TODO, include time info support stale nonces +func buildNonce() (string, error) { + /* #nosec */ + h := md5.New() + now := time.Now().Unix() + if _, err := io.WriteString(h, strconv.FormatInt(now, 10)); err != nil { + return "", errors.Wrap(err, fmt.Sprintf("Failed generating nonce %v \n", err)) + } + if _, err := io.WriteString(h, strconv.FormatInt(rand.Int63(), 10)); err != nil { + return "", errors.Wrap(err, fmt.Sprintf("Failed generating nonce %v \n", err)) + } + return fmt.Sprintf("%x", h.Sum(nil)), nil +} + +func assertMessageIntegrity(m *stun.Message, ourKey []byte) error { + messageIntegrityAttr := stun.MessageIntegrity(ourKey) + return messageIntegrityAttr.Check(m) +} diff --git a/vendor/github.com/pion/turn/stun.go b/vendor/github.com/pion/turn/stun.go new file mode 100644 index 00000000..becdfb13 --- /dev/null +++ b/vendor/github.com/pion/turn/stun.go @@ -0,0 +1,24 @@ +package turn + +import ( + "net" + + "github.com/pion/stun" + "github.com/pion/turn/internal/ipnet" +) + +// caller must hold the mutex +func (s *Server) handleBindingRequest(conn net.PacketConn, srcAddr net.Addr, m *stun.Message) error { + s.log.Debugf("received BindingRequest from %s", srcAddr.String()) + ip, port, err := ipnet.AddrIPPort(srcAddr) + if err != nil { + return err + } + + attrs := s.makeAttrs(m.TransactionID, stun.BindingSuccess, &stun.XORMappedAddress{ + IP: ip, + Port: port, + }, stun.Fingerprint) + + return s.sender(conn, srcAddr, attrs...) +} diff --git a/vendor/github.com/pion/turn/turn.go b/vendor/github.com/pion/turn/turn.go new file mode 100644 index 00000000..e998d9ae --- /dev/null +++ b/vendor/github.com/pion/turn/turn.go @@ -0,0 +1,493 @@ +package turn + +import ( + "crypto/md5" // #nosec + "fmt" + "net" + "strings" + "time" + + "github.com/pion/stun" + "github.com/pion/turn/internal/allocation" + "github.com/pion/turn/internal/ipnet" + "github.com/pion/turn/internal/proto" + "github.com/pkg/errors" +) + +const ( + maximumLifetime = time.Hour // https://tools.ietf.org/html/rfc5766#section-6.2 defines 3600 seconds recommendation +) + +type curriedSend func(class stun.MessageClass, method stun.Method, transactionID [stun.TransactionIDSize]byte, attrs ...stun.Setter) error + +func authenticateRequest(curriedSend curriedSend, m *stun.Message, callingMethod stun.Method, realm string, authHandler AuthHandler, srcAddr net.Addr) (stun.MessageIntegrity, string, error) { + handleErr := func(err error) (stun.MessageIntegrity, string, error) { + if sendErr := curriedSend(stun.ClassErrorResponse, callingMethod, m.TransactionID, + &stun.ErrorCodeAttribute{Code: stun.CodeBadRequest}, + ); sendErr != nil { + err = errors.Errorf(strings.Join([]string{sendErr.Error(), err.Error()}, "\n")) + } + return stun.MessageIntegrity{}, "", err + } + + if !m.Contains(stun.AttrMessageIntegrity) { + nonce, err := buildNonce() + if err != nil { + return stun.MessageIntegrity{}, "", err + } + + return nil, "", curriedSend(stun.ClassErrorResponse, callingMethod, m.TransactionID, + &stun.ErrorCodeAttribute{Code: stun.CodeUnauthorized}, + stun.NewNonce(nonce), + stun.NewRealm(realm), + ) + + } + + var ourKey [16]byte + nonceAttr := &stun.Nonce{} + usernameAttr := &stun.Username{} + realmAttr := &stun.Realm{} + + if err := realmAttr.GetFrom(m); err != nil { + return handleErr(err) + } + + if err := nonceAttr.GetFrom(m); err != nil { + return handleErr(err) + } + + if err := usernameAttr.GetFrom(m); err != nil { + return handleErr(err) + } + + password, ok := authHandler(usernameAttr.String(), srcAddr) + if !ok { + return handleErr(errors.Errorf("No user exists for %s", usernameAttr.String())) + } + + /* #nosec */ + ourKey = md5.Sum([]byte(usernameAttr.String() + ":" + realmAttr.String() + ":" + password)) + if err := assertMessageIntegrity(m, ourKey[:]); err != nil { + return handleErr(err) + } + + return stun.NewLongTermIntegrity(usernameAttr.String(), realmAttr.String(), password), usernameAttr.String(), nil +} + +func assertDontFragment(curriedSend curriedSend, m *stun.Message, attr stun.Setter) error { + if m.Contains(stun.AttrDontFragment) { + err := errors.Errorf("no support for DONT-FRAGMENT") + if sendErr := curriedSend(stun.ClassErrorResponse, stun.MethodAllocate, m.TransactionID, + &stun.ErrorCodeAttribute{Code: stun.CodeUnknownAttribute}, + &stun.UnknownAttributes{stun.AttrDontFragment}, + attr, + ); sendErr != nil { + err = errors.Errorf(strings.Join([]string{sendErr.Error(), err.Error()}, "\n")) + } + return err + } + return nil +} + +// https://tools.ietf.org/html/rfc5766#section-6.2 +// caller must hold the mutex +func (s *Server) handleAllocateRequest(conn net.PacketConn, srcAddr net.Addr, m *stun.Message) error { + s.log.Debugf("received AllocateRequest from %s", srcAddr.String()) + dstAddr := conn.LocalAddr() + curriedSend := func(class stun.MessageClass, method stun.Method, transactionID [stun.TransactionIDSize]byte, attrs ...stun.Setter) error { + return s.sender(conn, srcAddr, s.makeAttrs(transactionID, stun.NewType(method, class), attrs...)...) + } + respondWithError := func(err error, messageIntegrity stun.MessageIntegrity, errorCode stun.ErrorCode) error { + if sendErr := curriedSend(stun.ClassErrorResponse, stun.MethodAllocate, m.TransactionID, + &stun.ErrorCodeAttribute{Code: errorCode}, + messageIntegrity, + ); sendErr != nil { + err = errors.Errorf(strings.Join([]string{sendErr.Error(), err.Error()}, "\n")) + } + return err + } + + // 1. The server MUST require that the request be authenticated. This + // authentication MUST be done using the long-term credential + // mechanism of [https://tools.ietf.org/html/rfc5389#section-10.2.2] + // unless the client and server agree to use another mechanism through + // some procedure outside the scope of this document. + messageIntegrity, _, err := authenticateRequest(curriedSend, m, stun.MethodAllocate, s.realm, s.authHandler, srcAddr) + if err != nil { + return err + } + if messageIntegrity == nil { + return nil + } + + fiveTuple := &allocation.FiveTuple{ + SrcAddr: srcAddr, + DstAddr: dstAddr, + Protocol: allocation.UDP, + } + requestedPort := 0 + reservationToken := "" + + // 2. The server checks if the 5-tuple is currently in use by an + // existing allocation. If yes, the server rejects the request with + // a 437 (Allocation Mismatch) error. + if alloc := s.manager.GetAllocation(fiveTuple); alloc != nil { + return respondWithError(errors.Errorf("Relay already allocated for 5-TUPLE"), messageIntegrity, stun.CodeAllocMismatch) + } + + // 3. The server checks if the request contains a REQUESTED-TRANSPORT + // attribute. If the REQUESTED-TRANSPORT attribute is not included + // or is malformed, the server rejects the request with a 400 (Bad + // Request) error. Otherwise, if the attribute is included but + // specifies a protocol other that UDP, the server rejects the + // request with a 442 (Unsupported Transport Protocol) error. + var requestedTransport proto.RequestedTransport + if err = requestedTransport.GetFrom(m); err != nil { + return respondWithError(err, messageIntegrity, stun.CodeBadRequest) + } + if requestedTransport.Protocol != proto.ProtoUDP { + return respondWithError(err, messageIntegrity, stun.CodeUnsupportedTransProto) + } + + // 4. The request may contain a DONT-FRAGMENT attribute. If it does, + // but the server does not support sending UDP datagrams with the DF + // bit set to 1 (see Section 12), then the server treats the DONT- + // FRAGMENT attribute in the Allocate request as an unknown + // comprehension-required attribute. + if err = assertDontFragment(curriedSend, m, messageIntegrity); err != nil { + return err + } + + // 5. The server checks if the request contains a RESERVATION-TOKEN + // attribute. If yes, and the request also contains an EVEN-PORT + // attribute, then the server rejects the request with a 400 (Bad + // Request) error. Otherwise, it checks to see if the token is + // valid (i.e., the token is in range and has not expired and the + // corresponding relayed transport address is still available). If + // the token is not valid for some reason, the server rejects the + // request with a 508 (Insufficient Capacity) error. + var reservationTokenAttr proto.ReservationToken + if err = reservationTokenAttr.GetFrom(m); err == nil { + var evenPort proto.EvenPort + if err = evenPort.GetFrom(m); err == nil { + return respondWithError(errors.Errorf("Request must not contain RESERVATION-TOKEN and EVEN-PORT"), messageIntegrity, stun.CodeBadRequest) + } + + allocationPort, reservationFound := s.reservationManager.GetReservation(string(reservationTokenAttr)) + if !reservationFound { + return respondWithError(errors.Errorf("No reservation found with token %s", string(reservationTokenAttr)), messageIntegrity, stun.CodeBadRequest) + } + requestedPort = allocationPort + 1 + } + + // 6. The server checks if the request contains an EVEN-PORT attribute. + // If yes, then the server checks that it can satisfy the request + // (i.e., can allocate a relayed transport address as described + // below). If the server cannot satisfy the request, then the + // server rejects the request with a 508 (Insufficient Capacity) + // error. + var evenPort proto.EvenPort + if err = evenPort.GetFrom(m); err == nil { + randomPort := 0 + randomPort, err = allocation.GetRandomEvenPort() + if err != nil { + return respondWithError(err, messageIntegrity, stun.CodeInsufficientCapacity) + } + requestedPort = randomPort + reservationToken = randSeq(8) + } + + // 7. At any point, the server MAY choose to reject the request with a + // 486 (Allocation Quota Reached) error if it feels the client is + // trying to exceed some locally defined allocation quota. The + // server is free to define this allocation quota any way it wishes, + // but SHOULD define it based on the username used to authenticate + // the request, and not on the client's transport address. + + // 8. Also at any point, the server MAY choose to reject the request + // with a 300 (Try Alternate) error if it wishes to redirect the + // client to a different server. The use of this error code and + // attribute follow the specification in [RFC5389]. + // Check current usage vs redis usage of other servers + // if bad, redirect { stun.AttrErrorCode, 300 } + lifetimeDuration := allocationLifeTime(m) + a, err := s.manager.CreateAllocation( + fiveTuple, conn, + s.relayIPs[0], // TODO: allow more than one relay IP + requestedPort, + lifetimeDuration) + if err != nil { + return respondWithError(err, messageIntegrity, stun.CodeInsufficientCapacity) + } + + // Once the allocation is created, the server replies with a success + // response. The success response contains: + // * An XOR-RELAYED-ADDRESS attribute containing the relayed transport + // address. + // * A LIFETIME attribute containing the current value of the time-to- + // expiry timer. + // * A RESERVATION-TOKEN attribute (if a second relayed transport + // address was reserved). + // * An XOR-MAPPED-ADDRESS attribute containing the client's IP address + // and port (from the 5-tuple). + + srcIP, srcPort, err := ipnet.AddrIPPort(srcAddr) + if err != nil { + return respondWithError(err, messageIntegrity, stun.CodeBadRequest) + } + + _, relayPort, err := ipnet.AddrIPPort(a.RelayAddr) + if err != nil { + return respondWithError(err, messageIntegrity, stun.CodeBadRequest) + } + + dstIP, _, err := ipnet.AddrIPPort(dstAddr) + if err != nil { + return respondWithError(err, messageIntegrity, stun.CodeBadRequest) + } + + responseAttrs := []stun.Setter{ + &proto.RelayedAddress{ + IP: dstIP, + Port: relayPort, + }, + &proto.Lifetime{ + Duration: lifetimeDuration, + }, + &stun.XORMappedAddress{ + IP: srcIP, + Port: srcPort, + }, + } + + if reservationToken != "" { + s.reservationManager.CreateReservation(reservationToken, relayPort) + responseAttrs = append(responseAttrs, proto.ReservationToken([]byte(reservationToken))) + } + + return curriedSend(stun.ClassSuccessResponse, stun.MethodAllocate, m.TransactionID, append(responseAttrs, messageIntegrity)...) +} + +// caller must hold the mutex +func (s *Server) handleRefreshRequest(conn net.PacketConn, srcAddr net.Addr, m *stun.Message) error { + s.log.Debugf("received RefreshRequest from %s", srcAddr.String()) + dstAddr := conn.LocalAddr() + curriedSend := func(class stun.MessageClass, method stun.Method, transactionID [stun.TransactionIDSize]byte, attrs ...stun.Setter) error { + return s.sender(conn, srcAddr, s.makeAttrs(transactionID, stun.NewType(method, class), attrs...)...) + } + messageIntegrity, _, err := authenticateRequest(curriedSend, m, stun.MethodCreatePermission, s.realm, s.authHandler, srcAddr) + if err != nil { + return err + } + + a := s.manager.GetAllocation(&allocation.FiveTuple{ + SrcAddr: srcAddr, + DstAddr: dstAddr, + Protocol: allocation.UDP, + }) + if a == nil { + return errors.Errorf("No allocation found for %v:%v", srcAddr, dstAddr) + } + + lifetimeDuration := allocationLifeTime(m) + a.Refresh(lifetimeDuration) + + return curriedSend(stun.ClassSuccessResponse, stun.MethodRefresh, m.TransactionID, + &proto.Lifetime{ + Duration: lifetimeDuration, + }, + messageIntegrity, + ) +} + +// caller must hold the mutex +func (s *Server) handleCreatePermissionRequest(conn net.PacketConn, srcAddr net.Addr, m *stun.Message) error { + s.log.Debugf("received CreatePermission from %s", srcAddr.String()) + dstAddr := conn.LocalAddr() + curriedSend := func(class stun.MessageClass, method stun.Method, transactionID [stun.TransactionIDSize]byte, attrs ...stun.Setter) error { + return s.sender(conn, srcAddr, s.makeAttrs(transactionID, stun.NewType(method, class), attrs...)...) + } + + a := s.manager.GetAllocation(&allocation.FiveTuple{ + SrcAddr: srcAddr, + DstAddr: dstAddr, + Protocol: allocation.UDP, + }) + if a == nil { + return errors.Errorf("No allocation found for %v:%v", srcAddr, dstAddr) + } + + messageIntegrity, _, err := authenticateRequest(curriedSend, m, stun.MethodCreatePermission, s.realm, s.authHandler, srcAddr) + if err != nil { + return err + } + addCount := 0 + + if err := m.ForEach(stun.AttrXORPeerAddress, func(m *stun.Message) error { + var peerAddress proto.PeerAddress + if err := peerAddress.GetFrom(m); err != nil { + return err + } + + s.log.Debugf("adding permission for %s", fmt.Sprintf("%s:%d", + peerAddress.IP.String(), peerAddress.Port)) + a.AddPermission(allocation.NewPermission( + &net.UDPAddr{ + IP: peerAddress.IP, + Port: peerAddress.Port, + }, + s.log, + )) + addCount++ + return nil + }); err != nil { + addCount = 0 + } + + respClass := stun.ClassSuccessResponse + if addCount == 0 { + respClass = stun.ClassErrorResponse + } + + return curriedSend(respClass, stun.MethodCreatePermission, m.TransactionID, + messageIntegrity) +} + +// caller must hold the mutex +func (s *Server) handleSendIndication(conn net.PacketConn, srcAddr net.Addr, m *stun.Message) error { + s.log.Debugf("received SendIndication from %s", srcAddr.String()) + dstAddr := conn.LocalAddr() + a := s.manager.GetAllocation(&allocation.FiveTuple{ + SrcAddr: srcAddr, + DstAddr: dstAddr, + Protocol: allocation.UDP, + }) + if a == nil { + return errors.Errorf("No allocation found for %v:%v", srcAddr, dstAddr) + } + + dataAttr := proto.Data{} + if err := dataAttr.GetFrom(m); err != nil { + return err + } + + peerAddress := proto.PeerAddress{} + if err := peerAddress.GetFrom(m); err != nil { + return err + } + + msgDst := &net.UDPAddr{IP: peerAddress.IP, Port: peerAddress.Port} + if perm := a.GetPermission(msgDst); perm == nil { + return errors.Errorf("Unable to handle send-indication, no permission added: %v", msgDst) + } + + l, err := a.RelaySocket.WriteTo(dataAttr, msgDst) + if l != len(dataAttr) { + return errors.Errorf("packet write smaller than packet %d != %d (expected) err: %v", l, len(dataAttr), err) + } + return err +} + +// caller must hold the mutex +func (s *Server) handleChannelBindRequest(conn net.PacketConn, srcAddr net.Addr, m *stun.Message) error { + s.log.Debugf("received ChannelBindRequest from %s", srcAddr.String()) + dstAddr := conn.LocalAddr() + errorSend := func(err error, attrs ...stun.Setter) error { + sendErr := s.sender(conn, srcAddr, s.makeAttrs(m.TransactionID, stun.NewType(stun.MethodChannelBind, stun.ClassErrorResponse), attrs...)...) + if sendErr != nil { + err = errors.Errorf(strings.Join([]string{sendErr.Error(), err.Error()}, "\n")) + } + return err + } + + a := s.manager.GetAllocation(&allocation.FiveTuple{ + SrcAddr: srcAddr, + DstAddr: dstAddr, + Protocol: allocation.UDP, + }) + if a == nil { + return errors.Errorf("No allocation found for %v:%v", srcAddr, dstAddr) + } + + messageIntegrity, _, err := authenticateRequest(func(class stun.MessageClass, method stun.Method, transactionID [stun.TransactionIDSize]byte, attrs ...stun.Setter) error { + return s.sender(conn, srcAddr, s.makeAttrs(m.TransactionID, stun.NewType(method, class))...) + }, m, stun.MethodChannelBind, s.realm, s.authHandler, srcAddr) + if err != nil { + return errorSend(err, stun.CodeBadRequest) + } + + var channel proto.ChannelNumber + if err = channel.GetFrom(m); err != nil { + return errorSend(err, stun.CodeBadRequest) + } + + peerAddr := proto.PeerAddress{} + if err = peerAddr.GetFrom(m); err != nil { + return errorSend(err, stun.CodeBadRequest) + } + + s.log.Debugf("binding channel %d to %s", + channel, + fmt.Sprintf("%s:%d", peerAddr.IP.String(), peerAddr.Port)) + err = a.AddChannelBind(allocation.NewChannelBind( + channel, + &net.UDPAddr{IP: peerAddr.IP, Port: peerAddr.Port}, + s.log, + ), s.channelBindTimeout) + if err != nil { + return errorSend(err, stun.CodeBadRequest) + } + + return s.sender(conn, srcAddr, s.makeAttrs(m.TransactionID, stun.NewType(stun.MethodChannelBind, stun.ClassSuccessResponse), messageIntegrity)...) +} + +func (s *Server) handleChannelData(conn net.PacketConn, srcAddr net.Addr, c *proto.ChannelData) error { + s.log.Debugf("received ChannelData from %s", srcAddr.String()) + dstAddr := conn.LocalAddr() + a := s.manager.GetAllocation(&allocation.FiveTuple{ + SrcAddr: srcAddr, + DstAddr: dstAddr, + Protocol: allocation.UDP, + }) + if a == nil { + return errors.Errorf("No allocation found for %v:%v", srcAddr, dstAddr) + } + + channel := a.GetChannelByNumber(c.Number) + if channel == nil { + return errors.Errorf("No channel bind found for %x \n", uint16(c.Number)) + } + + l, err := a.RelaySocket.WriteTo(c.Data, channel.Peer) + if err != nil { + return errors.Wrap(err, "failed writing to socket") + } + + if l != len(c.Data) { + return errors.Errorf("packet write smaller than packet %d != %d (expected)", l, len(c.Data)) + } + + return nil +} + +func (s *Server) makeAttrs(transactionID [stun.TransactionIDSize]byte, msgType stun.MessageType, additional ...stun.Setter) []stun.Setter { + attrs := append([]stun.Setter{&stun.Message{TransactionID: transactionID}, msgType}, additional...) + if len(s.software) > 0 { + attrs = append(attrs, s.software) + } + return attrs +} + +func allocationLifeTime(m *stun.Message) time.Duration { + lifetimeDuration := proto.DefaultLifetime + + var lifetime proto.Lifetime + if err := lifetime.GetFrom(m); err == nil { + if lifetime.Duration < maximumLifetime { + lifetimeDuration = lifetime.Duration + } + } + + return lifetimeDuration +} diff --git a/vendor/github.com/pion/turnc/.codecov.yml b/vendor/github.com/pion/turnc/.codecov.yml deleted file mode 100644 index 81481d4f..00000000 --- a/vendor/github.com/pion/turnc/.codecov.yml +++ /dev/null @@ -1,9 +0,0 @@ -coverage: - status: - patch: off - project: - default: - # basic - target: 80 - threshold: null - base: auto diff --git a/vendor/github.com/pion/turnc/.editorconfig b/vendor/github.com/pion/turnc/.editorconfig deleted file mode 100644 index d2b32061..00000000 --- a/vendor/github.com/pion/turnc/.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -# http://editorconfig.org/ - -root = true - -[*] -charset = utf-8 -insert_final_newline = true -trim_trailing_whitespace = true -end_of_line = lf - -[*.go] -indent_style = tab -indent_size = 4 - -[{*.yml,*.yaml}] -indent_style = space -indent_size = 2 - -# Makefiles always use tabs for indentation -[Makefile] -indent_style = tab diff --git a/vendor/github.com/pion/turnc/.gitignore b/vendor/github.com/pion/turnc/.gitignore deleted file mode 100644 index 1d6f6909..00000000 --- a/vendor/github.com/pion/turnc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -coverage.txt -.idea diff --git a/vendor/github.com/pion/turnc/.golangci.yml b/vendor/github.com/pion/turnc/.golangci.yml deleted file mode 100644 index 7acb8ed3..00000000 --- a/vendor/github.com/pion/turnc/.golangci.yml +++ /dev/null @@ -1,104 +0,0 @@ -linters-settings: - govet: - check-shadowing: true - golint: - min-confidence: 0 - gocyclo: - min-complexity: 15 - maligned: - suggest-new: true - dupl: - threshold: 100 - goconst: - min-len: 3 - min-occurrences: 3 - misspell: - locale: US - lll: - line-length: 140 - goimports: - local-prefixes: github.com/pion - gocritic: - enabled-tags: - - performance - - style - - experimental - disabled-checks: - - commentedOutCode - - sloppyReassign - -issues: - exclude: - - "`assertHMACSize` - `blocksize` always receives `64`" - - "hugeParam: o is heavy" - exclude-rules: - - text: "string ``" - linters: - - goconst - - # Exclude some linters from running on tests files. - - path: _test\.go - linters: - - gocyclo - - errcheck - - dupl - - gosec - - goconst - - - path: client\.go - linters: - - maligned - - # Ease some gocritic warnings on test files. - - path: testutil\.go - text: "(rangeValCopy)" - linters: - - gocritic - - # Ease some gocritic warnings on test files. - - path: _test\.go - text: "(unnamedResult|exitAfterDefer|unlambda)" - linters: - - gocritic - - # Exclude known linters from partially hard-vendored code, - # which is impossible to exclude via "nolint" comments. - - path: internal/hmac/ - text: "weak cryptographic primitive" - linters: - - gosec - - path: internal/hmac/ - text: "Write\\` is not checked" - linters: - - errcheck - - # Ease linting on benchmarking code. - - path: cmd/stun-bench/ - linters: - - gosec - - errcheck - - unparam - - - path: ^cmd/ - linters: - - gocyclo - - path: ^cmd/ - text: "(unnamedResult|exitAfterDefer)" - linters: - - gocritic - -linters: - enable-all: true - disable: - - prealloc - - gochecknoglobals - - scopelint - - dupl - - interfacer - -run: - skip-dirs: - - e2e - - fuzz - - testdata - - api diff --git a/vendor/github.com/pion/turnc/.travis.yml b/vendor/github.com/pion/turnc/.travis.yml deleted file mode 100644 index 2703dfd9..00000000 --- a/vendor/github.com/pion/turnc/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: go - -sudo: false - -env: - global: - - GO111MODULE=on - - GOLANGCI_VER=v1.16.0 - -go: - - stable - -install: true - -before_script: - - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin $GOLANGCI_VER - -script: - - make assert - - make test - - make lint - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/pion/turnc/LICENSE b/vendor/github.com/pion/turnc/LICENSE deleted file mode 100644 index 15bc72f8..00000000 --- a/vendor/github.com/pion/turnc/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2019 - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/pion/turnc/Makefile b/vendor/github.com/pion/turnc/Makefile deleted file mode 100644 index 53e3fac0..00000000 --- a/vendor/github.com/pion/turnc/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -test-e2e: - cd e2e/coturn && ./test.sh -lint: - golangci-lint run -assert: - bash .github/assert-contributors.sh - bash .github/lint-disallowed-functions-in-library.sh - bash .github/lint-commit-message.sh -test: - @./go.test.sh diff --git a/vendor/github.com/pion/turnc/README.md b/vendor/github.com/pion/turnc/README.md deleted file mode 100644 index d58cf8c5..00000000 --- a/vendor/github.com/pion/turnc/README.md +++ /dev/null @@ -1,19 +0,0 @@ -[![Build Status](https://travis-ci.com/pion/turnc.svg?branch=master)](https://travis-ci.com/pion/turnc) -[![codecov](https://codecov.io/gh/pion/turnc/branch/master/graph/badge.svg)](https://codecov.io/gh/pion/turnc) -[![GoDoc](https://godoc.org/github.com/pion/turnc?status.svg)](https://godoc.org/github.com/pion/turnc) - -# TURNc - -Package `turnc` implements TURN [[RFC5766](https://tools.ietf.org/html/rfc5766)] client. -Based on [pion/stun](https://github.com/pion/stun) and [gortc/turn](https://github.com/gortc/turn) packages. - -*Work in progress* - -### Contributing -Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contributing)** to join the group of amazing people making this project possible: - -* [Aleksandr Razumov](https://github.com/ernado) -* [Sean DuBois](https://github.com/Sean-Der) - -## License -MIT diff --git a/vendor/github.com/pion/turnc/bypass_writer.go b/vendor/github.com/pion/turnc/bypass_writer.go deleted file mode 100644 index 23410a9b..00000000 --- a/vendor/github.com/pion/turnc/bypass_writer.go +++ /dev/null @@ -1,56 +0,0 @@ -package turnc - -import ( - "fmt" - "net" - "time" -) - -// bypassWriter wraps reader and writer connections, -// passing Read and SetReadDeadline to reader conn, -// Write, LocalAddr, RemoteAddr, SetWriteDeadline -// calls to writer. -type bypassWriter struct { - reader net.Conn - writer net.Conn -} - -func (w bypassWriter) Close() error { - rErr := w.reader.Close() - wErr := w.writer.Close() - if rErr == nil && wErr == nil { - return nil - } - return fmt.Errorf("reader: %v, writer: %v", rErr, wErr) -} - -func (w bypassWriter) LocalAddr() net.Addr { - return w.writer.LocalAddr() -} - -func (w bypassWriter) Read(b []byte) (n int, err error) { - return w.reader.Read(b) -} - -func (w bypassWriter) RemoteAddr() net.Addr { - return w.writer.RemoteAddr() -} - -func (w bypassWriter) SetDeadline(t time.Time) error { - if err := w.writer.SetDeadline(t); err != nil { - return err - } - return w.reader.SetDeadline(t) -} - -func (w bypassWriter) SetReadDeadline(t time.Time) error { - return w.reader.SetReadDeadline(t) -} - -func (w bypassWriter) SetWriteDeadline(t time.Time) error { - return w.writer.SetWriteDeadline(t) -} - -func (w bypassWriter) Write(b []byte) (n int, err error) { - return w.writer.Write(b) -} diff --git a/vendor/github.com/pion/turnc/client.go b/vendor/github.com/pion/turnc/client.go deleted file mode 100644 index 773f44ff..00000000 --- a/vendor/github.com/pion/turnc/client.go +++ /dev/null @@ -1,258 +0,0 @@ -package turnc - -import ( - "errors" - "io" - "net" - "sync" - "time" - - "github.com/gortc/turn" - - "github.com/pion/logging" - "github.com/pion/stun" -) - -// Client for TURN server. -// -// Provides transparent net.Conn interfaces to remote peers. -type Client struct { - log logging.LeveledLogger - con net.Conn - conClose bool - stun STUNClient - mux sync.RWMutex - username stun.Username - password string - realm stun.Realm - integrity stun.MessageIntegrity - alloc *Allocation // the only allocation - refreshRate time.Duration - done chan struct{} -} - -// Options contains available config for TURN client. -type Options struct { - Conn net.Conn - STUN STUNClient // optional STUN client - Log logging.LeveledLogger // defaults to Nop - - // Long-term integrity. - Username string - Password string - - // STUN client options. - RTO time.Duration - NoRetransmit bool - - // TURN options. - RefreshRate time.Duration - RefreshDisabled bool - - // ConnManualClose disables connection automatic close on Close(). - ConnManualClose bool -} - -// RefreshRate returns current rate of refresh requests. -func (c *Client) RefreshRate() time.Duration { return c.refreshRate } - -const defaultRefreshRate = time.Minute - -// New creates and initializes new TURN client. -func New(o Options) (*Client, error) { - if o.Conn == nil { - return nil, errors.New("connection not provided") - } - if o.Log == nil { - o.Log = nopLogger{} - } - c := &Client{ - password: o.Password, - log: o.Log, - conClose: true, - } - if o.ConnManualClose { - o.Log.Debug("manual close is enabled") - c.conClose = false - } - if o.STUN == nil { - // Setting up de-multiplexing. - m := newMultiplexer(o.Conn, c.log) - go m.discardData() // discarding any non-stun/turn data - o.Conn = bypassWriter{ - reader: m.turnL, - writer: m.conn, - } - // Starting STUN client on multiplexed connection. - var err error - stunOptions := []stun.ClientOption{ - stun.WithHandler(c.stunHandler), - } - if o.NoRetransmit { - stunOptions = append(stunOptions, stun.WithNoRetransmit) - } - if o.RTO > 0 { - stunOptions = append(stunOptions, stun.WithRTO(o.RTO)) - } - o.STUN, err = stun.NewClient(bypassWriter{ - reader: m.stunL, - writer: m.conn, - }, stunOptions...) - if err != nil { - return nil, err - } - } - c.done = make(chan struct{}) - c.stun = o.STUN - c.con = o.Conn - c.refreshRate = defaultRefreshRate - if o.RefreshRate > 0 { - c.refreshRate = o.RefreshRate - } - if o.RefreshDisabled { - c.refreshRate = 0 - } - if o.Username != "" { - c.username = stun.NewUsername(o.Username) - } - go c.readUntilClosed() - return c, nil -} - -// STUNClient abstracts STUN protocol interaction. -type STUNClient interface { - Indicate(m *stun.Message) error - Do(m *stun.Message, f func(e stun.Event)) error - Close() error -} - -var dataIndication = stun.NewType(stun.MethodData, stun.ClassIndication) - -func (c *Client) stunHandler(e stun.Event) { - if e.Error != nil { - // Just ignoring. - return - } - if e.Message.Type != dataIndication { - return - } - var ( - data turn.Data - addr turn.PeerAddress - ) - if err := e.Message.Parse(&data, &addr); err != nil { - c.log.Errorf("failed to parse while handling incoming STUN message: %v", err) - return - } - c.mux.RLock() - for i := range c.alloc.perms { - if !turn.Addr(c.alloc.perms[i].peerAddr).Equal(turn.Addr(addr)) { - continue - } - if _, err := c.alloc.perms[i].peerL.Write(data); err != nil { - c.log.Errorf("failed to write: %v", err) - } - } - c.mux.RUnlock() -} - -func (c *Client) handleChannelData(data *turn.ChannelData) { - c.log.Debugf("handleChannelData: 0x%x", int(data.Number)) - c.mux.RLock() - for i := range c.alloc.perms { - if data.Number != c.alloc.perms[i].Binding() { - continue - } - if _, err := c.alloc.perms[i].peerL.Write(data.Data); err != nil { - c.log.Errorf("failed to write: %v", err) - } - } - c.mux.RUnlock() -} - -func (c *Client) readUntilClosed() { - buf := make([]byte, 1500) - for { - n, err := c.con.Read(buf) - if err != nil { - if err == io.EOF { - continue - } - c.log.Debugf("read error: %v", err) - c.log.Info("connection closed") - break - } - data := buf[:n] - if !turn.IsChannelData(data) { - continue - } - cData := &turn.ChannelData{ - Raw: make([]byte, n), - } - copy(cData.Raw, data) - if err := cData.Decode(); err != nil { - panic(err) - } - go c.handleChannelData(cData) - } - close(c.done) -} - -func (c *Client) sendData(buf []byte, peerAddr *turn.PeerAddress) (int, error) { - err := c.stun.Indicate(stun.MustBuild(stun.TransactionID, - stun.NewType(stun.MethodSend, stun.ClassIndication), - turn.Data(buf), peerAddr, - )) - if err == nil { - return len(buf), nil - } - return 0, err -} - -func (c *Client) sendChan(buf []byte, n turn.ChannelNumber) (int, error) { - if !n.Valid() { - return 0, turn.ErrInvalidChannelNumber - } - d := &turn.ChannelData{ - Data: buf, - Number: n, - } - d.Encode() - return c.con.Write(d.Raw) -} - -func (c *Client) do(req, res *stun.Message) error { - var stunErr error - if doErr := c.stun.Do(req, func(e stun.Event) { - if e.Error != nil { - stunErr = e.Error - return - } - if res == nil { - return - } - if err := e.Message.CloneTo(res); err != nil { - stunErr = err - } - }); doErr != nil { - return doErr - } - return stunErr -} - -func (c *Client) Close() error { - if !c.conClose { - // TODO(ernado): Cleanup all resources. - return nil - } - c.log.Error("closing connection") - if err := c.con.Close(); err != nil { - return err - } - if err := c.stun.Close(); err != nil { - c.log.Errorf("failed to close stun client: %v", err) - } - <-c.done - c.log.Error("done signaled") - return nil -} diff --git a/vendor/github.com/pion/turnc/client_allocation.go b/vendor/github.com/pion/turnc/client_allocation.go deleted file mode 100644 index bfe0065c..00000000 --- a/vendor/github.com/pion/turnc/client_allocation.go +++ /dev/null @@ -1,209 +0,0 @@ -package turnc - -import ( - "context" - "errors" - "fmt" - "net" - - "github.com/gortc/turn" - - "github.com/pion/logging" - "github.com/pion/stun" -) - -// Allocation reflects TURN Allocation. -type Allocation struct { - log logging.LeveledLogger - client *Client - relayed turn.RelayedAddress - reflexive stun.XORMappedAddress - perms []*Permission // protected with client.mux - minBound turn.ChannelNumber - integrity stun.MessageIntegrity - nonce stun.Nonce -} - -func (a *Allocation) removePermission(p *Permission) { - a.client.mux.Lock() - newPerms := make([]*Permission, 0, len(a.perms)) - for _, permission := range a.perms { - if p == permission { - continue - } - newPerms = append(newPerms, permission) - } - a.perms = newPerms - a.client.mux.Unlock() -} - -var errUnauthorised = errors.New("unauthorised") - -// allocate expects client.mux locked. -func (c *Client) allocate(req, res *stun.Message) (*Allocation, error) { - if doErr := c.do(req, res); doErr != nil { - return nil, doErr - } - if res.Type == stun.NewType(stun.MethodAllocate, stun.ClassSuccessResponse) { - var ( - relayed turn.RelayedAddress - reflexive stun.XORMappedAddress - nonce stun.Nonce - ) - // Getting relayed and reflexive addresses from response. - if err := relayed.GetFrom(res); err != nil { - return nil, err - } - if err := reflexive.GetFrom(res); err != nil && err != stun.ErrAttributeNotFound { - return nil, err - } - // Getting nonce from request. - if err := nonce.GetFrom(req); err != nil && err != stun.ErrAttributeNotFound { - return nil, err - } - a := &Allocation{ - client: c, - log: c.log, - reflexive: reflexive, - relayed: relayed, - minBound: turn.MinChannelNumber, - integrity: c.integrity, - nonce: nonce, - } - c.alloc = a - return a, nil - } - // Anonymous allocate failed, trying to authenticate. - if res.Type.Method != stun.MethodAllocate { - return nil, fmt.Errorf("unexpected response type %s", res.Type) - } - var ( - code stun.ErrorCodeAttribute - ) - if err := code.GetFrom(res); err != nil { - return nil, err - } - if code.Code != stun.CodeUnauthorized { - return nil, fmt.Errorf("unexpected error code %d", code) - } - return nil, errUnauthorised -} - -// Allocate creates an allocation for current 5-tuple. Currently there can be -// only one allocation per client, because client wraps one net.Conn. -func (c *Client) Allocate() (*Allocation, error) { - var ( - nonce stun.Nonce - res = stun.New() - ) - req, reqErr := stun.Build(stun.TransactionID, - turn.AllocateRequest, turn.RequestedTransportUDP, - stun.Fingerprint, - ) - if reqErr != nil { - return nil, reqErr - } - a, allocErr := c.allocate(req, res) - if allocErr == nil { - return a, nil - } - if allocErr != errUnauthorised { - return nil, allocErr - } - // Anonymous allocate failed, trying to authenticate. - if err := nonce.GetFrom(res); err != nil { - return nil, err - } - if err := c.realm.GetFrom(res); err != nil { - return nil, err - } - c.realm = append([]byte(nil), c.realm...) - c.integrity = stun.NewLongTermIntegrity( - c.username.String(), c.realm.String(), c.password, - ) - // Trying to authorize. - if reqErr = req.Build(stun.TransactionID, - turn.AllocateRequest, turn.RequestedTransportUDP, - &c.username, &c.realm, - &nonce, - &c.integrity, stun.Fingerprint, - ); reqErr != nil { - return nil, reqErr - } - return c.allocate(req, res) -} - -// Create creates new permission to peer. -func (a *Allocation) Create(peer net.Addr) (*Permission, error) { - switch addr := peer.(type) { - case *net.UDPAddr: - return a.CreateUDP(addr) - default: - return nil, fmt.Errorf("unsupported addr type %T", peer) - } -} - -func (a *Allocation) allocate(peer turn.PeerAddress) error { - req := stun.New() - req.TransactionID = stun.NewTransactionID() - req.Type = stun.NewType(stun.MethodCreatePermission, stun.ClassRequest) - req.WriteHeader() - setters := make([]stun.Setter, 0, 10) - setters = append(setters, &peer) - if len(a.integrity) > 0 { - // Applying auth. - setters = append(setters, - a.nonce, a.client.username, a.client.realm, a.integrity, - ) - } - setters = append(setters, stun.Fingerprint) - for _, s := range setters { - if setErr := s.AddTo(req); setErr != nil { - return setErr - } - } - res := stun.New() - if doErr := a.client.do(req, res); doErr != nil { - return doErr - } - if res.Type.Class == stun.ClassErrorResponse { - var code stun.ErrorCodeAttribute - err := fmt.Errorf("unexpected error response: %s", res.Type) - if getErr := code.GetFrom(res); getErr == nil { - err = fmt.Errorf("unexpected error response: %s (error %s)", - res.Type, code, - ) - } - return err - } - return nil -} - -// Relayed returns the relayed address for the allocation -func (a *Allocation) Relayed() turn.RelayedAddress { - return a.relayed -} - -// CreateUDP creates new UDP Permission to peer with provided addr. -func (a *Allocation) CreateUDP(addr *net.UDPAddr) (*Permission, error) { - peer := turn.PeerAddress{ - IP: addr.IP, - Port: addr.Port, - } - if err := a.allocate(peer); err != nil { - return nil, err - } - p := &Permission{ - log: a.log, - peerAddr: peer, - client: a.client, - refreshRate: a.client.refreshRate, - } - p.ctx, p.cancel = context.WithCancel(context.Background()) - p.startRefreshLoop() - p.peerL, p.peerR = net.Pipe() - a.client.mux.Lock() - a.perms = append(a.perms, p) - a.client.mux.Unlock() - return p, nil -} diff --git a/vendor/github.com/pion/turnc/client_permission.go b/vendor/github.com/pion/turnc/client_permission.go deleted file mode 100644 index e5fa34be..00000000 --- a/vendor/github.com/pion/turnc/client_permission.go +++ /dev/null @@ -1,211 +0,0 @@ -package turnc - -import ( - "context" - "errors" - "fmt" - "net" - "sync" - "time" - - "github.com/gortc/turn" - - "github.com/pion/logging" - - "github.com/pion/stun" -) - -// Permission implements net.PacketConn. -type Permission struct { - log logging.LeveledLogger - mux sync.RWMutex - number turn.ChannelNumber - peerAddr turn.PeerAddress - peerL, peerR net.Conn - client *Client - ctx context.Context - cancel func() - wg sync.WaitGroup - refreshRate time.Duration -} - -// Read data from peer. -func (p *Permission) Read(b []byte) (n int, err error) { - return p.peerR.Read(b) -} - -// Bound returns true if channel number is bound for current permission. -func (p *Permission) Bound() bool { - p.mux.RLock() - defer p.mux.RUnlock() - return p.number.Valid() -} - -// Binding returns current channel number or 0 if not bound. -func (p *Permission) Binding() turn.ChannelNumber { - p.mux.RLock() - defer p.mux.RUnlock() - return p.number -} - -var ( - // ErrAlreadyBound means that selected permission already has bound channel number. - ErrAlreadyBound = errors.New("channel already bound") - // ErrNotBound means that selected permission already has no channel number. - ErrNotBound = errors.New("channel is not bound") -) - -func (p *Permission) refresh() error { - return p.client.alloc.allocate(p.peerAddr) -} - -func (p *Permission) startLoop(f func()) { - if p.refreshRate == 0 { - return - } - p.wg.Add(1) - go func() { - ticker := time.NewTicker(p.refreshRate) - defer p.wg.Done() - for { - select { - case <-ticker.C: - f() - case <-p.ctx.Done(): - return - } - } - }() -} - -func (p *Permission) startRefreshLoop() { - p.startLoop(func() { - if err := p.refresh(); err != nil { - p.log.Errorf("failed to refresh permission: %v", err) - } - p.log.Debug("permission refreshed") - }) -} - -// refreshBind performs rebinding of a channel. -func (p *Permission) refreshBind() error { - p.mux.Lock() - defer p.mux.Unlock() - if p.number == 0 { - return ErrNotBound - } - if err := p.bind(p.number); err != nil { - return err - } - p.log.Debug("binding refreshed") - return nil -} - -func (p *Permission) bind(n turn.ChannelNumber) error { - // Starting transaction. - a := p.client.alloc - res := stun.New() - req := stun.New() - req.TransactionID = stun.NewTransactionID() - req.Type = stun.NewType(stun.MethodChannelBind, stun.ClassRequest) - req.WriteHeader() - setters := make([]stun.Setter, 0, 10) - setters = append(setters, &p.peerAddr, n) - if len(a.integrity) > 0 { - // Applying auth. - setters = append(setters, - a.nonce, a.client.username, a.client.realm, a.integrity, - ) - } - setters = append(setters, stun.Fingerprint) - for _, s := range setters { - if setErr := s.AddTo(req); setErr != nil { - return setErr - } - } - if doErr := p.client.do(req, res); doErr != nil { - return doErr - } - if res.Type != stun.NewType(stun.MethodChannelBind, stun.ClassSuccessResponse) { - return fmt.Errorf("unexpected response type %s", res.Type) - } - // Success. - return nil -} - -// Bind performs binding transaction, allocating channel binding for -// the permission. -func (p *Permission) Bind() error { - p.mux.Lock() - defer p.mux.Unlock() - if p.number != 0 { - return ErrAlreadyBound - } - a := p.client.alloc - a.minBound++ - n := a.minBound - if err := p.bind(n); err != nil { - return err - } - p.number = n - p.startLoop(func() { - if err := p.refreshBind(); err != nil { - p.log.Errorf("failed to refresh bind: %v", err) - } - }) - return nil -} - -// Write sends buffer to peer. -// -// If permission is bound, the ChannelData message will be used. -func (p *Permission) Write(b []byte) (n int, err error) { - if n := p.Binding(); n.Valid() { - p.log.Debug("using channel data to write") - return p.client.sendChan(b, n) - } - p.log.Debug("using STUN to write") - return p.client.sendData(b, &p.peerAddr) -} - -// Close stops all refreshing loops for permission and removes it from -// allocation. -func (p *Permission) Close() error { - cErr := p.peerR.Close() - p.mux.Lock() - cancel := p.cancel - p.mux.Unlock() - cancel() - p.wg.Wait() - p.client.alloc.removePermission(p) - return cErr -} - -// LocalAddr is relayed address from TURN server. -func (p *Permission) LocalAddr() net.Addr { - return turn.Addr(p.client.alloc.relayed) -} - -// RemoteAddr is peer address. -func (p *Permission) RemoteAddr() net.Addr { - return turn.Addr(p.peerAddr) -} - -// SetDeadline implements net.Conn. -func (p *Permission) SetDeadline(t time.Time) error { - return p.peerR.SetDeadline(t) -} - -// SetReadDeadline implements net.Conn. -func (p *Permission) SetReadDeadline(t time.Time) error { - return p.peerR.SetReadDeadline(t) -} - -// ErrNotImplemented means that functionality is not currently implemented, -// but it will be (eventually). -var ErrNotImplemented = errors.New("functionality not implemented") - -// SetWriteDeadline implements net.Conn. -func (p *Permission) SetWriteDeadline(t time.Time) error { - return ErrNotImplemented -} diff --git a/vendor/github.com/pion/turnc/go.mod b/vendor/github.com/pion/turnc/go.mod deleted file mode 100644 index 04226a3b..00000000 --- a/vendor/github.com/pion/turnc/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module github.com/pion/turnc - -go 1.12 - -require ( - github.com/gortc/turn v0.7.3 - github.com/pion/logging v0.2.1 - github.com/pion/stun v0.3.1 -) diff --git a/vendor/github.com/pion/turnc/go.sum b/vendor/github.com/pion/turnc/go.sum deleted file mode 100644 index 3f6cc0ba..00000000 --- a/vendor/github.com/pion/turnc/go.sum +++ /dev/null @@ -1,8 +0,0 @@ -github.com/gortc/turn v0.7.3 h1:CE72C79erbcsfa6L/QDhKztcl2kDq1UK20ImrJWDt/w= -github.com/gortc/turn v0.7.3/go.mod h1:gvguwaGAFyv5/9KrcW9MkCgHALYD+e99mSM7pSCYYho= -github.com/pion/logging v0.2.1 h1:LwASkBKZ+2ysGJ+jLv1E/9H1ge0k1nTfi1X+5zirkDk= -github.com/pion/logging v0.2.1/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= -github.com/pion/stun v0.3.1 h1:d09JJzOmOS8ZzIp8NppCMgrxGZpJ4Ix8qirfNYyI3BA= -github.com/pion/stun v0.3.1/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/vendor/github.com/pion/turnc/go.test.sh b/vendor/github.com/pion/turnc/go.test.sh deleted file mode 100644 index 94f51f28..00000000 --- a/vendor/github.com/pion/turnc/go.test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -e -touch coverage.txt - -# quick-test without -race -go test ./... - -# quick-test with "debug" -go test -tags debug ./... - -for d in $(go list ./... | grep -v vendor); do - go test -race -coverprofile=profile.out -covermode=atomic "$d" - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/vendor/github.com/pion/turnc/log.go b/vendor/github.com/pion/turnc/log.go deleted file mode 100644 index 66bcb24c..00000000 --- a/vendor/github.com/pion/turnc/log.go +++ /dev/null @@ -1,15 +0,0 @@ -package turnc - -// TODO(ar): Move to logging package. -type nopLogger struct{} - -func (nopLogger) Trace(msg string) {} -func (nopLogger) Tracef(format string, args ...interface{}) {} -func (nopLogger) Debug(msg string) {} -func (nopLogger) Debugf(format string, args ...interface{}) {} -func (nopLogger) Info(msg string) {} -func (nopLogger) Infof(format string, args ...interface{}) {} -func (nopLogger) Warn(msg string) {} -func (nopLogger) Warnf(format string, args ...interface{}) {} -func (nopLogger) Error(msg string) {} -func (nopLogger) Errorf(format string, args ...interface{}) {} diff --git a/vendor/github.com/pion/turnc/multiplexer.go b/vendor/github.com/pion/turnc/multiplexer.go deleted file mode 100644 index 542abb9b..00000000 --- a/vendor/github.com/pion/turnc/multiplexer.go +++ /dev/null @@ -1,87 +0,0 @@ -package turnc - -import ( - "io" - "io/ioutil" - "net" - - "github.com/gortc/turn" - - "github.com/pion/logging" - "github.com/pion/stun" -) - -// multiplexer de-multiplexes STUN, TURN and application data -// from one connection into separate ones. -type multiplexer struct { - log logging.LeveledLogger - capacity int - conn net.Conn - - stunL, stunR net.Conn - turnL, turnR net.Conn - dataL, dataR net.Conn -} - -func newMultiplexer(conn net.Conn, log logging.LeveledLogger) *multiplexer { - m := &multiplexer{conn: conn, capacity: 1500, log: log} - m.stunL, m.stunR = net.Pipe() - m.turnL, m.turnR = net.Pipe() - m.dataL, m.dataR = net.Pipe() - go m.readUntilClosed() - return m -} - -func (m *multiplexer) discardData() { - discardLogged(m.log, "mux: failed to discard dataL: %v", m.dataL) -} - -func discardLogged(l logging.LeveledLogger, msg string, r io.Reader) { - _, err := io.Copy(ioutil.Discard, r) - if err != nil { - l.Errorf(msg, err) - } -} - -func closeLogged(l logging.LeveledLogger, msg string, conn io.Closer) { - if closeErr := conn.Close(); closeErr != nil { - l.Errorf(msg, closeErr) - } -} - -func (m *multiplexer) close() { - closeLogged(m.log, "mux: failed to close turnR: %v", m.turnR) - closeLogged(m.log, "mux: failed to close stunR: %v", m.stunR) - closeLogged(m.log, "mux: failed to close dataR: %v", m.dataR) -} - -func (m *multiplexer) readUntilClosed() { - buf := make([]byte, m.capacity) - for { - n, err := m.conn.Read(buf) - m.log.Debugf("mux: read %d err: %v", n, err) - if err != nil { - // End of cycle. - // TODO: Handle timeouts and temporary errors. - m.log.Info("connection closed") - m.close() - break - } - data := buf[:n] - conn := m.dataR - switch { - case stun.IsMessage(data): - m.log.Debug("mux: got STUN data") - conn = m.stunR - case turn.IsChannelData(data): - m.log.Debug("mux: got TURN data") - conn = m.turnR - default: - m.log.Debug("mux: got APP data") - } - _, err = conn.Write(data) - if err != nil { - m.log.Warnf("failed to write: %v", err) - } - } -} diff --git a/vendor/github.com/pion/webrtc/v2/.golangci.yml b/vendor/github.com/pion/webrtc/v2/.golangci.yml index 40d9e1b6..b5d7b165 100644 --- a/vendor/github.com/pion/webrtc/v2/.golangci.yml +++ b/vendor/github.com/pion/webrtc/v2/.golangci.yml @@ -9,7 +9,6 @@ linters: disable: - maligned - lll - - gochecknoglobals issues: exclude-use-default: false diff --git a/vendor/github.com/pion/webrtc/v2/.travis.yml b/vendor/github.com/pion/webrtc/v2/.travis.yml index b3ae371e..315453e7 100644 --- a/vendor/github.com/pion/webrtc/v2/.travis.yml +++ b/vendor/github.com/pion/webrtc/v2/.travis.yml @@ -21,6 +21,7 @@ install: - export PATH=$GOROOT/bin:$PATH - go version - go env + - go get -u github.com/matoous/godox # Install Node 11 (required for WASM tests) - source ~/.nvm/nvm.sh - nvm install 11 @@ -32,11 +33,12 @@ before_install: - wget https://raw.githubusercontent.com/creationix/nvm/v0.31.0/nvm.sh -O ~/.nvm/nvm.sh before_script: - - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.14.0 + - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b $GOPATH/bin v1.17.1 script: + - godox - golangci-lint run --build-tags quic ./... - - cd examples && golangci-lint run --build-tags quic ./... -D gochecknoinits + - cd examples && golangci-lint run --build-tags quic ./... - cd .. - rm -rf examples # Remove examples, no test coverage for them - go test -tags quic -coverpkg=$(go list ./... | tr '\n' ',') -coverprofile=cover.out -v -race -covermode=atomic ./... diff --git a/vendor/github.com/pion/webrtc/v2/README.md b/vendor/github.com/pion/webrtc/v2/README.md index 02831dac..fdb041ed 100644 --- a/vendor/github.com/pion/webrtc/v2/README.md +++ b/vendor/github.com/pion/webrtc/v2/README.md @@ -37,6 +37,8 @@ For more full featured examples that use 3rd party libraries see our **[example- The Pion WebRTC API closely matches the JavaScript **[WebRTC API](https://w3c.github.io/webrtc-pc/)**. Most existing documentation is therefore also usefull when working with Pion. Furthermore, our **[GoDoc](https://godoc.org/github.com/pion/webrtc)** is actively maintained. +We maintain a [FAQ](https://pion.ly/knowledge-base/pion-basics/faq/) with answers to common questions. If you have a question not covered please submit a PR, we would be happy to answer it! + Now go forth and build some awesome apps! Here are some **ideas** to get your creative juices flowing: * Send a video file to multiple browser in real time for perfectly synchronized movie watching. * Send a webcam on an embedded device to your browser with no additional server required! @@ -119,6 +121,12 @@ Check out the **[contributing wiki](https://github.com/pion/webrtc/wiki/Contribu * [Alex Harford](https://github.com/alexjh) * [Aleksandr Razumov](https://github.com/ernado) * [mchlrhw](https://github.com/mchlrhw) +* [AlexWoo(æ­¦æ°)](https://github.com/AlexWoo) *Fix RemoteDescription parsing for certificate fingerprint* +* [Cecylia Bocovich](https://github.com/cohosh) +* [Slugalisk](https://github.com/slugalisk) +* [Agugua Kenechukwu](https://github.com/spaceCh1mp) +* [Ato Araki](https://github.com/atotto) +* [Rafael Viscarra](https://github.com/rviscarra) ### License MIT License - see [LICENSE](LICENSE) for full text diff --git a/vendor/github.com/pion/webrtc/v2/configuration.go b/vendor/github.com/pion/webrtc/v2/configuration.go index b3b91a4a..e059cc18 100644 --- a/vendor/github.com/pion/webrtc/v2/configuration.go +++ b/vendor/github.com/pion/webrtc/v2/configuration.go @@ -2,10 +2,6 @@ package webrtc -import ( - "github.com/pion/ice" -) - // Configuration defines a set of parameters to configure how the // peer-to-peer communication via PeerConnection is established or // re-established. @@ -51,17 +47,3 @@ type Configuration struct { // SDP answers generated by the PeerConnection. SDPSemantics SDPSemantics } - -func (c Configuration) getICEServers() (*[]*ice.URL, error) { - var iceServers []*ice.URL - for _, server := range c.ICEServers { - for _, rawURL := range server.URLs { - url, err := ice.ParseURL(rawURL) - if err != nil { - return nil, err - } - iceServers = append(iceServers, url) - } - } - return &iceServers, nil -} diff --git a/vendor/github.com/pion/webrtc/v2/configuration_common.go b/vendor/github.com/pion/webrtc/v2/configuration_common.go new file mode 100644 index 00000000..ba2ed776 --- /dev/null +++ b/vendor/github.com/pion/webrtc/v2/configuration_common.go @@ -0,0 +1,29 @@ +package webrtc + +import ( + "strings" + + "github.com/pion/ice" +) + +// getICEServers side-steps the strict parsing mode of the ice package +// (as defined in https://tools.ietf.org/html/rfc7064) by stripping any +// erroneous queries from "stun(s):" URLs before parsing. +func (c Configuration) getICEServers() (*[]*ice.URL, error) { + var iceServers []*ice.URL + for _, server := range c.ICEServers { + for _, rawURL := range server.URLs { + if strings.HasPrefix(rawURL, "stun") { + // strip the query from "stun(s):" if present + parts := strings.Split(rawURL, "?") + rawURL = parts[0] + } + url, err := ice.ParseURL(rawURL) + if err != nil { + return nil, err + } + iceServers = append(iceServers, url) + } + } + return &iceServers, nil +} diff --git a/vendor/github.com/pion/webrtc/v2/configuration_js.go b/vendor/github.com/pion/webrtc/v2/configuration_js.go index ae15b27a..44ab9f3c 100644 --- a/vendor/github.com/pion/webrtc/v2/configuration_js.go +++ b/vendor/github.com/pion/webrtc/v2/configuration_js.go @@ -2,10 +2,6 @@ package webrtc -import ( - "github.com/pion/ice" -) - // Configuration defines a set of parameters to configure how the // peer-to-peer communication via PeerConnection is established or // re-established. @@ -37,17 +33,3 @@ type Configuration struct { // ICECandidatePoolSize describes the size of the prefetched ICE pool. ICECandidatePoolSize uint8 } - -func (c Configuration) getICEServers() (*[]*ice.URL, error) { - var iceServers []*ice.URL - for _, server := range c.ICEServers { - for _, rawURL := range server.URLs { - url, err := ice.ParseURL(rawURL) - if err != nil { - return nil, err - } - iceServers = append(iceServers, url) - } - } - return &iceServers, nil -} diff --git a/vendor/github.com/pion/webrtc/v2/datachannel.go b/vendor/github.com/pion/webrtc/v2/datachannel.go index a92aa3a2..1d07ea7b 100644 --- a/vendor/github.com/pion/webrtc/v2/datachannel.go +++ b/vendor/github.com/pion/webrtc/v2/datachannel.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "math" "sync" "github.com/pion/datachannel" @@ -13,7 +14,7 @@ import ( "github.com/pion/webrtc/v2/pkg/rtcerr" ) -const dataChannelBufferSize = 16384 // Lowest common denominator among browsers +const dataChannelBufferSize = math.MaxUint16 //message size limit for Chromium var errSCTPNotEstablished = errors.New("SCTP not establisched") // DataChannel represents a WebRTC DataChannel @@ -41,14 +42,13 @@ type DataChannel struct { // "blob". This attribute controls how binary data is exposed to scripts. // binaryType string - // OnError func() - onMessageHandler func(DataChannelMessage) onceMutex sync.Mutex openHandlerOnce sync.Once onOpenHandler func() onCloseHandler func() onBufferedAmountLow func() + onErrorHandler func(error) sctpTransport *SCTPTransport dataChannel *datachannel.DataChannel @@ -139,7 +139,7 @@ func (d *DataChannel) open(sctpTransport *SCTPTransport) error { cfg := &datachannel.Config{ ChannelType: channelType, - Priority: datachannel.ChannelPriorityNormal, // TODO: Wiring + Priority: datachannel.ChannelPriorityNormal, ReliabilityParameter: reliabilityParameteer, Label: d.label, LoggerFactory: d.api.settingEngine.LoggerFactory, @@ -285,21 +285,43 @@ func (d *DataChannel) handleOpen(dc *datachannel.DataChannel) { } } +// OnError sets an event handler which is invoked when +// the underlying data transport cannot be read. +func (d *DataChannel) OnError(f func(err error)) { + d.mu.Lock() + defer d.mu.Unlock() + d.onErrorHandler = f +} + +func (d *DataChannel) onError(err error) (done chan struct{}) { + d.mu.RLock() + hdlr := d.onErrorHandler + d.mu.RUnlock() + + done = make(chan struct{}) + if hdlr == nil { + close(done) + return + } + + go func() { + hdlr(err) + close(done) + }() + + return +} + func (d *DataChannel) readLoop() { for { buffer := make([]byte, dataChannelBufferSize) n, isString, err := d.dataChannel.ReadDataChannel(buffer) - if err == io.ErrShortBuffer { - d.log.Warnf("Failed to read from data channel: The message is larger than %d bytes.\n", dataChannelBufferSize) - continue - } if err != nil { d.mu.Lock() d.readyState = DataChannelStateClosed d.mu.Unlock() if err != io.EOF { - // TODO: Throw OnError - d.log.Errorf("Failed to read from data channel %v", err) + d.onError(err) } d.onClose() return @@ -534,3 +556,37 @@ func (d *DataChannel) OnBufferedAmountLow(f func()) { d.dataChannel.OnBufferedAmountLow(f) } } + +func (d *DataChannel) getStatsID() string { + d.mu.Lock() + defer d.mu.Unlock() + return fmt.Sprintf("DataChannel-%d", *d.id) +} + +func (d *DataChannel) collectStats(collector *statsReportCollector) { + collector.Collecting() + statsID := d.getStatsID() + + d.mu.Lock() + defer d.mu.Unlock() + + stats := DataChannelStats{ + Timestamp: statsTimestampNow(), + Type: StatsTypeDataChannel, + ID: statsID, + Label: d.label, + Protocol: d.protocol, + DataChannelIdentifier: int32(*d.id), + // TransportID string `json:"transportId"` + State: d.readyState, + } + + if d.dataChannel != nil { + stats.MessagesSent = d.dataChannel.MessagesSent() + stats.BytesSent = d.dataChannel.BytesSent() + stats.MessagesReceived = d.dataChannel.MessagesReceived() + stats.BytesReceived = d.dataChannel.BytesReceived() + } + + collector.Collect(stats.ID, stats) +} diff --git a/vendor/github.com/pion/webrtc/v2/datachannel_js.go b/vendor/github.com/pion/webrtc/v2/datachannel_js.go index c6e040cf..4b56a0f3 100644 --- a/vendor/github.com/pion/webrtc/v2/datachannel_js.go +++ b/vendor/github.com/pion/webrtc/v2/datachannel_js.go @@ -67,7 +67,7 @@ func (d *DataChannel) OnMessage(f func(msg DataChannelMessage)) { defer oldHandler.Release() } onMessageHandler := js.FuncOf(func(this js.Value, args []js.Value) interface{} { - // TODO: Ensure message order? + // pion/webrtc/projects/15 data := args[0].Get("data") go func() { // valueToDataChannelMessage may block when handling 'Blob' data diff --git a/vendor/github.com/pion/webrtc/v2/datachannel_js_detach.go b/vendor/github.com/pion/webrtc/v2/datachannel_js_detach.go index 7a84876d..dd0069e0 100644 --- a/vendor/github.com/pion/webrtc/v2/datachannel_js_detach.go +++ b/vendor/github.com/pion/webrtc/v2/datachannel_js_detach.go @@ -19,10 +19,10 @@ func newDetachedDataChannel(dc *DataChannel) *detachedDataChannel { // Wire up callbacks dc.OnMessage(func(msg DataChannelMessage) { - read <- msg // TODO: Potential leak? + read <- msg // pion/webrtc/projects/15 }) - // TODO: OnClose? + // pion/webrtc/projects/15 return &detachedDataChannel{ dc: dc, diff --git a/vendor/github.com/pion/webrtc/v2/dtlstransport.go b/vendor/github.com/pion/webrtc/v2/dtlstransport.go index 786d8468..9aaf107c 100644 --- a/vendor/github.com/pion/webrtc/v2/dtlstransport.go +++ b/vendor/github.com/pion/webrtc/v2/dtlstransport.go @@ -31,10 +31,9 @@ type DTLSTransport struct { certificates []Certificate remoteParameters DTLSParameters remoteCertificate []byte - // State DTLSTransportState + state DTLSTransportState - // OnStateChange func() - // OnError func() + onStateChangeHdlr func(DTLSTransportState) conn *dtls.Conn @@ -43,6 +42,8 @@ type DTLSTransport struct { srtpEndpoint *mux.Endpoint srtcpEndpoint *mux.Endpoint + dtlsMatcher mux.MatchFunc + api *API } @@ -50,7 +51,12 @@ type DTLSTransport struct { // This constructor is part of the ORTC API. It is not // meant to be used together with the basic WebRTC API. func (api *API) NewDTLSTransport(transport *ICETransport, certificates []Certificate) (*DTLSTransport, error) { - t := &DTLSTransport{iceTransport: transport, api: api} + t := &DTLSTransport{ + iceTransport: transport, + api: api, + state: DTLSTransportStateNew, + dtlsMatcher: mux.MatchDTLS, + } if len(certificates) > 0 { now := time.Now() @@ -83,12 +89,36 @@ func (t *DTLSTransport) ICETransport() *ICETransport { return t.iceTransport } +// onStateChange requires the caller holds the lock +func (t *DTLSTransport) onStateChange(state DTLSTransportState) { + t.state = state + hdlr := t.onStateChangeHdlr + if hdlr != nil { + hdlr(state) + } +} + +// OnStateChange sets a handler that is fired when the DTLS +// connection state changes. +func (t *DTLSTransport) OnStateChange(f func(DTLSTransportState)) { + t.lock.Lock() + defer t.lock.Unlock() + t.onStateChangeHdlr = f +} + +// State returns the current dtls transport state. +func (t *DTLSTransport) State() DTLSTransportState { + t.lock.RLock() + defer t.lock.RUnlock() + return t.state +} + // GetLocalParameters returns the DTLS parameters of the local DTLSTransport upon construction. func (t *DTLSTransport) GetLocalParameters() (DTLSParameters, error) { fingerprints := []DTLSFingerprint{} for _, c := range t.certificates { - prints, err := c.GetFingerprints() // TODO: Should be only one? + prints, err := c.GetFingerprints() if err != nil { return DTLSParameters{}, err } @@ -200,11 +230,15 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error { return err } + if t.state != DTLSTransportStateNew { + return &rtcerr.InvalidStateError{Err: fmt.Errorf("attempted to start DTLSTransport that is not in new state: %s", t.state)} + } + dtlsEndpoint := t.iceTransport.NewEndpoint(mux.MatchDTLS) t.srtpEndpoint = t.iceTransport.NewEndpoint(mux.MatchSRTP) t.srtcpEndpoint = t.iceTransport.NewEndpoint(mux.MatchSRTCP) - // TODO: handle multiple certs + // pion/webrtc#753 cert := t.certificates[0] dtlsCofig := &dtls.Config{ @@ -213,11 +247,15 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error { SRTPProtectionProfiles: []dtls.SRTPProtectionProfile{dtls.SRTP_AES128_CM_HMAC_SHA1_80}, ClientAuth: dtls.RequireAnyClientCert, LoggerFactory: t.api.settingEngine.LoggerFactory, + InsecureSkipVerify: true, } + + t.onStateChange(DTLSTransportStateConnecting) if t.isClient() { // Assumes the peer offered to be passive and we accepted. dtlsConn, err := dtls.Client(dtlsEndpoint, dtlsCofig) if err != nil { + t.onStateChange(DTLSTransportStateFailed) return err } t.conn = dtlsConn @@ -225,10 +263,12 @@ func (t *DTLSTransport) Start(remoteParameters DTLSParameters) error { // Assumes we offer to be passive and this is accepted. dtlsConn, err := dtls.Server(dtlsEndpoint, dtlsCofig) if err != nil { + t.onStateChange(DTLSTransportStateFailed) return err } t.conn = dtlsConn } + t.onStateChange(DTLSTransportStateConnected) // Check the fingerprint if a certificate was exchanged remoteCert := t.conn.RemoteCertificate() @@ -265,6 +305,7 @@ func (t *DTLSTransport) Stop() error { closeErrs = append(closeErrs, err) } } + t.onStateChange(DTLSTransportStateClosed) return util.FlattenErrs(closeErrs) } diff --git a/vendor/github.com/pion/webrtc/v2/go.mod b/vendor/github.com/pion/webrtc/v2/go.mod index ade8c3c7..892f04be 100644 --- a/vendor/github.com/pion/webrtc/v2/go.mod +++ b/vendor/github.com/pion/webrtc/v2/go.mod @@ -3,16 +3,16 @@ module github.com/pion/webrtc/v2 go 1.12 require ( - github.com/pion/datachannel v1.4.3 - github.com/pion/dtls v1.3.5 - github.com/pion/ice v0.4.0 - github.com/pion/logging v0.2.1 + github.com/pion/datachannel v1.4.5 + github.com/pion/dtls v1.5.0 + github.com/pion/ice v0.5.7 + github.com/pion/logging v0.2.2 github.com/pion/quic v0.1.1 - github.com/pion/rtcp v1.2.0 - github.com/pion/rtp v1.1.2 - github.com/pion/sctp v1.6.3 - github.com/pion/sdp/v2 v2.2.0 - github.com/pion/srtp v1.2.4 - github.com/pion/transport v0.8.0 + github.com/pion/rtcp v1.2.1 + github.com/pion/rtp v1.1.3 + github.com/pion/sctp v1.6.4 + github.com/pion/sdp/v2 v2.3.0 + github.com/pion/srtp v1.2.6 + github.com/pion/transport v0.8.6 github.com/stretchr/testify v1.3.0 ) diff --git a/vendor/github.com/pion/webrtc/v2/go.sum b/vendor/github.com/pion/webrtc/v2/go.sum index 1404e12b..4dae1e8a 100644 --- a/vendor/github.com/pion/webrtc/v2/go.sum +++ b/vendor/github.com/pion/webrtc/v2/go.sum @@ -9,9 +9,6 @@ github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gortc/turn v0.7.1/go.mod h1:3FZ+LvCZKCKu6YYgwuYPqEi3FqCtdjfSFnFqVQNwfjk= -github.com/gortc/turn v0.7.3 h1:CE72C79erbcsfa6L/QDhKztcl2kDq1UK20ImrJWDt/w= -github.com/gortc/turn v0.7.3/go.mod h1:gvguwaGAFyv5/9KrcW9MkCgHALYD+e99mSM7pSCYYho= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9 h1:tbuodUh2vuhOVZAdW3NEUvosFHUMJwUNl7jk/VSEiwc= @@ -23,41 +20,38 @@ github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pion/datachannel v1.4.3 h1:tqS6YiqqAiFCxGGhvn1K7fHEzemK9Aov025dE/isGFo= -github.com/pion/datachannel v1.4.3/go.mod h1:SpMJbuu8v+qbA94m6lWQwSdCf8JKQvgmdSHDNtcbe+w= -github.com/pion/dtls v1.3.5 h1:mBioifvh6JSE9pD4FtJh5WoizygoqkOJNJyS5Ns+y1U= -github.com/pion/dtls v1.3.5/go.mod h1:CjlPLfQdsTg3G4AEXjJp8FY5bRweBlxHrgoFrN+fQsk= -github.com/pion/ice v0.4.0 h1:BdTXHTjzdsJHGi9yMFnj9ffgr+Kg2oHVv1qk4B0mQ8A= -github.com/pion/ice v0.4.0/go.mod h1:/gw3aFmD/pBG8UM3TcEHs6HuaOEMSd/v1As3TodE7Ss= -github.com/pion/logging v0.2.1 h1:LwASkBKZ+2ysGJ+jLv1E/9H1ge0k1nTfi1X+5zirkDk= +github.com/pion/datachannel v1.4.5 h1:paz18kYAetpTdK8tlMAtDY+Ayxrv5fndZ5XPZwiZHrU= +github.com/pion/datachannel v1.4.5/go.mod h1:SpMJbuu8v+qbA94m6lWQwSdCf8JKQvgmdSHDNtcbe+w= +github.com/pion/dtls v1.5.0 h1:GtN3DJ0Fv5wC/Y04uOXT1zPeGA4C3HrsP1aAKsIBiU8= +github.com/pion/dtls v1.5.0/go.mod h1:CjlPLfQdsTg3G4AEXjJp8FY5bRweBlxHrgoFrN+fQsk= +github.com/pion/ice v0.5.7 h1:1ZhyuFkwo0Nup7cRplz72ulghFXnZSpocD5YVJP90yg= +github.com/pion/ice v0.5.7/go.mod h1:FSTDLP+ian3PtxRjervtyDP2AOqt2c6cvfebZ7dwLnI= github.com/pion/logging v0.2.1/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= -github.com/pion/mdns v0.0.2 h1:T22Gg4dSuYVYsZ21oRFh9z7twzAm27+5PEKiABbjCvM= -github.com/pion/mdns v0.0.2/go.mod h1:VrN3wefVgtfL8QgpEblPUC46ag1reLIfpqekCnKunLE= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/mdns v0.0.3 h1:DxdOYd0pgwLKiDlIIxfU0qdG5iWh1Xn6CsS9vc6cMAY= +github.com/pion/mdns v0.0.3/go.mod h1:VrN3wefVgtfL8QgpEblPUC46ag1reLIfpqekCnKunLE= github.com/pion/quic v0.1.1 h1:D951FV+TOqI9A0rTF7tHx0Loooqz+nyzjEyj8o3PuMA= github.com/pion/quic v0.1.1/go.mod h1:zEU51v7ru8Mp4AUBJvj6psrSth5eEFNnVQK5K48oV3k= -github.com/pion/rtcp v1.2.0 h1:rT2FptW5YHIern+4XlbGYnnsT26XGxurnkNLnzhtDXg= -github.com/pion/rtcp v1.2.0/go.mod h1:a5dj2d6BKIKHl43EnAOIrCczcjESrtPuMgfmL6/K6QM= -github.com/pion/rtp v1.1.2 h1:ERNugzYHW9F2ldpwoARbeFGKRoq1REe5Jxdjvm/rOx8= -github.com/pion/rtp v1.1.2/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE= -github.com/pion/sctp v1.6.3 h1:SC4vKOjcddK8tXiTNj05a+0/GyPpCmuNfeBA/rzNFqs= +github.com/pion/rtcp v1.2.1 h1:S3yG4KpYAiSmBVqKAfgRa5JdwBNj4zK3RLUa8JYdhak= +github.com/pion/rtcp v1.2.1/go.mod h1:a5dj2d6BKIKHl43EnAOIrCczcjESrtPuMgfmL6/K6QM= +github.com/pion/rtp v1.1.3 h1:GTYSTsSLF5vH+UqShGYQEBdoYasWjTTC9UeYglnUO+o= +github.com/pion/rtp v1.1.3/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE= github.com/pion/sctp v1.6.3/go.mod h1:cCqpLdYvgEUdl715+qbWtgT439CuQrAgy8BZTp0aEfA= -github.com/pion/sdp/v2 v2.2.0 h1:JiixCEU8g6LbSsh1Bg5SOk0TPnJrn2HBOA1yJ+mRYhI= -github.com/pion/sdp/v2 v2.2.0/go.mod h1:idSlWxhfWQDtTy9J05cgxpHBu/POwXN2VDRGYxT/EjU= -github.com/pion/srtp v1.2.4 h1:wwGKC5ewuBukkZ+i+pZ8aO33+t6z2y/XRiYtyP0Xpv0= -github.com/pion/srtp v1.2.4/go.mod h1:52qiP0g3FVMG/5NL6Ko8Vr2qirevKH+ukYbNS/4EX40= -github.com/pion/stun v0.3.0/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M= +github.com/pion/sctp v1.6.4 h1:edUNxTabSErLWOdeUUAxds8gwx5kGnFam4zL5DWpILk= +github.com/pion/sctp v1.6.4/go.mod h1:cCqpLdYvgEUdl715+qbWtgT439CuQrAgy8BZTp0aEfA= +github.com/pion/sdp/v2 v2.3.0 h1:5EhwPh1xKWYYjjvMuubHoMLy6M0B9U26Hh7q3f7vEGk= +github.com/pion/sdp/v2 v2.3.0/go.mod h1:idSlWxhfWQDtTy9J05cgxpHBu/POwXN2VDRGYxT/EjU= +github.com/pion/srtp v1.2.6 h1:mHQuAMh0P67R7/j1F260u3O+fbRWLyjKLRPZYYvODFM= +github.com/pion/srtp v1.2.6/go.mod h1:rd8imc5htjfs99XiEoOjLMEOcVjME63UHx9Ek9IGst0= github.com/pion/stun v0.3.1 h1:d09JJzOmOS8ZzIp8NppCMgrxGZpJ4Ix8qirfNYyI3BA= github.com/pion/stun v0.3.1/go.mod h1:xrCld6XM+6GWDZdvjPlLMsTU21rNxnO6UO8XsAvHr/M= -github.com/pion/transport v0.6.0 h1:WAoyJg/6OI8dhCVFl/0JHTMd1iu2iHgGUXevptMtJ3U= github.com/pion/transport v0.6.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE= -github.com/pion/transport v0.7.0 h1:EsXN8TglHMlKZMo4ZGqwK6QgXBu0WYg7wfGMWIXsS+w= github.com/pion/transport v0.7.0/go.mod h1:iWZ07doqOosSLMhZ+FXUTq+TamDoXSllxpbGcfkCmbE= -github.com/pion/transport v0.8.0 h1:YHZnWBBrBuMqkuvMFUHeAETXS+LgfwW1IsVd2K2cyW8= -github.com/pion/transport v0.8.0/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno= -github.com/pion/turn v1.1.4 h1:yGxcasBvge4idNjxjowePn8oW43C4v70bXroBBKLyKY= -github.com/pion/turn v1.1.4/go.mod h1:2O2GFDGO6+hJ5gsyExDhoNHtVcacPB1NOyc81gkq0WA= -github.com/pion/turnc v0.0.6 h1:FHsmwYvdJ8mhT1/ZtWWer9L0unEb7AyRgrymfWy6mEY= -github.com/pion/turnc v0.0.6/go.mod h1:4MSFv5i0v3MRkDLdo5eF9cD/xJtj1pxSphHNnxKL2W8= +github.com/pion/transport v0.8.6 h1:xHQq2mxAjB+UrFs90aUBaXwlmIACfQAZnOiVAX3uqMw= +github.com/pion/transport v0.8.6/go.mod h1:nAmRRnn+ArVtsoNuwktvAD+jrjSD7pA+H3iRmZwdUno= +github.com/pion/turn v1.3.3 h1:jO8bYTgUZ7ls6BCVa5lIQhxu56UFc5afX1A50vfxFio= +github.com/pion/turn v1.3.3/go.mod h1:zGPB7YYB/HTE9MWn0Sbznz8NtyfeVeanZ834cG/MXu0= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -66,24 +60,22 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 h1:jsG6UpNLt9iAsb0S2AGW28DveNzzgmbXR+ENoPjUeIU= golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5 h1:bselrhR0Or1vomJZC8ZIjWtbDmn9OYFLX5Ik9alpJpE= golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190403144856-b630fd6fe46b/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b h1:lkjdUzSyJ5P1+eal9fxXX9Xg2BTfswsonKUse48C0uE= golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c= golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 h1:LepdCS8Gf/MVejFIt8lsiexZATdoGVyp5bcyS+rYoUI= +golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/vendor/github.com/pion/webrtc/v2/ice_go.go b/vendor/github.com/pion/webrtc/v2/ice_go.go index 167268e4..2e412c1c 100644 --- a/vendor/github.com/pion/webrtc/v2/ice_go.go +++ b/vendor/github.com/pion/webrtc/v2/ice_go.go @@ -53,17 +53,3 @@ func newICECandidateFromSDP(c sdp.ICECandidate) (ICECandidate, error) { RelatedPort: c.RelatedPort, }, nil } - -func iceCandidateToSDP(c ICECandidate) sdp.ICECandidate { - return sdp.ICECandidate{ - Foundation: c.Foundation, - Priority: c.Priority, - Address: c.Address, - Protocol: c.Protocol.String(), - Port: c.Port, - Component: c.Component, - Typ: c.Typ.String(), - RelatedAddress: c.RelatedAddress, - RelatedPort: c.RelatedPort, - } -} diff --git a/vendor/github.com/pion/webrtc/v2/icecandidate.go b/vendor/github.com/pion/webrtc/v2/icecandidate.go index 098971fe..0bd95b95 100644 --- a/vendor/github.com/pion/webrtc/v2/icecandidate.go +++ b/vendor/github.com/pion/webrtc/v2/icecandidate.go @@ -4,10 +4,12 @@ import ( "fmt" "github.com/pion/ice" + "github.com/pion/sdp/v2" ) // ICECandidate represents a ice candidate type ICECandidate struct { + statsID string Foundation string `json:"foundation"` Priority uint32 `json:"priority"` Address string `json:"address"` @@ -46,6 +48,7 @@ func newICECandidateFromICE(i ice.Candidate) (ICECandidate, error) { } c := ICECandidate{ + statsID: i.ID(), Foundation: "foundation", Priority: i.Priority(), Address: i.Address(), @@ -64,18 +67,50 @@ func newICECandidateFromICE(i ice.Candidate) (ICECandidate, error) { } func (c ICECandidate) toICE() (ice.Candidate, error) { + candidateID := c.statsID switch c.Typ { case ICECandidateTypeHost: - return ice.NewCandidateHost(c.Protocol.String(), c.Address, int(c.Port), c.Component) + config := ice.CandidateHostConfig{ + CandidateID: candidateID, + Network: c.Protocol.String(), + Address: c.Address, + Port: int(c.Port), + Component: c.Component, + } + return ice.NewCandidateHost(&config) case ICECandidateTypeSrflx: - return ice.NewCandidateServerReflexive(c.Protocol.String(), c.Address, int(c.Port), c.Component, - c.RelatedAddress, int(c.RelatedPort)) + config := ice.CandidateServerReflexiveConfig{ + CandidateID: candidateID, + Network: c.Protocol.String(), + Address: c.Address, + Port: int(c.Port), + Component: c.Component, + RelAddr: c.RelatedAddress, + RelPort: int(c.RelatedPort), + } + return ice.NewCandidateServerReflexive(&config) case ICECandidateTypePrflx: - return ice.NewCandidatePeerReflexive(c.Protocol.String(), c.Address, int(c.Port), c.Component, - c.RelatedAddress, int(c.RelatedPort)) + config := ice.CandidatePeerReflexiveConfig{ + CandidateID: candidateID, + Network: c.Protocol.String(), + Address: c.Address, + Port: int(c.Port), + Component: c.Component, + RelAddr: c.RelatedAddress, + RelPort: int(c.RelatedPort), + } + return ice.NewCandidatePeerReflexive(&config) case ICECandidateTypeRelay: - return ice.NewCandidateRelay(c.Protocol.String(), c.Address, int(c.Port), c.Component, - c.RelatedAddress, int(c.RelatedPort)) + config := ice.CandidateRelayConfig{ + CandidateID: candidateID, + Network: c.Protocol.String(), + Address: c.Address, + Port: int(c.Port), + Component: c.Component, + RelAddr: c.RelatedAddress, + RelPort: int(c.RelatedPort), + } + return ice.NewCandidateRelay(&config) default: return nil, fmt.Errorf("unknown candidate type: %s", c.Typ) } @@ -103,3 +138,27 @@ func (c ICECandidate) String() string { } return ic.String() } + +func iceCandidateToSDP(c ICECandidate) sdp.ICECandidate { + return sdp.ICECandidate{ + Foundation: c.Foundation, + Priority: c.Priority, + Address: c.Address, + Protocol: c.Protocol.String(), + Port: c.Port, + Component: c.Component, + Typ: c.Typ.String(), + RelatedAddress: c.RelatedAddress, + RelatedPort: c.RelatedPort, + } +} + +// ToJSON returns an ICECandidateInit +// as indicated by the spec https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-tojson +func (c ICECandidate) ToJSON() ICECandidateInit { + var sdpmLineIndex uint16 + return ICECandidateInit{ + Candidate: fmt.Sprintf("candidate:%s", iceCandidateToSDP(c).Marshal()), + SDPMLineIndex: &sdpmLineIndex, + } +} diff --git a/vendor/github.com/pion/webrtc/v2/icecandidatepair.go b/vendor/github.com/pion/webrtc/v2/icecandidatepair.go index 417b6d77..7350fbe5 100644 --- a/vendor/github.com/pion/webrtc/v2/icecandidatepair.go +++ b/vendor/github.com/pion/webrtc/v2/icecandidatepair.go @@ -2,13 +2,16 @@ package webrtc import "fmt" -type ( - // ICECandidatePair represents an ICE Candidate pair - ICECandidatePair struct { - Local *ICECandidate - Remote *ICECandidate - } -) +// ICECandidatePair represents an ICE Candidate pair +type ICECandidatePair struct { + statsID string + Local *ICECandidate + Remote *ICECandidate +} + +func newICECandidatePairStatsID(localID, remoteID string) string { + return fmt.Sprintf("%s-%s", localID, remoteID) +} func (p *ICECandidatePair) String() string { return fmt.Sprintf("(local) %s <-> (remote) %s", p.Local, p.Remote) @@ -17,8 +20,10 @@ func (p *ICECandidatePair) String() string { // NewICECandidatePair returns an initialized *ICECandidatePair // for the given pair of ICECandidate instances func NewICECandidatePair(local, remote *ICECandidate) *ICECandidatePair { + statsID := newICECandidatePairStatsID(local.statsID, remote.statsID) return &ICECandidatePair{ - Local: local, - Remote: remote, + statsID: statsID, + Local: local, + Remote: remote, } } diff --git a/vendor/github.com/pion/webrtc/v2/icecandidatetype.go b/vendor/github.com/pion/webrtc/v2/icecandidatetype.go index d1381f0c..e500e10c 100644 --- a/vendor/github.com/pion/webrtc/v2/icecandidatetype.go +++ b/vendor/github.com/pion/webrtc/v2/icecandidatetype.go @@ -1,6 +1,10 @@ package webrtc -import "fmt" +import ( + "fmt" + + "github.com/pion/ice" +) // ICECandidateType represents the type of the ICE candidate used. type ICECandidateType int @@ -71,3 +75,22 @@ func (t ICECandidateType) String() string { return ErrUnknownType.Error() } } + +func getCandidateType(candidateType ice.CandidateType) (ICECandidateType, error) { + switch candidateType { + case ice.CandidateTypeHost: + return ICECandidateTypeHost, nil + case ice.CandidateTypeServerReflexive: + return ICECandidateTypeSrflx, nil + case ice.CandidateTypePeerReflexive: + return ICECandidateTypePrflx, nil + case ice.CandidateTypeRelay: + return ICECandidateTypeRelay, nil + default: + // NOTE: this should never happen[tm] + err := fmt.Errorf( + "cannot convert ice.CandidateType into webrtc.ICECandidateType, invalid typej: %s", + candidateType.String()) + return ICECandidateType(Unknown), err + } +} diff --git a/vendor/github.com/pion/webrtc/v2/icegatherer.go b/vendor/github.com/pion/webrtc/v2/icegatherer.go index b5188973..7813582b 100644 --- a/vendor/github.com/pion/webrtc/v2/icegatherer.go +++ b/vendor/github.com/pion/webrtc/v2/icegatherer.go @@ -119,7 +119,7 @@ func (g *ICEGatherer) createAgent() error { requestedNetworkTypes := g.networkTypes if len(requestedNetworkTypes) == 0 { - requestedNetworkTypes = supportedNetworkTypes + requestedNetworkTypes = supportedNetworkTypes() } for _, typ := range requestedNetworkTypes { @@ -147,6 +147,10 @@ func (g *ICEGatherer) Gather() error { g.lock.Lock() onLocalCandidateHdlr := g.onLocalCandidateHdlr + if onLocalCandidateHdlr == nil { + onLocalCandidateHdlr = func(*ICECandidate) {} + } + isTrickle := g.agentIsTrickle agent := g.agent g.lock.Unlock() @@ -279,3 +283,114 @@ func (g *ICEGatherer) SignalCandidates() error { } return nil } + +func (g *ICEGatherer) collectStats(collector *statsReportCollector) { + collector.Collecting() + + go func(collector *statsReportCollector) { + for _, candidatePairStats := range g.agent.GetCandidatePairsStats() { + collector.Collecting() + + state, err := toStatsICECandidatePairState(candidatePairStats.State) + if err != nil { + g.log.Error(err.Error()) + } + + pairID := newICECandidatePairStatsID(candidatePairStats.LocalCandidateID, + candidatePairStats.RemoteCandidateID) + + stats := ICECandidatePairStats{ + Timestamp: statsTimestampFrom(candidatePairStats.Timestamp), + Type: StatsTypeCandidatePair, + ID: pairID, + // TransportID: + LocalCandidateID: candidatePairStats.LocalCandidateID, + RemoteCandidateID: candidatePairStats.RemoteCandidateID, + State: state, + Nominated: candidatePairStats.Nominated, + PacketsSent: candidatePairStats.PacketsSent, + PacketsReceived: candidatePairStats.PacketsReceived, + BytesSent: candidatePairStats.BytesSent, + BytesReceived: candidatePairStats.BytesReceived, + LastPacketSentTimestamp: statsTimestampFrom(candidatePairStats.LastPacketSentTimestamp), + LastPacketReceivedTimestamp: statsTimestampFrom(candidatePairStats.LastPacketReceivedTimestamp), + FirstRequestTimestamp: statsTimestampFrom(candidatePairStats.FirstRequestTimestamp), + LastRequestTimestamp: statsTimestampFrom(candidatePairStats.LastRequestTimestamp), + LastResponseTimestamp: statsTimestampFrom(candidatePairStats.LastResponseTimestamp), + TotalRoundTripTime: candidatePairStats.TotalRoundTripTime, + CurrentRoundTripTime: candidatePairStats.CurrentRoundTripTime, + AvailableOutgoingBitrate: candidatePairStats.AvailableOutgoingBitrate, + AvailableIncomingBitrate: candidatePairStats.AvailableIncomingBitrate, + CircuitBreakerTriggerCount: candidatePairStats.CircuitBreakerTriggerCount, + RequestsReceived: candidatePairStats.RequestsReceived, + RequestsSent: candidatePairStats.RequestsSent, + ResponsesReceived: candidatePairStats.ResponsesReceived, + ResponsesSent: candidatePairStats.ResponsesSent, + RetransmissionsReceived: candidatePairStats.RetransmissionsReceived, + RetransmissionsSent: candidatePairStats.RetransmissionsSent, + ConsentRequestsSent: candidatePairStats.ConsentRequestsSent, + ConsentExpiredTimestamp: statsTimestampFrom(candidatePairStats.ConsentExpiredTimestamp), + } + collector.Collect(stats.ID, stats) + } + + for _, candidateStats := range g.agent.GetLocalCandidatesStats() { + collector.Collecting() + + networkType, err := getNetworkType(candidateStats.NetworkType) + if err != nil { + g.log.Error(err.Error()) + } + + candidateType, err := getCandidateType(candidateStats.CandidateType) + if err != nil { + g.log.Error(err.Error()) + } + + stats := ICECandidateStats{ + Timestamp: statsTimestampFrom(candidateStats.Timestamp), + ID: candidateStats.ID, + Type: StatsTypeLocalCandidate, + NetworkType: networkType, + IP: candidateStats.IP, + Port: int32(candidateStats.Port), + Protocol: networkType.Protocol(), + CandidateType: candidateType, + Priority: int32(candidateStats.Priority), + URL: candidateStats.URL, + RelayProtocol: candidateStats.RelayProtocol, + Deleted: candidateStats.Deleted, + } + collector.Collect(stats.ID, stats) + } + + for _, candidateStats := range g.agent.GetRemoteCandidatesStats() { + collector.Collecting() + networkType, err := getNetworkType(candidateStats.NetworkType) + if err != nil { + g.log.Error(err.Error()) + } + + candidateType, err := getCandidateType(candidateStats.CandidateType) + if err != nil { + g.log.Error(err.Error()) + } + + stats := ICECandidateStats{ + Timestamp: statsTimestampFrom(candidateStats.Timestamp), + ID: candidateStats.ID, + Type: StatsTypeRemoteCandidate, + NetworkType: networkType, + IP: candidateStats.IP, + Port: int32(candidateStats.Port), + Protocol: networkType.Protocol(), + CandidateType: candidateType, + Priority: int32(candidateStats.Priority), + URL: candidateStats.URL, + RelayProtocol: candidateStats.RelayProtocol, + } + collector.Collect(stats.ID, stats) + } + collector.Done() + }(collector) +} diff --git a/vendor/github.com/pion/webrtc/v2/internal/mux/muxfunc.go b/vendor/github.com/pion/webrtc/v2/internal/mux/muxfunc.go index 89ee1907..2ab585bf 100644 --- a/vendor/github.com/pion/webrtc/v2/internal/mux/muxfunc.go +++ b/vendor/github.com/pion/webrtc/v2/internal/mux/muxfunc.go @@ -57,7 +57,9 @@ func MatchZRTP(b []byte) bool { // MatchDTLS is a MatchFunc that accepts packets with the first byte in [20..63] // as defied in RFC7983 -var MatchDTLS = MatchRange(20, 63) +func MatchDTLS(b []byte) bool { + return MatchRange(20, 63)(b) +} // MatchTURN is a MatchFunc that accepts packets with the first byte in [64..79] // as defied in RFC7983 diff --git a/vendor/github.com/pion/webrtc/v2/js_utils.go b/vendor/github.com/pion/webrtc/v2/js_utils.go index f5636f02..712a3975 100644 --- a/vendor/github.com/pion/webrtc/v2/js_utils.go +++ b/vendor/github.com/pion/webrtc/v2/js_utils.go @@ -162,8 +162,7 @@ func recoveryToError(e interface{}) error { func uint8ArrayValueToBytes(val js.Value) []byte { result := make([]byte, val.Length()) - for i := 0; i < val.Length(); i++ { - result[i] = byte(val.Index(i).Int()) - } + jsResult := js.TypedArrayOf(result) + jsResult.Call("set", val) return result } diff --git a/vendor/github.com/pion/webrtc/v2/mediaengine.go b/vendor/github.com/pion/webrtc/v2/mediaengine.go index 823b15b3..1756b707 100644 --- a/vendor/github.com/pion/webrtc/v2/mediaengine.go +++ b/vendor/github.com/pion/webrtc/v2/mediaengine.go @@ -27,12 +27,12 @@ type MediaEngine struct { // RegisterCodec registers a codec to a media engine func (m *MediaEngine) RegisterCodec(codec *RTPCodec) uint8 { - // TODO: generate PayloadType if not set + // pion/webrtc#43 m.codecs = append(m.codecs, codec) return codec.PayloadType } -// RegisterDefaultCodecs is a helper that registers the default codecs supported by pion-webrtc +// RegisterDefaultCodecs is a helper that registers the default codecs supported by Pion WebRTC func (m *MediaEngine) RegisterDefaultCodecs() { m.RegisterCodec(NewRTPOpusCodec(DefaultPayloadTypeOpus, 48000)) m.RegisterCodec(NewRTPG722Codec(DefaultPayloadTypeG722, 8000)) @@ -56,7 +56,7 @@ func (m *MediaEngine) getCodecSDP(sdpCodec sdp.Codec) (*RTPCodec, error) { codec.ClockRate == sdpCodec.ClockRate && (sdpCodec.EncodingParameters == "" || strconv.Itoa(int(codec.Channels)) == sdpCodec.EncodingParameters) && - codec.SDPFmtpLine == sdpCodec.Fmtp { // TODO: Protocol specific matching? + codec.SDPFmtpLine == sdpCodec.Fmtp { // pion/webrtc#43 return codec, nil } } @@ -73,7 +73,7 @@ func (m *MediaEngine) getCodecsByKind(kind RTPCodecType) []*RTPCodec { return codecs } -// Names for the default codecs supported by pion-webrtc +// Names for the default codecs supported by Pion WebRTC const ( G722 = "G722" Opus = "opus" @@ -126,7 +126,7 @@ func NewRTPVP9Codec(payloadType uint8, clockrate uint32) *RTPCodec { 0, "", payloadType, - nil) // TODO + nil) // pion/webrtc#755 return c } diff --git a/vendor/github.com/pion/webrtc/v2/networktype.go b/vendor/github.com/pion/webrtc/v2/networktype.go index c90726b3..f3481980 100644 --- a/vendor/github.com/pion/webrtc/v2/networktype.go +++ b/vendor/github.com/pion/webrtc/v2/networktype.go @@ -2,13 +2,17 @@ package webrtc import ( "fmt" + + "github.com/pion/ice" ) -var supportedNetworkTypes = []NetworkType{ - NetworkTypeUDP4, - NetworkTypeUDP6, - // NetworkTypeTCP4, // Not supported yet - // NetworkTypeTCP6, // Not supported yet +func supportedNetworkTypes() []NetworkType { + return []NetworkType{ + NetworkTypeUDP4, + NetworkTypeUDP6, + // NetworkTypeTCP4, // Not supported yet + // NetworkTypeTCP6, // Not supported yet + } } // NetworkType represents the type of network @@ -51,6 +55,22 @@ func (t NetworkType) String() string { } } +// Protocol returns udp or tcp +func (t NetworkType) Protocol() string { + switch t { + case NetworkTypeUDP4: + return "udp" + case NetworkTypeUDP6: + return "udp" + case NetworkTypeTCP4: + return "tcp" + case NetworkTypeTCP6: + return "tcp" + default: + return ErrUnknownType.Error() + } +} + func newNetworkType(raw string) (NetworkType, error) { switch raw { case networkTypeUDP4Str: @@ -65,3 +85,18 @@ func newNetworkType(raw string) (NetworkType, error) { return NetworkType(Unknown), fmt.Errorf("unknown network type: %s", raw) } } + +func getNetworkType(iceNetworkType ice.NetworkType) (NetworkType, error) { + switch iceNetworkType { + case ice.NetworkTypeUDP4: + return NetworkTypeUDP4, nil + case ice.NetworkTypeUDP6: + return NetworkTypeUDP6, nil + case ice.NetworkTypeTCP4: + return NetworkTypeTCP4, nil + case ice.NetworkTypeTCP6: + return NetworkTypeTCP6, nil + default: + return NetworkType(Unknown), fmt.Errorf("unknown network type: %s", iceNetworkType.String()) + } +} diff --git a/vendor/github.com/pion/webrtc/v2/peerconnection.go b/vendor/github.com/pion/webrtc/v2/peerconnection.go index 374ffae6..c6f04931 100644 --- a/vendor/github.com/pion/webrtc/v2/peerconnection.go +++ b/vendor/github.com/pion/webrtc/v2/peerconnection.go @@ -15,7 +15,6 @@ import ( "sync" "time" - "github.com/pion/ice" "github.com/pion/logging" "github.com/pion/rtcp" "github.com/pion/sdp/v2" @@ -24,15 +23,12 @@ import ( "github.com/pion/webrtc/v2/pkg/rtcerr" ) -const ( - newTransceiverMid = "NEW" -) - // PeerConnection represents a WebRTC connection that establishes a // peer-to-peer communications with another PeerConnection instance in a // browser, or to another endpoint implementing the required protocols. type PeerConnection struct { - mu sync.RWMutex + statsID string + mu sync.RWMutex configuration Configuration @@ -55,12 +51,10 @@ type PeerConnection struct { rtpTransceivers []*RTPTransceiver // DataChannels - dataChannels map[uint16]*DataChannel - - // OnNegotiationNeeded func() // FIXME NOT-USED - // OnICECandidateError func() // FIXME NOT-USED - - // OnConnectionStateChange func() // FIXME NOT-USED + dataChannels map[uint16]*DataChannel + dataChannelsOpened uint32 + dataChannelsRequested uint32 + dataChannelsAccepted uint32 onSignalingStateChangeHandler func(SignalingState) onICEConnectionStateChangeHandler func(ICEConnectionState) @@ -92,6 +86,7 @@ func (api *API) NewPeerConnection(configuration Configuration) (*PeerConnection, // Some variables defined explicitly despite their implicit zero values to // allow better readability to understand what is happening. pc := &PeerConnection{ + statsID: fmt.Sprintf("PeerConnection-%d", time.Now().UnixNano()), configuration: Configuration{ ICEServers: []ICEServer{}, ICETransportPolicy: ICETransportPolicyAll, @@ -391,6 +386,12 @@ func (pc *PeerConnection) GetConfiguration() Configuration { return pc.configuration } +func (pc *PeerConnection) getStatsID() string { + pc.mu.RLock() + defer pc.mu.RUnlock() + return pc.statsID +} + // CreateOffer starts the PeerConnection and generates the localDescription func (pc *PeerConnection) CreateOffer(options *OfferOptions) (SessionDescription, error) { useIdentity := pc.idpLoginURL != nil @@ -502,7 +503,7 @@ func (pc *PeerConnection) createICETransport() *ICETransport { t := pc.api.NewICETransport(pc.iceGatherer) t.OnConnectionStateChange(func(state ICETransportState) { - cs := ICEConnectionStateNew + var cs ICEConnectionState switch state { case ICETransportStateNew: cs = ICEConnectionStateNew @@ -574,7 +575,6 @@ func satisfyTypeAndDirection(remoteKind RTPCodecType, remoteDirection RTPTransce } return &RTPTransceiver{ - Mid: newTransceiverMid, kind: remoteKind, Direction: RTPTransceiverDirectionInactive, }, localTransceivers @@ -637,7 +637,7 @@ func (pc *PeerConnection) addAnswerMediaTransceivers(d *sdp.SessionDescription) for { // keep going until we can't get any more t, localTransceivers = satisfyTypeAndDirection(kind, direction, localTransceivers) - if t.Mid == newTransceiverMid { + if t.Direction == RTPTransceiverDirectionInactive { break } mediaTransceivers = append(mediaTransceivers, t) @@ -825,17 +825,21 @@ func (pc *PeerConnection) SetLocalDescription(desc SessionDescription) error { return err } + // To support all unittests which are following the future trickle=true + // setup while also support the old trickle=false synchronous gathering + // process this is necessary to avoid calling Garther() in multiple + // pleces; which causes race conditions. (issue-707) if !pc.iceGatherer.agentIsTrickle { - // To support all unittests which are following the future trickle=true - // setup while also support the old trickle=false synchronous gathering - // process this is necessary to avoid calling Garther() in multiple - // pleces; which causes race conditions. (issue-707) if err := pc.iceGatherer.SignalCandidates(); err != nil { return err } return nil } - return pc.iceGatherer.Gather() + + if desc.Type == SDPTypeAnswer { + return pc.iceGatherer.Gather() + } + return nil } // LocalDescription returns pendingLocalDescription if it is not null and @@ -850,9 +854,8 @@ func (pc *PeerConnection) LocalDescription() *SessionDescription { } // SetRemoteDescription sets the SessionDescription of the remote peer -func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { - // FIXME: Remove this when renegotiation is supported - if pc.currentRemoteDescription != nil { +func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { //nolint pion/webrtc#614 + if pc.currentRemoteDescription != nil { // pion/webrtc#207 return fmt.Errorf("remoteDescription is already defined, SetRemoteDescription can only be called once") } if pc.isClosed { @@ -874,7 +877,12 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { weOffer = false } + fingerprint, haveFingerprint := desc.parsed.Attribute("fingerprint") for _, m := range pc.RemoteDescription().parsed.MediaDescriptions { + if !haveFingerprint { + fingerprint, haveFingerprint = m.Attribute("fingerprint") + } + for _, a := range m.Attributes { switch { case a.IsICECandidate(): @@ -899,20 +907,16 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { } } - fingerprint, ok := desc.parsed.Attribute("fingerprint") - if !ok { - fingerprint, ok = desc.parsed.MediaDescriptions[0].Attribute("fingerprint") - if !ok { - return fmt.Errorf("could not find fingerprint") - } + if !haveFingerprint { + return fmt.Errorf("could not find fingerprint") } - var fingerprintHash string + parts := strings.Split(fingerprint, " ") if len(parts) != 2 { return fmt.Errorf("invalid fingerprint") } fingerprint = parts[1] - fingerprintHash = parts[0] + fingerprintHash := parts[0] // Create the SCTP transport sctp := pc.api.NewSCTPTransport(pc.dtlsTransport) @@ -922,12 +926,21 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { sctp.OnDataChannel(func(d *DataChannel) { pc.mu.RLock() hdlr := pc.onDataChannelHandler + pc.dataChannels[*d.ID()] = d + pc.dataChannelsAccepted++ pc.mu.RUnlock() if hdlr != nil { hdlr(d) } }) + // Wire up the on datachannel opened handler + sctp.OnDataChannelOpened(func(d *DataChannel) { + pc.mu.RLock() + pc.dataChannelsOpened++ + pc.mu.RUnlock() + }) + go func() { // Star the networking in a new routine since it will block until // the connection is actually established. @@ -948,7 +961,7 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { ) if err != nil { - // TODO: Handle error + // pion/webrtc#614 pc.log.Warnf("Failed to start manager: %s", err) return } @@ -959,7 +972,7 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { Fingerprints: []DTLSFingerprint{{Algorithm: fingerprintHash, Value: fingerprint}}, }) if err != nil { - // TODO: Handle error + // pion/webrtc#614 pc.log.Warnf("Failed to start manager: %s", err) return } @@ -989,37 +1002,41 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error { MaxMessageSize: 0, }) if err != nil { - // TODO: Handle error + // pion/webrtc#614 pc.log.Warnf("Failed to start SCTP: %s", err) return } // Open data channels that where created before signaling - pc.openDataChannels() + pc.mu.Lock() + // make a copy of dataChannels to avoid race condition accessing pc.dataChannels + dataChannels := make(map[uint16]*DataChannel, len(pc.dataChannels)) + for k, v := range pc.dataChannels { + dataChannels[k] = v + } + pc.mu.Unlock() + + var openedDCCount uint32 + for _, d := range dataChannels { + err := d.open(pc.sctpTransport) + if err != nil { + pc.log.Warnf("failed to open data channel: %s", err) + continue + } + openedDCCount++ + } + + pc.mu.Lock() + pc.dataChannelsOpened += openedDCCount + pc.mu.Unlock() }() + if (desc.Type == SDPTypeAnswer || desc.Type == SDPTypePranswer) && pc.iceGatherer.agentIsTrickle { + return pc.iceGatherer.Gather() + } return nil } -// openDataChannels opens the existing data channels -func (pc *PeerConnection) openDataChannels() { - pc.mu.Lock() - // make a copy of dataChannels to avoid race condition accessing pc.dataChannels - dataChannels := make(map[uint16]*DataChannel, len(pc.dataChannels)) - for k, v := range pc.dataChannels { - dataChannels[k] = v - } - pc.mu.Unlock() - - for _, d := range dataChannels { - err := d.open(pc.sctpTransport) - if err != nil { - pc.log.Warnf("failed to open data channel: %s", err) - continue - } - } -} - func (pc *PeerConnection) descriptionIsPlanB(desc *SessionDescription) bool { if desc == nil || desc.parsed == nil { return false @@ -1179,24 +1196,13 @@ func (pc *PeerConnection) drainSRTP() { return } - r, ssrc, err := srtpSession.AcceptStream() + _, ssrc, err := srtpSession.AcceptStream() if err != nil { pc.log.Warnf("Failed to accept RTP %v \n", err) return } - go func() { - rtpBuf := make([]byte, receiveMTU) - for { - _, header, err := r.ReadRTP(rtpBuf) - if err != nil { - pc.log.Warnf("Failed to read, drainSRTP done for: %v %d \n", err, ssrc) - return - } - - pc.log.Debugf("got RTP: %+v", header) - } - }() + pc.log.Debugf("Incoming unhandled RTP ssrc(%d)", ssrc) } }() @@ -1207,23 +1213,12 @@ func (pc *PeerConnection) drainSRTP() { return } - r, ssrc, err := srtcpSession.AcceptStream() + _, ssrc, err := srtcpSession.AcceptStream() if err != nil { pc.log.Warnf("Failed to accept RTCP %v \n", err) return } - - go func() { - rtcpBuf := make([]byte, receiveMTU) - for { - _, header, err := r.ReadRTCP(rtcpBuf) - if err != nil { - pc.log.Warnf("Failed to read, drainSRTCP done for: %v %d \n", err, ssrc) - return - } - pc.log.Debugf("got RTCP: %+v", header) - } - }() + pc.log.Debugf("Incoming unhandled RTCP ssrc(%d)", ssrc) } } @@ -1269,10 +1264,6 @@ func (pc *PeerConnection) ICEConnectionState() ICEConnectionState { return pc.iceConnectionState } -// ------------------------------------------------------------------------ -// --- FIXME - BELOW CODE NEEDS RE-ORGANIZATION - https://w3c.github.io/webrtc-pc/#rtp-media-api -// ------------------------------------------------------------------------ - // GetSenders returns the RTPSender that are currently attached to this PeerConnection func (pc *PeerConnection) GetSenders() []*RTPSender { pc.mu.Lock() @@ -1348,33 +1339,33 @@ func (pc *PeerConnection) AddTrack(track *Track) (*RTPSender, error) { ) } - transceiver.Mid = track.Kind().String() // TODO: Mid generation - return transceiver.Sender, nil } -// func (pc *PeerConnection) RemoveTrack() { -// panic("not implemented yet") // FIXME NOT-IMPLEMENTED nolint -// } - // AddTransceiver Create a new RTCRtpTransceiver and add it to the set of transceivers. +// Deprecated: Use AddTrack, AddTransceiverFromKind or AddTransceiverFromTrack func (pc *PeerConnection) AddTransceiver(trackOrKind RTPCodecType, init ...RtpTransceiverInit) (*RTPTransceiver, error) { + return pc.AddTransceiverFromKind(trackOrKind, init...) +} + +// AddTransceiverFromKind Create a new RTCRtpTransceiver(SendRecv or RecvOnly) and add it to the set of transceivers. +func (pc *PeerConnection) AddTransceiverFromKind(kind RTPCodecType, init ...RtpTransceiverInit) (*RTPTransceiver, error) { direction := RTPTransceiverDirectionSendrecv if len(init) > 1 { - return nil, fmt.Errorf("AddTransceiver only accepts one RtpTransceiverInit") + return nil, fmt.Errorf("AddTransceiverFromKind only accepts one RtpTransceiverInit") } else if len(init) == 1 { direction = init[0].Direction } switch direction { case RTPTransceiverDirectionSendrecv: - receiver, err := pc.api.NewRTPReceiver(trackOrKind, pc.dtlsTransport) + receiver, err := pc.api.NewRTPReceiver(kind, pc.dtlsTransport) if err != nil { return nil, err } payloadType := DefaultPayloadTypeOpus - if trackOrKind == RTPCodecTypeVideo { + if kind == RTPCodecTypeVideo { payloadType = DefaultPayloadTypeVP8 } @@ -1392,11 +1383,11 @@ func (pc *PeerConnection) AddTransceiver(trackOrKind RTPCodecType, init ...RtpTr receiver, sender, RTPTransceiverDirectionSendrecv, - trackOrKind, + kind, ), nil case RTPTransceiverDirectionRecvonly: - receiver, err := pc.api.NewRTPReceiver(trackOrKind, pc.dtlsTransport) + receiver, err := pc.api.NewRTPReceiver(kind, pc.dtlsTransport) if err != nil { return nil, err } @@ -1405,10 +1396,55 @@ func (pc *PeerConnection) AddTransceiver(trackOrKind RTPCodecType, init ...RtpTr receiver, nil, RTPTransceiverDirectionRecvonly, - trackOrKind, + kind, ), nil default: - return nil, fmt.Errorf("AddTransceiver currently only suports recvonly and sendrecv") + return nil, fmt.Errorf("AddTransceiverFromKind currently only supports recvonly and sendrecv") + } +} + +// AddTransceiverFromTrack Creates a new send only transceiver and add it to the set of +func (pc *PeerConnection) AddTransceiverFromTrack(track *Track, init ...RtpTransceiverInit) (*RTPTransceiver, error) { + direction := RTPTransceiverDirectionSendrecv + if len(init) > 1 { + return nil, fmt.Errorf("AddTransceiverFromTrack only accepts one RtpTransceiverInit") + } else if len(init) == 1 { + direction = init[0].Direction + } + + switch direction { + case RTPTransceiverDirectionSendrecv: + receiver, err := pc.api.NewRTPReceiver(track.Kind(), pc.dtlsTransport) + if err != nil { + return nil, err + } + + sender, err := pc.api.NewRTPSender(track, pc.dtlsTransport) + if err != nil { + return nil, err + } + + return pc.newRTPTransceiver( + receiver, + sender, + RTPTransceiverDirectionSendrecv, + track.Kind(), + ), nil + + case RTPTransceiverDirectionSendonly: + sender, err := pc.api.NewRTPSender(track, pc.dtlsTransport) + if err != nil { + return nil, err + } + + return pc.newRTPTransceiver( + nil, + sender, + RTPTransceiverDirectionSendonly, + track.Kind(), + ), nil + default: + return nil, fmt.Errorf("AddTransceiverFromTrack currently only supports sendonly and sendrecv") } } @@ -1424,9 +1460,7 @@ func (pc *PeerConnection) CreateDataChannel(label string, options *DataChannelIn return nil, &rtcerr.InvalidStateError{Err: ErrConnectionClosed} } - // TODO: Add additional options once implemented. DataChannelInit - // implements all options. DataChannelParameters implements the - // options that actually have an effect at this point. + // pion/webrtc#748 params := &DataChannelParameters{ Label: label, Ordered: true, @@ -1466,13 +1500,7 @@ func (pc *PeerConnection) CreateDataChannel(label string, options *DataChannelIn } } - // TODO: Enable validation of other parameters once they are implemented. - // - Protocol - // - Negotiated - // - Priority: - // - // See https://w3c.github.io/webrtc-pc/#peer-to-peer-data-api for details - + // pion/webrtc#748 d, err := pc.api.newDataChannel(params, pc.log) if err != nil { pc.mu.Unlock() @@ -1490,6 +1518,7 @@ func (pc *PeerConnection) CreateDataChannel(label string, options *DataChannelIn sctpReady := pc.sctpTransport != nil && pc.sctpTransport.association != nil + pc.dataChannelsRequested++ pc.mu.Unlock() // Open if networking already started @@ -1538,7 +1567,7 @@ func (pc *PeerConnection) WriteRTCP(pkts []rtcp.Packet) error { srtcpSession, err := pc.dtlsTransport.getSRTCPSession() if err != nil { - return nil // TODO WriteRTCP before would gracefully discard packets until ready + return nil } writeStream, err := srtcpSession.OpenWriteStream() @@ -1558,6 +1587,13 @@ func (pc *PeerConnection) Close() error { if pc.isClosed { return nil } + // Try closing everything and collect the errors + // Shutdown strategy: + // 1. All Conn close by closing their underlying Conn. + // 2. A Mux stops this chain. It won't close the underlying + // Conn if one of the endpoints is closed down. To + // continue the chain the Mux has to be closed. + var closeErrs []error // https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close (step #3) pc.isClosed = true @@ -1566,27 +1602,15 @@ func (pc *PeerConnection) Close() error { pc.signalingState = SignalingStateClosed // https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close (step #11) - // pc.ICEConnectionState = ICEConnectionStateClosed - pc.iceStateChange(ice.ConnectionStateClosed) // FIXME REMOVE - - // https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close (step #12) - pc.connectionState = PeerConnectionStateClosed - - // Try closing everything and collect the errors - var closeErrs []error - - // Shutdown strategy: - // 1. All Conn close by closing their underlying Conn. - // 2. A Mux stops this chain. It won't close the underlying - // Conn if one of the endpoints is closed down. To - // continue the chain the Mux has to be closed. - if pc.iceTransport != nil { if err := pc.iceTransport.Stop(); err != nil { closeErrs = append(closeErrs, err) } } + // https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close (step #12) + pc.connectionState = PeerConnectionStateClosed + if err := pc.dtlsTransport.Stop(); err != nil { closeErrs = append(closeErrs, err) } @@ -1602,9 +1626,6 @@ func (pc *PeerConnection) Close() error { closeErrs = append(closeErrs, err) } } - - // TODO: Figure out stopping ICE transport & Gatherer independently. - // pc.iceGatherer() return util.FlattenErrs(closeErrs) } @@ -1617,7 +1638,7 @@ func (pc *PeerConnection) iceStateChange(newState ICEConnectionState) { } func (pc *PeerConnection) addFingerprint(d *sdp.SessionDescription) error { - // TODO: Handle multiple certificates + // pion/webrtc#753 fingerprints, err := pc.configuration.Certificates[0].GetFingerprints() if err != nil { return err @@ -1635,10 +1656,10 @@ func (pc *PeerConnection) addTransceiverSDP(d *sdp.SessionDescription, midValue // Use the first transceiver to generate the section attributes t := transceivers[0] media := sdp.NewJSEPMediaDescription(t.kind.String(), []string{}). - WithValueAttribute(sdp.AttrKeyConnectionSetup, dtlsRole.String()). // TODO: Support other connection types + WithValueAttribute(sdp.AttrKeyConnectionSetup, dtlsRole.String()). // pion/webrtc#494 WithValueAttribute(sdp.AttrKeyMID, midValue). WithICECredentials(iceParams.UsernameFragment, iceParams.Password). - WithPropertyAttribute(sdp.AttrKeyRTCPMux). // TODO: support RTCP fallback + WithPropertyAttribute(sdp.AttrKeyRTCPMux). WithPropertyAttribute(sdp.AttrKeyRTCPRsize) codecs := pc.api.mediaEngine.getCodecsByKind(t.kind) @@ -1697,7 +1718,7 @@ func (pc *PeerConnection) addDataMediaSection(d *sdp.SessionDescription, midValu }, }, }). - WithValueAttribute(sdp.AttrKeyConnectionSetup, dtlsRole.String()). // TODO: Support other connection types + WithValueAttribute(sdp.AttrKeyConnectionSetup, dtlsRole.String()). // pion/webrtc#494 WithValueAttribute(sdp.AttrKeyMID, midValue). WithPropertyAttribute(RTPTransceiverDirectionSendrecv.String()). WithPropertyAttribute("sctpmap:5000 webrtc-datachannel 1024"). @@ -1823,6 +1844,40 @@ func (pc *PeerConnection) ConnectionState() PeerConnectionState { return pc.connectionState } +// GetStats return data providing statistics about the overall connection +func (pc *PeerConnection) GetStats() StatsReport { + statsCollector := newStatsReportCollector() + statsCollector.Collecting() + + pc.mu.Lock() + var dataChannelsClosed uint32 + for _, d := range pc.dataChannels { + state := d.ReadyState() + + if state != DataChannelStateConnecting && state != DataChannelStateOpen { + dataChannelsClosed++ + } + + d.collectStats(statsCollector) + } + + pc.iceGatherer.collectStats(statsCollector) + + stats := PeerConnectionStats{ + Timestamp: statsTimestampNow(), + Type: StatsTypePeerConnection, + ID: pc.statsID, + DataChannelsOpened: pc.dataChannelsOpened, + DataChannelsClosed: dataChannelsClosed, + DataChannelsRequested: pc.dataChannelsRequested, + DataChannelsAccepted: pc.dataChannelsAccepted, + } + pc.mu.Unlock() + + statsCollector.Collect(stats.ID, stats) + return statsCollector.Ready() +} + func addCandidatesToMediaDescriptions(candidates []ICECandidate, m *sdp.MediaDescription) { for _, c := range candidates { sdpCandidate := iceCandidateToSDP(c) diff --git a/vendor/github.com/pion/webrtc/v2/peerconnection_js.go b/vendor/github.com/pion/webrtc/v2/peerconnection_js.go index 7af77449..e3ccc806 100644 --- a/vendor/github.com/pion/webrtc/v2/peerconnection_js.go +++ b/vendor/github.com/pion/webrtc/v2/peerconnection_js.go @@ -73,10 +73,11 @@ func (pc *PeerConnection) OnDataChannel(f func(*DataChannel)) { defer oldHandler.Release() } onDataChannelHandler := js.FuncOf(func(this js.Value, args []js.Value) interface{} { - // BUG(albrow): This reference to the underlying DataChannel doesn't know + // pion/webrtc/projects/15 + // This reference to the underlying DataChannel doesn't know // about any other references to the same DataChannel. This might result in - // memory leaks where we don't clean up handler functions. Could possibly - // fix by keeping a mutex-protected list of all DataChannel references as a + // memory leaks where we don't clean up handler functions. Could possibly fix + // by keeping a mutex-protected list of all DataChannel references as a // property of this PeerConnection, but at the cost of additional overhead. dataChannel := &DataChannel{ underlying: args[0].Get("channel"), @@ -124,7 +125,7 @@ func (pc *PeerConnection) checkConfiguration(configuration Configuration) error } } - // TODO: Enable these checks once Certificates are supported. + // https://github.com/pion/webrtc/issues/513 // https://www.w3.org/TR/webrtc/#set-the-configuration (step #4) // if len(configuration.Certificates) > 0 { // if len(configuration.Certificates) != len(existingConfiguration.Certificates) { diff --git a/vendor/github.com/pion/webrtc/v2/quictransport.go b/vendor/github.com/pion/webrtc/v2/quictransport.go index 861185f2..edd2692b 100644 --- a/vendor/github.com/pion/webrtc/v2/quictransport.go +++ b/vendor/github.com/pion/webrtc/v2/quictransport.go @@ -75,7 +75,7 @@ func (t *QUICTransport) GetLocalParameters() (QUICParameters, error) { fingerprints := []DTLSFingerprint{} for _, c := range t.certificates { - prints, err := c.GetFingerprints() // TODO: Should be only one? + prints, err := c.GetFingerprints() if err != nil { return QUICParameters{}, err @@ -98,7 +98,7 @@ func (t *QUICTransport) Start(remoteParameters QUICParameters) error { return err } - // TODO: handle multiple certs + // pion/webrtc#753 cert := t.certificates[0] isClient := true @@ -125,7 +125,6 @@ func (t *QUICTransport) Start(remoteParameters QUICParameters) error { } // Check the fingerprint if a certificate was exchanged - // TODO: Check why never received. remoteCerts := t.TransportBase.GetRemoteCertificates() if len(remoteCerts) > 0 { err := t.validateFingerPrint(remoteParameters, remoteCerts[0]) diff --git a/vendor/github.com/pion/webrtc/v2/rtptransceiver.go b/vendor/github.com/pion/webrtc/v2/rtptransceiver.go index df5fd5c9..f5ecdb4c 100644 --- a/vendor/github.com/pion/webrtc/v2/rtptransceiver.go +++ b/vendor/github.com/pion/webrtc/v2/rtptransceiver.go @@ -8,7 +8,6 @@ import ( // RTPTransceiver represents a combination of an RTPSender and an RTPReceiver that share a common mid. type RTPTransceiver struct { - Mid string Sender *RTPSender Receiver *RTPReceiver Direction RTPTransceiverDirection diff --git a/vendor/github.com/pion/webrtc/v2/sctptransport.go b/vendor/github.com/pion/webrtc/v2/sctptransport.go index 1efe5e8f..7b9508dc 100644 --- a/vendor/github.com/pion/webrtc/v2/sctptransport.go +++ b/vendor/github.com/pion/webrtc/v2/sctptransport.go @@ -24,8 +24,6 @@ type SCTPTransport struct { // State represents the current state of the SCTP transport. state SCTPTransportState - port uint16 - // MaxMessageSize represents the maximum size of data that can be passed to // DataChannel's send() method. maxMessageSize float64 @@ -36,8 +34,9 @@ type SCTPTransport struct { // OnStateChange func() - association *sctp.Association - onDataChannelHandler func(*DataChannel) + association *sctp.Association + onDataChannelHandler func(*DataChannel) + onDataChannelOpenedHandler func(*DataChannel) api *API log logging.LeveledLogger @@ -50,7 +49,6 @@ func (api *API) NewSCTPTransport(dtls *DTLSTransport) *SCTPTransport { res := &SCTPTransport{ dtlsTransport: dtls, state: SCTPTransportStateConnecting, - port: 5000, // TODO api: api, log: api.settingEngine.LoggerFactory.NewLogger("ortc"), } @@ -83,9 +81,6 @@ func (r *SCTPTransport) Start(remoteCaps SCTPCapabilities) error { r.lock.Lock() defer r.lock.Unlock() - // TODO: port - _ = r.maxMessageSize // TODO - if err := r.ensureDTLS(); err != nil { return err } @@ -142,8 +137,8 @@ func (r *SCTPTransport) acceptDataChannels() { if err != nil { if err != io.EOF { r.log.Errorf("Failed to accept data channel: %v", err) + // pion/webrtc#754 } - // TODO: Kill DataChannel/PeerConnection? return } @@ -183,12 +178,20 @@ func (r *SCTPTransport) acceptDataChannels() { if err != nil { r.log.Errorf("Failed to accept data channel: %v", err) - // TODO: Kill DataChannel/PeerConnection? + // pion/webrtc#754 return } <-r.onDataChannel(rtcDC) rtcDC.handleOpen(dc) + + r.lock.Lock() + dcOpenedHdlr := r.onDataChannelOpenedHandler + r.lock.Unlock() + + if dcOpenedHdlr != nil { + dcOpenedHdlr(rtcDC) + } } } @@ -200,6 +203,14 @@ func (r *SCTPTransport) OnDataChannel(f func(*DataChannel)) { r.onDataChannelHandler = f } +// OnDataChannelOpened sets an event handler which is invoked when a data +// channel is opened +func (r *SCTPTransport) OnDataChannelOpened(f func(*DataChannel)) { + r.lock.Lock() + defer r.lock.Unlock() + r.onDataChannelOpenedHandler = f +} + func (r *SCTPTransport) onDataChannel(dc *DataChannel) (done chan struct{}) { r.lock.Lock() hdlr := r.onDataChannelHandler @@ -225,8 +236,8 @@ func (r *SCTPTransport) updateMessageSize() { r.lock.Lock() defer r.lock.Unlock() - var remoteMaxMessageSize float64 = 65536 // TODO: get from SDP - var canSendSize float64 = 65536 // TODO: Get from SCTP implementation + var remoteMaxMessageSize float64 = 65536 // pion/webrtc#758 + var canSendSize float64 = 65536 // pion/webrtc#758 r.maxMessageSize = r.calcMessageSize(remoteMaxMessageSize, canSendSize) } diff --git a/vendor/github.com/pion/webrtc/v2/stats.go b/vendor/github.com/pion/webrtc/v2/stats.go index 4a1f4dde..aa55333e 100644 --- a/vendor/github.com/pion/webrtc/v2/stats.go +++ b/vendor/github.com/pion/webrtc/v2/stats.go @@ -1,7 +1,11 @@ package webrtc import ( + "fmt" + "sync" "time" + + "github.com/pion/ice" ) // A Stats object contains a set of statistics copies out of a monitored component @@ -76,9 +80,50 @@ func (s StatsTimestamp) Time() time.Time { return time.Unix(0, nanos).UTC() } +func statsTimestampFrom(t time.Time) StatsTimestamp { + return StatsTimestamp(t.UnixNano() / int64(time.Millisecond)) +} + +func statsTimestampNow() StatsTimestamp { + return statsTimestampFrom(time.Now()) +} + // StatsReport collects Stats objects indexed by their ID. type StatsReport map[string]Stats +type statsReportCollector struct { + collectingGroup sync.WaitGroup + report StatsReport + mux sync.Mutex +} + +func newStatsReportCollector() *statsReportCollector { + return &statsReportCollector{report: make(StatsReport)} +} + +func (src *statsReportCollector) Collecting() { + src.collectingGroup.Add(1) +} + +func (src *statsReportCollector) Collect(id string, stats Stats) { + src.mux.Lock() + defer src.mux.Unlock() + + src.report[id] = stats + src.collectingGroup.Done() +} + +func (src *statsReportCollector) Done() { + src.collectingGroup.Done() +} + +func (src *statsReportCollector) Ready() StatsReport { + src.collectingGroup.Wait() + src.mux.Lock() + defer src.mux.Unlock() + return src.report +} + // CodecType specifies whether a CodecStats objects represents a media format // that is being encoded or decoded type CodecType string @@ -1138,6 +1183,25 @@ type TransportStats struct { // ICECandidatePairStats object. type StatsICECandidatePairState string +func toStatsICECandidatePairState(state ice.CandidatePairState) (StatsICECandidatePairState, error) { + switch state { + case ice.CandidatePairStateWaiting: + return StatsICECandidatePairStateWaiting, nil + case ice.CandidatePairStateInProgress: + return StatsICECandidatePairStateInProgress, nil + case ice.CandidatePairStateFailed: + return StatsICECandidatePairStateFailed, nil + case ice.CandidatePairStateSucceeded: + return StatsICECandidatePairStateSucceeded, nil + default: + // NOTE: this should never happen[tm] + err := fmt.Errorf( + "cannot convert to StatsICECandidatePairStateSucceeded invalid ice candidate state: %s", + state.String()) + return StatsICECandidatePairState(Unknown), err + } +} + const ( // StatsICECandidatePairStateFrozen means a check for this pair hasn't been // performed, and it can't yet be performed until some other check succeeds, diff --git a/vendor/github.com/pion/webrtc/v2/stats_go.go b/vendor/github.com/pion/webrtc/v2/stats_go.go new file mode 100644 index 00000000..9d92ddfe --- /dev/null +++ b/vendor/github.com/pion/webrtc/v2/stats_go.go @@ -0,0 +1,63 @@ +// +build !js + +package webrtc + +// GetConnectionStats is a helper method to return the associated stats for a given PeerConnection +func (r StatsReport) GetConnectionStats(conn *PeerConnection) (PeerConnectionStats, bool) { + statsID := conn.getStatsID() + stats, ok := r[statsID] + if !ok { + return PeerConnectionStats{}, false + } + + pcStats, ok := stats.(PeerConnectionStats) + if !ok { + return PeerConnectionStats{}, false + } + return pcStats, true +} + +// GetDataChannelStats is a helper method to return the associated stats for a given DataChannel +func (r StatsReport) GetDataChannelStats(dc *DataChannel) (DataChannelStats, bool) { + statsID := dc.getStatsID() + stats, ok := r[statsID] + if !ok { + return DataChannelStats{}, false + } + + dcStats, ok := stats.(DataChannelStats) + if !ok { + return DataChannelStats{}, false + } + return dcStats, true +} + +// GetICECandidateStats is a helper method to return the associated stats for a given ICECandidate +func (r StatsReport) GetICECandidateStats(c *ICECandidate) (ICECandidateStats, bool) { + statsID := c.statsID + stats, ok := r[statsID] + if !ok { + return ICECandidateStats{}, false + } + + candidateStats, ok := stats.(ICECandidateStats) + if !ok { + return ICECandidateStats{}, false + } + return candidateStats, true +} + +// GetICECandidatePairStats is a helper method to return the associated stats for a given ICECandidatePair +func (r StatsReport) GetICECandidatePairStats(c *ICECandidatePair) (ICECandidatePairStats, bool) { + statsID := c.statsID + stats, ok := r[statsID] + if !ok { + return ICECandidatePairStats{}, false + } + + candidateStats, ok := stats.(ICECandidatePairStats) + if !ok { + return ICECandidatePairStats{}, false + } + return candidateStats, true +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info.go b/vendor/github.com/prometheus/client_golang/prometheus/build_info.go new file mode 100644 index 00000000..288f0e85 --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/build_info.go @@ -0,0 +1,29 @@ +// Copyright 2019 The Prometheus Authors +// 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. + +// +build go1.12 + +package prometheus + +import "runtime/debug" + +// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go 1.12+. +func readBuildInfo() (path, version, sum string) { + path, version, sum = "unknown", "unknown", "unknown" + if bi, ok := debug.ReadBuildInfo(); ok { + path = bi.Main.Path + version = bi.Main.Version + sum = bi.Main.Sum + } + return +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go b/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go new file mode 100644 index 00000000..6609e287 --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/build_info_pre_1.12.go @@ -0,0 +1,22 @@ +// Copyright 2019 The Prometheus Authors +// 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. + +// +build !go1.12 + +package prometheus + +// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go versions before +// 1.12. Remove this whole file once the minimum supported Go version is 1.12. +func readBuildInfo() (path, version, sum string) { + return "unknown", "unknown", "unknown" +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/doc.go b/vendor/github.com/prometheus/client_golang/prometheus/doc.go index 1e0d578e..01977de6 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/doc.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/doc.go @@ -183,7 +183,6 @@ // method can then expose the gathered metrics in some way. Usually, the metrics // are served via HTTP on the /metrics endpoint. That's happening in the example // above. The tools to expose metrics via HTTP are in the promhttp sub-package. -// (The top-level functions in the prometheus package are deprecated.) // // Pushing to the Pushgateway // diff --git a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go index b108ec51..dc9247fe 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/go_collector.go @@ -36,7 +36,7 @@ type goCollector struct { msMaxAge time.Duration // Maximum allowed age of old memstats. } -// NewGoCollector returns a collector which exports metrics about the current Go +// NewGoCollector returns a collector that exports metrics about the current Go // process. This includes memory stats. To collect those, runtime.ReadMemStats // is called. This requires to “stop the worldâ€, which usually only happens for // garbage collection (GC). Take the following implications into account when @@ -364,3 +364,33 @@ type memStatsMetrics []struct { eval func(*runtime.MemStats) float64 valType ValueType } + +// NewBuildInfoCollector returns a collector collecting a single metric +// "go_build_info" with the constant value 1 and three labels "path", "version", +// and "checksum". Their label values contain the main module path, version, and +// checksum, respectively. The labels will only have meaningful values if the +// binary is built with Go module support and from source code retrieved from +// the source repository (rather than the local file system). This is usually +// accomplished by building from outside of GOPATH, specifying the full address +// of the main package, e.g. "GO111MODULE=on go run +// github.com/prometheus/client_golang/examples/random". If built without Go +// module support, all label values will be "unknown". If built with Go module +// support but using the source code from the local file system, the "path" will +// be set appropriately, but "checksum" will be empty and "version" will be +// "(devel)". +// +// This collector uses only the build information for the main module. See +// https://github.com/povilasv/prommod for an example of a collector for the +// module dependencies. +func NewBuildInfoCollector() Collector { + path, version, sum := readBuildInfo() + c := &selfCollector{MustNewConstMetric( + NewDesc( + "go_build_info", + "Build information about the main Go module.", + nil, Labels{"path": path, "version": version, "checksum": sum}, + ), + GaugeValue, 1)} + c.init(c.self) + return c +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/http.go b/vendor/github.com/prometheus/client_golang/prometheus/http.go deleted file mode 100644 index 19a3e8f4..00000000 --- a/vendor/github.com/prometheus/client_golang/prometheus/http.go +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright 2014 The Prometheus Authors -// 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. - -package prometheus - -import ( - "bufio" - "compress/gzip" - "io" - "net" - "net/http" - "strconv" - "strings" - "sync" - "time" - - "github.com/prometheus/common/expfmt" -) - -// TODO(beorn7): Remove this whole file. It is a partial mirror of -// promhttp/http.go (to avoid circular import chains) where everything HTTP -// related should live. The functions here are just for avoiding -// breakage. Everything is deprecated. - -const ( - contentTypeHeader = "Content-Type" - contentEncodingHeader = "Content-Encoding" - acceptEncodingHeader = "Accept-Encoding" -) - -var gzipPool = sync.Pool{ - New: func() interface{} { - return gzip.NewWriter(nil) - }, -} - -// Handler returns an HTTP handler for the DefaultGatherer. It is -// already instrumented with InstrumentHandler (using "prometheus" as handler -// name). -// -// Deprecated: Please note the issues described in the doc comment of -// InstrumentHandler. You might want to consider using promhttp.Handler instead. -func Handler() http.Handler { - return InstrumentHandler("prometheus", UninstrumentedHandler()) -} - -// UninstrumentedHandler returns an HTTP handler for the DefaultGatherer. -// -// Deprecated: Use promhttp.HandlerFor(DefaultGatherer, promhttp.HandlerOpts{}) -// instead. See there for further documentation. -func UninstrumentedHandler() http.Handler { - return http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) { - mfs, err := DefaultGatherer.Gather() - if err != nil { - httpError(rsp, err) - return - } - - contentType := expfmt.Negotiate(req.Header) - header := rsp.Header() - header.Set(contentTypeHeader, string(contentType)) - - w := io.Writer(rsp) - if gzipAccepted(req.Header) { - header.Set(contentEncodingHeader, "gzip") - gz := gzipPool.Get().(*gzip.Writer) - defer gzipPool.Put(gz) - - gz.Reset(w) - defer gz.Close() - - w = gz - } - - enc := expfmt.NewEncoder(w, contentType) - - for _, mf := range mfs { - if err := enc.Encode(mf); err != nil { - httpError(rsp, err) - return - } - } - }) -} - -var instLabels = []string{"method", "code"} - -type nower interface { - Now() time.Time -} - -type nowFunc func() time.Time - -func (n nowFunc) Now() time.Time { - return n() -} - -var now nower = nowFunc(func() time.Time { - return time.Now() -}) - -// InstrumentHandler wraps the given HTTP handler for instrumentation. It -// registers four metric collectors (if not already done) and reports HTTP -// metrics to the (newly or already) registered collectors: http_requests_total -// (CounterVec), http_request_duration_microseconds (Summary), -// http_request_size_bytes (Summary), http_response_size_bytes (Summary). Each -// has a constant label named "handler" with the provided handlerName as -// value. http_requests_total is a metric vector partitioned by HTTP method -// (label name "method") and HTTP status code (label name "code"). -// -// Deprecated: InstrumentHandler has several issues. Use the tooling provided in -// package promhttp instead. The issues are the following: (1) It uses Summaries -// rather than Histograms. Summaries are not useful if aggregation across -// multiple instances is required. (2) It uses microseconds as unit, which is -// deprecated and should be replaced by seconds. (3) The size of the request is -// calculated in a separate goroutine. Since this calculator requires access to -// the request header, it creates a race with any writes to the header performed -// during request handling. httputil.ReverseProxy is a prominent example for a -// handler performing such writes. (4) It has additional issues with HTTP/2, cf. -// https://github.com/prometheus/client_golang/issues/272. -func InstrumentHandler(handlerName string, handler http.Handler) http.HandlerFunc { - return InstrumentHandlerFunc(handlerName, handler.ServeHTTP) -} - -// InstrumentHandlerFunc wraps the given function for instrumentation. It -// otherwise works in the same way as InstrumentHandler (and shares the same -// issues). -// -// Deprecated: InstrumentHandlerFunc is deprecated for the same reasons as -// InstrumentHandler is. Use the tooling provided in package promhttp instead. -func InstrumentHandlerFunc(handlerName string, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc { - return InstrumentHandlerFuncWithOpts( - SummaryOpts{ - Subsystem: "http", - ConstLabels: Labels{"handler": handlerName}, - Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001}, - }, - handlerFunc, - ) -} - -// InstrumentHandlerWithOpts works like InstrumentHandler (and shares the same -// issues) but provides more flexibility (at the cost of a more complex call -// syntax). As InstrumentHandler, this function registers four metric -// collectors, but it uses the provided SummaryOpts to create them. However, the -// fields "Name" and "Help" in the SummaryOpts are ignored. "Name" is replaced -// by "requests_total", "request_duration_microseconds", "request_size_bytes", -// and "response_size_bytes", respectively. "Help" is replaced by an appropriate -// help string. The names of the variable labels of the http_requests_total -// CounterVec are "method" (get, post, etc.), and "code" (HTTP status code). -// -// If InstrumentHandlerWithOpts is called as follows, it mimics exactly the -// behavior of InstrumentHandler: -// -// prometheus.InstrumentHandlerWithOpts( -// prometheus.SummaryOpts{ -// Subsystem: "http", -// ConstLabels: prometheus.Labels{"handler": handlerName}, -// }, -// handler, -// ) -// -// Technical detail: "requests_total" is a CounterVec, not a SummaryVec, so it -// cannot use SummaryOpts. Instead, a CounterOpts struct is created internally, -// and all its fields are set to the equally named fields in the provided -// SummaryOpts. -// -// Deprecated: InstrumentHandlerWithOpts is deprecated for the same reasons as -// InstrumentHandler is. Use the tooling provided in package promhttp instead. -func InstrumentHandlerWithOpts(opts SummaryOpts, handler http.Handler) http.HandlerFunc { - return InstrumentHandlerFuncWithOpts(opts, handler.ServeHTTP) -} - -// InstrumentHandlerFuncWithOpts works like InstrumentHandlerFunc (and shares -// the same issues) but provides more flexibility (at the cost of a more complex -// call syntax). See InstrumentHandlerWithOpts for details how the provided -// SummaryOpts are used. -// -// Deprecated: InstrumentHandlerFuncWithOpts is deprecated for the same reasons -// as InstrumentHandler is. Use the tooling provided in package promhttp instead. -func InstrumentHandlerFuncWithOpts(opts SummaryOpts, handlerFunc func(http.ResponseWriter, *http.Request)) http.HandlerFunc { - reqCnt := NewCounterVec( - CounterOpts{ - Namespace: opts.Namespace, - Subsystem: opts.Subsystem, - Name: "requests_total", - Help: "Total number of HTTP requests made.", - ConstLabels: opts.ConstLabels, - }, - instLabels, - ) - if err := Register(reqCnt); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqCnt = are.ExistingCollector.(*CounterVec) - } else { - panic(err) - } - } - - opts.Name = "request_duration_microseconds" - opts.Help = "The HTTP request latencies in microseconds." - reqDur := NewSummary(opts) - if err := Register(reqDur); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqDur = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - opts.Name = "request_size_bytes" - opts.Help = "The HTTP request sizes in bytes." - reqSz := NewSummary(opts) - if err := Register(reqSz); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - reqSz = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - opts.Name = "response_size_bytes" - opts.Help = "The HTTP response sizes in bytes." - resSz := NewSummary(opts) - if err := Register(resSz); err != nil { - if are, ok := err.(AlreadyRegisteredError); ok { - resSz = are.ExistingCollector.(Summary) - } else { - panic(err) - } - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - now := time.Now() - - delegate := &responseWriterDelegator{ResponseWriter: w} - out := computeApproximateRequestSize(r) - - _, cn := w.(http.CloseNotifier) - _, fl := w.(http.Flusher) - _, hj := w.(http.Hijacker) - _, rf := w.(io.ReaderFrom) - var rw http.ResponseWriter - if cn && fl && hj && rf { - rw = &fancyResponseWriterDelegator{delegate} - } else { - rw = delegate - } - handlerFunc(rw, r) - - elapsed := float64(time.Since(now)) / float64(time.Microsecond) - - method := sanitizeMethod(r.Method) - code := sanitizeCode(delegate.status) - reqCnt.WithLabelValues(method, code).Inc() - reqDur.Observe(elapsed) - resSz.Observe(float64(delegate.written)) - reqSz.Observe(float64(<-out)) - }) -} - -func computeApproximateRequestSize(r *http.Request) <-chan int { - // Get URL length in current goroutine for avoiding a race condition. - // HandlerFunc that runs in parallel may modify the URL. - s := 0 - if r.URL != nil { - s += len(r.URL.String()) - } - - out := make(chan int, 1) - - go func() { - s += len(r.Method) - s += len(r.Proto) - for name, values := range r.Header { - s += len(name) - for _, value := range values { - s += len(value) - } - } - s += len(r.Host) - - // N.B. r.Form and r.MultipartForm are assumed to be included in r.URL. - - if r.ContentLength != -1 { - s += int(r.ContentLength) - } - out <- s - close(out) - }() - - return out -} - -type responseWriterDelegator struct { - http.ResponseWriter - - status int - written int64 - wroteHeader bool -} - -func (r *responseWriterDelegator) WriteHeader(code int) { - r.status = code - r.wroteHeader = true - r.ResponseWriter.WriteHeader(code) -} - -func (r *responseWriterDelegator) Write(b []byte) (int, error) { - if !r.wroteHeader { - r.WriteHeader(http.StatusOK) - } - n, err := r.ResponseWriter.Write(b) - r.written += int64(n) - return n, err -} - -type fancyResponseWriterDelegator struct { - *responseWriterDelegator -} - -func (f *fancyResponseWriterDelegator) CloseNotify() <-chan bool { - //lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to - //remove support from client_golang yet. - return f.ResponseWriter.(http.CloseNotifier).CloseNotify() -} - -func (f *fancyResponseWriterDelegator) Flush() { - f.ResponseWriter.(http.Flusher).Flush() -} - -func (f *fancyResponseWriterDelegator) Hijack() (net.Conn, *bufio.ReadWriter, error) { - return f.ResponseWriter.(http.Hijacker).Hijack() -} - -func (f *fancyResponseWriterDelegator) ReadFrom(r io.Reader) (int64, error) { - if !f.wroteHeader { - f.WriteHeader(http.StatusOK) - } - n, err := f.ResponseWriter.(io.ReaderFrom).ReadFrom(r) - f.written += n - return n, err -} - -func sanitizeMethod(m string) string { - switch m { - case "GET", "get": - return "get" - case "PUT", "put": - return "put" - case "HEAD", "head": - return "head" - case "POST", "post": - return "post" - case "DELETE", "delete": - return "delete" - case "CONNECT", "connect": - return "connect" - case "OPTIONS", "options": - return "options" - case "NOTIFY", "notify": - return "notify" - default: - return strings.ToLower(m) - } -} - -func sanitizeCode(s int) string { - switch s { - case 100: - return "100" - case 101: - return "101" - - case 200: - return "200" - case 201: - return "201" - case 202: - return "202" - case 203: - return "203" - case 204: - return "204" - case 205: - return "205" - case 206: - return "206" - - case 300: - return "300" - case 301: - return "301" - case 302: - return "302" - case 304: - return "304" - case 305: - return "305" - case 307: - return "307" - - case 400: - return "400" - case 401: - return "401" - case 402: - return "402" - case 403: - return "403" - case 404: - return "404" - case 405: - return "405" - case 406: - return "406" - case 407: - return "407" - case 408: - return "408" - case 409: - return "409" - case 410: - return "410" - case 411: - return "411" - case 412: - return "412" - case 413: - return "413" - case 414: - return "414" - case 415: - return "415" - case 416: - return "416" - case 417: - return "417" - case 418: - return "418" - - case 500: - return "500" - case 501: - return "501" - case 502: - return "502" - case 503: - return "503" - case 504: - return "504" - case 505: - return "505" - - case 428: - return "428" - case 429: - return "429" - case 431: - return "431" - case 511: - return "511" - - default: - return strconv.Itoa(s) - } -} - -// gzipAccepted returns whether the client will accept gzip-encoded content. -func gzipAccepted(header http.Header) bool { - a := header.Get(acceptEncodingHeader) - parts := strings.Split(a, ",") - for _, part := range parts { - part = strings.TrimSpace(part) - if part == "gzip" || strings.HasPrefix(part, "gzip;") { - return true - } - } - return false -} - -// httpError removes any content-encoding header and then calls http.Error with -// the provided error and http.StatusInternalServerErrer. Error contents is -// supposed to be uncompressed plain text. However, same as with a plain -// http.Error, any header settings will be void if the header has already been -// sent. The error message will still be written to the writer, but it will -// probably be of limited use. -func httpError(rsp http.ResponseWriter, err error) { - rsp.Header().Del(contentEncodingHeader) - http.Error( - rsp, - "An error has occurred while serving metrics:\n\n"+err.Error(), - http.StatusInternalServerError, - ) -} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go index 55176d58..9b809794 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector.go @@ -16,8 +16,6 @@ package prometheus import ( "errors" "os" - - "github.com/prometheus/procfs" ) type processCollector struct { @@ -59,20 +57,9 @@ type ProcessCollectorOpts struct { // collector for the current process with an empty namespace string and no error // reporting. // -// Currently, the collector depends on a Linux-style proc filesystem and -// therefore only exports metrics for Linux. -// -// Note: An older version of this function had the following signature: -// -// NewProcessCollector(pid int, namespace string) Collector -// -// Most commonly, it was called as -// -// NewProcessCollector(os.Getpid(), "") -// -// The following call of the current version is equivalent to the above: -// -// NewProcessCollector(ProcessCollectorOpts{}) +// The collector only works on operating systems with a Linux-style proc +// filesystem and on Microsoft Windows. On other operating systems, it will not +// collect any metrics. func NewProcessCollector(opts ProcessCollectorOpts) Collector { ns := "" if len(opts.Namespace) > 0 { @@ -126,7 +113,7 @@ func NewProcessCollector(opts ProcessCollectorOpts) Collector { } // Set up process metric collection if supported by the runtime. - if _, err := procfs.NewStat(); err == nil { + if canCollectProcess() { c.collectFn = c.processCollect } else { c.collectFn = func(ch chan<- Metric) { @@ -153,46 +140,6 @@ func (c *processCollector) Collect(ch chan<- Metric) { c.collectFn(ch) } -func (c *processCollector) processCollect(ch chan<- Metric) { - pid, err := c.pidFn() - if err != nil { - c.reportError(ch, nil, err) - return - } - - p, err := procfs.NewProc(pid) - if err != nil { - c.reportError(ch, nil, err) - return - } - - if stat, err := p.NewStat(); err == nil { - ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime()) - ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory())) - ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory())) - if startTime, err := stat.StartTime(); err == nil { - ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime) - } else { - c.reportError(ch, c.startTime, err) - } - } else { - c.reportError(ch, nil, err) - } - - if fds, err := p.FileDescriptorsLen(); err == nil { - ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds)) - } else { - c.reportError(ch, c.openFDs, err) - } - - if limits, err := p.NewLimits(); err == nil { - ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles)) - ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace)) - } else { - c.reportError(ch, nil, err) - } -} - func (c *processCollector) reportError(ch chan<- Metric, desc *Desc, err error) { if !c.reportErrors { return diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go new file mode 100644 index 00000000..3117461c --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go @@ -0,0 +1,65 @@ +// Copyright 2019 The Prometheus Authors +// 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. + +// +build !windows + +package prometheus + +import ( + "github.com/prometheus/procfs" +) + +func canCollectProcess() bool { + _, err := procfs.NewDefaultFS() + return err == nil +} + +func (c *processCollector) processCollect(ch chan<- Metric) { + pid, err := c.pidFn() + if err != nil { + c.reportError(ch, nil, err) + return + } + + p, err := procfs.NewProc(pid) + if err != nil { + c.reportError(ch, nil, err) + return + } + + if stat, err := p.Stat(); err == nil { + ch <- MustNewConstMetric(c.cpuTotal, CounterValue, stat.CPUTime()) + ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(stat.VirtualMemory())) + ch <- MustNewConstMetric(c.rss, GaugeValue, float64(stat.ResidentMemory())) + if startTime, err := stat.StartTime(); err == nil { + ch <- MustNewConstMetric(c.startTime, GaugeValue, startTime) + } else { + c.reportError(ch, c.startTime, err) + } + } else { + c.reportError(ch, nil, err) + } + + if fds, err := p.FileDescriptorsLen(); err == nil { + ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(fds)) + } else { + c.reportError(ch, c.openFDs, err) + } + + if limits, err := p.Limits(); err == nil { + ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(limits.OpenFiles)) + ch <- MustNewConstMetric(c.maxVsize, GaugeValue, float64(limits.AddressSpace)) + } else { + c.reportError(ch, nil, err) + } +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go new file mode 100644 index 00000000..e0b935d1 --- /dev/null +++ b/vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go @@ -0,0 +1,112 @@ +// Copyright 2019 The Prometheus Authors +// 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. + +package prometheus + +import ( + "syscall" + "unsafe" + + "golang.org/x/sys/windows" +) + +func canCollectProcess() bool { + return true +} + +var ( + modpsapi = syscall.NewLazyDLL("psapi.dll") + modkernel32 = syscall.NewLazyDLL("kernel32.dll") + + procGetProcessMemoryInfo = modpsapi.NewProc("GetProcessMemoryInfo") + procGetProcessHandleCount = modkernel32.NewProc("GetProcessHandleCount") +) + +type processMemoryCounters struct { + // https://docs.microsoft.com/en-us/windows/desktop/api/psapi/ns-psapi-_process_memory_counters_ex + _ uint32 + PageFaultCount uint32 + PeakWorkingSetSize uint64 + WorkingSetSize uint64 + QuotaPeakPagedPoolUsage uint64 + QuotaPagedPoolUsage uint64 + QuotaPeakNonPagedPoolUsage uint64 + QuotaNonPagedPoolUsage uint64 + PagefileUsage uint64 + PeakPagefileUsage uint64 + PrivateUsage uint64 +} + +func getProcessMemoryInfo(handle windows.Handle) (processMemoryCounters, error) { + mem := processMemoryCounters{} + r1, _, err := procGetProcessMemoryInfo.Call( + uintptr(handle), + uintptr(unsafe.Pointer(&mem)), + uintptr(unsafe.Sizeof(mem)), + ) + if r1 != 1 { + return mem, err + } else { + return mem, nil + } +} + +func getProcessHandleCount(handle windows.Handle) (uint32, error) { + var count uint32 + r1, _, err := procGetProcessHandleCount.Call( + uintptr(handle), + uintptr(unsafe.Pointer(&count)), + ) + if r1 != 1 { + return 0, err + } else { + return count, nil + } +} + +func (c *processCollector) processCollect(ch chan<- Metric) { + h, err := windows.GetCurrentProcess() + if err != nil { + c.reportError(ch, nil, err) + return + } + + var startTime, exitTime, kernelTime, userTime windows.Filetime + err = windows.GetProcessTimes(h, &startTime, &exitTime, &kernelTime, &userTime) + if err != nil { + c.reportError(ch, nil, err) + return + } + ch <- MustNewConstMetric(c.startTime, GaugeValue, float64(startTime.Nanoseconds()/1e9)) + ch <- MustNewConstMetric(c.cpuTotal, CounterValue, fileTimeToSeconds(kernelTime)+fileTimeToSeconds(userTime)) + + mem, err := getProcessMemoryInfo(h) + if err != nil { + c.reportError(ch, nil, err) + return + } + ch <- MustNewConstMetric(c.vsize, GaugeValue, float64(mem.PrivateUsage)) + ch <- MustNewConstMetric(c.rss, GaugeValue, float64(mem.WorkingSetSize)) + + handles, err := getProcessHandleCount(h) + if err != nil { + c.reportError(ch, nil, err) + return + } + ch <- MustNewConstMetric(c.openFDs, GaugeValue, float64(handles)) + ch <- MustNewConstMetric(c.maxFDs, GaugeValue, float64(16*1024*1024)) // Windows has a hard-coded max limit, not per-process. +} + +func fileTimeToSeconds(ft windows.Filetime) float64 { + return float64(uint64(ft.HighDateTime)<<32+uint64(ft.LowDateTime)) / 1e7 +} diff --git a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go index b137c883..cea5a90f 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go @@ -84,10 +84,32 @@ func Handler() http.Handler { // instrumentation. Use the InstrumentMetricHandler function to apply the same // kind of instrumentation as it is used by the Handler function. func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler { - var inFlightSem chan struct{} + var ( + inFlightSem chan struct{} + errCnt = prometheus.NewCounterVec( + prometheus.CounterOpts{ + Name: "promhttp_metric_handler_errors_total", + Help: "Total number of internal errors encountered by the promhttp metric handler.", + }, + []string{"cause"}, + ) + ) + if opts.MaxRequestsInFlight > 0 { inFlightSem = make(chan struct{}, opts.MaxRequestsInFlight) } + if opts.Registry != nil { + // Initialize all possibilites that can occur below. + errCnt.WithLabelValues("gathering") + errCnt.WithLabelValues("encoding") + if err := opts.Registry.Register(errCnt); err != nil { + if are, ok := err.(prometheus.AlreadyRegisteredError); ok { + errCnt = are.ExistingCollector.(*prometheus.CounterVec) + } else { + panic(err) + } + } + } h := http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) { if inFlightSem != nil { @@ -106,6 +128,7 @@ func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler { if opts.ErrorLog != nil { opts.ErrorLog.Println("error gathering metrics:", err) } + errCnt.WithLabelValues("gathering").Inc() switch opts.ErrorHandling { case PanicOnError: panic(err) @@ -146,6 +169,7 @@ func HandlerFor(reg prometheus.Gatherer, opts HandlerOpts) http.Handler { if opts.ErrorLog != nil { opts.ErrorLog.Println("error encoding and sending metric family:", err) } + errCnt.WithLabelValues("encoding").Inc() switch opts.ErrorHandling { case PanicOnError: panic(err) @@ -236,9 +260,12 @@ const ( // Ignore errors and try to serve as many metrics as possible. However, // if no metrics can be served, serve an HTTP status code 500 and the // last error message in the body. Only use this in deliberate "best - // effort" metrics collection scenarios. It is recommended to at least - // log errors (by providing an ErrorLog in HandlerOpts) to not mask - // errors completely. + // effort" metrics collection scenarios. In this case, it is highly + // recommended to provide other means of detecting errors: By setting an + // ErrorLog in HandlerOpts, the errors are logged. By providing a + // Registry in HandlerOpts, the exposed metrics include an error counter + // "promhttp_metric_handler_errors_total", which can be used for + // alerts. ContinueOnError // Panic upon the first error encountered (useful for "crash only" apps). PanicOnError @@ -261,6 +288,18 @@ type HandlerOpts struct { // logged regardless of the configured ErrorHandling provided ErrorLog // is not nil. ErrorHandling HandlerErrorHandling + // If Registry is not nil, it is used to register a metric + // "promhttp_metric_handler_errors_total", partitioned by "cause". A + // failed registration causes a panic. Note that this error counter is + // different from the instrumentation you get from the various + // InstrumentHandler... helpers. It counts errors that don't necessarily + // result in a non-2xx HTTP status code. There are two typical cases: + // (1) Encoding errors that only happen after streaming of the HTTP body + // has already started (and the status code 200 has been sent). This + // should only happen with custom collectors. (2) Collection errors with + // no effect on the HTTP status code because ErrorHandling is set to + // ContinueOnError. + Registry prometheus.Registerer // If DisableCompression is true, the handler will never compress the // response, even if requested by the client. DisableCompression bool diff --git a/vendor/github.com/prometheus/client_golang/prometheus/registry.go b/vendor/github.com/prometheus/client_golang/prometheus/registry.go index f2fb67ae..6c32516a 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/registry.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/registry.go @@ -325,9 +325,17 @@ func (r *Registry) Register(c Collector) error { return nil } if existing, exists := r.collectorsByID[collectorID]; exists { - return AlreadyRegisteredError{ - ExistingCollector: existing, - NewCollector: c, + switch e := existing.(type) { + case *wrappingCollector: + return AlreadyRegisteredError{ + ExistingCollector: e.unwrapRecursively(), + NewCollector: c, + } + default: + return AlreadyRegisteredError{ + ExistingCollector: e, + NewCollector: c, + } } } // If the collectorID is new, but at least one of the descs existed diff --git a/vendor/github.com/prometheus/client_golang/prometheus/summary.go b/vendor/github.com/prometheus/client_golang/prometheus/summary.go index 1574b0fe..c970fdee 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/summary.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/summary.go @@ -39,7 +39,7 @@ const quantileLabel = "quantile" // A typical use-case is the observation of request latencies. By default, a // Summary provides the median, the 90th and the 99th percentile of the latency // as rank estimations. However, the default behavior will change in the -// upcoming v0.10 of the library. There will be no rank estimations at all by +// upcoming v1.0.0 of the library. There will be no rank estimations at all by // default. For a sane transition, it is recommended to set the desired rank // estimations explicitly. // @@ -58,16 +58,8 @@ type Summary interface { Observe(float64) } -// DefObjectives are the default Summary quantile values. -// -// Deprecated: DefObjectives will not be used as the default objectives in -// v0.10 of the library. The default Summary will have no quantiles then. -var ( - DefObjectives = map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001} - - errQuantileLabelNotAllowed = fmt.Errorf( - "%q is not allowed as label name in summaries", quantileLabel, - ) +var errQuantileLabelNotAllowed = fmt.Errorf( + "%q is not allowed as label name in summaries", quantileLabel, ) // Default values for SummaryOpts. @@ -86,7 +78,7 @@ const ( // mandatory to set Name to a non-empty string. While all other fields are // optional and can safely be left at their zero value, it is recommended to set // a help string and to explicitly set the Objectives field to the desired value -// as the default value will change in the upcoming v0.10 of the library. +// as the default value will change in the upcoming v1.0.0 of the library. type SummaryOpts struct { // Namespace, Subsystem, and Name are components of the fully-qualified // name of the Summary (created by joining these components with @@ -123,14 +115,8 @@ type SummaryOpts struct { // Objectives defines the quantile rank estimates with their respective // absolute error. If Objectives[q] = e, then the value reported for q // will be the φ-quantile value for some φ between q-e and q+e. The - // default value is DefObjectives. It is used if Objectives is left at - // its zero value (i.e. nil). To create a Summary without Objectives, - // set it to an empty map (i.e. map[float64]float64{}). - // - // Note that the current value of DefObjectives is deprecated. It will - // be replaced by an empty map in v0.10 of the library. Please - // explicitly set Objectives to the desired value to avoid problems - // during the transition. + // default value is an empty map, resulting in a summary without + // quantiles. Objectives map[float64]float64 // MaxAge defines the duration for which an observation stays relevant @@ -199,7 +185,7 @@ func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary { } if opts.Objectives == nil { - opts.Objectives = DefObjectives + opts.Objectives = map[float64]float64{} } if opts.MaxAge < 0 { diff --git a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go index 49159bf3..e303eef6 100644 --- a/vendor/github.com/prometheus/client_golang/prometheus/wrap.go +++ b/vendor/github.com/prometheus/client_golang/prometheus/wrap.go @@ -32,6 +32,12 @@ import ( // WrapRegistererWith provides a way to add fixed labels to a subset of // Collectors. It should not be used to add fixed labels to all metrics exposed. // +// Conflicts between Collectors registered through the original Registerer with +// Collectors registered through the wrapping Registerer will still be +// detected. Any AlreadyRegisteredError returned by the Register method of +// either Registerer will contain the ExistingCollector in the form it was +// provided to the respective registry. +// // The Collector example demonstrates a use of WrapRegistererWith. func WrapRegistererWith(labels Labels, reg Registerer) Registerer { return &wrappingRegisterer{ @@ -54,6 +60,12 @@ func WrapRegistererWith(labels Labels, reg Registerer) Registerer { // (see NewGoCollector) and the process collector (see NewProcessCollector). (In // fact, those metrics are already prefixed with “go_†or “process_â€, // respectively.) +// +// Conflicts between Collectors registered through the original Registerer with +// Collectors registered through the wrapping Registerer will still be +// detected. Any AlreadyRegisteredError returned by the Register method of +// either Registerer will contain the ExistingCollector in the form it was +// provided to the respective registry. func WrapRegistererWithPrefix(prefix string, reg Registerer) Registerer { return &wrappingRegisterer{ wrappedRegisterer: reg, @@ -123,6 +135,15 @@ func (c *wrappingCollector) Describe(ch chan<- *Desc) { } } +func (c *wrappingCollector) unwrapRecursively() Collector { + switch wc := c.wrappedCollector.(type) { + case *wrappingCollector: + return wc.unwrapRecursively() + default: + return wc + } +} + type wrappingMetric struct { wrappedMetric Metric prefix string diff --git a/vendor/github.com/prometheus/common/model/time.go b/vendor/github.com/prometheus/common/model/time.go index 46259b1f..7b0064fd 100644 --- a/vendor/github.com/prometheus/common/model/time.go +++ b/vendor/github.com/prometheus/common/model/time.go @@ -150,7 +150,13 @@ func (t *Time) UnmarshalJSON(b []byte) error { return err } - *t = Time(v + va) + // If the value was something like -0.1 the negative is lost in the + // parsing because of the leading zero, this ensures that we capture it. + if len(p[0]) > 0 && p[0][0] == '-' && v+va > 0 { + *t = Time(v+va) * -1 + } else { + *t = Time(v + va) + } default: return fmt.Errorf("invalid time %q", string(b)) diff --git a/vendor/github.com/prometheus/procfs/Makefile b/vendor/github.com/prometheus/procfs/Makefile index 314d1ba5..616a0d25 100644 --- a/vendor/github.com/prometheus/procfs/Makefile +++ b/vendor/github.com/prometheus/procfs/Makefile @@ -14,6 +14,7 @@ include Makefile.common %/.unpacked: %.ttar + @echo ">> extracting fixtures" ./ttar -C $(dir $*) -x -f $*.ttar touch $@ diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common index 4f18ea58..d7aea1b8 100644 --- a/vendor/github.com/prometheus/procfs/Makefile.common +++ b/vendor/github.com/prometheus/procfs/Makefile.common @@ -69,7 +69,7 @@ else GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH) endif -PROMU_VERSION ?= 0.3.0 +PROMU_VERSION ?= 0.4.0 PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz GOLANGCI_LINT := @@ -86,6 +86,7 @@ endif PREFIX ?= $(shell pwd) BIN_DIR ?= $(shell pwd) DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) +DOCKERFILE_PATH ?= ./ DOCKER_REPO ?= prom DOCKER_ARCHS ?= amd64 @@ -212,7 +213,7 @@ $(BUILD_DOCKER_ARCHS): common-docker-%: docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \ --build-arg ARCH="$*" \ --build-arg OS="linux" \ - . + $(DOCKERFILE_PATH) .PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS) common-docker-publish: $(PUBLISH_DOCKER_ARCHS) @@ -247,7 +248,9 @@ proto: ifdef GOLANGCI_LINT $(GOLANGCI_LINT): mkdir -p $(FIRST_GOPATH)/bin - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION) + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_LINT_VERSION)/install.sh \ + | sed -e '/install -d/d' \ + | sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION) endif ifdef GOVENDOR diff --git a/vendor/github.com/prometheus/procfs/README.md b/vendor/github.com/prometheus/procfs/README.md index 20954947..6f8850fe 100644 --- a/vendor/github.com/prometheus/procfs/README.md +++ b/vendor/github.com/prometheus/procfs/README.md @@ -1,7 +1,7 @@ # procfs This procfs package provides functions to retrieve system, kernel and process -metrics from the pseudo-filesystem proc. +metrics from the pseudo-filesystems /proc and /sys. *WARNING*: This package is a work in progress. Its API may still break in backwards-incompatible ways without warnings. Use it at your own risk. @@ -9,3 +9,45 @@ backwards-incompatible ways without warnings. Use it at your own risk. [![GoDoc](https://godoc.org/github.com/prometheus/procfs?status.png)](https://godoc.org/github.com/prometheus/procfs) [![Build Status](https://travis-ci.org/prometheus/procfs.svg?branch=master)](https://travis-ci.org/prometheus/procfs) [![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/procfs)](https://goreportcard.com/report/github.com/prometheus/procfs) + +## Usage + +The procfs library is organized by packages based on whether the gathered data is coming from +/proc, /sys, or both. Each package contains an `FS` type which represents the path to either /proc, /sys, or both. For example, current cpu statistics are gathered from +`/proc/stat` and are available via the root procfs package. First, the proc filesystem mount +point is initialized, and then the stat information is read. + +```go +fs, err := procfs.NewFS("/proc") +stats, err := fs.Stat() +``` + +Some sub-packages such as `blockdevice`, require access to both the proc and sys filesystems. + +```go + fs, err := blockdevice.NewFS("/proc", "/sys") + stats, err := fs.ProcDiskstats() +``` + +## Building and Testing + +The procfs library is normally built as part of another application. However, when making +changes to the library, the `make test` command can be used to run the API test suite. + +### Updating Test Fixtures + +The procfs library includes a set of test fixtures which include many example files from +the `/proc` and `/sys` filesystems. These fixtures are included as a [ttar](https://github.com/ideaship/ttar) file +which is extracted automatically during testing. To add/update the test fixtures, first +ensure the `fixtures` directory is up to date by removing the existing directory and then +extracting the ttar file using `make fixtures/.unpacked` or just `make test`. + +```bash +rm -rf fixtures +make test +``` + +Next, make the required changes to the extracted files in the `fixtures` directory. When +the changes are complete, run `make update_fixtures` to create a new `fixtures.ttar` file +based on the updated `fixtures` directory. And finally, verify the changes using +`git diff fixtures.ttar`. diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go index 5cd22a83..63d4229a 100644 --- a/vendor/github.com/prometheus/procfs/buddyinfo.go +++ b/vendor/github.com/prometheus/procfs/buddyinfo.go @@ -31,18 +31,8 @@ type BuddyInfo struct { Sizes []float64 } -// NewBuddyInfo reads the buddyinfo statistics. -func NewBuddyInfo() ([]BuddyInfo, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return nil, err - } - - return fs.NewBuddyInfo() -} - // NewBuddyInfo reads the buddyinfo statistics from the specified `proc` filesystem. -func (fs FS) NewBuddyInfo() ([]BuddyInfo, error) { +func (fs FS) BuddyInfo() ([]BuddyInfo, error) { file, err := os.Open(fs.proc.Path("buddyinfo")) if err != nil { return nil, err diff --git a/vendor/github.com/prometheus/procfs/fixtures.ttar b/vendor/github.com/prometheus/procfs/fixtures.ttar index f7f84ef3..6b42e7ba 100644 --- a/vendor/github.com/prometheus/procfs/fixtures.ttar +++ b/vendor/github.com/prometheus/procfs/fixtures.ttar @@ -3,7 +3,7 @@ Directory: fixtures Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc -Mode: 755 +Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/26231 Mode: 755 @@ -21,6 +21,11 @@ Mode: 644 Path: fixtures/proc/26231/cwd SymlinkTo: /usr/bin # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/26231/environ +Lines: 1 +PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binNULLBYTEHOSTNAME=cd24e11f73a5NULLBYTETERM=xtermNULLBYTEGOLANG_VERSION=1.12.5NULLBYTEGOPATH=/goNULLBYTEHOME=/rootNULLBYTEEOF +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/26231/exe SymlinkTo: /usr/bin/vim # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -75,13 +80,13 @@ Max realtime timeout unlimited unlimited us Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/26231/mountstats -Lines: 19 +Lines: 20 device rootfs mounted on / with fstype rootfs device sysfs mounted on /sys with fstype sysfs device proc mounted on /proc with fstype proc device /dev/sda1 mounted on / with fstype ext4 device 192.168.1.1:/srv/test mounted on /mnt/nfs/test with fstype nfs4 statvers=1.1 - opts: rw,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.5,local_lock=none + opts: rw,vers=4.0,rsize=1048576,wsize=1048576,namlen=255,acregmin=3,acregmax=60,acdirmin=30,acdirmax=60,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.1,clientaddr=192.168.1.5,local_lock=none age: 13968 caps: caps=0xfff7,wtmult=512,dtsize=32768,bsize=0,namlen=255 nfsv4: bm0=0xfdffafff,bm1=0xf9be3e,bm2=0x0,acl=0x0,pnfs=not configured @@ -94,6 +99,7 @@ device 192.168.1.1:/srv/test mounted on /mnt/nfs/test with fstype nfs4 statvers= NULL: 0 0 0 0 0 0 0 0 READ: 1298 1298 0 207680 1210292152 6 79386 79407 WRITE: 0 0 0 0 0 0 0 0 + ACCESS: 2927395007 2927394995 0 526931094212 362996810236 18446743919241604546 1667369447 1953587717 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -125,6 +131,63 @@ Lines: 1 26231 (vim) R 5392 7446 5392 34835 7446 4218880 32533 309516 26 82 1677 44 158 99 20 0 1 0 82375 56274944 1981 18446744073709551615 4194304 6294284 140736914091744 140736914087944 139965136429984 0 0 12288 1870679807 0 0 0 17 0 0 0 31 0 0 8391624 8481048 16420864 140736914093252 140736914093279 140736914093279 140736914096107 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/26231/status +Lines: 53 + +Name: prometheus +Umask: 0022 +State: S (sleeping) +Tgid: 1 +Ngid: 0 +Pid: 1 +PPid: 0 +TracerPid: 0 +Uid: 0 0 0 0 +Gid: 0 0 0 0 +FDSize: 128 +Groups: +NStgid: 1 +NSpid: 1 +NSpgid: 1 +NSsid: 1 +VmPeak: 58472 kB +VmSize: 58440 kB +VmLck: 0 kB +VmPin: 0 kB +VmHWM: 8028 kB +VmRSS: 6716 kB +RssAnon: 2092 kB +RssFile: 4624 kB +RssShmem: 0 kB +VmData: 2580 kB +VmStk: 136 kB +VmExe: 948 kB +VmLib: 6816 kB +VmPTE: 128 kB +VmPMD: 12 kB +VmSwap: 660 kB +HugetlbPages: 0 kB +Threads: 1 +SigQ: 8/63965 +SigPnd: 0000000000000000 +ShdPnd: 0000000000000000 +SigBlk: 7be3c0fe28014a03 +SigIgn: 0000000000001000 +SigCgt: 00000001800004ec +CapInh: 0000000000000000 +CapPrm: 0000003fffffffff +CapEff: 0000003fffffffff +CapBnd: 0000003fffffffff +CapAmb: 0000000000000000 +Seccomp: 0 +Cpus_allowed: ff +Cpus_allowed_list: 0-7 +Mems_allowed: 00000000,00000001 +Mems_allowed_list: 0 +voluntary_ctxt_switches: 4742839 +nonvoluntary_ctxt_switches: 1727500 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/proc/26232 Mode: 755 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -160,23 +223,23 @@ SymlinkTo: ../../symlinktargets/xyz # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/26232/limits Lines: 17 -Limit Soft Limit Hard Limit Units -Max cpu time unlimited unlimited seconds -Max file size unlimited unlimited bytes -Max data size unlimited unlimited bytes -Max stack size 8388608 unlimited bytes -Max core file size 0 unlimited bytes -Max resident set unlimited unlimited bytes -Max processes 29436 29436 processes -Max open files 1024 4096 files -Max locked memory 65536 65536 bytes -Max address space unlimited unlimited bytes -Max file locks unlimited unlimited locks -Max pending signals 29436 29436 signals -Max msgqueue size 819200 819200 bytes -Max nice priority 0 0 -Max realtime priority 0 0 -Max realtime timeout unlimited unlimited us +Limit Soft Limit Hard Limit Units +Max cpu time unlimited unlimited seconds +Max file size unlimited unlimited bytes +Max data size unlimited unlimited bytes +Max stack size 8388608 unlimited bytes +Max core file size 0 unlimited bytes +Max resident set unlimited unlimited bytes +Max processes 29436 29436 processes +Max open files 1024 4096 files +Max locked memory 65536 65536 bytes +Max address space unlimited unlimited bytes +Max file locks unlimited unlimited locks +Max pending signals 29436 29436 signals +Max msgqueue size 819200 819200 bytes +Max nice priority 0 0 +Max realtime priority 0 0 +Max realtime timeout unlimited unlimited us Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/26232/root @@ -206,9 +269,9 @@ Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/buddyinfo Lines: 3 -Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3 -Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0 -Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 0 +Node 0, zone DMA 1 0 1 0 2 1 1 0 1 1 3 +Node 0, zone DMA32 759 572 791 475 194 45 12 0 0 0 0 +Node 0, zone Normal 4381 1093 185 1530 567 102 4 0 0 0 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/diskstats @@ -298,32 +361,62 @@ debug 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/mdstat -Lines: 26 +Lines: 56 Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] -md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] + +md3 : active raid6 sda1[8] sdh1[7] sdg1[6] sdf1[5] sde1[11] sdd1[3] sdc1[10] sdb1[9] sdd1[10](S) sdd2[11](S) 5853468288 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/8] [UUUUUUUU] - + md127 : active raid1 sdi2[0] sdj2[1] 312319552 blocks [2/2] [UU] - -md0 : active raid1 sdk[2](S) sdi1[0] sdj1[1] + +md0 : active raid1 sdi1[0] sdj1[1] 248896 blocks [2/2] [UU] - -md4 : inactive raid1 sda3[0] sdb3[1] + +md4 : inactive raid1 sda3[0](F) sdb3[1](S) 4883648 blocks [2/2] [UU] -md6 : active raid1 sdb2[2] sda2[0] +md6 : active raid1 sdb2[2](F) sdc[1](S) sda2[0] 195310144 blocks [2/1] [U_] [=>...................] recovery = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec -md8 : active raid1 sdb1[1] sda1[0] +md8 : active raid1 sdb1[1] sda1[0] sdc[2](S) sde[3](S) 195310144 blocks [2/2] [UU] [=>...................] resync = 8.5% (16775552/195310144) finish=17.0min speed=259783K/sec -md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1] +md7 : active raid6 sdb1[0] sde1[3] sdd1[2] sdc1[1](F) 7813735424 blocks super 1.2 level 6, 512k chunk, algorithm 2 [4/3] [U_UU] bitmap: 0/30 pages [0KB], 65536KB chunk +md9 : active raid1 sdc2[2] sdd2[3] sdb2[1] sda2[0] sde[4](F) sdf[5](F) sdg[6](S) + 523968 blocks super 1.2 [4/4] [UUUU] + resync=DELAYED + +md10 : active raid0 sda1[0] sdb1[1] + 314159265 blocks 64k chunks + +md11 : active (auto-read-only) raid1 sdb2[0] sdc2[1] sdc3[2](F) hda[4](S) ssdc2[3](S) + 4190208 blocks super 1.2 [2/2] [UU] + resync=PENDING + +md12 : active raid0 sdc2[0] sdd2[1] + 3886394368 blocks super 1.2 512k chunks + +md126 : active raid0 sdb[1] sdc[0] + 1855870976 blocks super external:/md127/0 128k chunks + +md219 : inactive sdb[2](S) sdc[1](S) sda[0](S) + 7932 blocks super external:imsm + +md00 : active raid0 xvdb[0] + 4186624 blocks super 1.2 256k chunks + +md120 : active linear sda1[1] sdb1[0] + 2095104 blocks super 1.2 0k rounding + +md101 : active (read-only) raid0 sdb[2] sdd[1] sdc[0] + 322560 blocks super 1.2 512k chunks + unused devices: Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -402,6 +495,26 @@ proc4 2 2 10853 proc4ops 72 0 0 0 1098 2 0 0 0 0 8179 5896 0 0 0 0 5900 0 0 2 0 2 0 9609 0 2 150 1272 0 0 0 1236 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/unix +Lines: 6 +Num RefCount Protocol Flags Type St Inode Path +0000000000000000: 00000002 00000000 00010000 0001 01 3442596 /var/run/postgresql/.s.PGSQL.5432 +0000000000000000: 0000000a 00000000 00010000 0005 01 10061 /run/udev/control +0000000000000000: 00000007 00000000 00000000 0002 01 12392 /dev/log +0000000000000000: 00000003 00000000 00000000 0001 03 4787297 /var/run/postgresql/.s.PGSQL.5432 +0000000000000000: 00000003 00000000 00000000 0001 03 5091797 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/proc/net/unix_without_inode +Lines: 6 +Num RefCount Protocol Flags Type St Path +0000000000000000: 00000002 00000000 00010000 0001 01 /var/run/postgresql/.s.PGSQL.5432 +0000000000000000: 0000000a 00000000 00010000 0005 01 /run/udev/control +0000000000000000: 00000007 00000000 00000000 0002 01 /dev/log +0000000000000000: 00000003 00000000 00000000 0001 03 /var/run/postgresql/.s.PGSQL.5432 +0000000000000000: 00000003 00000000 00000000 0001 03 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Path: fixtures/proc/net/xfrm_stat Lines: 28 XfrmInError 1 @@ -531,6 +644,232 @@ Mode: 664 Directory: fixtures/sys/class Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/mlx4_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/board_id +Lines: 1 +SM_1141000001000 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/fw_ver +Lines: 1 +2.31.5050 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/hca_type +Lines: 1 +MT4099 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/mlx4_0/ports +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/mlx4_0/ports/1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/excessive_buffer_overrun_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/link_downed +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/link_error_recovery +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/local_link_integrity_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_constraint_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_data +Lines: 1 +2221223609 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_packets +Lines: 1 +87169372 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_remote_physical_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_rcv_switch_relay_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_constraint_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_data +Lines: 1 +26509113295 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_discards +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_packets +Lines: 1 +85734114 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/port_xmit_wait +Lines: 1 +3599 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/counters/symbol_error +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/phys_state +Lines: 1 +5: LinkUp +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/rate +Lines: 1 +40 Gb/sec (4X QDR) +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/1/state +Lines: 1 +4: ACTIVE +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/mlx4_0/ports/2 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/excessive_buffer_overrun_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/link_downed +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/link_error_recovery +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/local_link_integrity_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_constraint_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_data +Lines: 1 +2460436784 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_packets +Lines: 1 +89332064 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_remote_physical_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_rcv_switch_relay_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_constraint_errors +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_data +Lines: 1 +26540356890 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_discards +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_packets +Lines: 1 +88622850 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/port_xmit_wait +Lines: 1 +3846 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/counters/symbol_error +Lines: 1 +0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/phys_state +Lines: 1 +5: LinkUp +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/rate +Lines: 1 +40 Gb/sec (4X QDR) +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/class/infiniband/mlx4_0/ports/2/state +Lines: 1 +4: ACTIVE +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/class/net Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1104,9 +1443,54 @@ Lines: 1 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/rbd +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/rbd/0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/rbd/0/name +Lines: 1 +demo +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/rbd/0/pool +Lines: 1 +iscsi-images +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/rbd/1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/rbd/1/name +Lines: 1 +wrong +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/rbd/1/pool +Lines: 1 +wrong-images +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/system/clocksource +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/devices/system/clocksource/clocksource0 +Mode: 775 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/system/clocksource/clocksource0/available_clocksource +Lines: 1 +tsc hpet acpi_pm +Mode: 444 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/devices/system/clocksource/clocksource0/current_clocksource +Lines: 1 +tsc +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Directory: fixtures/sys/devices/system/cpu Mode: 775 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1712,3 +2096,248 @@ Lines: 1 extent_alloc 2 0 0 0 Mode: 644 # ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/fileio_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/fileio_1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/fileio_1/file_lio_1G/udev_path +Lines: 1 +/home/iscsi/file_back_1G +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/iblock_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/iblock_0/block_lio_rbd1/udev_path +Lines: 1 +/dev/rbd1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/rbd_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/rbd_0/iscsi-images-demo/udev_path +Lines: 1 +/dev/rbd/iscsi-images/demo +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/rd_mcp_119 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/core/rd_mcp_119/ramdisk_lio_1G/udev_path +Lines: 0 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/7f4a4eb56d +SymlinkTo: ../../../../../../target/core/rd_mcp_119/ramdisk_lio_1G +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds +Lines: 1 +204950 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes +Lines: 1 +10325 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.8888bbbbddd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes +Lines: 1 +40325 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/795b7c7026 +SymlinkTo: ../../../../../../target/core/iblock_0/block_lio_rbd1 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds +Lines: 1 +104950 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes +Lines: 1 +20095 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2003-01.org.linux-iscsi.osd1.x8664:sn.abcd1abcd2ab/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes +Lines: 1 +71235 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/fff5e16686 +SymlinkTo: ../../../../../../target/core/fileio_1/file_lio_1G +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds +Lines: 1 +301950 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes +Lines: 1 +10195 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:dev.rbd0/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes +Lines: 1 +30195 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/enable +Lines: 1 +1 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0 +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/eba1edf893 +SymlinkTo: ../../../../../../target/core/rbd_0/iscsi-images-demo +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Directory: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port +Mode: 755 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/in_cmds +Lines: 1 +1234 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/read_mbytes +Lines: 1 +1504 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Path: fixtures/sys/kernel/config/target/iscsi/iqn.2016-11.org.linux-iscsi.igw.x86:sn.ramdemo/tpgt_1/lun/lun_0/statistics/scsi_tgt_port/write_mbytes +Lines: 1 +4733 +Mode: 644 +# ttar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go index 9c56c839..0102ab0f 100644 --- a/vendor/github.com/prometheus/procfs/fs.go +++ b/vendor/github.com/prometheus/procfs/fs.go @@ -26,8 +26,14 @@ type FS struct { // DefaultMountPoint is the common mount point of the proc filesystem. const DefaultMountPoint = fs.DefaultProcMountPoint +// NewDefaultFS returns a new proc FS mounted under the default proc mountPoint. +// It will error if the mount point directory can't be read or is a file. +func NewDefaultFS() (FS, error) { + return NewFS(DefaultMountPoint) +} + // NewFS returns a new proc FS mounted under the given proc mountPoint. It will error -// if the mount point dirctory can't be read or is a file. +// if the mount point directory can't be read or is a file. func NewFS(mountPoint string) (FS, error) { fs, err := fs.NewFS(mountPoint) if err != nil { diff --git a/vendor/github.com/prometheus/procfs/go.mod b/vendor/github.com/prometheus/procfs/go.mod index 8a1b839f..b2f8cca9 100644 --- a/vendor/github.com/prometheus/procfs/go.mod +++ b/vendor/github.com/prometheus/procfs/go.mod @@ -1,3 +1,6 @@ module github.com/prometheus/procfs -require golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 +require ( + github.com/google/go-cmp v0.3.0 + golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 +) diff --git a/vendor/github.com/prometheus/procfs/go.sum b/vendor/github.com/prometheus/procfs/go.sum index 7827dd3d..db54133d 100644 --- a/vendor/github.com/prometheus/procfs/go.sum +++ b/vendor/github.com/prometheus/procfs/go.sum @@ -1,2 +1,4 @@ +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go index c66a1cf8..7ddfd6b6 100644 --- a/vendor/github.com/prometheus/procfs/internal/fs/fs.go +++ b/vendor/github.com/prometheus/procfs/internal/fs/fs.go @@ -25,6 +25,9 @@ const ( // DefaultSysMountPoint is the common mount point of the sys filesystem. DefaultSysMountPoint = "/sys" + + // DefaultConfigfsMountPoint is the commont mount point of the configfs + DefaultConfigfsMountPoint = "/sys/kernel/config" ) // FS represents a pseudo-filesystem, normally /proc or /sys, which provides an diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go index 41e645d2..2d6cb8d1 100644 --- a/vendor/github.com/prometheus/procfs/ipvs.go +++ b/vendor/github.com/prometheus/procfs/ipvs.go @@ -62,18 +62,8 @@ type IPVSBackendStatus struct { Weight uint64 } -// NewIPVSStats reads the IPVS statistics. -func NewIPVSStats() (IPVSStats, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return IPVSStats{}, err - } - - return fs.NewIPVSStats() -} - -// NewIPVSStats reads the IPVS statistics from the specified `proc` filesystem. -func (fs FS) NewIPVSStats() (IPVSStats, error) { +// IPVSStats reads the IPVS statistics from the specified `proc` filesystem. +func (fs FS) IPVSStats() (IPVSStats, error) { file, err := os.Open(fs.proc.Path("net/ip_vs_stats")) if err != nil { return IPVSStats{}, err @@ -131,18 +121,8 @@ func parseIPVSStats(file io.Reader) (IPVSStats, error) { return stats, nil } -// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs. -func NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return []IPVSBackendStatus{}, err - } - - return fs.NewIPVSBackendStatus() -} - -// NewIPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem. -func (fs FS) NewIPVSBackendStatus() ([]IPVSBackendStatus, error) { +// IPVSBackendStatus reads and returns the status of all (virtual,real) server pairs from the specified `proc` filesystem. +func (fs FS) IPVSBackendStatus() ([]IPVSBackendStatus, error) { file, err := os.Open(fs.proc.Path("net/ip_vs")) if err != nil { return nil, err diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go index 6ac7a12f..2af3ada1 100644 --- a/vendor/github.com/prometheus/procfs/mdstat.go +++ b/vendor/github.com/prometheus/procfs/mdstat.go @@ -22,8 +22,8 @@ import ( ) var ( - statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) - buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`) + statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) + recoveryLineRE = regexp.MustCompile(`\((\d+)/\d+\)`) ) // MDStat holds info parsed from /proc/mdstat. @@ -34,117 +34,160 @@ type MDStat struct { ActivityState string // Number of active disks. DisksActive int64 - // Total number of disks the device consists of. + // Total number of disks the device requires. DisksTotal int64 + // Number of failed disks. + DisksFailed int64 + // Spare disks in the device. + DisksSpare int64 // Number of blocks the device holds. BlocksTotal int64 // Number of blocks on the device that are in sync. BlocksSynced int64 } -// ParseMDStat parses an mdstat-file and returns a struct with the relevant infos. -func (fs FS) ParseMDStat() (mdstates []MDStat, err error) { - mdStatusFilePath := fs.proc.Path("mdstat") - content, err := ioutil.ReadFile(mdStatusFilePath) +// MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of +// structs containing the relevant info. More information available here: +// https://raid.wiki.kernel.org/index.php/Mdstat +func (fs FS) MDStat() ([]MDStat, error) { + data, err := ioutil.ReadFile(fs.proc.Path("mdstat")) if err != nil { - return []MDStat{}, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) + return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err) } + mdstat, err := parseMDStat(data) + if err != nil { + return nil, fmt.Errorf("error parsing mdstat %s: %s", fs.proc.Path("mdstat"), err) + } + return mdstat, nil +} - mdStates := []MDStat{} - lines := strings.Split(string(content), "\n") - for i, l := range lines { - if l == "" { - continue - } - if l[0] == ' ' { - continue - } - if strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") { +// parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of +// structs containing the relevant info. +func parseMDStat(mdStatData []byte) ([]MDStat, error) { + mdStats := []MDStat{} + lines := strings.Split(string(mdStatData), "\n") + + for i, line := range lines { + if strings.TrimSpace(line) == "" || line[0] == ' ' || + strings.HasPrefix(line, "Personalities") || + strings.HasPrefix(line, "unused") { continue } - mainLine := strings.Split(l, " ") - if len(mainLine) < 3 { - return mdStates, fmt.Errorf("error parsing mdline: %s", l) + deviceFields := strings.Fields(line) + if len(deviceFields) < 3 { + return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", line) } - mdName := mainLine[0] - activityState := mainLine[2] + mdName := deviceFields[0] // mdx + state := deviceFields[2] // active or inactive if len(lines) <= i+3 { - return mdStates, fmt.Errorf( - "error parsing %s: too few lines for md device %s", - mdStatusFilePath, + return nil, fmt.Errorf( + "error parsing %s: too few lines for md device", mdName, ) } - active, total, size, err := evalStatusline(lines[i+1]) + // Failed disks have the suffix (F) & Spare disks have the suffix (S). + fail := int64(strings.Count(line, "(F)")) + spare := int64(strings.Count(line, "(S)")) + active, total, size, err := evalStatusLine(lines[i], lines[i+1]) + if err != nil { - return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) + return nil, fmt.Errorf("error parsing md device lines: %s", err) } - // j is the line number of the syncing-line. - j := i + 2 + syncLineIdx := i + 2 if strings.Contains(lines[i+2], "bitmap") { // skip bitmap line - j = i + 3 + syncLineIdx++ } // If device is syncing at the moment, get the number of currently // synced bytes, otherwise that number equals the size of the device. syncedBlocks := size - if strings.Contains(lines[j], "recovery") || strings.Contains(lines[j], "resync") { - syncedBlocks, err = evalBuildline(lines[j]) - if err != nil { - return mdStates, fmt.Errorf("error parsing %s: %s", mdStatusFilePath, err) + recovering := strings.Contains(lines[syncLineIdx], "recovery") + resyncing := strings.Contains(lines[syncLineIdx], "resync") + + // Append recovery and resyncing state info. + if recovering || resyncing { + if recovering { + state = "recovering" + } else { + state = "resyncing" + } + + // Handle case when resync=PENDING or resync=DELAYED. + if strings.Contains(lines[syncLineIdx], "PENDING") || + strings.Contains(lines[syncLineIdx], "DELAYED") { + syncedBlocks = 0 + } else { + syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx]) + if err != nil { + return nil, fmt.Errorf("error parsing sync line in md device %s: %s", mdName, err) + } } } - mdStates = append(mdStates, MDStat{ + mdStats = append(mdStats, MDStat{ Name: mdName, - ActivityState: activityState, + ActivityState: state, DisksActive: active, + DisksFailed: fail, + DisksSpare: spare, DisksTotal: total, BlocksTotal: size, BlocksSynced: syncedBlocks, }) } - return mdStates, nil + return mdStats, nil } -func evalStatusline(statusline string) (active, total, size int64, err error) { - matches := statuslineRE.FindStringSubmatch(statusline) - if len(matches) != 4 { - return 0, 0, 0, fmt.Errorf("unexpected statusline: %s", statusline) +func evalStatusLine(deviceLine, statusLine string) (active, total, size int64, err error) { + + sizeStr := strings.Fields(statusLine)[0] + size, err = strconv.ParseInt(sizeStr, 10, 64) + if err != nil { + return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) } - size, err = strconv.ParseInt(matches[1], 10, 64) - if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) + if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") { + // In the device deviceLine, only disks have a number associated with them in []. + total = int64(strings.Count(deviceLine, "[")) + return total, total, size, nil + } + + if strings.Contains(deviceLine, "inactive") { + return 0, 0, size, nil + } + + matches := statusLineRE.FindStringSubmatch(statusLine) + if len(matches) != 4 { + return 0, 0, 0, fmt.Errorf("couldn't find all the substring matches: %s", statusLine) } total, err = strconv.ParseInt(matches[2], 10, 64) if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) + return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) } active, err = strconv.ParseInt(matches[3], 10, 64) if err != nil { - return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) + return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err) } return active, total, size, nil } -func evalBuildline(buildline string) (syncedBlocks int64, err error) { - matches := buildlineRE.FindStringSubmatch(buildline) +func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, err error) { + matches := recoveryLineRE.FindStringSubmatch(recoveryLine) if len(matches) != 2 { - return 0, fmt.Errorf("unexpected buildline: %s", buildline) + return 0, fmt.Errorf("unexpected recoveryLine: %s", recoveryLine) } syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64) if err != nil { - return 0, fmt.Errorf("%s in buildline: %s", err, buildline) + return 0, fmt.Errorf("%s in recoveryLine: %s", err, recoveryLine) } return syncedBlocks, nil diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go new file mode 100644 index 00000000..61fa6188 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/mountinfo.go @@ -0,0 +1,178 @@ +// Copyright 2019 The Prometheus Authors +// 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. + +package procfs + +import ( + "bufio" + "fmt" + "io" + "os" + "strconv" + "strings" +) + +var validOptionalFields = map[string]bool{ + "shared": true, + "master": true, + "propagate_from": true, + "unbindable": true, +} + +// A MountInfo is a type that describes the details, options +// for each mount, parsed from /proc/self/mountinfo. +// The fields described in each entry of /proc/self/mountinfo +// is described in the following man page. +// http://man7.org/linux/man-pages/man5/proc.5.html +type MountInfo struct { + // Unique Id for the mount + MountId int + // The Id of the parent mount + ParentId int + // The value of `st_dev` for the files on this FS + MajorMinorVer string + // The pathname of the directory in the FS that forms + // the root for this mount + Root string + // The pathname of the mount point relative to the root + MountPoint string + // Mount options + Options map[string]string + // Zero or more optional fields + OptionalFields map[string]string + // The Filesystem type + FSType string + // FS specific information or "none" + Source string + // Superblock options + SuperOptions map[string]string +} + +// Returns part of the mountinfo line, if it exists, else an empty string. +func getStringSliceElement(parts []string, idx int, defaultValue string) string { + if idx >= len(parts) { + return defaultValue + } + return parts[idx] +} + +// Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs. +func parseMountInfo(r io.Reader) ([]*MountInfo, error) { + mounts := []*MountInfo{} + scanner := bufio.NewScanner(r) + for scanner.Scan() { + mountString := scanner.Text() + parsedMounts, err := parseMountInfoString(mountString) + if err != nil { + return nil, err + } + mounts = append(mounts, parsedMounts) + } + + err := scanner.Err() + return mounts, err +} + +// Parses a mountinfo file line, and converts it to a MountInfo struct. +// An important check here is to see if the hyphen separator, as if it does not exist, +// it means that the line is malformed. +func parseMountInfoString(mountString string) (*MountInfo, error) { + var err error + + // OptionalFields can be zero, hence these checks to ensure we do not populate the wrong values in the wrong spots + separatorIndex := strings.Index(mountString, "-") + if separatorIndex == -1 { + return nil, fmt.Errorf("no separator found in mountinfo string: %s", mountString) + } + beforeFields := strings.Fields(mountString[:separatorIndex]) + afterFields := strings.Fields(mountString[separatorIndex+1:]) + if (len(beforeFields) + len(afterFields)) < 7 { + return nil, fmt.Errorf("too few fields") + } + + mount := &MountInfo{ + MajorMinorVer: getStringSliceElement(beforeFields, 2, ""), + Root: getStringSliceElement(beforeFields, 3, ""), + MountPoint: getStringSliceElement(beforeFields, 4, ""), + Options: mountOptionsParser(getStringSliceElement(beforeFields, 5, "")), + OptionalFields: nil, + FSType: getStringSliceElement(afterFields, 0, ""), + Source: getStringSliceElement(afterFields, 1, ""), + SuperOptions: mountOptionsParser(getStringSliceElement(afterFields, 2, "")), + } + + mount.MountId, err = strconv.Atoi(getStringSliceElement(beforeFields, 0, "")) + if err != nil { + return nil, fmt.Errorf("failed to parse mount ID") + } + mount.ParentId, err = strconv.Atoi(getStringSliceElement(beforeFields, 1, "")) + if err != nil { + return nil, fmt.Errorf("failed to parse parent ID") + } + // Has optional fields, which is a space separated list of values. + // Example: shared:2 master:7 + if len(beforeFields) > 6 { + mount.OptionalFields = make(map[string]string) + optionalFields := beforeFields[6:] + for _, field := range optionalFields { + optionSplit := strings.Split(field, ":") + target, value := optionSplit[0], "" + if len(optionSplit) == 2 { + value = optionSplit[1] + } + // Checks if the 'keys' in the optional fields in the mountinfo line are acceptable. + // Allowed 'keys' are shared, master, propagate_from, unbindable. + if _, ok := validOptionalFields[target]; ok { + mount.OptionalFields[target] = value + } + } + } + return mount, nil +} + +// Parses the mount options, superblock options. +func mountOptionsParser(mountOptions string) map[string]string { + opts := make(map[string]string) + options := strings.Split(mountOptions, ",") + for _, opt := range options { + splitOption := strings.Split(opt, "=") + if len(splitOption) < 2 { + key := splitOption[0] + opts[key] = "" + } else { + key, value := splitOption[0], splitOption[1] + opts[key] = value + } + } + return opts +} + +// Retrieves mountinfo information from `/proc/self/mountinfo`. +func GetMounts() ([]*MountInfo, error) { + f, err := os.Open("/proc/self/mountinfo") + if err != nil { + return nil, err + } + defer f.Close() + return parseMountInfo(f) +} + +// Retrieves mountinfo information from a processes' `/proc//mountinfo`. +func GetProcMounts(pid int) ([]*MountInfo, error) { + f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid)) + if err != nil { + return nil, err + } + defer f.Close() + return parseMountInfo(f) +} diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go index fc385afc..35b2ef35 100644 --- a/vendor/github.com/prometheus/procfs/mountstats.go +++ b/vendor/github.com/prometheus/procfs/mountstats.go @@ -69,8 +69,8 @@ type MountStats interface { type MountStatsNFS struct { // The version of statistics provided. StatVersion string - // The optional mountaddr of the NFS mount. - MountAddress string + // The mount options of the NFS mount. + Opts map[string]string // The age of the NFS mount. Age time.Duration // Statistics related to byte counters for various operations. @@ -181,11 +181,11 @@ type NFSOperationStats struct { // Number of bytes received for this operation, including RPC headers and payload. BytesReceived uint64 // Duration all requests spent queued for transmission before they were sent. - CumulativeQueueTime time.Duration + CumulativeQueueMilliseconds uint64 // Duration it took to get a reply back after the request was transmitted. - CumulativeTotalResponseTime time.Duration + CumulativeTotalResponseMilliseconds uint64 // Duration from when a request was enqueued to when it was completely handled. - CumulativeTotalRequestTime time.Duration + CumulativeTotalRequestMilliseconds uint64 } // A NFSTransportStats contains statistics for the NFS mount RPC requests and @@ -204,7 +204,7 @@ type NFSTransportStats struct { // spent waiting for connections to the server to be established. ConnectIdleTime uint64 // Duration since the NFS mount last saw any RPC traffic. - IdleTime time.Duration + IdleTimeSeconds uint64 // Number of RPC requests for this mount sent to the NFS server. Sends uint64 // Number of RPC responses for this mount received from the NFS server. @@ -342,10 +342,15 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e switch ss[0] { case fieldOpts: + if stats.Opts == nil { + stats.Opts = map[string]string{} + } for _, opt := range strings.Split(ss[1], ",") { split := strings.Split(opt, "=") - if len(split) == 2 && split[0] == "mountaddr" { - stats.MountAddress = split[1] + if len(split) == 2 { + stats.Opts[split[0]] = split[1] + } else { + stats.Opts[opt] = "" } } case fieldAge: @@ -519,15 +524,15 @@ func parseNFSOperationStats(s *bufio.Scanner) ([]NFSOperationStats, error) { } ops = append(ops, NFSOperationStats{ - Operation: strings.TrimSuffix(ss[0], ":"), - Requests: ns[0], - Transmissions: ns[1], - MajorTimeouts: ns[2], - BytesSent: ns[3], - BytesReceived: ns[4], - CumulativeQueueTime: time.Duration(ns[5]) * time.Millisecond, - CumulativeTotalResponseTime: time.Duration(ns[6]) * time.Millisecond, - CumulativeTotalRequestTime: time.Duration(ns[7]) * time.Millisecond, + Operation: strings.TrimSuffix(ss[0], ":"), + Requests: ns[0], + Transmissions: ns[1], + MajorTimeouts: ns[2], + BytesSent: ns[3], + BytesReceived: ns[4], + CumulativeQueueMilliseconds: ns[5], + CumulativeTotalResponseMilliseconds: ns[6], + CumulativeTotalRequestMilliseconds: ns[7], }) } @@ -603,7 +608,7 @@ func parseNFSTransportStats(ss []string, statVersion string) (*NFSTransportStats Bind: ns[1], Connect: ns[2], ConnectIdleTime: ns[3], - IdleTime: time.Duration(ns[4]) * time.Second, + IdleTimeSeconds: ns[4], Sends: ns[5], Receives: ns[6], BadTransactionIDs: ns[7], diff --git a/vendor/github.com/prometheus/procfs/net_dev.go b/vendor/github.com/prometheus/procfs/net_dev.go index 0063594e..a0b7a011 100644 --- a/vendor/github.com/prometheus/procfs/net_dev.go +++ b/vendor/github.com/prometheus/procfs/net_dev.go @@ -47,23 +47,13 @@ type NetDevLine struct { // are interface names. type NetDev map[string]NetDevLine -// NewNetDev returns kernel/system statistics read from /proc/net/dev. -func NewNetDev() (NetDev, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return nil, err - } - - return fs.NewNetDev() -} - -// NewNetDev returns kernel/system statistics read from /proc/net/dev. -func (fs FS) NewNetDev() (NetDev, error) { +// NetDev returns kernel/system statistics read from /proc/net/dev. +func (fs FS) NetDev() (NetDev, error) { return newNetDev(fs.proc.Path("net/dev")) } -// NewNetDev returns kernel/system statistics read from /proc/[pid]/net/dev. -func (p Proc) NewNetDev() (NetDev, error) { +// NetDev returns kernel/system statistics read from /proc/[pid]/net/dev. +func (p Proc) NetDev() (NetDev, error) { return newNetDev(p.path("net/dev")) } @@ -75,7 +65,7 @@ func newNetDev(file string) (NetDev, error) { } defer f.Close() - nd := NetDev{} + netDev := NetDev{} s := bufio.NewScanner(f) for n := 0; s.Scan(); n++ { // Skip the 2 header lines. @@ -83,20 +73,20 @@ func newNetDev(file string) (NetDev, error) { continue } - line, err := nd.parseLine(s.Text()) + line, err := netDev.parseLine(s.Text()) if err != nil { - return nd, err + return netDev, err } - nd[line.Name] = *line + netDev[line.Name] = *line } - return nd, s.Err() + return netDev, s.Err() } // parseLine parses a single line from the /proc/net/dev file. Header lines // must be filtered prior to calling this method. -func (nd NetDev) parseLine(rawLine string) (*NetDevLine, error) { +func (netDev NetDev) parseLine(rawLine string) (*NetDevLine, error) { parts := strings.SplitN(rawLine, ":", 2) if len(parts) != 2 { return nil, errors.New("invalid net/dev line, missing colon") @@ -185,11 +175,11 @@ func (nd NetDev) parseLine(rawLine string) (*NetDevLine, error) { // Total aggregates the values across interfaces and returns a new NetDevLine. // The Name field will be a sorted comma separated list of interface names. -func (nd NetDev) Total() NetDevLine { +func (netDev NetDev) Total() NetDevLine { total := NetDevLine{} - names := make([]string, 0, len(nd)) - for _, ifc := range nd { + names := make([]string, 0, len(netDev)) + for _, ifc := range netDev { names = append(names, ifc.Name) total.RxBytes += ifc.RxBytes total.RxPackets += ifc.RxPackets diff --git a/vendor/github.com/prometheus/procfs/net_unix.go b/vendor/github.com/prometheus/procfs/net_unix.go new file mode 100644 index 00000000..240340a8 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/net_unix.go @@ -0,0 +1,275 @@ +// Copyright 2018 The Prometheus Authors +// 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. + +package procfs + +import ( + "bufio" + "errors" + "fmt" + "io" + "os" + "strconv" + "strings" +) + +// For the proc file format details, +// see https://elixir.bootlin.com/linux/v4.17/source/net/unix/af_unix.c#L2815 +// and https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/net.h#L48. + +const ( + netUnixKernelPtrIdx = iota + netUnixRefCountIdx + _ + netUnixFlagsIdx + netUnixTypeIdx + netUnixStateIdx + netUnixInodeIdx + + // Inode and Path are optional. + netUnixStaticFieldsCnt = 6 +) + +const ( + netUnixTypeStream = 1 + netUnixTypeDgram = 2 + netUnixTypeSeqpacket = 5 + + netUnixFlagListen = 1 << 16 + + netUnixStateUnconnected = 1 + netUnixStateConnecting = 2 + netUnixStateConnected = 3 + netUnixStateDisconnected = 4 +) + +var errInvalidKernelPtrFmt = errors.New("Invalid Num(the kernel table slot number) format") + +// NetUnixType is the type of the type field. +type NetUnixType uint64 + +// NetUnixFlags is the type of the flags field. +type NetUnixFlags uint64 + +// NetUnixState is the type of the state field. +type NetUnixState uint64 + +// NetUnixLine represents a line of /proc/net/unix. +type NetUnixLine struct { + KernelPtr string + RefCount uint64 + Protocol uint64 + Flags NetUnixFlags + Type NetUnixType + State NetUnixState + Inode uint64 + Path string +} + +// NetUnix holds the data read from /proc/net/unix. +type NetUnix struct { + Rows []*NetUnixLine +} + +// NewNetUnix returns data read from /proc/net/unix. +func NewNetUnix() (*NetUnix, error) { + fs, err := NewFS(DefaultMountPoint) + if err != nil { + return nil, err + } + + return fs.NewNetUnix() +} + +// NewNetUnix returns data read from /proc/net/unix. +func (fs FS) NewNetUnix() (*NetUnix, error) { + return NewNetUnixByPath(fs.proc.Path("net/unix")) +} + +// NewNetUnixByPath returns data read from /proc/net/unix by file path. +// It might returns an error with partial parsed data, if an error occur after some data parsed. +func NewNetUnixByPath(path string) (*NetUnix, error) { + f, err := os.Open(path) + if err != nil { + return nil, err + } + defer f.Close() + return NewNetUnixByReader(f) +} + +// NewNetUnixByReader returns data read from /proc/net/unix by a reader. +// It might returns an error with partial parsed data, if an error occur after some data parsed. +func NewNetUnixByReader(reader io.Reader) (*NetUnix, error) { + nu := &NetUnix{ + Rows: make([]*NetUnixLine, 0, 32), + } + scanner := bufio.NewScanner(reader) + // Omit the header line. + scanner.Scan() + header := scanner.Text() + // From the man page of proc(5), it does not contain an Inode field, + // but in actually it exists. + // This code works for both cases. + hasInode := strings.Contains(header, "Inode") + + minFieldsCnt := netUnixStaticFieldsCnt + if hasInode { + minFieldsCnt++ + } + for scanner.Scan() { + line := scanner.Text() + item, err := nu.parseLine(line, hasInode, minFieldsCnt) + if err != nil { + return nu, err + } + nu.Rows = append(nu.Rows, item) + } + + return nu, scanner.Err() +} + +func (u *NetUnix) parseLine(line string, hasInode bool, minFieldsCnt int) (*NetUnixLine, error) { + fields := strings.Fields(line) + fieldsLen := len(fields) + if fieldsLen < minFieldsCnt { + return nil, fmt.Errorf( + "Parse Unix domain failed: expect at least %d fields but got %d", + minFieldsCnt, fieldsLen) + } + kernelPtr, err := u.parseKernelPtr(fields[netUnixKernelPtrIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain num(%s) failed: %s", fields[netUnixKernelPtrIdx], err) + } + users, err := u.parseUsers(fields[netUnixRefCountIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain ref count(%s) failed: %s", fields[netUnixRefCountIdx], err) + } + flags, err := u.parseFlags(fields[netUnixFlagsIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain flags(%s) failed: %s", fields[netUnixFlagsIdx], err) + } + typ, err := u.parseType(fields[netUnixTypeIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain type(%s) failed: %s", fields[netUnixTypeIdx], err) + } + state, err := u.parseState(fields[netUnixStateIdx]) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain state(%s) failed: %s", fields[netUnixStateIdx], err) + } + var inode uint64 + if hasInode { + inodeStr := fields[netUnixInodeIdx] + inode, err = u.parseInode(inodeStr) + if err != nil { + return nil, fmt.Errorf("Parse Unix domain inode(%s) failed: %s", inodeStr, err) + } + } + + nuLine := &NetUnixLine{ + KernelPtr: kernelPtr, + RefCount: users, + Type: typ, + Flags: flags, + State: state, + Inode: inode, + } + + // Path field is optional. + if fieldsLen > minFieldsCnt { + pathIdx := netUnixInodeIdx + 1 + if !hasInode { + pathIdx-- + } + nuLine.Path = fields[pathIdx] + } + + return nuLine, nil +} + +func (u NetUnix) parseKernelPtr(str string) (string, error) { + if !strings.HasSuffix(str, ":") { + return "", errInvalidKernelPtrFmt + } + return str[:len(str)-1], nil +} + +func (u NetUnix) parseUsers(hexStr string) (uint64, error) { + return strconv.ParseUint(hexStr, 16, 32) +} + +func (u NetUnix) parseProtocol(hexStr string) (uint64, error) { + return strconv.ParseUint(hexStr, 16, 32) +} + +func (u NetUnix) parseType(hexStr string) (NetUnixType, error) { + typ, err := strconv.ParseUint(hexStr, 16, 16) + if err != nil { + return 0, err + } + return NetUnixType(typ), nil +} + +func (u NetUnix) parseFlags(hexStr string) (NetUnixFlags, error) { + flags, err := strconv.ParseUint(hexStr, 16, 32) + if err != nil { + return 0, err + } + return NetUnixFlags(flags), nil +} + +func (u NetUnix) parseState(hexStr string) (NetUnixState, error) { + st, err := strconv.ParseInt(hexStr, 16, 8) + if err != nil { + return 0, err + } + return NetUnixState(st), nil +} + +func (u NetUnix) parseInode(inodeStr string) (uint64, error) { + return strconv.ParseUint(inodeStr, 10, 64) +} + +func (t NetUnixType) String() string { + switch t { + case netUnixTypeStream: + return "stream" + case netUnixTypeDgram: + return "dgram" + case netUnixTypeSeqpacket: + return "seqpacket" + } + return "unknown" +} + +func (f NetUnixFlags) String() string { + switch f { + case netUnixFlagListen: + return "listen" + default: + return "default" + } +} + +func (s NetUnixState) String() string { + switch s { + case netUnixStateUnconnected: + return "unconnected" + case netUnixStateConnecting: + return "connecting" + case netUnixStateConnected: + return "connected" + case netUnixStateDisconnected: + return "disconnected" + } + return "unknown" +} diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go index 8e38493a..41c148d0 100644 --- a/vendor/github.com/prometheus/procfs/proc.go +++ b/vendor/github.com/prometheus/procfs/proc.go @@ -54,7 +54,7 @@ func NewProc(pid int) (Proc, error) { if err != nil { return Proc{}, err } - return fs.NewProc(pid) + return fs.Proc(pid) } // AllProcs returns a list of all currently available processes under /proc. @@ -76,11 +76,18 @@ func (fs FS) Self() (Proc, error) { if err != nil { return Proc{}, err } - return fs.NewProc(pid) + return fs.Proc(pid) } // NewProc returns a process for the given pid. +// +// Deprecated: use fs.Proc() instead func (fs FS) NewProc(pid int) (Proc, error) { + return fs.Proc(pid) +} + +// Proc returns a process for the given pid. +func (fs FS) Proc(pid int) (Proc, error) { if _, err := os.Stat(fs.proc.Path(strconv.Itoa(pid))); err != nil { return Proc{}, err } @@ -240,6 +247,20 @@ func (p Proc) MountStats() ([]*Mount, error) { return parseMountStats(f) } +// MountInfo retrieves mount information for mount points in a +// process's namespace. +// It supplies information missing in `/proc/self/mounts` and +// fixes various other problems with that file too. +func (p Proc) MountInfo() ([]*MountInfo, error) { + f, err := os.Open(p.path("mountinfo")) + if err != nil { + return nil, err + } + defer f.Close() + + return parseMountInfo(f) +} + func (p Proc) fileDescriptors() ([]string, error) { d, err := os.Open(p.path("fd")) if err != nil { diff --git a/vendor/github.com/prometheus/procfs/proc_environ.go b/vendor/github.com/prometheus/procfs/proc_environ.go new file mode 100644 index 00000000..7172bb58 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/proc_environ.go @@ -0,0 +1,43 @@ +// Copyright 2019 The Prometheus Authors +// 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. + +package procfs + +import ( + "io/ioutil" + "os" + "strings" +) + +// Environ reads process environments from /proc//environ +func (p Proc) Environ() ([]string, error) { + environments := make([]string, 0) + + f, err := os.Open(p.path("environ")) + if err != nil { + return environments, err + } + defer f.Close() + + data, err := ioutil.ReadAll(f) + if err != nil { + return environments, err + } + + environments = strings.Split(string(data), "\000") + if len(environments) > 0 { + environments = environments[:len(environments)-1] + } + + return environments, nil +} diff --git a/vendor/github.com/prometheus/procfs/proc_io.go b/vendor/github.com/prometheus/procfs/proc_io.go index 0251c83b..0ff89b1c 100644 --- a/vendor/github.com/prometheus/procfs/proc_io.go +++ b/vendor/github.com/prometheus/procfs/proc_io.go @@ -39,8 +39,8 @@ type ProcIO struct { CancelledWriteBytes int64 } -// NewIO creates a new ProcIO instance from a given Proc instance. -func (p Proc) NewIO() (ProcIO, error) { +// IO creates a new ProcIO instance from a given Proc instance. +func (p Proc) IO() (ProcIO, error) { pio := ProcIO{} f, err := os.Open(p.path("io")) diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go index f04ba6fd..91ee24df 100644 --- a/vendor/github.com/prometheus/procfs/proc_limits.go +++ b/vendor/github.com/prometheus/procfs/proc_limits.go @@ -78,7 +78,14 @@ var ( ) // NewLimits returns the current soft limits of the process. +// +// Deprecated: use p.Limits() instead func (p Proc) NewLimits() (ProcLimits, error) { + return p.Limits() +} + +// Limits returns the current soft limits of the process. +func (p Proc) Limits() (ProcLimits, error) { f, err := os.Open(p.path("limits")) if err != nil { return ProcLimits{}, err diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go index d06c26eb..c66740ff 100644 --- a/vendor/github.com/prometheus/procfs/proc_ns.go +++ b/vendor/github.com/prometheus/procfs/proc_ns.go @@ -29,9 +29,9 @@ type Namespace struct { // Namespaces contains all of the namespaces that the process is contained in. type Namespaces map[string]Namespace -// NewNamespaces reads from /proc/[pid/ns/* to get the namespaces of which the +// Namespaces reads from /proc//ns/* to get the namespaces of which the // process is a member. -func (p Proc) NewNamespaces() (Namespaces, error) { +func (p Proc) Namespaces() (Namespaces, error) { d, err := os.Open(p.path("ns")) if err != nil { return nil, err diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go index a23d4c0f..46fe2662 100644 --- a/vendor/github.com/prometheus/procfs/proc_psi.go +++ b/vendor/github.com/prometheus/procfs/proc_psi.go @@ -51,19 +51,10 @@ type PSIStats struct { Full *PSILine } -// NewPSIStatsForResource reads pressure stall information for the specified -// resource. At time of writing this can be either "cpu", "memory" or "io". -func NewPSIStatsForResource(resource string) (PSIStats, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return PSIStats{}, err - } - - return fs.NewPSIStatsForResource(resource) -} - -// NewPSIStatsForResource reads pressure stall information from /proc/pressure/ -func (fs FS) NewPSIStatsForResource(resource string) (PSIStats, error) { +// PSIStatsForResource reads pressure stall information for the specified +// resource from /proc/pressure/. At time of writing this can be +// either "cpu", "memory" or "io". +func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) { file, err := os.Open(fs.proc.Path(fmt.Sprintf("%s/%s", "pressure", resource))) if err != nil { return PSIStats{}, fmt.Errorf("psi_stats: unavailable for %s", resource) diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go index 4c8b03ce..dbde1fa0 100644 --- a/vendor/github.com/prometheus/procfs/proc_stat.go +++ b/vendor/github.com/prometheus/procfs/proc_stat.go @@ -105,7 +105,14 @@ type ProcStat struct { } // NewStat returns the current status information of the process. +// +// Deprecated: use p.Stat() instead func (p Proc) NewStat() (ProcStat, error) { + return p.Stat() +} + +// Stat returns the current status information of the process. +func (p Proc) Stat() (ProcStat, error) { f, err := os.Open(p.path("stat")) if err != nil { return ProcStat{}, err @@ -178,7 +185,7 @@ func (s ProcStat) ResidentMemory() int { // StartTime returns the unix timestamp of the process in seconds. func (s ProcStat) StartTime() (float64, error) { fs := FS{proc: s.proc} - stat, err := fs.NewStat() + stat, err := fs.Stat() if err != nil { return 0, err } diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go new file mode 100644 index 00000000..6b4b61f7 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/proc_status.go @@ -0,0 +1,162 @@ +// Copyright 2018 The Prometheus Authors +// 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. + +package procfs + +import ( + "bytes" + "io/ioutil" + "os" + "strconv" + "strings" +) + +// ProcStat provides status information about the process, +// read from /proc/[pid]/stat. +type ProcStatus struct { + // The process ID. + PID int + // The process name. + Name string + + // Peak virtual memory size. + VmPeak uint64 + // Virtual memory size. + VmSize uint64 + // Locked memory size. + VmLck uint64 + // Pinned memory size. + VmPin uint64 + // Peak resident set size. + VmHWM uint64 + // Resident set size (sum of RssAnnon RssFile and RssShmem). + VmRSS uint64 + // Size of resident anonymous memory. + RssAnon uint64 + // Size of resident file mappings. + RssFile uint64 + // Size of resident shared memory. + RssShmem uint64 + // Size of data segments. + VmData uint64 + // Size of stack segments. + VmStk uint64 + // Size of text segments. + VmExe uint64 + // Shared library code size. + VmLib uint64 + // Page table entries size. + VmPTE uint64 + // Size of second-level page tables. + VmPMD uint64 + // Swapped-out virtual memory size by anonymous private. + VmSwap uint64 + // Size of hugetlb memory portions + HugetlbPages uint64 + + // Number of voluntary context switches. + VoluntaryCtxtSwitches uint64 + // Number of involuntary context switches. + NonVoluntaryCtxtSwitches uint64 +} + +// NewStatus returns the current status information of the process. +func (p Proc) NewStatus() (ProcStatus, error) { + f, err := os.Open(p.path("status")) + if err != nil { + return ProcStatus{}, err + } + defer f.Close() + + data, err := ioutil.ReadAll(f) + if err != nil { + return ProcStatus{}, err + } + + s := ProcStatus{PID: p.PID} + + lines := strings.Split(string(data), "\n") + for _, line := range lines { + if !bytes.Contains([]byte(line), []byte(":")) { + continue + } + + kv := strings.SplitN(line, ":", 2) + + // removes spaces + k := string(strings.TrimSpace(kv[0])) + v := string(strings.TrimSpace(kv[1])) + // removes "kB" + v = string(bytes.Trim([]byte(v), " kB")) + + // value to int when possible + // we can skip error check here, 'cause vKBytes is not used when value is a string + vKBytes, _ := strconv.ParseUint(v, 10, 64) + // convert kB to B + vBytes := vKBytes * 1024 + + s.fillStatus(k, v, vKBytes, vBytes) + } + + return s, nil +} + +func (s *ProcStatus) fillStatus(k string, vString string, vUint uint64, vUintBytes uint64) { + switch k { + case "Name": + s.Name = vString + case "VmPeak": + s.VmPeak = vUintBytes + case "VmSize": + s.VmSize = vUintBytes + case "VmLck": + s.VmLck = vUintBytes + case "VmPin": + s.VmPin = vUintBytes + case "VmHWM": + s.VmHWM = vUintBytes + case "VmRSS": + s.VmRSS = vUintBytes + case "RssAnon": + s.RssAnon = vUintBytes + case "RssFile": + s.RssFile = vUintBytes + case "RssShmem": + s.RssShmem = vUintBytes + case "VmData": + s.VmData = vUintBytes + case "VmStk": + s.VmStk = vUintBytes + case "VmExe": + s.VmExe = vUintBytes + case "VmLib": + s.VmLib = vUintBytes + case "VmPTE": + s.VmPTE = vUintBytes + case "VmPMD": + s.VmPMD = vUintBytes + case "VmSwap": + s.VmSwap = vUintBytes + case "HugetlbPages": + s.HugetlbPages = vUintBytes + case "voluntary_ctxt_switches": + s.VoluntaryCtxtSwitches = vUint + case "nonvoluntary_ctxt_switches": + s.NonVoluntaryCtxtSwitches = vUint + } +} + +// TotalCtxtSwitches returns the total context switch. +func (s ProcStatus) TotalCtxtSwitches() uint64 { + return s.VoluntaryCtxtSwitches + s.NonVoluntaryCtxtSwitches +} diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go index 44c9af1b..6661ee03 100644 --- a/vendor/github.com/prometheus/procfs/stat.go +++ b/vendor/github.com/prometheus/procfs/stat.go @@ -20,6 +20,8 @@ import ( "os" "strconv" "strings" + + "github.com/prometheus/procfs/internal/fs" ) // CPUStat shows how much time the cpu spend in various stages. @@ -78,16 +80,6 @@ type Stat struct { SoftIRQ SoftIRQStat } -// NewStat returns kernel/system statistics read from /proc/stat. -func NewStat() (Stat, error) { - fs, err := NewFS(DefaultMountPoint) - if err != nil { - return Stat{}, err - } - - return fs.NewStat() -} - // Parse a cpu statistics line and returns the CPUStat struct plus the cpu id (or -1 for the overall sum). func parseCPUStat(line string) (CPUStat, int64, error) { cpuStat := CPUStat{} @@ -149,9 +141,29 @@ func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) { return softIRQStat, total, nil } -// NewStat returns an information about current kernel/system statistics. +// NewStat returns information about current cpu/process statistics. +// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +// +// Deprecated: use fs.Stat() instead +func NewStat() (Stat, error) { + fs, err := NewFS(fs.DefaultProcMountPoint) + if err != nil { + return Stat{}, err + } + return fs.Stat() +} + +// NewStat returns information about current cpu/process statistics. +// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +// +// Deprecated: use fs.Stat() instead func (fs FS) NewStat() (Stat, error) { - // See https://www.kernel.org/doc/Documentation/filesystems/proc.txt + return fs.Stat() +} + +// Stat returns information about current cpu/process statistics. +// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt +func (fs FS) Stat() (Stat, error) { f, err := os.Open(fs.proc.Path("stat")) if err != nil { diff --git a/vendor/github.com/prometheus/procfs/ttar b/vendor/github.com/prometheus/procfs/ttar index b0171a12..19ef02b8 100644 --- a/vendor/github.com/prometheus/procfs/ttar +++ b/vendor/github.com/prometheus/procfs/ttar @@ -86,8 +86,10 @@ Usage: $bname [-C ] -c -f (create archive) $bname [-C ] -x -f (extract archive) Options: - -C (change directory) - -v (verbose) + -C (change directory) + -v (verbose) + --recursive-unlink (recursively delete existing directory if path + collides with file or directory to extract) Example: Change to sysfs directory, create ttar file from fixtures directory $bname -C sysfs -c -f sysfs/fixtures.ttar fixtures/ @@ -111,8 +113,9 @@ function set_cmd { } unset VERBOSE +unset RECURSIVE_UNLINK -while getopts :cf:htxvC: opt; do +while getopts :cf:-:htxvC: opt; do case $opt in c) set_cmd "create" @@ -136,6 +139,18 @@ while getopts :cf:htxvC: opt; do C) CDIR=$OPTARG ;; + -) + case $OPTARG in + recursive-unlink) + RECURSIVE_UNLINK="yes" + ;; + *) + echo -e "Error: invalid option -$OPTARG" + echo + usage 1 + ;; + esac + ;; *) echo >&2 "ERROR: invalid option -$OPTARG" echo @@ -212,16 +227,16 @@ function extract { local eof_without_newline if [ "$size" -gt 0 ]; then if [[ "$line" =~ [^\\]EOF ]]; then - # An EOF not preceeded by a backslash indicates that the line + # An EOF not preceded by a backslash indicates that the line # does not end with a newline eof_without_newline=1 else eof_without_newline=0 fi # Replace NULLBYTE with null byte if at beginning of line - # Replace NULLBYTE with null byte unless preceeded by backslash + # Replace NULLBYTE with null byte unless preceded by backslash # Remove one backslash in front of NULLBYTE (if any) - # Remove EOF unless preceeded by backslash + # Remove EOF unless preceded by backslash # Remove one backslash in front of EOF if [ $USE_PYTHON -eq 1 ]; then echo -n "$line" | python -c "$PYTHON_EXTRACT_FILTER" >> "$path" @@ -245,7 +260,16 @@ function extract { fi if [[ $line =~ ^Path:\ (.*)$ ]]; then path=${BASH_REMATCH[1]} - if [ -e "$path" ] || [ -L "$path" ]; then + if [ -L "$path" ]; then + rm "$path" + elif [ -d "$path" ]; then + if [ "${RECURSIVE_UNLINK:-}" == "yes" ]; then + rm -r "$path" + else + # Safe because symlinks to directories are dealt with above + rmdir "$path" + fi + elif [ -e "$path" ]; then rm "$path" fi elif [[ $line =~ ^Lines:\ (.*)$ ]]; then @@ -338,8 +362,8 @@ function _create { else < "$file" \ sed 's/EOF/\\EOF/g; - s/NULLBYTE/\\NULLBYTE/g; - s/\x0/NULLBYTE/g; + s/NULLBYTE/\\NULLBYTE/g; + s/\x0/NULLBYTE/g; ' fi if [[ "$eof_without_newline" -eq 1 ]]; then diff --git a/vendor/go.opencensus.io/README.md b/vendor/go.opencensus.io/README.md index 3f40ed5c..fabab2e0 100644 --- a/vendor/go.opencensus.io/README.md +++ b/vendor/go.opencensus.io/README.md @@ -253,10 +253,10 @@ release in which the functionality was marked *Deprecated*. [new-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap [new-replace-ex]: https://godoc.org/go.opencensus.io/tag#example-NewMap--Replace -[exporter-prom]: https://godoc.org/go.opencensus.io/exporter/prometheus +[exporter-prom]: https://godoc.org/contrib.go.opencensus.io/exporter/prometheus [exporter-stackdriver]: https://godoc.org/contrib.go.opencensus.io/exporter/stackdriver -[exporter-zipkin]: https://godoc.org/go.opencensus.io/exporter/zipkin -[exporter-jaeger]: https://godoc.org/go.opencensus.io/exporter/jaeger +[exporter-zipkin]: https://godoc.org/contrib.go.opencensus.io/exporter/zipkin +[exporter-jaeger]: https://godoc.org/contrib.go.opencensus.io/exporter/jaeger [exporter-xray]: https://github.com/census-ecosystem/opencensus-go-exporter-aws [exporter-datadog]: https://github.com/DataDog/opencensus-go-exporter-datadog [exporter-graphite]: https://github.com/census-ecosystem/opencensus-go-exporter-graphite diff --git a/vendor/go.opencensus.io/go.mod b/vendor/go.opencensus.io/go.mod index 8b7d38e9..cb4de80f 100644 --- a/vendor/go.opencensus.io/go.mod +++ b/vendor/go.opencensus.io/go.mod @@ -1,10 +1,12 @@ module go.opencensus.io require ( - github.com/golang/protobuf v1.2.0 - github.com/google/go-cmp v0.2.0 - github.com/hashicorp/golang-lru v0.5.0 - golang.org/x/net v0.0.0-20190311183353-d8887717615a - google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 // indirect - google.golang.org/grpc v1.19.0 + github.com/golang/protobuf v1.3.1 + github.com/google/go-cmp v0.3.0 + github.com/hashicorp/golang-lru v0.5.1 + golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 + golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd // indirect + golang.org/x/text v0.3.2 // indirect + google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb // indirect + google.golang.org/grpc v1.20.1 ) diff --git a/vendor/go.opencensus.io/go.sum b/vendor/go.opencensus.io/go.sum index cbb37036..0b948c2b 100644 --- a/vendor/go.opencensus.io/go.sum +++ b/vendor/go.opencensus.io/go.sum @@ -6,21 +6,24 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfU github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= -github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09 h1:KaQtG+aDELoNmXYas3TVkGNYRuq8JQ1aa7LJt8EXVyo= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -31,20 +34,28 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd h1:r7DufRZuZbWB7j439YfAzP8RPDa9unLkpwQKUYbIMPI= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb h1:i1Ppqkc3WQXikh8bXiwHqAN5Rv3/qDCcRk0/Otx73BY= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/go.opencensus.io/opencensus.go b/vendor/go.opencensus.io/opencensus.go index d2565f1e..626d7364 100644 --- a/vendor/go.opencensus.io/opencensus.go +++ b/vendor/go.opencensus.io/opencensus.go @@ -17,5 +17,5 @@ package opencensus // import "go.opencensus.io" // Version is the current release version of OpenCensus in use. func Version() string { - return "0.21.0" + return "0.22.0" } diff --git a/vendor/go.opencensus.io/stats/view/view_to_metric.go b/vendor/go.opencensus.io/stats/view/view_to_metric.go index 010f81ba..f67b5c46 100644 --- a/vendor/go.opencensus.io/stats/view/view_to_metric.go +++ b/vendor/go.opencensus.io/stats/view/view_to_metric.go @@ -73,7 +73,7 @@ func getType(v *View) metricdata.Type { } } -func getLableKeys(v *View) []metricdata.LabelKey { +func getLabelKeys(v *View) []metricdata.LabelKey { labelKeys := []metricdata.LabelKey{} for _, k := range v.TagKeys { labelKeys = append(labelKeys, metricdata.LabelKey{Key: k.Name()}) @@ -87,7 +87,7 @@ func viewToMetricDescriptor(v *View) *metricdata.Descriptor { Description: v.Description, Unit: getUnit(v.Measure.Unit()), Type: getType(v), - LabelKeys: getLableKeys(v), + LabelKeys: getLabelKeys(v), } } diff --git a/vendor/go.opencensus.io/tag/key.go b/vendor/go.opencensus.io/tag/key.go index ebbed950..4e63d08c 100644 --- a/vendor/go.opencensus.io/tag/key.go +++ b/vendor/go.opencensus.io/tag/key.go @@ -29,6 +29,16 @@ func NewKey(name string) (Key, error) { return Key{name: name}, nil } +// MustNewKey creates or retrieves a string key identified by name. +// An invalid key name raises a panic. +func MustNewKey(name string) Key { + k, err := NewKey(name) + if err != nil { + panic(err) + } + return k +} + // Name returns the name of the key. func (k Key) Name() string { return k.name diff --git a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s index af76bbcc..9dd5d7a9 100644 --- a/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s +++ b/vendor/golang.org/x/crypto/chacha20poly1305/chacha20poly1305_amd64.s @@ -200,7 +200,7 @@ GLOBL ·andMask<>(SB), (NOPTR+RODATA), $240 #define polyMulStage1 MOVQ (0*8)(BP), AX; MOVQ AX, t2; MULQ acc0; MOVQ AX, t0; MOVQ DX, t1; MOVQ (0*8)(BP), AX; MULQ acc1; IMULQ acc2, t2; ADDQ AX, t1; ADCQ DX, t2 #define polyMulStage2 MOVQ (1*8)(BP), AX; MOVQ AX, t3; MULQ acc0; ADDQ AX, t1; ADCQ $0, DX; MOVQ DX, acc0; MOVQ (1*8)(BP), AX; MULQ acc1; ADDQ AX, t2; ADCQ $0, DX #define polyMulStage3 IMULQ acc2, t3; ADDQ acc0, t2; ADCQ DX, t3 -#define polyMulReduceStage MOVQ t0, acc0; MOVQ t1, acc1; MOVQ t2, acc2; ANDQ $3, acc2; MOVQ t2, t0; ANDQ $-4, t0; MOVQ t3, t1; SHRQ $2, t2:t3; SHRQ $2, t3; ADDQ t0, acc0; ADCQ t1, acc1; ADCQ $0, acc2; ADDQ t2, acc0; ADCQ t3, acc1; ADCQ $0, acc2 +#define polyMulReduceStage MOVQ t0, acc0; MOVQ t1, acc1; MOVQ t2, acc2; ANDQ $3, acc2; MOVQ t2, t0; ANDQ $-4, t0; MOVQ t3, t1; SHRQ $2, t3, t2; SHRQ $2, t3; ADDQ t0, acc0; ADCQ t1, acc1; ADCQ $0, acc2; ADDQ t2, acc0; ADCQ t3, acc1; ADCQ $0, acc2 #define polyMulStage1_AVX2 MOVQ (0*8)(BP), DX; MOVQ DX, t2; MULXQ acc0, t0, t1; IMULQ acc2, t2; MULXQ acc1, AX, DX; ADDQ AX, t1; ADCQ DX, t2 #define polyMulStage2_AVX2 MOVQ (1*8)(BP), DX; MULXQ acc0, acc0, AX; ADDQ acc0, t1; MULXQ acc1, acc1, t3; ADCQ acc1, t2; ADCQ $0, t3 @@ -248,7 +248,7 @@ hashADTail: ADDQ itr2, adp hashADTailLoop: - SHLQ $8, t1:t0 + SHLQ $8, t0, t1 SHLQ $8, t0 MOVB -1(adp), t2 XORQ t2, t0 diff --git a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s index 9e9040b2..e0ac30c7 100644 --- a/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s +++ b/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s @@ -121,18 +121,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -236,18 +236,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -441,18 +441,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -591,18 +591,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -731,18 +731,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -846,18 +846,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -996,18 +996,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -1146,18 +1146,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX @@ -1332,18 +1332,18 @@ TEXT ·ladderstep(SB),0,$296-8 ADDQ AX,R12 ADCQ DX,R13 MOVQ $REDMASK51,DX - SHLQ $13,CX:SI + SHLQ $13,SI,CX ANDQ DX,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ DX,R8 ADDQ CX,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ DX,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ DX,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ DX,R14 ADDQ R13,R14 IMUL3Q $19,R15,CX diff --git a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s index 5ce80a2e..1f76d1a3 100644 --- a/vendor/golang.org/x/crypto/curve25519/mul_amd64.s +++ b/vendor/golang.org/x/crypto/curve25519/mul_amd64.s @@ -124,18 +124,18 @@ TEXT ·mul(SB),0,$16-24 ADDQ AX,R14 ADCQ DX,R15 MOVQ $REDMASK51,SI - SHLQ $13,R9:R8 + SHLQ $13,R8,R9 ANDQ SI,R8 - SHLQ $13,R11:R10 + SHLQ $13,R10,R11 ANDQ SI,R10 ADDQ R9,R10 - SHLQ $13,R13:R12 + SHLQ $13,R12,R13 ANDQ SI,R12 ADDQ R11,R12 - SHLQ $13,R15:R14 + SHLQ $13,R14,R15 ANDQ SI,R14 ADDQ R13,R14 - SHLQ $13,BP:BX + SHLQ $13,BX,BP ANDQ SI,BX ADDQ R15,BX IMUL3Q $19,BP,DX diff --git a/vendor/golang.org/x/crypto/curve25519/square_amd64.s b/vendor/golang.org/x/crypto/curve25519/square_amd64.s index 12f73734..07511a45 100644 --- a/vendor/golang.org/x/crypto/curve25519/square_amd64.s +++ b/vendor/golang.org/x/crypto/curve25519/square_amd64.s @@ -87,18 +87,18 @@ TEXT ·square(SB),7,$0-16 ADDQ AX,R13 ADCQ DX,R14 MOVQ $REDMASK51,SI - SHLQ $13,R8:CX + SHLQ $13,CX,R8 ANDQ SI,CX - SHLQ $13,R10:R9 + SHLQ $13,R9,R10 ANDQ SI,R9 ADDQ R8,R9 - SHLQ $13,R12:R11 + SHLQ $13,R11,R12 ANDQ SI,R11 ADDQ R10,R11 - SHLQ $13,R14:R13 + SHLQ $13,R13,R14 ANDQ SI,R13 ADDQ R12,R13 - SHLQ $13,BX:R15 + SHLQ $13,R15,BX ANDQ SI,R15 ADDQ R14,R15 IMUL3Q $19,BX,DX diff --git a/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s b/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s new file mode 100644 index 00000000..8815cb00 --- /dev/null +++ b/vendor/golang.org/x/crypto/internal/chacha20/asm_ppc64le.s @@ -0,0 +1,668 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Based on CRYPTOGAMS code with the following comment: +// # ==================================================================== +// # Written by Andy Polyakov for the OpenSSL +// # project. The module is, however, dual licensed under OpenSSL and +// # CRYPTOGAMS licenses depending on where you obtain it. For further +// # details see http://www.openssl.org/~appro/cryptogams/. +// # ==================================================================== + +// Original code can be found at the link below: +// https://github.com/dot-asm/cryptogams/commit/a60f5b50ed908e91e5c39ca79126a4a876d5d8ff + +// There are some differences between CRYPTOGAMS code and this one. The round +// loop for "_int" isn't the same as the original. Some adjustments were +// necessary because there are less vector registers available. For example, some +// X variables (r12, r13, r14, and r15) share the same register used by the +// counter. The original code uses ctr to name the counter. Here we use CNT +// because golang uses CTR as the counter register name. + +// +build ppc64le,!gccgo,!appengine + +#include "textflag.h" + +#define OUT R3 +#define INP R4 +#define LEN R5 +#define KEY R6 +#define CNT R7 + +#define TEMP R8 + +#define X0 R11 +#define X1 R12 +#define X2 R14 +#define X3 R15 +#define X4 R16 +#define X5 R17 +#define X6 R18 +#define X7 R19 +#define X8 R20 +#define X9 R21 +#define X10 R22 +#define X11 R23 +#define X12 R24 +#define X13 R25 +#define X14 R26 +#define X15 R27 + +#define CON0 X0 +#define CON1 X1 +#define CON2 X2 +#define CON3 X3 + +#define KEY0 X4 +#define KEY1 X5 +#define KEY2 X6 +#define KEY3 X7 +#define KEY4 X8 +#define KEY5 X9 +#define KEY6 X10 +#define KEY7 X11 + +#define CNT0 X12 +#define CNT1 X13 +#define CNT2 X14 +#define CNT3 X15 + +#define TMP0 R9 +#define TMP1 R10 +#define TMP2 R28 +#define TMP3 R29 + +#define CONSTS R8 + +#define A0 V0 +#define B0 V1 +#define C0 V2 +#define D0 V3 +#define A1 V4 +#define B1 V5 +#define C1 V6 +#define D1 V7 +#define A2 V8 +#define B2 V9 +#define C2 V10 +#define D2 V11 +#define T0 V12 +#define T1 V13 +#define T2 V14 + +#define K0 V15 +#define K1 V16 +#define K2 V17 +#define K3 V18 +#define K4 V19 +#define K5 V20 + +#define FOUR V21 +#define SIXTEEN V22 +#define TWENTY4 V23 +#define TWENTY V24 +#define TWELVE V25 +#define TWENTY5 V26 +#define SEVEN V27 + +#define INPPERM V28 +#define OUTPERM V29 +#define OUTMASK V30 + +#define DD0 V31 +#define DD1 SEVEN +#define DD2 T0 +#define DD3 T1 +#define DD4 T2 + +DATA ·consts+0x00(SB)/8, $0x3320646e61707865 +DATA ·consts+0x08(SB)/8, $0x6b20657479622d32 +DATA ·consts+0x10(SB)/8, $0x0000000000000001 +DATA ·consts+0x18(SB)/8, $0x0000000000000000 +DATA ·consts+0x20(SB)/8, $0x0000000000000004 +DATA ·consts+0x28(SB)/8, $0x0000000000000000 +DATA ·consts+0x30(SB)/8, $0x0a0b08090e0f0c0d +DATA ·consts+0x38(SB)/8, $0x0203000106070405 +DATA ·consts+0x40(SB)/8, $0x090a0b080d0e0f0c +DATA ·consts+0x48(SB)/8, $0x0102030005060704 +GLOBL ·consts(SB), RODATA, $80 + +//func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[32]byte, counter *[16]byte) +TEXT ·chaCha20_ctr32_vmx(SB),NOSPLIT|NOFRAME,$0 + // Load the arguments inside the registers + MOVD out+0(FP), OUT + MOVD inp+8(FP), INP + MOVD len+16(FP), LEN + MOVD key+24(FP), KEY + MOVD cnt+32(FP), CNT + + MOVD $·consts(SB), CONSTS // point to consts addr + + MOVD $16, X0 + MOVD $32, X1 + MOVD $48, X2 + MOVD $64, X3 + MOVD $31, X4 + MOVD $15, X5 + + // Load key + LVX (KEY)(R0), K1 + LVSR (KEY)(R0), T0 + LVX (KEY)(X0), K2 + LVX (KEY)(X4), DD0 + + // Load counter + LVX (CNT)(R0), K3 + LVSR (CNT)(R0), T1 + LVX (CNT)(X5), DD1 + + // Load constants + LVX (CONSTS)(R0), K0 + LVX (CONSTS)(X0), K5 + LVX (CONSTS)(X1), FOUR + LVX (CONSTS)(X2), SIXTEEN + LVX (CONSTS)(X3), TWENTY4 + + // Align key and counter + VPERM K2, K1, T0, K1 + VPERM DD0, K2, T0, K2 + VPERM DD1, K3, T1, K3 + + // Load counter to GPR + MOVWZ 0(CNT), CNT0 + MOVWZ 4(CNT), CNT1 + MOVWZ 8(CNT), CNT2 + MOVWZ 12(CNT), CNT3 + + // Adjust vectors for the initial state + VADDUWM K3, K5, K3 + VADDUWM K3, K5, K4 + VADDUWM K4, K5, K5 + + // Synthesized constants + VSPLTISW $-12, TWENTY + VSPLTISW $12, TWELVE + VSPLTISW $-7, TWENTY5 + + VXOR T0, T0, T0 + VSPLTISW $-1, OUTMASK + LVSR (INP)(R0), INPPERM + LVSL (OUT)(R0), OUTPERM + VPERM OUTMASK, T0, OUTPERM, OUTMASK + +loop_outer_vmx: + // Load constant + MOVD $0x61707865, CON0 + MOVD $0x3320646e, CON1 + MOVD $0x79622d32, CON2 + MOVD $0x6b206574, CON3 + + VOR K0, K0, A0 + VOR K0, K0, A1 + VOR K0, K0, A2 + VOR K1, K1, B0 + + MOVD $10, TEMP + + // Load key to GPR + MOVWZ 0(KEY), X4 + MOVWZ 4(KEY), X5 + MOVWZ 8(KEY), X6 + MOVWZ 12(KEY), X7 + VOR K1, K1, B1 + VOR K1, K1, B2 + MOVWZ 16(KEY), X8 + MOVWZ 0(CNT), X12 + MOVWZ 20(KEY), X9 + MOVWZ 4(CNT), X13 + VOR K2, K2, C0 + VOR K2, K2, C1 + MOVWZ 24(KEY), X10 + MOVWZ 8(CNT), X14 + VOR K2, K2, C2 + VOR K3, K3, D0 + MOVWZ 28(KEY), X11 + MOVWZ 12(CNT), X15 + VOR K4, K4, D1 + VOR K5, K5, D2 + + MOVD X4, TMP0 + MOVD X5, TMP1 + MOVD X6, TMP2 + MOVD X7, TMP3 + VSPLTISW $7, SEVEN + + MOVD TEMP, CTR + +loop_vmx: + // CRYPTOGAMS uses a macro to create a loop using perl. This isn't possible + // using assembly macros. Therefore, the macro expansion result was used + // in order to maintain the algorithm efficiency. + // This loop generates three keystream blocks using VMX instructions and, + // in parallel, one keystream block using scalar instructions. + ADD X4, X0, X0 + ADD X5, X1, X1 + VADDUWM A0, B0, A0 + VADDUWM A1, B1, A1 + ADD X6, X2, X2 + ADD X7, X3, X3 + VADDUWM A2, B2, A2 + VXOR D0, A0, D0 + XOR X0, X12, X12 + XOR X1, X13, X13 + VXOR D1, A1, D1 + VXOR D2, A2, D2 + XOR X2, X14, X14 + XOR X3, X15, X15 + VPERM D0, D0, SIXTEEN, D0 + VPERM D1, D1, SIXTEEN, D1 + ROTLW $16, X12, X12 + ROTLW $16, X13, X13 + VPERM D2, D2, SIXTEEN, D2 + VADDUWM C0, D0, C0 + ROTLW $16, X14, X14 + ROTLW $16, X15, X15 + VADDUWM C1, D1, C1 + VADDUWM C2, D2, C2 + ADD X12, X8, X8 + ADD X13, X9, X9 + VXOR B0, C0, T0 + VXOR B1, C1, T1 + ADD X14, X10, X10 + ADD X15, X11, X11 + VXOR B2, C2, T2 + VRLW T0, TWELVE, B0 + XOR X8, X4, X4 + XOR X9, X5, X5 + VRLW T1, TWELVE, B1 + VRLW T2, TWELVE, B2 + XOR X10, X6, X6 + XOR X11, X7, X7 + VADDUWM A0, B0, A0 + VADDUWM A1, B1, A1 + ROTLW $12, X4, X4 + ROTLW $12, X5, X5 + VADDUWM A2, B2, A2 + VXOR D0, A0, D0 + ROTLW $12, X6, X6 + ROTLW $12, X7, X7 + VXOR D1, A1, D1 + VXOR D2, A2, D2 + ADD X4, X0, X0 + ADD X5, X1, X1 + VPERM D0, D0, TWENTY4, D0 + VPERM D1, D1, TWENTY4, D1 + ADD X6, X2, X2 + ADD X7, X3, X3 + VPERM D2, D2, TWENTY4, D2 + VADDUWM C0, D0, C0 + XOR X0, X12, X12 + XOR X1, X13, X13 + VADDUWM C1, D1, C1 + VADDUWM C2, D2, C2 + XOR X2, X14, X14 + XOR X3, X15, X15 + VXOR B0, C0, T0 + VXOR B1, C1, T1 + ROTLW $8, X12, X12 + ROTLW $8, X13, X13 + VXOR B2, C2, T2 + VRLW T0, SEVEN, B0 + ROTLW $8, X14, X14 + ROTLW $8, X15, X15 + VRLW T1, SEVEN, B1 + VRLW T2, SEVEN, B2 + ADD X12, X8, X8 + ADD X13, X9, X9 + VSLDOI $8, C0, C0, C0 + VSLDOI $8, C1, C1, C1 + ADD X14, X10, X10 + ADD X15, X11, X11 + VSLDOI $8, C2, C2, C2 + VSLDOI $12, B0, B0, B0 + XOR X8, X4, X4 + XOR X9, X5, X5 + VSLDOI $12, B1, B1, B1 + VSLDOI $12, B2, B2, B2 + XOR X10, X6, X6 + XOR X11, X7, X7 + VSLDOI $4, D0, D0, D0 + VSLDOI $4, D1, D1, D1 + ROTLW $7, X4, X4 + ROTLW $7, X5, X5 + VSLDOI $4, D2, D2, D2 + VADDUWM A0, B0, A0 + ROTLW $7, X6, X6 + ROTLW $7, X7, X7 + VADDUWM A1, B1, A1 + VADDUWM A2, B2, A2 + ADD X5, X0, X0 + ADD X6, X1, X1 + VXOR D0, A0, D0 + VXOR D1, A1, D1 + ADD X7, X2, X2 + ADD X4, X3, X3 + VXOR D2, A2, D2 + VPERM D0, D0, SIXTEEN, D0 + XOR X0, X15, X15 + XOR X1, X12, X12 + VPERM D1, D1, SIXTEEN, D1 + VPERM D2, D2, SIXTEEN, D2 + XOR X2, X13, X13 + XOR X3, X14, X14 + VADDUWM C0, D0, C0 + VADDUWM C1, D1, C1 + ROTLW $16, X15, X15 + ROTLW $16, X12, X12 + VADDUWM C2, D2, C2 + VXOR B0, C0, T0 + ROTLW $16, X13, X13 + ROTLW $16, X14, X14 + VXOR B1, C1, T1 + VXOR B2, C2, T2 + ADD X15, X10, X10 + ADD X12, X11, X11 + VRLW T0, TWELVE, B0 + VRLW T1, TWELVE, B1 + ADD X13, X8, X8 + ADD X14, X9, X9 + VRLW T2, TWELVE, B2 + VADDUWM A0, B0, A0 + XOR X10, X5, X5 + XOR X11, X6, X6 + VADDUWM A1, B1, A1 + VADDUWM A2, B2, A2 + XOR X8, X7, X7 + XOR X9, X4, X4 + VXOR D0, A0, D0 + VXOR D1, A1, D1 + ROTLW $12, X5, X5 + ROTLW $12, X6, X6 + VXOR D2, A2, D2 + VPERM D0, D0, TWENTY4, D0 + ROTLW $12, X7, X7 + ROTLW $12, X4, X4 + VPERM D1, D1, TWENTY4, D1 + VPERM D2, D2, TWENTY4, D2 + ADD X5, X0, X0 + ADD X6, X1, X1 + VADDUWM C0, D0, C0 + VADDUWM C1, D1, C1 + ADD X7, X2, X2 + ADD X4, X3, X3 + VADDUWM C2, D2, C2 + VXOR B0, C0, T0 + XOR X0, X15, X15 + XOR X1, X12, X12 + VXOR B1, C1, T1 + VXOR B2, C2, T2 + XOR X2, X13, X13 + XOR X3, X14, X14 + VRLW T0, SEVEN, B0 + VRLW T1, SEVEN, B1 + ROTLW $8, X15, X15 + ROTLW $8, X12, X12 + VRLW T2, SEVEN, B2 + VSLDOI $8, C0, C0, C0 + ROTLW $8, X13, X13 + ROTLW $8, X14, X14 + VSLDOI $8, C1, C1, C1 + VSLDOI $8, C2, C2, C2 + ADD X15, X10, X10 + ADD X12, X11, X11 + VSLDOI $4, B0, B0, B0 + VSLDOI $4, B1, B1, B1 + ADD X13, X8, X8 + ADD X14, X9, X9 + VSLDOI $4, B2, B2, B2 + VSLDOI $12, D0, D0, D0 + XOR X10, X5, X5 + XOR X11, X6, X6 + VSLDOI $12, D1, D1, D1 + VSLDOI $12, D2, D2, D2 + XOR X8, X7, X7 + XOR X9, X4, X4 + ROTLW $7, X5, X5 + ROTLW $7, X6, X6 + ROTLW $7, X7, X7 + ROTLW $7, X4, X4 + BC 0x10, 0, loop_vmx + + SUB $256, LEN, LEN + + // Accumulate key block + ADD $0x61707865, X0, X0 + ADD $0x3320646e, X1, X1 + ADD $0x79622d32, X2, X2 + ADD $0x6b206574, X3, X3 + ADD TMP0, X4, X4 + ADD TMP1, X5, X5 + ADD TMP2, X6, X6 + ADD TMP3, X7, X7 + MOVWZ 16(KEY), TMP0 + MOVWZ 20(KEY), TMP1 + MOVWZ 24(KEY), TMP2 + MOVWZ 28(KEY), TMP3 + ADD TMP0, X8, X8 + ADD TMP1, X9, X9 + ADD TMP2, X10, X10 + ADD TMP3, X11, X11 + + MOVWZ 12(CNT), TMP0 + MOVWZ 8(CNT), TMP1 + MOVWZ 4(CNT), TMP2 + MOVWZ 0(CNT), TEMP + ADD TMP0, X15, X15 + ADD TMP1, X14, X14 + ADD TMP2, X13, X13 + ADD TEMP, X12, X12 + + // Accumulate key block + VADDUWM A0, K0, A0 + VADDUWM A1, K0, A1 + VADDUWM A2, K0, A2 + VADDUWM B0, K1, B0 + VADDUWM B1, K1, B1 + VADDUWM B2, K1, B2 + VADDUWM C0, K2, C0 + VADDUWM C1, K2, C1 + VADDUWM C2, K2, C2 + VADDUWM D0, K3, D0 + VADDUWM D1, K4, D1 + VADDUWM D2, K5, D2 + + // Increment counter + ADD $4, TEMP, TEMP + MOVW TEMP, 0(CNT) + + VADDUWM K3, FOUR, K3 + VADDUWM K4, FOUR, K4 + VADDUWM K5, FOUR, K5 + + // XOR the input slice (INP) with the keystream, which is stored in GPRs (X0-X3). + + // Load input (aligned or not) + MOVWZ 0(INP), TMP0 + MOVWZ 4(INP), TMP1 + MOVWZ 8(INP), TMP2 + MOVWZ 12(INP), TMP3 + + // XOR with input + XOR TMP0, X0, X0 + XOR TMP1, X1, X1 + XOR TMP2, X2, X2 + XOR TMP3, X3, X3 + MOVWZ 16(INP), TMP0 + MOVWZ 20(INP), TMP1 + MOVWZ 24(INP), TMP2 + MOVWZ 28(INP), TMP3 + XOR TMP0, X4, X4 + XOR TMP1, X5, X5 + XOR TMP2, X6, X6 + XOR TMP3, X7, X7 + MOVWZ 32(INP), TMP0 + MOVWZ 36(INP), TMP1 + MOVWZ 40(INP), TMP2 + MOVWZ 44(INP), TMP3 + XOR TMP0, X8, X8 + XOR TMP1, X9, X9 + XOR TMP2, X10, X10 + XOR TMP3, X11, X11 + MOVWZ 48(INP), TMP0 + MOVWZ 52(INP), TMP1 + MOVWZ 56(INP), TMP2 + MOVWZ 60(INP), TMP3 + XOR TMP0, X12, X12 + XOR TMP1, X13, X13 + XOR TMP2, X14, X14 + XOR TMP3, X15, X15 + + // Store output (aligned or not) + MOVW X0, 0(OUT) + MOVW X1, 4(OUT) + MOVW X2, 8(OUT) + MOVW X3, 12(OUT) + + ADD $64, INP, INP // INP points to the end of the slice for the alignment code below + + MOVW X4, 16(OUT) + MOVD $16, TMP0 + MOVW X5, 20(OUT) + MOVD $32, TMP1 + MOVW X6, 24(OUT) + MOVD $48, TMP2 + MOVW X7, 28(OUT) + MOVD $64, TMP3 + MOVW X8, 32(OUT) + MOVW X9, 36(OUT) + MOVW X10, 40(OUT) + MOVW X11, 44(OUT) + MOVW X12, 48(OUT) + MOVW X13, 52(OUT) + MOVW X14, 56(OUT) + MOVW X15, 60(OUT) + ADD $64, OUT, OUT + + // Load input + LVX (INP)(R0), DD0 + LVX (INP)(TMP0), DD1 + LVX (INP)(TMP1), DD2 + LVX (INP)(TMP2), DD3 + LVX (INP)(TMP3), DD4 + ADD $64, INP, INP + + VPERM DD1, DD0, INPPERM, DD0 // Align input + VPERM DD2, DD1, INPPERM, DD1 + VPERM DD3, DD2, INPPERM, DD2 + VPERM DD4, DD3, INPPERM, DD3 + VXOR A0, DD0, A0 // XOR with input + VXOR B0, DD1, B0 + LVX (INP)(TMP0), DD1 // Keep loading input + VXOR C0, DD2, C0 + LVX (INP)(TMP1), DD2 + VXOR D0, DD3, D0 + LVX (INP)(TMP2), DD3 + LVX (INP)(TMP3), DD0 + ADD $64, INP, INP + MOVD $63, TMP3 // 63 is not a typo + VPERM A0, A0, OUTPERM, A0 + VPERM B0, B0, OUTPERM, B0 + VPERM C0, C0, OUTPERM, C0 + VPERM D0, D0, OUTPERM, D0 + + VPERM DD1, DD4, INPPERM, DD4 // Align input + VPERM DD2, DD1, INPPERM, DD1 + VPERM DD3, DD2, INPPERM, DD2 + VPERM DD0, DD3, INPPERM, DD3 + VXOR A1, DD4, A1 + VXOR B1, DD1, B1 + LVX (INP)(TMP0), DD1 // Keep loading + VXOR C1, DD2, C1 + LVX (INP)(TMP1), DD2 + VXOR D1, DD3, D1 + LVX (INP)(TMP2), DD3 + + // Note that the LVX address is always rounded down to the nearest 16-byte + // boundary, and that it always points to at most 15 bytes beyond the end of + // the slice, so we cannot cross a page boundary. + LVX (INP)(TMP3), DD4 // Redundant in aligned case. + ADD $64, INP, INP + VPERM A1, A1, OUTPERM, A1 // Pre-misalign output + VPERM B1, B1, OUTPERM, B1 + VPERM C1, C1, OUTPERM, C1 + VPERM D1, D1, OUTPERM, D1 + + VPERM DD1, DD0, INPPERM, DD0 // Align Input + VPERM DD2, DD1, INPPERM, DD1 + VPERM DD3, DD2, INPPERM, DD2 + VPERM DD4, DD3, INPPERM, DD3 + VXOR A2, DD0, A2 + VXOR B2, DD1, B2 + VXOR C2, DD2, C2 + VXOR D2, DD3, D2 + VPERM A2, A2, OUTPERM, A2 + VPERM B2, B2, OUTPERM, B2 + VPERM C2, C2, OUTPERM, C2 + VPERM D2, D2, OUTPERM, D2 + + ANDCC $15, OUT, X1 // Is out aligned? + MOVD OUT, X0 + + VSEL A0, B0, OUTMASK, DD0 // Collect pre-misaligned output + VSEL B0, C0, OUTMASK, DD1 + VSEL C0, D0, OUTMASK, DD2 + VSEL D0, A1, OUTMASK, DD3 + VSEL A1, B1, OUTMASK, B0 + VSEL B1, C1, OUTMASK, C0 + VSEL C1, D1, OUTMASK, D0 + VSEL D1, A2, OUTMASK, A1 + VSEL A2, B2, OUTMASK, B1 + VSEL B2, C2, OUTMASK, C1 + VSEL C2, D2, OUTMASK, D1 + + STVX DD0, (OUT+TMP0) + STVX DD1, (OUT+TMP1) + STVX DD2, (OUT+TMP2) + ADD $64, OUT, OUT + STVX DD3, (OUT+R0) + STVX B0, (OUT+TMP0) + STVX C0, (OUT+TMP1) + STVX D0, (OUT+TMP2) + ADD $64, OUT, OUT + STVX A1, (OUT+R0) + STVX B1, (OUT+TMP0) + STVX C1, (OUT+TMP1) + STVX D1, (OUT+TMP2) + ADD $64, OUT, OUT + + BEQ aligned_vmx + + SUB X1, OUT, X2 // in misaligned case edges + MOVD $0, X3 // are written byte-by-byte + +unaligned_tail_vmx: + STVEBX D2, (X2+X3) + ADD $1, X3, X3 + CMPW X3, X1 + BNE unaligned_tail_vmx + SUB X1, X0, X2 + +unaligned_head_vmx: + STVEBX A0, (X2+X1) + CMPW X1, $15 + ADD $1, X1, X1 + BNE unaligned_head_vmx + + CMPU LEN, $255 // done with 256-byte block yet? + BGT loop_outer_vmx + + JMP done_vmx + +aligned_vmx: + STVX A0, (X0+R0) + CMPU LEN, $255 // done with 256-byte block yet? + BGT loop_outer_vmx + +done_vmx: + RET diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go index 47eac031..bf8beba6 100644 --- a/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go +++ b/vendor/golang.org/x/crypto/internal/chacha20/chacha_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !arm64,!s390x arm64,!go1.11 gccgo appengine +// +build !ppc64le,!arm64,!s390x arm64,!go1.11 gccgo appengine package chacha20 diff --git a/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go b/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go new file mode 100644 index 00000000..9bd6df64 --- /dev/null +++ b/vendor/golang.org/x/crypto/internal/chacha20/chacha_ppc64le.go @@ -0,0 +1,51 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ppc64le,!gccgo,!appengine + +package chacha20 + +import "encoding/binary" + +var haveAsm = true + +const bufSize = 256 + +//go:noescape +func chaCha20_ctr32_vmx(out, inp *byte, len int, key *[8]uint32, counter *uint32) + +func (c *Cipher) xorKeyStreamAsm(dst, src []byte) { + if len(src) >= bufSize { + chaCha20_ctr32_vmx(&dst[0], &src[0], len(src)-len(src)%bufSize, &c.key, &c.counter) + } + if len(src)%bufSize != 0 { + chaCha20_ctr32_vmx(&c.buf[0], &c.buf[0], bufSize, &c.key, &c.counter) + start := len(src) - len(src)%bufSize + ts, td, tb := src[start:], dst[start:], c.buf[:] + // Unroll loop to XOR 32 bytes per iteration. + for i := 0; i < len(ts)-32; i += 32 { + td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination + s0 := binary.LittleEndian.Uint64(ts[0:8]) + s1 := binary.LittleEndian.Uint64(ts[8:16]) + s2 := binary.LittleEndian.Uint64(ts[16:24]) + s3 := binary.LittleEndian.Uint64(ts[24:32]) + b0 := binary.LittleEndian.Uint64(tb[0:8]) + b1 := binary.LittleEndian.Uint64(tb[8:16]) + b2 := binary.LittleEndian.Uint64(tb[16:24]) + b3 := binary.LittleEndian.Uint64(tb[24:32]) + binary.LittleEndian.PutUint64(td[0:8], s0^b0) + binary.LittleEndian.PutUint64(td[8:16], s1^b1) + binary.LittleEndian.PutUint64(td[16:24], s2^b2) + binary.LittleEndian.PutUint64(td[24:32], s3^b3) + ts, td, tb = ts[32:], td[32:], tb[32:] + } + td, tb = td[:len(ts)], tb[:len(ts)] // bounds check elimination + for i, v := range ts { + td[i] = tb[i] ^ v + } + c.len = bufSize - (len(src) % bufSize) + + } + +} diff --git a/vendor/golang.org/x/crypto/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/poly1305/mac_noasm.go index 8387d299..a8dd589a 100644 --- a/vendor/golang.org/x/crypto/poly1305/mac_noasm.go +++ b/vendor/golang.org/x/crypto/poly1305/mac_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !amd64 gccgo appengine +// +build !amd64,!ppc64le gccgo appengine package poly1305 diff --git a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go b/vendor/golang.org/x/crypto/poly1305/sum_noasm.go index fcdef46a..8a9c2070 100644 --- a/vendor/golang.org/x/crypto/poly1305/sum_noasm.go +++ b/vendor/golang.org/x/crypto/poly1305/sum_noasm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build s390x,!go1.11 !arm,!amd64,!s390x gccgo appengine nacl +// +build s390x,!go1.11 !arm,!amd64,!s390x,!ppc64le gccgo appengine nacl package poly1305 diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go b/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go new file mode 100644 index 00000000..2402b637 --- /dev/null +++ b/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go @@ -0,0 +1,68 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ppc64le,!gccgo,!appengine + +package poly1305 + +//go:noescape +func initialize(state *[7]uint64, key *[32]byte) + +//go:noescape +func update(state *[7]uint64, msg []byte) + +//go:noescape +func finalize(tag *[TagSize]byte, state *[7]uint64) + +// Sum generates an authenticator for m using a one-time key and puts the +// 16-byte result into out. Authenticating two different messages with the same +// key allows an attacker to forge messages at will. +func Sum(out *[16]byte, m []byte, key *[32]byte) { + h := newMAC(key) + h.Write(m) + h.Sum(out) +} + +func newMAC(key *[32]byte) (h mac) { + initialize(&h.state, key) + return +} + +type mac struct { + state [7]uint64 // := uint64{ h0, h1, h2, r0, r1, pad0, pad1 } + + buffer [TagSize]byte + offset int +} + +func (h *mac) Write(p []byte) (n int, err error) { + n = len(p) + if h.offset > 0 { + remaining := TagSize - h.offset + if n < remaining { + h.offset += copy(h.buffer[h.offset:], p) + return n, nil + } + copy(h.buffer[h.offset:], p[:remaining]) + p = p[remaining:] + h.offset = 0 + update(&h.state, h.buffer[:]) + } + if nn := len(p) - (len(p) % TagSize); nn > 0 { + update(&h.state, p[:nn]) + p = p[nn:] + } + if len(p) > 0 { + h.offset += copy(h.buffer[h.offset:], p) + } + return n, nil +} + +func (h *mac) Sum(out *[16]byte) { + state := h.state + if h.offset > 0 { + update(&state, h.buffer[:h.offset]) + } + finalize(out, &state) +} diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s b/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s new file mode 100644 index 00000000..55c7167e --- /dev/null +++ b/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s @@ -0,0 +1,247 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ppc64le,!gccgo,!appengine + +#include "textflag.h" + +// This was ported from the amd64 implementation. + +#define POLY1305_ADD(msg, h0, h1, h2, t0, t1, t2) \ + MOVD (msg), t0; \ + MOVD 8(msg), t1; \ + MOVD $1, t2; \ + ADDC t0, h0, h0; \ + ADDE t1, h1, h1; \ + ADDE t2, h2; \ + ADD $16, msg + +#define POLY1305_MUL(h0, h1, h2, r0, r1, t0, t1, t2, t3, t4, t5) \ + MULLD r0, h0, t0; \ + MULLD r0, h1, t4; \ + MULHDU r0, h0, t1; \ + MULHDU r0, h1, t5; \ + ADDC t4, t1, t1; \ + MULLD r0, h2, t2; \ + ADDZE t5; \ + MULHDU r1, h0, t4; \ + MULLD r1, h0, h0; \ + ADD t5, t2, t2; \ + ADDC h0, t1, t1; \ + MULLD h2, r1, t3; \ + ADDZE t4, h0; \ + MULHDU r1, h1, t5; \ + MULLD r1, h1, t4; \ + ADDC t4, t2, t2; \ + ADDE t5, t3, t3; \ + ADDC h0, t2, t2; \ + MOVD $-4, t4; \ + MOVD t0, h0; \ + MOVD t1, h1; \ + ADDZE t3; \ + ANDCC $3, t2, h2; \ + AND t2, t4, t0; \ + ADDC t0, h0, h0; \ + ADDE t3, h1, h1; \ + SLD $62, t3, t4; \ + SRD $2, t2; \ + ADDZE h2; \ + OR t4, t2, t2; \ + SRD $2, t3; \ + ADDC t2, h0, h0; \ + ADDE t3, h1, h1; \ + ADDZE h2 + +DATA ·poly1305Mask<>+0x00(SB)/8, $0x0FFFFFFC0FFFFFFF +DATA ·poly1305Mask<>+0x08(SB)/8, $0x0FFFFFFC0FFFFFFC +GLOBL ·poly1305Mask<>(SB), RODATA, $16 + +// func update(state *[7]uint64, msg []byte) + +TEXT ·update(SB), $0-32 + MOVD state+0(FP), R3 + MOVD msg_base+8(FP), R4 + MOVD msg_len+16(FP), R5 + + MOVD 0(R3), R8 // h0 + MOVD 8(R3), R9 // h1 + MOVD 16(R3), R10 // h2 + MOVD 24(R3), R11 // r0 + MOVD 32(R3), R12 // r1 + + CMP R5, $16 + BLT bytes_between_0_and_15 + +loop: + POLY1305_ADD(R4, R8, R9, R10, R20, R21, R22) + +multiply: + POLY1305_MUL(R8, R9, R10, R11, R12, R16, R17, R18, R14, R20, R21) + ADD $-16, R5 + CMP R5, $16 + BGE loop + +bytes_between_0_and_15: + CMP $0, R5 + BEQ done + MOVD $0, R16 // h0 + MOVD $0, R17 // h1 + +flush_buffer: + CMP R5, $8 + BLE just1 + + MOVD $8, R21 + SUB R21, R5, R21 + + // Greater than 8 -- load the rightmost remaining bytes in msg + // and put into R17 (h1) + MOVD (R4)(R21), R17 + MOVD $16, R22 + + // Find the offset to those bytes + SUB R5, R22, R22 + SLD $3, R22 + + // Shift to get only the bytes in msg + SRD R22, R17, R17 + + // Put 1 at high end + MOVD $1, R23 + SLD $3, R21 + SLD R21, R23, R23 + OR R23, R17, R17 + + // Remainder is 8 + MOVD $8, R5 + +just1: + CMP R5, $8 + BLT less8 + + // Exactly 8 + MOVD (R4), R16 + + CMP $0, R17 + + // Check if we've already set R17; if not + // set 1 to indicate end of msg. + BNE carry + MOVD $1, R17 + BR carry + +less8: + MOVD $0, R16 // h0 + MOVD $0, R22 // shift count + CMP R5, $4 + BLT less4 + MOVWZ (R4), R16 + ADD $4, R4 + ADD $-4, R5 + MOVD $32, R22 + +less4: + CMP R5, $2 + BLT less2 + MOVHZ (R4), R21 + SLD R22, R21, R21 + OR R16, R21, R16 + ADD $16, R22 + ADD $-2, R5 + ADD $2, R4 + +less2: + CMP $0, R5 + BEQ insert1 + MOVBZ (R4), R21 + SLD R22, R21, R21 + OR R16, R21, R16 + ADD $8, R22 + +insert1: + // Insert 1 at end of msg + MOVD $1, R21 + SLD R22, R21, R21 + OR R16, R21, R16 + +carry: + // Add new values to h0, h1, h2 + ADDC R16, R8 + ADDE R17, R9 + ADDE $0, R10 + MOVD $16, R5 + ADD R5, R4 + BR multiply + +done: + // Save h0, h1, h2 in state + MOVD R8, 0(R3) + MOVD R9, 8(R3) + MOVD R10, 16(R3) + RET + +// func initialize(state *[7]uint64, key *[32]byte) +TEXT ·initialize(SB), $0-16 + MOVD state+0(FP), R3 + MOVD key+8(FP), R4 + + // state[0...7] is initialized with zero + // Load key + MOVD 0(R4), R5 + MOVD 8(R4), R6 + MOVD 16(R4), R7 + MOVD 24(R4), R8 + + // Address of key mask + MOVD $·poly1305Mask<>(SB), R9 + + // Save original key in state + MOVD R7, 40(R3) + MOVD R8, 48(R3) + + // Get mask + MOVD (R9), R7 + MOVD 8(R9), R8 + + // And with key + AND R5, R7, R5 + AND R6, R8, R6 + + // Save masked key in state + MOVD R5, 24(R3) + MOVD R6, 32(R3) + RET + +// func finalize(tag *[TagSize]byte, state *[7]uint64) +TEXT ·finalize(SB), $0-16 + MOVD tag+0(FP), R3 + MOVD state+8(FP), R4 + + // Get h0, h1, h2 from state + MOVD 0(R4), R5 + MOVD 8(R4), R6 + MOVD 16(R4), R7 + + // Save h0, h1 + MOVD R5, R8 + MOVD R6, R9 + MOVD $3, R20 + MOVD $-1, R21 + SUBC $-5, R5 + SUBE R21, R6 + SUBE R20, R7 + MOVD $0, R21 + SUBZE R21 + + // Check for carry + CMP $0, R21 + ISEL $2, R5, R8, R5 + ISEL $2, R6, R9, R6 + MOVD 40(R4), R8 + MOVD 48(R4), R9 + ADDC R8, R5 + ADDE R9, R6 + MOVD R5, 0(R3) + MOVD R6, 8(R3) + RET diff --git a/vendor/golang.org/x/net/internal/socket/sys_posix.go b/vendor/golang.org/x/net/internal/socket/sys_posix.go index 24fbb696..22eae809 100644 --- a/vendor/golang.org/x/net/internal/socket/sys_posix.go +++ b/vendor/golang.org/x/net/internal/socket/sys_posix.go @@ -33,7 +33,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte { if ip4 := ip.To4(); ip4 != nil { b := make([]byte, sizeofSockaddrInet) switch runtime.GOOS { - case "android", "linux", "solaris", "windows": + case "android", "illumos", "linux", "solaris", "windows": NativeEndian.PutUint16(b[:2], uint16(sysAF_INET)) default: b[0] = sizeofSockaddrInet @@ -46,7 +46,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte { if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil { b := make([]byte, sizeofSockaddrInet6) switch runtime.GOOS { - case "android", "linux", "solaris", "windows": + case "android", "illumos", "linux", "solaris", "windows": NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6)) default: b[0] = sizeofSockaddrInet6 @@ -68,7 +68,7 @@ func parseInetAddr(b []byte, network string) (net.Addr, error) { } var af int switch runtime.GOOS { - case "android", "linux", "solaris", "windows": + case "android", "illumos", "linux", "solaris", "windows": af = int(NativeEndian.Uint16(b[:2])) default: af = int(b[1]) diff --git a/vendor/golang.org/x/oauth2/google/default.go b/vendor/golang.org/x/oauth2/google/default.go index 5087d845..ad2c0923 100644 --- a/vendor/golang.org/x/oauth2/google/default.go +++ b/vendor/golang.org/x/oauth2/google/default.go @@ -73,7 +73,6 @@ func DefaultTokenSource(ctx context.Context, scope ...string) (oauth2.TokenSourc // 4. On Google Compute Engine, Google App Engine standard second generation runtimes // (>= Go 1.11), and Google App Engine flexible environment, it fetches // credentials from the metadata server. -// (In this final case any provided scopes are ignored.) func FindDefaultCredentials(ctx context.Context, scopes ...string) (*Credentials, error) { // First, try the environment variable. const envVar = "GOOGLE_APPLICATION_CREDENTIALS" @@ -109,7 +108,7 @@ func FindDefaultCredentials(ctx context.Context, scopes ...string) (*Credentials id, _ := metadata.ProjectID() return &DefaultCredentials{ ProjectID: id, - TokenSource: ComputeTokenSource(""), + TokenSource: ComputeTokenSource("", scopes...), }, nil } diff --git a/vendor/golang.org/x/oauth2/google/google.go b/vendor/golang.org/x/oauth2/google/google.go index df8e87d7..81de32b3 100644 --- a/vendor/golang.org/x/oauth2/google/google.go +++ b/vendor/golang.org/x/oauth2/google/google.go @@ -9,6 +9,7 @@ import ( "encoding/json" "errors" "fmt" + "net/url" "strings" "time" @@ -151,14 +152,16 @@ func (f *credentialsFile) tokenSource(ctx context.Context, scopes []string) (oau // from Google Compute Engine (GCE)'s metadata server. It's only valid to use // this token source if your program is running on a GCE instance. // If no account is specified, "default" is used. +// If no scopes are specified, a set of default scopes are automatically granted. // Further information about retrieving access tokens from the GCE metadata // server can be found at https://cloud.google.com/compute/docs/authentication. -func ComputeTokenSource(account string) oauth2.TokenSource { - return oauth2.ReuseTokenSource(nil, computeSource{account: account}) +func ComputeTokenSource(account string, scope ...string) oauth2.TokenSource { + return oauth2.ReuseTokenSource(nil, computeSource{account: account, scopes: scope}) } type computeSource struct { account string + scopes []string } func (cs computeSource) Token() (*oauth2.Token, error) { @@ -169,7 +172,13 @@ func (cs computeSource) Token() (*oauth2.Token, error) { if acct == "" { acct = "default" } - tokenJSON, err := metadata.Get("instance/service-accounts/" + acct + "/token") + tokenURI := "instance/service-accounts/" + acct + "/token" + if len(cs.scopes) > 0 { + v := url.Values{} + v.Set("scopes", strings.Join(cs.scopes, ",")) + tokenURI = tokenURI + "?" + v.Encode() + } + tokenJSON, err := metadata.Get(tokenURI) if err != nil { return nil, err } @@ -185,9 +194,16 @@ func (cs computeSource) Token() (*oauth2.Token, error) { if res.ExpiresInSec == 0 || res.AccessToken == "" { return nil, fmt.Errorf("oauth2/google: incomplete token received from metadata") } - return &oauth2.Token{ + tok := &oauth2.Token{ AccessToken: res.AccessToken, TokenType: res.TokenType, Expiry: time.Now().Add(time.Duration(res.ExpiresInSec) * time.Second), - }, nil + } + // NOTE(cbro): add hidden metadata about where the token is from. + // This is needed for detection by client libraries to know that credentials come from the metadata server. + // This may be removed in a future version of this library. + return tok.WithExtra(map[string]interface{}{ + "oauth2.google.tokenSource": "compute-metadata", + "oauth2.google.serviceAccount": acct, + }), nil } diff --git a/vendor/golang.org/x/oauth2/internal/token.go b/vendor/golang.org/x/oauth2/internal/token.go index 83f7847e..355c3869 100644 --- a/vendor/golang.org/x/oauth2/internal/token.go +++ b/vendor/golang.org/x/oauth2/internal/token.go @@ -63,16 +63,12 @@ type tokenJSON struct { TokenType string `json:"token_type"` RefreshToken string `json:"refresh_token"` ExpiresIn expirationTime `json:"expires_in"` // at least PayPal returns string, while most return number - Expires expirationTime `json:"expires"` // broken Facebook spelling of expires_in } func (e *tokenJSON) expiry() (t time.Time) { if v := e.ExpiresIn; v != 0 { return time.Now().Add(time.Duration(v) * time.Second) } - if v := e.Expires; v != 0 { - return time.Now().Add(time.Duration(v) * time.Second) - } return } @@ -264,12 +260,6 @@ func doTokenRoundTrip(ctx context.Context, req *http.Request) (*Token, error) { Raw: vals, } e := vals.Get("expires_in") - if e == "" || e == "null" { - // TODO(jbd): Facebook's OAuth2 implementation is broken and - // returns expires_in field in expires. Remove the fallback to expires, - // when Facebook fixes their implementation. - e = vals.Get("expires") - } expires, _ := strconv.Atoi(e) if expires != 0 { token.Expiry = time.Now().Add(time.Duration(expires) * time.Second) diff --git a/vendor/golang.org/x/oauth2/jwt/jwt.go b/vendor/golang.org/x/oauth2/jwt/jwt.go index 99f3e0a3..b2bf1829 100644 --- a/vendor/golang.org/x/oauth2/jwt/jwt.go +++ b/vendor/golang.org/x/oauth2/jwt/jwt.go @@ -66,6 +66,14 @@ type Config struct { // request. If empty, the value of TokenURL is used as the // intended audience. Audience string + + // PrivateClaims optionally specifies custom private claims in the JWT. + // See http://tools.ietf.org/html/draft-jones-json-web-token-10#section-4.3 + PrivateClaims map[string]interface{} + + // UseIDToken optionally specifies whether ID token should be used instead + // of access token when the server returns both. + UseIDToken bool } // TokenSource returns a JWT TokenSource using the configuration @@ -97,9 +105,10 @@ func (js jwtSource) Token() (*oauth2.Token, error) { } hc := oauth2.NewClient(js.ctx, nil) claimSet := &jws.ClaimSet{ - Iss: js.conf.Email, - Scope: strings.Join(js.conf.Scopes, " "), - Aud: js.conf.TokenURL, + Iss: js.conf.Email, + Scope: strings.Join(js.conf.Scopes, " "), + Aud: js.conf.TokenURL, + PrivateClaims: js.conf.PrivateClaims, } if subject := js.conf.Subject; subject != "" { claimSet.Sub = subject @@ -166,5 +175,11 @@ func (js jwtSource) Token() (*oauth2.Token, error) { } token.Expiry = time.Unix(claimSet.Exp, 0) } + if js.conf.UseIDToken { + if tokenRes.IDToken == "" { + return nil, fmt.Errorf("oauth2: response doesn't have JWT token") + } + token.AccessToken = tokenRes.IDToken + } return token, nil } diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.go index 428283f0..291df5c8 100644 --- a/vendor/golang.org/x/oauth2/oauth2.go +++ b/vendor/golang.org/x/oauth2/oauth2.go @@ -117,7 +117,7 @@ var ( // ApprovalForce forces the users to view the consent dialog // and confirm the permissions request at the URL returned // from AuthCodeURL, even if they've already done so. - ApprovalForce AuthCodeOption = SetAuthURLParam("approval_prompt", "force") + ApprovalForce AuthCodeOption = SetAuthURLParam("prompt", "consent") ) // An AuthCodeOption is passed to Config.AuthCodeURL. diff --git a/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s new file mode 100644 index 00000000..06f84b85 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/asm_aix_ppc64.s @@ -0,0 +1,17 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo + +#include "textflag.h" + +// +// System calls for ppc64, AIX are implemented in runtime/syscall_aix.go +// + +TEXT ·syscall6(SB),NOSPLIT,$0-88 + JMP syscall·syscall6(SB) + +TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 + JMP syscall·rawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go b/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go index d8c26a04..be602722 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go +++ b/vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go @@ -6,8 +6,6 @@ package cpu -import "golang.org/x/sys/unix" - const cacheLineSize = 128 const ( @@ -18,7 +16,7 @@ const ( ) func init() { - impl := unix.Getsystemcfg(_SC_IMPL) + impl := getsystemcfg(_SC_IMPL) if impl&_IMPL_POWER8 != 0 { PPC64.IsPOWER8 = true } @@ -28,3 +26,9 @@ func init() { Initialized = true } + +func getsystemcfg(label int) (n uint64) { + r0, _ := callgetsystemcfg(label) + n = uint64(r0) + return +} diff --git a/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go new file mode 100644 index 00000000..78fe25e8 --- /dev/null +++ b/vendor/golang.org/x/sys/cpu/syscall_aix_ppc64_gc.go @@ -0,0 +1,36 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Minimal copy of x/sys/unix so the cpu package can make a +// system call on AIX without depending on x/sys/unix. +// (See golang.org/issue/32102) + +// +build aix,ppc64 +// +build !gccgo + +package cpu + +import ( + "syscall" + "unsafe" +) + +//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" + +//go:linkname libc_getsystemcfg libc_getsystemcfg + +type syscallFunc uintptr + +var libc_getsystemcfg syscallFunc + +type errno = syscall.Errno + +// Implemented in runtime/syscall_aix.go. +func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) +func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) + +func callgetsystemcfg(label int) (r1 uintptr, e1 errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0) + return +} diff --git a/vendor/golang.org/x/sys/unix/affinity_linux.go b/vendor/golang.org/x/sys/unix/affinity_linux.go index 72afe333..14e4d5ca 100644 --- a/vendor/golang.org/x/sys/unix/affinity_linux.go +++ b/vendor/golang.org/x/sys/unix/affinity_linux.go @@ -91,9 +91,13 @@ func onesCount64(x uint64) int { const m0 = 0x5555555555555555 // 01010101 ... const m1 = 0x3333333333333333 // 00110011 ... const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ... - const m3 = 0x00ff00ff00ff00ff // etc. - const m4 = 0x0000ffff0000ffff + // Unused in this function, but definitions preserved for + // documentation purposes: + // + // const m3 = 0x00ff00ff00ff00ff // etc. + // const m4 = 0x0000ffff0000ffff + // // Implementation: Parallel summing of adjacent bits. // See "Hacker's Delight", Chap. 5: Counting Bits. // The following pattern shows the general approach: diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s new file mode 100644 index 00000000..6db717de --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s @@ -0,0 +1,54 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build riscv64,!gccgo + +#include "textflag.h" + +// +// System calls for linux/riscv64. +// +// Where available, just jump to package syscall's implementation of +// these functions. + +TEXT ·Syscall(SB),NOSPLIT,$0-56 + JMP syscall·Syscall(SB) + +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + JMP syscall·Syscall6(SB) + +TEXT ·SyscallNoError(SB),NOSPLIT,$0-48 + CALL runtime·entersyscall(SB) + MOV a1+8(FP), A0 + MOV a2+16(FP), A1 + MOV a3+24(FP), A2 + MOV $0, A3 + MOV $0, A4 + MOV $0, A5 + MOV $0, A6 + MOV trap+0(FP), A7 // syscall entry + ECALL + MOV A0, r1+32(FP) // r1 + MOV A1, r2+40(FP) // r2 + CALL runtime·exitsyscall(SB) + RET + +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + JMP syscall·RawSyscall(SB) + +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + JMP syscall·RawSyscall6(SB) + +TEXT ·RawSyscallNoError(SB),NOSPLIT,$0-48 + MOV a1+8(FP), A0 + MOV a2+16(FP), A1 + MOV a3+24(FP), A2 + MOV ZERO, A3 + MOV ZERO, A4 + MOV ZERO, A5 + MOV trap+0(FP), A7 // syscall entry + ECALL + MOV A0, r1+32(FP) + MOV A1, r2+40(FP) + RET diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s new file mode 100644 index 00000000..0cedea3d --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s @@ -0,0 +1,29 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !gccgo + +#include "textflag.h" + +// +// System call support for arm64, OpenBSD +// + +// Just jump to package syscall's implementation for all these functions. +// The runtime may know about them. + +TEXT ·Syscall(SB),NOSPLIT,$0-56 + JMP syscall·Syscall(SB) + +TEXT ·Syscall6(SB),NOSPLIT,$0-80 + JMP syscall·Syscall6(SB) + +TEXT ·Syscall9(SB),NOSPLIT,$0-104 + JMP syscall·Syscall9(SB) + +TEXT ·RawSyscall(SB),NOSPLIT,$0-56 + JMP syscall·RawSyscall(SB) + +TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 + JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index 4407c505..304016b6 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -2,16 +2,101 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix -import "syscall" +import "unsafe" + +// readInt returns the size-bytes unsigned integer in native byte order at offset off. +func readInt(b []byte, off, size uintptr) (u uint64, ok bool) { + if len(b) < int(off+size) { + return 0, false + } + if isBigEndian { + return readIntBE(b[off:], size), true + } + return readIntLE(b[off:], size), true +} + +func readIntBE(b []byte, size uintptr) uint64 { + switch size { + case 1: + return uint64(b[0]) + case 2: + _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[1]) | uint64(b[0])<<8 + case 4: + _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[3]) | uint64(b[2])<<8 | uint64(b[1])<<16 | uint64(b[0])<<24 + case 8: + _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | + uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 + default: + panic("syscall: readInt with unsupported size") + } +} + +func readIntLE(b []byte, size uintptr) uint64 { + switch size { + case 1: + return uint64(b[0]) + case 2: + _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[0]) | uint64(b[1])<<8 + case 4: + _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 + case 8: + _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 + default: + panic("syscall: readInt with unsupported size") + } +} // ParseDirent parses up to max directory entries in buf, // appending the names to names. It returns the number of // bytes consumed from buf, the number of entries added // to names, and the new names slice. func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { - return syscall.ParseDirent(buf, max, names) + origlen := len(buf) + count = 0 + for max != 0 && len(buf) > 0 { + reclen, ok := direntReclen(buf) + if !ok || reclen > uint64(len(buf)) { + return origlen, count, names + } + rec := buf[:reclen] + buf = buf[reclen:] + ino, ok := direntIno(rec) + if !ok { + break + } + if ino == 0 { // File absent in directory. + continue + } + const namoff = uint64(unsafe.Offsetof(Dirent{}.Name)) + namlen, ok := direntNamlen(rec) + if !ok || namoff+namlen > uint64(len(rec)) { + break + } + name := rec[namoff : namoff+namlen] + for i, c := range name { + if c == 0 { + name = name[:i] + break + } + } + // Check for useless names before allocating a string. + if string(name) == "." || string(name) == ".." { + continue + } + max-- + count++ + names = append(names, string(name)) + } + return origlen - len(buf), count, names } diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go index 085df2d8..bcdb5d30 100644 --- a/vendor/golang.org/x/sys/unix/endian_little.go +++ b/vendor/golang.org/x/sys/unix/endian_little.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // -// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le +// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64 package unix diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index 1e5c59d0..5a22eca9 100644 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -105,25 +105,25 @@ dragonfly_amd64) freebsd_386) mkerrors="$mkerrors -m32" mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_amd64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; freebsd_arm) mkerrors="$mkerrors" mksyscall="go run mksyscall.go -l32 -arm" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; freebsd_arm64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'" + mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; netbsd_386) @@ -146,24 +146,39 @@ netbsd_arm) # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; +netbsd_arm64) + mkerrors="$mkerrors -m64" + mksyscall="go run mksyscall.go -netbsd" + mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'" + mktypes="GOARCH=$GOARCH go tool cgo -godefs" + ;; openbsd_386) mkerrors="$mkerrors -m32" mksyscall="go run mksyscall.go -l32 -openbsd" - mksysctl="./mksysctl_openbsd.pl" + mksysctl="go run mksysctl_openbsd.go" mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_amd64) mkerrors="$mkerrors -m64" mksyscall="go run mksyscall.go -openbsd" - mksysctl="./mksysctl_openbsd.pl" + mksysctl="go run mksysctl_openbsd.go" mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; openbsd_arm) mkerrors="$mkerrors" mksyscall="go run mksyscall.go -l32 -openbsd -arm" - mksysctl="./mksysctl_openbsd.pl" + mksysctl="go run mksysctl_openbsd.go" + mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + # Let the type of C char be signed for making the bare syscall + # API consistent across platforms. + mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + ;; +openbsd_arm64) + mkerrors="$mkerrors -m64" + mksyscall="go run mksyscall.go -openbsd" + mksysctl="go run mksysctl_openbsd.go" mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" # Let the type of C char be signed for making the bare syscall # API consistent across platforms. diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index cfb61ba0..14624b95 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -182,6 +182,8 @@ struct ltchars { #include #include #include +#include +#include #include #include #include @@ -197,6 +199,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -222,6 +225,7 @@ struct ltchars { #include #include #include +#include #include #include @@ -432,7 +436,9 @@ ccflags="$@" $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || - $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || + $2 ~ /^LO_(KEY|NAME)_SIZE$/ || + $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || + $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || $2 ~ /^TP_STATUS_/ || $2 ~ /^FALLOC_/ || $2 == "ICMPV6_FILTER" || @@ -465,7 +471,7 @@ ccflags="$@" $2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|LOCKS|MEMLOCK|MSGQUEUE|NICE|NOFILE|NPROC|RSS|RTPRIO|RTTIME|SIGPENDING|STACK)|RLIM_INFINITY/ || $2 ~ /^PRIO_(PROCESS|PGRP|USER)/ || $2 ~ /^CLONE_[A-Z_]+/ || - $2 !~ /^(BPF_TIMEVAL)$/ && + $2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ && $2 ~ /^(BPF|DLT)_/ || $2 ~ /^(CLOCK|TIMER)_/ || $2 ~ /^CAN_/ || @@ -499,6 +505,7 @@ ccflags="$@" $2 ~ /^NFN/ || $2 ~ /^XDP_/ || $2 ~ /^(HDIO|WIN|SMART)_/ || + $2 ~ /^CRYPTO_/ || $2 !~ "WMESGLEN" && $2 ~ /^W[A-Z0-9]+$/ || $2 ~/^PPPIOC/ || diff --git a/vendor/golang.org/x/sys/unix/mkpost.go b/vendor/golang.org/x/sys/unix/mkpost.go index 9feddd00..eb433205 100644 --- a/vendor/golang.org/x/sys/unix/mkpost.go +++ b/vendor/golang.org/x/sys/unix/mkpost.go @@ -42,9 +42,16 @@ func main() { log.Fatal(err) } + if goos == "aix" { + // Replace type of Atim, Mtim and Ctim by Timespec in Stat_t + // to avoid having both StTimespec and Timespec. + sttimespec := regexp.MustCompile(`_Ctype_struct_st_timespec`) + b = sttimespec.ReplaceAll(b, []byte("Timespec")) + } + // Intentionally export __val fields in Fsid and Sigset_t - valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__val(\s+\S+\s+)}`) - b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$3}")) + valRegex := regexp.MustCompile(`type (Fsid|Sigset_t) struct {(\s+)X__(bits|val)(\s+\S+\s+)}`) + b = valRegex.ReplaceAll(b, []byte("type $1 struct {${2}Val$4}")) // Intentionally export __fds_bits field in FdSet fdSetRegex := regexp.MustCompile(`type (FdSet) struct {(\s+)X__fds_bits(\s+\S+\s+)}`) @@ -96,6 +103,15 @@ func main() { cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`) b = cgoCommandRegex.ReplaceAll(b, []byte(replacement)) + // Rename Stat_t time fields + if goos == "freebsd" && goarch == "386" { + // Hide Stat_t.[AMCB]tim_ext fields + renameStatTimeExtFieldsRegex := regexp.MustCompile(`[AMCB]tim_ext`) + b = renameStatTimeExtFieldsRegex.ReplaceAll(b, []byte("_")) + } + renameStatTimeFieldsRegex := regexp.MustCompile(`([AMCB])(?:irth)?time?(?:spec)?\s+(Timespec|StTimespec)`) + b = renameStatTimeFieldsRegex.ReplaceAll(b, []byte("${1}tim ${2}")) + // gofmt b, err = format.Source(b) if err != nil { diff --git a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go index f2c58fb7..3be3cdfc 100644 --- a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go @@ -214,6 +214,11 @@ func main() { } if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" { + if sysname == "select" { + // select is a keyword of Go. Its name is + // changed to c_select. + cExtern += "#define c_select select\n" + } // Imports of system calls from libc cExtern += fmt.Sprintf("%s %s", cRettype, sysname) cIn := strings.Join(cIn, ", ") @@ -328,7 +333,13 @@ func main() { } else { call += "" } - call += fmt.Sprintf("C.%s(%s)", sysname, arglist) + if sysname == "select" { + // select is a keyword of Go. Its name is + // changed to c_select. + call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist) + } else { + call += fmt.Sprintf("C.%s(%s)", sysname, arglist) + } // Assign return values. body := "" diff --git a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go index 45b44290..c9600995 100644 --- a/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go @@ -282,6 +282,11 @@ func main() { if !onlyCommon { // GCCGO Prototype Generation // Imports of system calls from libc + if sysname == "select" { + // select is a keyword of Go. Its name is + // changed to c_select. + cExtern += "#define c_select select\n" + } cExtern += fmt.Sprintf("%s %s", cRettype, sysname) cIn := strings.Join(cIn, ", ") cExtern += fmt.Sprintf("(%s);\n", cIn) @@ -490,7 +495,14 @@ func main() { // GCCGO function generation argsgccgolist := strings.Join(argsgccgo, ", ") - callgccgo := fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist) + var callgccgo string + if sysname == "select" { + // select is a keyword of Go. Its name is + // changed to c_select. + callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist) + } else { + callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist) + } textgccgo += callProto textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo) textgccgo += "\te1 = syscall.GetErrno()\n" diff --git a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.go b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.go new file mode 100644 index 00000000..b6b40990 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.go @@ -0,0 +1,355 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ignore + +// Parse the header files for OpenBSD and generate a Go usable sysctl MIB. +// +// Build a MIB with each entry being an array containing the level, type and +// a hash that will contain additional entries if the current entry is a node. +// We then walk this MIB and create a flattened sysctl name to OID hash. + +package main + +import ( + "bufio" + "fmt" + "os" + "path/filepath" + "regexp" + "sort" + "strings" +) + +var ( + goos, goarch string +) + +// cmdLine returns this programs's commandline arguments. +func cmdLine() string { + return "go run mksysctl_openbsd.go " + strings.Join(os.Args[1:], " ") +} + +// buildTags returns build tags. +func buildTags() string { + return fmt.Sprintf("%s,%s", goarch, goos) +} + +// reMatch performs regular expression match and stores the substring slice to value pointed by m. +func reMatch(re *regexp.Regexp, str string, m *[]string) bool { + *m = re.FindStringSubmatch(str) + if *m != nil { + return true + } + return false +} + +type nodeElement struct { + n int + t string + pE *map[string]nodeElement +} + +var ( + debugEnabled bool + mib map[string]nodeElement + node *map[string]nodeElement + nodeMap map[string]string + sysCtl []string +) + +var ( + ctlNames1RE = regexp.MustCompile(`^#define\s+(CTL_NAMES)\s+{`) + ctlNames2RE = regexp.MustCompile(`^#define\s+(CTL_(.*)_NAMES)\s+{`) + ctlNames3RE = regexp.MustCompile(`^#define\s+((.*)CTL_NAMES)\s+{`) + netInetRE = regexp.MustCompile(`^netinet/`) + netInet6RE = regexp.MustCompile(`^netinet6/`) + netRE = regexp.MustCompile(`^net/`) + bracesRE = regexp.MustCompile(`{.*}`) + ctlTypeRE = regexp.MustCompile(`{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}`) + fsNetKernRE = regexp.MustCompile(`^(fs|net|kern)_`) +) + +func debug(s string) { + if debugEnabled { + fmt.Fprintln(os.Stderr, s) + } +} + +// Walk the MIB and build a sysctl name to OID mapping. +func buildSysctl(pNode *map[string]nodeElement, name string, oid []int) { + lNode := pNode // local copy of pointer to node + var keys []string + for k := range *lNode { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, key := range keys { + nodename := name + if name != "" { + nodename += "." + } + nodename += key + + nodeoid := append(oid, (*pNode)[key].n) + + if (*pNode)[key].t == `CTLTYPE_NODE` { + if _, ok := nodeMap[nodename]; ok { + lNode = &mib + ctlName := nodeMap[nodename] + for _, part := range strings.Split(ctlName, ".") { + lNode = ((*lNode)[part]).pE + } + } else { + lNode = (*pNode)[key].pE + } + buildSysctl(lNode, nodename, nodeoid) + } else if (*pNode)[key].t != "" { + oidStr := []string{} + for j := range nodeoid { + oidStr = append(oidStr, fmt.Sprintf("%d", nodeoid[j])) + } + text := "\t{ \"" + nodename + "\", []_C_int{ " + strings.Join(oidStr, ", ") + " } }, \n" + sysCtl = append(sysCtl, text) + } + } +} + +func main() { + // Get the OS (using GOOS_TARGET if it exist) + goos = os.Getenv("GOOS_TARGET") + if goos == "" { + goos = os.Getenv("GOOS") + } + // Get the architecture (using GOARCH_TARGET if it exists) + goarch = os.Getenv("GOARCH_TARGET") + if goarch == "" { + goarch = os.Getenv("GOARCH") + } + // Check if GOOS and GOARCH environment variables are defined + if goarch == "" || goos == "" { + fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n") + os.Exit(1) + } + + mib = make(map[string]nodeElement) + headers := [...]string{ + `sys/sysctl.h`, + `sys/socket.h`, + `sys/tty.h`, + `sys/malloc.h`, + `sys/mount.h`, + `sys/namei.h`, + `sys/sem.h`, + `sys/shm.h`, + `sys/vmmeter.h`, + `uvm/uvmexp.h`, + `uvm/uvm_param.h`, + `uvm/uvm_swap_encrypt.h`, + `ddb/db_var.h`, + `net/if.h`, + `net/if_pfsync.h`, + `net/pipex.h`, + `netinet/in.h`, + `netinet/icmp_var.h`, + `netinet/igmp_var.h`, + `netinet/ip_ah.h`, + `netinet/ip_carp.h`, + `netinet/ip_divert.h`, + `netinet/ip_esp.h`, + `netinet/ip_ether.h`, + `netinet/ip_gre.h`, + `netinet/ip_ipcomp.h`, + `netinet/ip_ipip.h`, + `netinet/pim_var.h`, + `netinet/tcp_var.h`, + `netinet/udp_var.h`, + `netinet6/in6.h`, + `netinet6/ip6_divert.h`, + `netinet6/pim6_var.h`, + `netinet/icmp6.h`, + `netmpls/mpls.h`, + } + + ctls := [...]string{ + `kern`, + `vm`, + `fs`, + `net`, + //debug /* Special handling required */ + `hw`, + //machdep /* Arch specific */ + `user`, + `ddb`, + //vfs /* Special handling required */ + `fs.posix`, + `kern.forkstat`, + `kern.intrcnt`, + `kern.malloc`, + `kern.nchstats`, + `kern.seminfo`, + `kern.shminfo`, + `kern.timecounter`, + `kern.tty`, + `kern.watchdog`, + `net.bpf`, + `net.ifq`, + `net.inet`, + `net.inet.ah`, + `net.inet.carp`, + `net.inet.divert`, + `net.inet.esp`, + `net.inet.etherip`, + `net.inet.gre`, + `net.inet.icmp`, + `net.inet.igmp`, + `net.inet.ip`, + `net.inet.ip.ifq`, + `net.inet.ipcomp`, + `net.inet.ipip`, + `net.inet.mobileip`, + `net.inet.pfsync`, + `net.inet.pim`, + `net.inet.tcp`, + `net.inet.udp`, + `net.inet6`, + `net.inet6.divert`, + `net.inet6.ip6`, + `net.inet6.icmp6`, + `net.inet6.pim6`, + `net.inet6.tcp6`, + `net.inet6.udp6`, + `net.mpls`, + `net.mpls.ifq`, + `net.key`, + `net.pflow`, + `net.pfsync`, + `net.pipex`, + `net.rt`, + `vm.swapencrypt`, + //vfsgenctl /* Special handling required */ + } + + // Node name "fixups" + ctlMap := map[string]string{ + "ipproto": "net.inet", + "net.inet.ipproto": "net.inet", + "net.inet6.ipv6proto": "net.inet6", + "net.inet6.ipv6": "net.inet6.ip6", + "net.inet.icmpv6": "net.inet6.icmp6", + "net.inet6.divert6": "net.inet6.divert", + "net.inet6.tcp6": "net.inet.tcp", + "net.inet6.udp6": "net.inet.udp", + "mpls": "net.mpls", + "swpenc": "vm.swapencrypt", + } + + // Node mappings + nodeMap = map[string]string{ + "net.inet.ip.ifq": "net.ifq", + "net.inet.pfsync": "net.pfsync", + "net.mpls.ifq": "net.ifq", + } + + mCtls := make(map[string]bool) + for _, ctl := range ctls { + mCtls[ctl] = true + } + + for _, header := range headers { + debug("Processing " + header) + file, err := os.Open(filepath.Join("/usr/include", header)) + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + os.Exit(1) + } + s := bufio.NewScanner(file) + for s.Scan() { + var sub []string + if reMatch(ctlNames1RE, s.Text(), &sub) || + reMatch(ctlNames2RE, s.Text(), &sub) || + reMatch(ctlNames3RE, s.Text(), &sub) { + if sub[1] == `CTL_NAMES` { + // Top level. + node = &mib + } else { + // Node. + nodename := strings.ToLower(sub[2]) + ctlName := "" + if reMatch(netInetRE, header, &sub) { + ctlName = "net.inet." + nodename + } else if reMatch(netInet6RE, header, &sub) { + ctlName = "net.inet6." + nodename + } else if reMatch(netRE, header, &sub) { + ctlName = "net." + nodename + } else { + ctlName = nodename + ctlName = fsNetKernRE.ReplaceAllString(ctlName, `$1.`) + } + + if val, ok := ctlMap[ctlName]; ok { + ctlName = val + } + if _, ok := mCtls[ctlName]; !ok { + debug("Ignoring " + ctlName + "...") + continue + } + + // Walk down from the top of the MIB. + node = &mib + for _, part := range strings.Split(ctlName, ".") { + if _, ok := (*node)[part]; !ok { + debug("Missing node " + part) + (*node)[part] = nodeElement{n: 0, t: "", pE: &map[string]nodeElement{}} + } + node = (*node)[part].pE + } + } + + // Populate current node with entries. + i := -1 + for !strings.HasPrefix(s.Text(), "}") { + s.Scan() + if reMatch(bracesRE, s.Text(), &sub) { + i++ + } + if !reMatch(ctlTypeRE, s.Text(), &sub) { + continue + } + (*node)[sub[1]] = nodeElement{n: i, t: sub[2], pE: &map[string]nodeElement{}} + } + } + } + err = s.Err() + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + os.Exit(1) + } + file.Close() + } + buildSysctl(&mib, "", []int{}) + + sort.Strings(sysCtl) + text := strings.Join(sysCtl, "") + + fmt.Printf(srcTemplate, cmdLine(), buildTags(), text) +} + +const srcTemplate = `// %s +// Code generated by the command above; DO NOT EDIT. + +// +build %s + +package unix + +type mibentry struct { + ctlname string + ctloid []_C_int +} + +var sysctlMib = []mibentry { +%s +} +` diff --git a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl b/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl deleted file mode 100644 index 20632e14..00000000 --- a/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl +++ /dev/null @@ -1,265 +0,0 @@ -#!/usr/bin/env perl - -# Copyright 2011 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# -# Parse the header files for OpenBSD and generate a Go usable sysctl MIB. -# -# Build a MIB with each entry being an array containing the level, type and -# a hash that will contain additional entries if the current entry is a node. -# We then walk this MIB and create a flattened sysctl name to OID hash. -# - -use strict; - -if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { - print STDERR "GOARCH or GOOS not defined in environment\n"; - exit 1; -} - -my $debug = 0; -my %ctls = (); - -my @headers = qw ( - sys/sysctl.h - sys/socket.h - sys/tty.h - sys/malloc.h - sys/mount.h - sys/namei.h - sys/sem.h - sys/shm.h - sys/vmmeter.h - uvm/uvmexp.h - uvm/uvm_param.h - uvm/uvm_swap_encrypt.h - ddb/db_var.h - net/if.h - net/if_pfsync.h - net/pipex.h - netinet/in.h - netinet/icmp_var.h - netinet/igmp_var.h - netinet/ip_ah.h - netinet/ip_carp.h - netinet/ip_divert.h - netinet/ip_esp.h - netinet/ip_ether.h - netinet/ip_gre.h - netinet/ip_ipcomp.h - netinet/ip_ipip.h - netinet/pim_var.h - netinet/tcp_var.h - netinet/udp_var.h - netinet6/in6.h - netinet6/ip6_divert.h - netinet6/pim6_var.h - netinet/icmp6.h - netmpls/mpls.h -); - -my @ctls = qw ( - kern - vm - fs - net - #debug # Special handling required - hw - #machdep # Arch specific - user - ddb - #vfs # Special handling required - fs.posix - kern.forkstat - kern.intrcnt - kern.malloc - kern.nchstats - kern.seminfo - kern.shminfo - kern.timecounter - kern.tty - kern.watchdog - net.bpf - net.ifq - net.inet - net.inet.ah - net.inet.carp - net.inet.divert - net.inet.esp - net.inet.etherip - net.inet.gre - net.inet.icmp - net.inet.igmp - net.inet.ip - net.inet.ip.ifq - net.inet.ipcomp - net.inet.ipip - net.inet.mobileip - net.inet.pfsync - net.inet.pim - net.inet.tcp - net.inet.udp - net.inet6 - net.inet6.divert - net.inet6.ip6 - net.inet6.icmp6 - net.inet6.pim6 - net.inet6.tcp6 - net.inet6.udp6 - net.mpls - net.mpls.ifq - net.key - net.pflow - net.pfsync - net.pipex - net.rt - vm.swapencrypt - #vfsgenctl # Special handling required -); - -# Node name "fixups" -my %ctl_map = ( - "ipproto" => "net.inet", - "net.inet.ipproto" => "net.inet", - "net.inet6.ipv6proto" => "net.inet6", - "net.inet6.ipv6" => "net.inet6.ip6", - "net.inet.icmpv6" => "net.inet6.icmp6", - "net.inet6.divert6" => "net.inet6.divert", - "net.inet6.tcp6" => "net.inet.tcp", - "net.inet6.udp6" => "net.inet.udp", - "mpls" => "net.mpls", - "swpenc" => "vm.swapencrypt" -); - -# Node mappings -my %node_map = ( - "net.inet.ip.ifq" => "net.ifq", - "net.inet.pfsync" => "net.pfsync", - "net.mpls.ifq" => "net.ifq" -); - -my $ctlname; -my %mib = (); -my %sysctl = (); -my $node; - -sub debug() { - print STDERR "$_[0]\n" if $debug; -} - -# Walk the MIB and build a sysctl name to OID mapping. -sub build_sysctl() { - my ($node, $name, $oid) = @_; - my %node = %{$node}; - my @oid = @{$oid}; - - foreach my $key (sort keys %node) { - my @node = @{$node{$key}}; - my $nodename = $name.($name ne '' ? '.' : '').$key; - my @nodeoid = (@oid, $node[0]); - if ($node[1] eq 'CTLTYPE_NODE') { - if (exists $node_map{$nodename}) { - $node = \%mib; - $ctlname = $node_map{$nodename}; - foreach my $part (split /\./, $ctlname) { - $node = \%{@{$$node{$part}}[2]}; - } - } else { - $node = $node[2]; - } - &build_sysctl($node, $nodename, \@nodeoid); - } elsif ($node[1] ne '') { - $sysctl{$nodename} = \@nodeoid; - } - } -} - -foreach my $ctl (@ctls) { - $ctls{$ctl} = $ctl; -} - -# Build MIB -foreach my $header (@headers) { - &debug("Processing $header..."); - open HEADER, "/usr/include/$header" || - print STDERR "Failed to open $header\n"; - while (
) { - if ($_ =~ /^#define\s+(CTL_NAMES)\s+{/ || - $_ =~ /^#define\s+(CTL_(.*)_NAMES)\s+{/ || - $_ =~ /^#define\s+((.*)CTL_NAMES)\s+{/) { - if ($1 eq 'CTL_NAMES') { - # Top level. - $node = \%mib; - } else { - # Node. - my $nodename = lc($2); - if ($header =~ /^netinet\//) { - $ctlname = "net.inet.$nodename"; - } elsif ($header =~ /^netinet6\//) { - $ctlname = "net.inet6.$nodename"; - } elsif ($header =~ /^net\//) { - $ctlname = "net.$nodename"; - } else { - $ctlname = "$nodename"; - $ctlname =~ s/^(fs|net|kern)_/$1\./; - } - if (exists $ctl_map{$ctlname}) { - $ctlname = $ctl_map{$ctlname}; - } - if (not exists $ctls{$ctlname}) { - &debug("Ignoring $ctlname..."); - next; - } - - # Walk down from the top of the MIB. - $node = \%mib; - foreach my $part (split /\./, $ctlname) { - if (not exists $$node{$part}) { - &debug("Missing node $part"); - $$node{$part} = [ 0, '', {} ]; - } - $node = \%{@{$$node{$part}}[2]}; - } - } - - # Populate current node with entries. - my $i = -1; - while (defined($_) && $_ !~ /^}/) { - $_ =
; - $i++ if $_ =~ /{.*}/; - next if $_ !~ /{\s+"(\w+)",\s+(CTLTYPE_[A-Z]+)\s+}/; - $$node{$1} = [ $i, $2, {} ]; - } - } - } - close HEADER; -} - -&build_sysctl(\%mib, "", []); - -print <>= 32 + stat.Mtim.Nsec >>= 32 + stat.Ctim.Nsec >>= 32 +} + +func Fstat(fd int, stat *Stat_t) error { + err := fstat(fd, stat) + if err != nil { + return err + } + fixStatTimFields(stat) + return nil +} + +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) error { + err := fstatat(dirfd, path, stat, flags) + if err != nil { + return err + } + fixStatTimFields(stat) + return nil +} + +func Lstat(path string, stat *Stat_t) error { + err := lstat(path, stat) + if err != nil { + return err + } + fixStatTimFields(stat) + return nil +} + +func Stat(path string, statptr *Stat_t) error { + err := stat(path, statptr) + if err != nil { + return err + } + fixStatTimFields(statptr) + return nil +} diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 33c8b5f0..97a8eef6 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -63,15 +63,6 @@ func Setgroups(gids []int) (err error) { return setgroups(len(a), &a[0]) } -func ReadDirent(fd int, buf []byte) (n int, err error) { - // Final argument is (basep *uintptr) and the syscall doesn't take nil. - // 64 bits should be enough. (32 bits isn't even on 386). Since the - // actual system call is getdirentries64, 64 is a good guess. - // TODO(rsc): Can we use a single global basep for all calls? - var base = (*uintptr)(unsafe.Pointer(new(uint64))) - return Getdirentries(fd, buf, base) -} - // Wait status is 7 bits at bottom, either 0 (exited), // 0x7F (stopped), or a signal number that caused an exit. // The 0x80 bit is whether there was a core dump. @@ -86,6 +77,7 @@ const ( shift = 8 exited = 0 + killed = 9 stopped = 0x7F ) @@ -112,6 +104,8 @@ func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 } func (w WaitStatus) Stopped() bool { return w&mask == stopped && syscall.Signal(w>>shift) != SIGSTOP } +func (w WaitStatus) Killed() bool { return w&mask == killed && syscall.Signal(w>>shift) != SIGKILL } + func (w WaitStatus) Continued() bool { return w&mask == stopped && syscall.Signal(w>>shift) == SIGSTOP } func (w WaitStatus) StopSignal() syscall.Signal { diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 21200918..216b4ac9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -77,6 +77,18 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) +} + //sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 962eee30..260a400f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -57,6 +57,22 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) +} + +func direntReclen(buf []byte) (uint64, bool) { + namlen, ok := direntNamlen(buf) + if !ok { + return 0, false + } + return (16 + namlen + 1 + 7) &^ 7, true +} + +func direntNamlen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) +} + //sysnb pipe() (r int, w int, err error) func Pipe(p []int) (err error) { @@ -269,6 +285,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Fstatfs(fd int, stat *Statfs_t) (err error) //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) +//sys Getdents(fd int, buf []byte) (n int, err error) //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) //sys Getdtablesize() (size int) //sysnb Getegid() (egid int) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index a7ca1ebe..329d240b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -82,6 +82,18 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) +} + func Pipe(p []int) (err error) { return Pipe2(p, 0) } @@ -362,7 +374,21 @@ func Getdents(fd int, buf []byte) (n int, err error) { func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { if supportsABI(_ino64First) { - return getdirentries_freebsd12(fd, buf, basep) + if basep == nil || unsafe.Sizeof(*basep) == 8 { + return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep))) + } + // The freebsd12 syscall needs a 64-bit base. On 32-bit machines + // we can't just use the basep passed in. See #32498. + var base uint64 = uint64(*basep) + n, err = getdirentries_freebsd12(fd, buf, &base) + *basep = uintptr(base) + if base>>32 != 0 { + // We can't stuff the base back into a uintptr, so any + // future calls would be suspect. Generate an error. + // EIO is allowed by getdirentries. + err = EIO + } + return } // The old syscall entries are smaller than the new. Use 1/4 of the original @@ -404,22 +430,22 @@ func roundup(x, y int) int { func (s *Stat_t) convertFrom(old *stat_freebsd11_t) { *s = Stat_t{ - Dev: uint64(old.Dev), - Ino: uint64(old.Ino), - Nlink: uint64(old.Nlink), - Mode: old.Mode, - Uid: old.Uid, - Gid: old.Gid, - Rdev: uint64(old.Rdev), - Atim: old.Atim, - Mtim: old.Mtim, - Ctim: old.Ctim, - Birthtim: old.Birthtim, - Size: old.Size, - Blocks: old.Blocks, - Blksize: old.Blksize, - Flags: old.Flags, - Gen: uint64(old.Gen), + Dev: uint64(old.Dev), + Ino: uint64(old.Ino), + Nlink: uint64(old.Nlink), + Mode: old.Mode, + Uid: old.Uid, + Gid: old.Gid, + Rdev: uint64(old.Rdev), + Atim: old.Atim, + Mtim: old.Mtim, + Ctim: old.Ctim, + Btim: old.Btim, + Size: old.Size, + Blocks: old.Blocks, + Blksize: old.Blksize, + Flags: old.Flags, + Gen: uint64(old.Gen), } } @@ -507,6 +533,70 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e return sendfile(outfd, infd, offset, count) } +//sys ptrace(request int, pid int, addr uintptr, data int) (err error) + +func PtraceAttach(pid int) (err error) { + return ptrace(PTRACE_ATTACH, pid, 0, 0) +} + +func PtraceCont(pid int, signal int) (err error) { + return ptrace(PTRACE_CONT, pid, 1, signal) +} + +func PtraceDetach(pid int) (err error) { + return ptrace(PTRACE_DETACH, pid, 1, 0) +} + +func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) { + return ptrace(PTRACE_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0) +} + +func PtraceGetFsBase(pid int, fsbase *int64) (err error) { + return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0) +} + +func PtraceGetRegs(pid int, regsout *Reg) (err error) { + return ptrace(PTRACE_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0) +} + +func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) { + ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint(countin)} + err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0) + return int(ioDesc.Len), err +} + +func PtraceLwpEvents(pid int, enable int) (err error) { + return ptrace(PTRACE_LWPEVENTS, pid, 0, enable) +} + +func PtraceLwpInfo(pid int, info uintptr) (err error) { + return ptrace(PTRACE_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{}))) +} + +func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) { + return PtraceIO(PIOD_READ_D, pid, addr, out, SizeofLong) +} + +func PtracePeekText(pid int, addr uintptr, out []byte) (count int, err error) { + return PtraceIO(PIOD_READ_I, pid, addr, out, SizeofLong) +} + +func PtracePokeData(pid int, addr uintptr, data []byte) (count int, err error) { + return PtraceIO(PIOD_WRITE_D, pid, addr, data, SizeofLong) +} + +func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) { + return PtraceIO(PIOD_WRITE_I, pid, addr, data, SizeofLong) +} + +func PtraceSetRegs(pid int, regs *Reg) (err error) { + return ptrace(PTRACE_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0) +} + +func PtraceSingleStep(pid int) (err error) { + return ptrace(PTRACE_SINGLESTEP, pid, 1, 0) +} + /* * Exposed directly */ @@ -555,7 +645,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) //sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) -//sys getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) +//sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) //sys Getdtablesize() (size int) //sysnb Getegid() (egid int) //sysnb Geteuid() (uid int) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 7e429ab2..637b5017 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -13,7 +13,6 @@ package unix import ( "encoding/binary" - "net" "runtime" "syscall" "unsafe" @@ -109,6 +108,12 @@ func IoctlGetInt(fd int, req uint) (int, error) { return value, err } +func IoctlGetUint32(fd int, req uint) (uint32, error) { + var value uint32 + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return value, err +} + func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { var value Winsize err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) @@ -759,7 +764,7 @@ const px_proto_oe = 0 type SockaddrPPPoE struct { SID uint16 - Remote net.HardwareAddr + Remote []byte Dev string raw RawSockaddrPPPoX } @@ -910,7 +915,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } sa := &SockaddrPPPoE{ SID: binary.BigEndian.Uint16(pp[6:8]), - Remote: net.HardwareAddr(pp[8:14]), + Remote: pp[8:14], } for i := 14; i < 14+IFNAMSIZ; i++ { if pp[i] == 0 { @@ -1408,8 +1413,20 @@ func Reboot(cmd int) (err error) { return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "") } -func ReadDirent(fd int, buf []byte) (n int, err error) { - return Getdents(fd, buf) +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + reclen, ok := direntReclen(buf) + if !ok { + return 0, false + } + return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true } //sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) @@ -1444,6 +1461,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Acct(path string) (err error) //sys AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) //sys Adjtimex(buf *Timex) (state int, err error) +//sys Capget(hdr *CapUserHeader, data *CapUserData) (err error) +//sys Capset(hdr *CapUserHeader, data *CapUserData) (err error) //sys Chdir(path string) (err error) //sys Chroot(path string) (err error) //sys ClockGetres(clockid int32, res *Timespec) (err error) @@ -1531,9 +1550,13 @@ func Setgid(uid int) (err error) { return EOPNOTSUPP } +func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) { + return signalfd(fd, sigmask, _C__NSIG/8, flags) +} + //sys Setpriority(which int, who int, prio int) (err error) //sys Setxattr(path string, attr string, data []byte, flags int) (err error) -//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4 +//sys signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) = SYS_SIGNALFD4 //sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) //sys Sync() //sys Syncfs(fd int) (err error) @@ -1662,6 +1685,82 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { return EACCES } +//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT +//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT + +// fileHandle is the argument to nameToHandleAt and openByHandleAt. We +// originally tried to generate it via unix/linux/types.go with "type +// fileHandle C.struct_file_handle" but that generated empty structs +// for mips64 and mips64le. Instead, hard code it for now (it's the +// same everywhere else) until the mips64 generator issue is fixed. +type fileHandle struct { + Bytes uint32 + Type int32 +} + +// FileHandle represents the C struct file_handle used by +// name_to_handle_at (see NameToHandleAt) and open_by_handle_at (see +// OpenByHandleAt). +type FileHandle struct { + *fileHandle +} + +// NewFileHandle constructs a FileHandle. +func NewFileHandle(handleType int32, handle []byte) FileHandle { + const hdrSize = unsafe.Sizeof(fileHandle{}) + buf := make([]byte, hdrSize+uintptr(len(handle))) + copy(buf[hdrSize:], handle) + fh := (*fileHandle)(unsafe.Pointer(&buf[0])) + fh.Type = handleType + fh.Bytes = uint32(len(handle)) + return FileHandle{fh} +} + +func (fh *FileHandle) Size() int { return int(fh.fileHandle.Bytes) } +func (fh *FileHandle) Type() int32 { return fh.fileHandle.Type } +func (fh *FileHandle) Bytes() []byte { + n := fh.Size() + if n == 0 { + return nil + } + return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n] +} + +// NameToHandleAt wraps the name_to_handle_at system call; it obtains +// a handle for a path name. +func NameToHandleAt(dirfd int, path string, flags int) (handle FileHandle, mountID int, err error) { + var mid _C_int + // Try first with a small buffer, assuming the handle will + // only be 32 bytes. + size := uint32(32 + unsafe.Sizeof(fileHandle{})) + didResize := false + for { + buf := make([]byte, size) + fh := (*fileHandle)(unsafe.Pointer(&buf[0])) + fh.Bytes = size - uint32(unsafe.Sizeof(fileHandle{})) + err = nameToHandleAt(dirfd, path, fh, &mid, flags) + if err == EOVERFLOW { + if didResize { + // We shouldn't need to resize more than once + return + } + didResize = true + size = fh.Bytes + uint32(unsafe.Sizeof(fileHandle{})) + continue + } + if err != nil { + return + } + return FileHandle{fh}, int(mid), nil + } +} + +// OpenByHandleAt wraps the open_by_handle_at system call; it opens a +// file via a handle as previously returned by NameToHandleAt. +func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err error) { + return openByHandleAt(mountFD, handle.fileHandle, flags) +} + /* * Unimplemented */ @@ -1669,8 +1768,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { // Alarm // ArchPrctl // Brk -// Capget -// Capset // ClockNanosleep // ClockSettime // Clone diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index 3a3c37b4..f6267944 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -272,3 +272,16 @@ func SyncFileRange(fd int, off int64, n int64, flags int) error { // order of their arguments. return armSyncFileRange(fd, flags, off, n) } + +//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) + +func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { + cmdlineLen := len(cmdline) + if cmdlineLen > 0 { + // Account for the additional NULL byte added by + // BytePtrFromString in kexecFileLoad. The kexec_file_load + // syscall expects a NULL-terminated string. + cmdlineLen++ + } + return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 5240e16e..5ef30904 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -94,6 +94,18 @@ func nametomib(name string) (mib []_C_int, err error) { return mib, nil } +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) +} + func SysctlClockinfo(name string) (*Clockinfo, error) { mib, err := sysctlmib(name) if err != nil { @@ -120,9 +132,30 @@ func Pipe(p []int) (err error) { return } -//sys getdents(fd int, buf []byte) (n int, err error) +//sys Getdents(fd int, buf []byte) (n int, err error) func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return getdents(fd, buf) + n, err = Getdents(fd, buf) + if err != nil || basep == nil { + return + } + + var off int64 + off, err = Seek(fd, 0, 1 /* SEEK_CUR */) + if err != nil { + *basep = ^uintptr(0) + return + } + *basep = uintptr(off) + if unsafe.Sizeof(*basep) == 8 { + return + } + if off>>32 != 0 { + // We can't stuff the offset back into a uintptr, so any + // future calls would be suspect. Generate an error. + // EIO is allowed by getdirentries. + err = EIO + } + return } const ImplementsGetwd = true diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index c8648ec0..1a074b2f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -43,6 +43,18 @@ func nametomib(name string) (mib []_C_int, err error) { return nil, EINVAL } +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) +} + func SysctlClockinfo(name string) (*Clockinfo, error) { mib, err := sysctlmib(name) if err != nil { @@ -89,9 +101,30 @@ func Pipe(p []int) (err error) { return } -//sys getdents(fd int, buf []byte) (n int, err error) +//sys Getdents(fd int, buf []byte) (n int, err error) func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return getdents(fd, buf) + n, err = Getdents(fd, buf) + if err != nil || basep == nil { + return + } + + var off int64 + off, err = Seek(fd, 0, 1 /* SEEK_CUR */) + if err != nil { + *basep = ^uintptr(0) + return + } + *basep = uintptr(off) + if unsafe.Sizeof(*basep) == 8 { + return + } + if off>>32 != 0 { + // We can't stuff the offset back into a uintptr, so any + // future calls would be suspect. Generate an error. + // EIO was allowed by getdirentries. + err = EIO + } + return } const ImplementsGetwd = true diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go new file mode 100644 index 00000000..0fb39cf5 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go @@ -0,0 +1,37 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build arm64,openbsd + +package unix + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = int16(mode) + k.Flags = uint16(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions +// of openbsd/amd64 the syscall is called sysctl instead of __sysctl. +const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index e4780127..0153a316 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -35,6 +35,22 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +func direntIno(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) +} + +func direntReclen(buf []byte) (uint64, bool) { + return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) +} + +func direntNamlen(buf []byte) (uint64, bool) { + reclen, ok := direntReclen(buf) + if !ok { + return 0, false + } + return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true +} + //sysnb pipe(p *[2]_C_int) (n int, err error) func Pipe(p []int) (err error) { @@ -189,6 +205,7 @@ func Setgroups(gids []int) (err error) { return setgroups(len(a), &a[0]) } +// ReadDirent reads directory entries from fd and writes them into buf. func ReadDirent(fd int, buf []byte) (n int, err error) { // Final argument is (basep *uintptr) and the syscall doesn't take nil. // TODO(rsc): Can we use a single global basep for all calls? diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 0ed1d58d..3de37566 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -351,7 +351,11 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) { } func SetsockoptString(fd, level, opt int, s string) (err error) { - return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s))) + var p unsafe.Pointer + if len(s) > 0 { + p = unsafe.Pointer(&[]byte(s)[0]) + } + return setsockopt(fd, level, opt, p, uintptr(len(s))) } func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) { diff --git a/vendor/golang.org/x/sys/unix/types_aix.go b/vendor/golang.org/x/sys/unix/types_aix.go index 25e83494..40d2beed 100644 --- a/vendor/golang.org/x/sys/unix/types_aix.go +++ b/vendor/golang.org/x/sys/unix/types_aix.go @@ -87,8 +87,6 @@ type Mode_t C.mode_t type Timespec C.struct_timespec -type StTimespec C.struct_st_timespec - type Timeval C.struct_timeval type Timeval32 C.struct_timeval32 @@ -133,6 +131,8 @@ type RawSockaddrInet6 C.struct_sockaddr_in6 type RawSockaddrUnix C.struct_sockaddr_un +type RawSockaddrDatalink C.struct_sockaddr_dl + type RawSockaddr C.struct_sockaddr type RawSockaddrAny C.struct_sockaddr_any @@ -156,17 +156,18 @@ type Linger C.struct_linger type Msghdr C.struct_msghdr const ( - SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in - SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 - SizeofSockaddrAny = C.sizeof_struct_sockaddr_any - SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un - SizeofLinger = C.sizeof_struct_linger - SizeofIPMreq = C.sizeof_struct_ip_mreq - SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq - SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo - SizeofMsghdr = C.sizeof_struct_msghdr - SizeofCmsghdr = C.sizeof_struct_cmsghdr - SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter + SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in + SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 + SizeofSockaddrAny = C.sizeof_struct_sockaddr_any + SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un + SizeofSockaddrDatalink = C.sizeof_struct_sockaddr_dl + SizeofLinger = C.sizeof_struct_linger + SizeofIPMreq = C.sizeof_struct_ip_mreq + SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq + SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo + SizeofMsghdr = C.sizeof_struct_msghdr + SizeofCmsghdr = C.sizeof_struct_cmsghdr + SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter ) // Routing and interface messages diff --git a/vendor/golang.org/x/sys/unix/types_freebsd.go b/vendor/golang.org/x/sys/unix/types_freebsd.go index 74707989..a121dc33 100644 --- a/vendor/golang.org/x/sys/unix/types_freebsd.go +++ b/vendor/golang.org/x/sys/unix/types_freebsd.go @@ -243,11 +243,55 @@ const ( // Ptrace requests const ( - PTRACE_TRACEME = C.PT_TRACE_ME - PTRACE_CONT = C.PT_CONTINUE - PTRACE_KILL = C.PT_KILL + PTRACE_ATTACH = C.PT_ATTACH + PTRACE_CONT = C.PT_CONTINUE + PTRACE_DETACH = C.PT_DETACH + PTRACE_GETFPREGS = C.PT_GETFPREGS + PTRACE_GETFSBASE = C.PT_GETFSBASE + PTRACE_GETLWPLIST = C.PT_GETLWPLIST + PTRACE_GETNUMLWPS = C.PT_GETNUMLWPS + PTRACE_GETREGS = C.PT_GETREGS + PTRACE_GETXSTATE = C.PT_GETXSTATE + PTRACE_IO = C.PT_IO + PTRACE_KILL = C.PT_KILL + PTRACE_LWPEVENTS = C.PT_LWP_EVENTS + PTRACE_LWPINFO = C.PT_LWPINFO + PTRACE_SETFPREGS = C.PT_SETFPREGS + PTRACE_SETREGS = C.PT_SETREGS + PTRACE_SINGLESTEP = C.PT_STEP + PTRACE_TRACEME = C.PT_TRACE_ME ) +const ( + PIOD_READ_D = C.PIOD_READ_D + PIOD_WRITE_D = C.PIOD_WRITE_D + PIOD_READ_I = C.PIOD_READ_I + PIOD_WRITE_I = C.PIOD_WRITE_I +) + +const ( + PL_FLAG_BORN = C.PL_FLAG_BORN + PL_FLAG_EXITED = C.PL_FLAG_EXITED + PL_FLAG_SI = C.PL_FLAG_SI +) + +const ( + TRAP_BRKPT = C.TRAP_BRKPT + TRAP_TRACE = C.TRAP_TRACE +) + +type PtraceLwpInfoStruct C.struct_ptrace_lwpinfo + +type __Siginfo C.struct___siginfo + +type Sigset_t C.sigset_t + +type Reg C.struct_reg + +type FpReg C.struct_fpreg + +type PtraceIoDesc C.struct_ptrace_io_desc + // Events (kqueue, kevent) type Kevent_t C.struct_kevent_freebsd11 diff --git a/vendor/golang.org/x/sys/unix/types_netbsd.go b/vendor/golang.org/x/sys/unix/types_netbsd.go index 2dd4f954..4a96d72c 100644 --- a/vendor/golang.org/x/sys/unix/types_netbsd.go +++ b/vendor/golang.org/x/sys/unix/types_netbsd.go @@ -254,6 +254,7 @@ type Ptmget C.struct_ptmget const ( AT_FDCWD = C.AT_FDCWD + AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW ) diff --git a/vendor/golang.org/x/sys/unix/types_openbsd.go b/vendor/golang.org/x/sys/unix/types_openbsd.go index 8aafbe44..775cb57d 100644 --- a/vendor/golang.org/x/sys/unix/types_openbsd.go +++ b/vendor/golang.org/x/sys/unix/types_openbsd.go @@ -241,6 +241,7 @@ type Winsize C.struct_winsize const ( AT_FDCWD = C.AT_FDCWD + AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW ) diff --git a/vendor/golang.org/x/sys/unix/openbsd_unveil.go b/vendor/golang.org/x/sys/unix/unveil_openbsd.go similarity index 98% rename from vendor/golang.org/x/sys/unix/openbsd_unveil.go rename to vendor/golang.org/x/sys/unix/unveil_openbsd.go index aebc2dc5..168d5ae7 100644 --- a/vendor/golang.org/x/sys/unix/openbsd_unveil.go +++ b/vendor/golang.org/x/sys/unix/unveil_openbsd.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build openbsd - package unix import ( diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go index 4b7b9650..1def8a58 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go @@ -926,6 +926,8 @@ const ( TCSETSF = 0x5404 TCSETSW = 0x5403 TCXONC = 0x540b + TIMER_ABSTIME = 0x3e7 + TIMER_MAX = 0x20 TIOC = 0x5400 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go index ed04fd1b..03187dea 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go @@ -3,7 +3,7 @@ // +build ppc64,aix -// Created by cgo -godefs - DO NOT EDIT +// Code generated by cmd/cgo -godefs; DO NOT EDIT. // cgo -godefs -- -maix64 _const.go package unix @@ -926,6 +926,8 @@ const ( TCSETSF = 0x5404 TCSETSW = 0x5403 TCXONC = 0x540b + TIMER_ABSTIME = 0x3e7 + TIMER_MAX = 0x20 TIOC = 0x5400 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 9e99d67c..5213d820 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1012,6 +1149,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1052,6 +1203,15 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1487,6 +1647,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1864,6 +2025,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x80108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x80108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -1957,6 +2122,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2005,6 +2171,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2016,9 +2184,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2060,6 +2236,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2111,6 +2288,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2277,6 +2456,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x400854d5 TUNDETACHFILTER = 0x400854d6 + TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x800854db TUNGETIFF = 0x800454d2 @@ -2312,8 +2492,10 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 + UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 + UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2462,6 +2644,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index e3091f1e..39b630cc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1012,6 +1149,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1052,6 +1203,15 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1487,6 +1647,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1865,6 +2026,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x80108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x80108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -1958,6 +2123,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2006,6 +2172,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2017,9 +2185,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2061,6 +2237,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2112,6 +2289,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2278,6 +2457,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 + TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 @@ -2313,8 +2493,10 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 + UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 + UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2462,6 +2644,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index a75dfebc..c59a1beb 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1050,6 +1201,15 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1485,6 +1645,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1871,6 +2032,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x80108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x80108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -1964,6 +2129,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2012,6 +2178,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2023,9 +2191,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2067,6 +2243,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2118,6 +2295,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2284,6 +2463,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x400854d5 TUNDETACHFILTER = 0x400854d6 + TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x800854db TUNGETIFF = 0x800454d2 @@ -2319,8 +2499,10 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 + UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 + UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2468,6 +2650,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 393ad7c9..5f35c19d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -415,6 +541,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -499,6 +626,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -507,8 +635,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -522,6 +654,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -530,6 +666,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1014,6 +1151,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1053,6 +1204,15 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1488,6 +1648,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1855,6 +2016,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x80108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x80108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -1948,6 +2113,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -1996,6 +2162,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2007,9 +2175,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2052,6 +2228,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2103,6 +2280,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2269,6 +2448,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 + TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 @@ -2304,8 +2484,10 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 + UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 + UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2453,6 +2635,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index ba1beb90..7f1b7bef 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1050,6 +1201,15 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1485,6 +1645,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1864,6 +2025,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -1957,6 +2122,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2005,6 +2171,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2016,10 +2184,18 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2061,6 +2237,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2111,6 +2288,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2279,6 +2458,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x800854d5 TUNDETACHFILTER = 0x800854d6 + TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x400854db TUNGETIFF = 0x400454d2 @@ -2314,8 +2494,10 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2464,6 +2646,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index efba3e5c..603d88b8 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1050,6 +1201,15 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1485,6 +1645,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1864,6 +2025,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -1957,6 +2122,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2005,6 +2171,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2016,10 +2184,18 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2061,6 +2237,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2111,6 +2288,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2279,6 +2458,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 + TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 @@ -2314,8 +2494,10 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2464,6 +2646,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index d3f6e906..ed178f8a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1050,6 +1201,15 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1485,6 +1645,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1864,6 +2025,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -1957,6 +2122,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2005,6 +2171,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2016,10 +2184,18 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2061,6 +2237,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2111,6 +2288,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2279,6 +2458,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 + TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 @@ -2314,8 +2494,10 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2464,6 +2646,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 7275cd87..080b7893 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1050,6 +1201,15 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x40000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1485,6 +1645,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1864,6 +2025,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -1957,6 +2122,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe @@ -2005,6 +2171,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 @@ -2016,10 +2184,18 @@ const ( SO_SNDBUFFORCE = 0x1f SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x1005 SO_STYLE = 0x1008 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2061,6 +2237,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2111,6 +2288,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2279,6 +2458,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x800854d5 TUNDETACHFILTER = 0x800854d6 + TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x400854db TUNGETIFF = 0x400454d2 @@ -2314,8 +2494,10 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2464,6 +2646,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 7586a134..961e8eab 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0xff CBAUDEX = 0x0 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x3000 CREAD = 0x800 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1049,6 +1200,15 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x20000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 @@ -1487,6 +1647,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1922,6 +2083,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x4004667f SIOCOUTQ = 0x40047473 SIOCOUTQNSD = 0x894b @@ -2015,6 +2180,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2063,6 +2229,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 SO_RCVTIMEO = 0x12 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x12 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2074,9 +2242,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x11 SO_SNDTIMEO = 0x13 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x13 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2118,6 +2294,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2167,6 +2344,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2339,6 +2518,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 + TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 @@ -2374,8 +2554,10 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2523,6 +2705,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index b861ec78..6e0538f2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0xff CBAUDEX = 0x0 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x3000 CREAD = 0x800 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1049,6 +1200,15 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x20000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 @@ -1487,6 +1647,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1922,6 +2083,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x4004667f SIOCOUTQ = 0x40047473 SIOCOUTQNSD = 0x894b @@ -2015,6 +2180,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2063,6 +2229,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x10 SO_RCVTIMEO = 0x12 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x12 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2074,9 +2242,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x11 SO_SNDTIMEO = 0x13 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x13 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2118,6 +2294,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2167,6 +2344,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2339,6 +2518,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 + TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 @@ -2374,8 +2554,10 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2523,6 +2705,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index a321ec23..06c0148c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1050,6 +1201,15 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1485,6 +1645,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1852,6 +2013,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x80108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x80108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -1945,6 +2110,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -1993,6 +2159,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2004,9 +2172,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2048,6 +2224,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2099,6 +2276,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2265,6 +2444,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 + TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 @@ -2300,8 +2480,10 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 + UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 + UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2449,6 +2631,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index f6c99164..39875095 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -196,11 +196,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -208,8 +267,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -223,20 +290,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -264,6 +346,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -302,6 +423,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -320,6 +442,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -414,6 +540,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -497,6 +624,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -505,8 +633,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -520,6 +652,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -528,6 +664,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1011,6 +1148,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1050,6 +1201,15 @@ const ( MAP_STACK = 0x20000 MAP_SYNC = 0x80000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 @@ -1485,6 +1645,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1925,6 +2086,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x80108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x80108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -2018,6 +2183,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x33 SO_ATTACH_REUSEPORT_EBPF = 0x34 SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e SO_BPF_EXTENSIONS = 0x30 SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe @@ -2066,6 +2232,8 @@ const ( SO_RCVBUFFORCE = 0x21 SO_RCVLOWAT = 0x12 SO_RCVTIMEO = 0x14 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x14 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 @@ -2077,9 +2245,17 @@ const ( SO_SNDBUFFORCE = 0x20 SO_SNDLOWAT = 0x13 SO_SNDTIMEO = 0x15 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x15 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3d SO_TYPE = 0x3 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2121,6 +2297,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2172,6 +2349,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2338,6 +2517,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 + TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 @@ -2373,8 +2553,10 @@ const ( UBI_IOCMKVOL = 0x40986f00 UBI_IOCRMVOL = 0x40046f01 UBI_IOCRNVOL = 0x51106f03 + UBI_IOCRPEB = 0x40046f04 UBI_IOCRSVOL = 0x400c6f02 UBI_IOCSETVOLPROP = 0x40104f06 + UBI_IOCSPEB = 0x40046f05 UBI_IOCVOLCRBLK = 0x40804f07 UBI_IOCVOLRMBLK = 0x4f08 UBI_IOCVOLUP = 0x40084f00 @@ -2522,6 +2704,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index c1e95e29..8d80f99b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -199,11 +199,70 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 + BPF_ALU64 = 0x7 BPF_AND = 0x50 + BPF_ANY = 0x0 + BPF_ARSH = 0xc0 BPF_B = 0x10 + BPF_BUILD_ID_SIZE = 0x14 + BPF_CALL = 0x80 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 BPF_DIV = 0x30 + BPF_DW = 0x18 + BPF_END = 0xd0 + BPF_EXIST = 0x2 + BPF_EXIT = 0x90 + BPF_FROM_BE = 0x8 + BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ALLOW_MULTI = 0x2 + BPF_F_ALLOW_OVERRIDE = 0x1 + BPF_F_ANY_ALIGNMENT = 0x2 + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CURRENT_NETNS = -0x1 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_INGRESS = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NUMA_NODE = 0x4 + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_QUERY_EFFECTIVE = 0x1 + BPF_F_RDONLY = 0x8 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_STRICT_ALIGNMENT = 0x1 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_USER_STACK = 0x100 + BPF_F_WRONLY = 0x10 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -211,8 +270,16 @@ const ( BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 + BPF_JLE = 0xb0 + BPF_JLT = 0xa0 BPF_JMP = 0x5 + BPF_JMP32 = 0x6 + BPF_JNE = 0x50 BPF_JSET = 0x40 + BPF_JSGE = 0x70 + BPF_JSGT = 0x60 + BPF_JSLE = 0xd0 + BPF_JSLT = 0xc0 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 @@ -226,20 +293,35 @@ const ( BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MOD = 0x90 + BPF_MOV = 0xb0 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_NET_OFF = -0x100000 + BPF_NOEXIST = 0x1 + BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 + BPF_TAG_SIZE = 0x8 BPF_TAX = 0x0 + BPF_TO_BE = 0x8 + BPF_TO_LE = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XADD = 0xc0 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 @@ -267,6 +349,45 @@ const ( CAN_SFF_MASK = 0x7ff CAN_TP16 = 0x3 CAN_TP20 = 0x4 + CAP_AUDIT_CONTROL = 0x1e + CAP_AUDIT_READ = 0x25 + CAP_AUDIT_WRITE = 0x1d + CAP_BLOCK_SUSPEND = 0x24 + CAP_CHOWN = 0x0 + CAP_DAC_OVERRIDE = 0x1 + CAP_DAC_READ_SEARCH = 0x2 + CAP_FOWNER = 0x3 + CAP_FSETID = 0x4 + CAP_IPC_LOCK = 0xe + CAP_IPC_OWNER = 0xf + CAP_KILL = 0x5 + CAP_LAST_CAP = 0x25 + CAP_LEASE = 0x1c + CAP_LINUX_IMMUTABLE = 0x9 + CAP_MAC_ADMIN = 0x21 + CAP_MAC_OVERRIDE = 0x20 + CAP_MKNOD = 0x1b + CAP_NET_ADMIN = 0xc + CAP_NET_BIND_SERVICE = 0xa + CAP_NET_BROADCAST = 0xb + CAP_NET_RAW = 0xd + CAP_SETFCAP = 0x1f + CAP_SETGID = 0x6 + CAP_SETPCAP = 0x8 + CAP_SETUID = 0x7 + CAP_SYSLOG = 0x22 + CAP_SYS_ADMIN = 0x15 + CAP_SYS_BOOT = 0x16 + CAP_SYS_CHROOT = 0x12 + CAP_SYS_MODULE = 0x10 + CAP_SYS_NICE = 0x17 + CAP_SYS_PACCT = 0x14 + CAP_SYS_PTRACE = 0x13 + CAP_SYS_RAWIO = 0x11 + CAP_SYS_RESOURCE = 0x18 + CAP_SYS_TIME = 0x19 + CAP_SYS_TTY_CONFIG = 0x1a + CAP_WAKE_ALARM = 0x23 CBAUD = 0x100f CBAUDEX = 0x1000 CFLUSH = 0xf @@ -305,6 +426,7 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 + CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -323,6 +445,10 @@ const ( CRDLY = 0x600 CREAD = 0x80 CRTSCTS = 0x80000000 + CRYPTO_MAX_NAME = 0x40 + CRYPTO_MSG_MAX = 0x15 + CRYPTO_NR_MSGTYPES = 0x6 + CRYPTO_REPORT_MAXSIZE = 0x160 CS5 = 0x0 CS6 = 0x10 CS7 = 0x20 @@ -418,6 +544,7 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b + ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -501,6 +628,7 @@ const ( FAN_ALL_MARK_FLAGS = 0xff FAN_ALL_OUTGOING_EVENTS = 0x3403b FAN_ALL_PERM_EVENTS = 0x30000 + FAN_ATTRIB = 0x4 FAN_AUDIT = 0x10 FAN_CLASS_CONTENT = 0x4 FAN_CLASS_NOTIF = 0x0 @@ -509,8 +637,12 @@ const ( FAN_CLOSE = 0x18 FAN_CLOSE_NOWRITE = 0x10 FAN_CLOSE_WRITE = 0x8 + FAN_CREATE = 0x100 + FAN_DELETE = 0x200 + FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 FAN_MARK_ADD = 0x1 @@ -524,6 +656,10 @@ const ( FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 FAN_MODIFY = 0x2 + FAN_MOVE = 0xc0 + FAN_MOVED_FROM = 0x40 + FAN_MOVED_TO = 0x80 + FAN_MOVE_SELF = 0x800 FAN_NOFD = -0x1 FAN_NONBLOCK = 0x2 FAN_ONDIR = 0x40000000 @@ -532,6 +668,7 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_FID = 0x200 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 @@ -1015,6 +1152,20 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 + LOOP_CLR_FD = 0x4c01 + LOOP_CTL_ADD = 0x4c80 + LOOP_CTL_GET_FREE = 0x4c82 + LOOP_CTL_REMOVE = 0x4c81 + LOOP_GET_STATUS = 0x4c03 + LOOP_GET_STATUS64 = 0x4c05 + LOOP_SET_BLOCK_SIZE = 0x4c09 + LOOP_SET_CAPACITY = 0x4c07 + LOOP_SET_DIRECT_IO = 0x4c08 + LOOP_SET_FD = 0x4c00 + LOOP_SET_STATUS = 0x4c02 + LOOP_SET_STATUS64 = 0x4c04 + LO_KEY_SIZE = 0x20 + LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -1054,6 +1205,15 @@ const ( MAP_SHARED_VALIDATE = 0x3 MAP_STACK = 0x20000 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x0 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x2a + MCAST_JOIN_SOURCE_GROUP = 0x2e + MCAST_LEAVE_GROUP = 0x2d + MCAST_LEAVE_SOURCE_GROUP = 0x2f + MCAST_MSFILTER = 0x30 + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 @@ -1489,6 +1649,7 @@ const ( PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 PR_SPEC_DISABLE = 0x4 + PR_SPEC_DISABLE_NOEXEC = 0x10 PR_SPEC_ENABLE = 0x2 PR_SPEC_FORCE_DISABLE = 0x8 PR_SPEC_INDIRECT_BRANCH = 0x1 @@ -1917,6 +2078,10 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMPNS_OLD = 0x8907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x4004667f SIOCOUTQ = 0x40047473 SIOCOUTQNSD = 0x894b @@ -2010,6 +2175,7 @@ const ( SO_ATTACH_REUSEPORT_CBPF = 0x35 SO_ATTACH_REUSEPORT_EBPF = 0x36 SO_BINDTODEVICE = 0xd + SO_BINDTOIFINDEX = 0x41 SO_BPF_EXTENSIONS = 0x32 SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0x400 @@ -2058,6 +2224,8 @@ const ( SO_RCVBUFFORCE = 0x100b SO_RCVLOWAT = 0x800 SO_RCVTIMEO = 0x2000 + SO_RCVTIMEO_NEW = 0x44 + SO_RCVTIMEO_OLD = 0x2000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x24 @@ -2069,9 +2237,17 @@ const ( SO_SNDBUFFORCE = 0x100a SO_SNDLOWAT = 0x1000 SO_SNDTIMEO = 0x4000 + SO_SNDTIMEO_NEW = 0x45 + SO_SNDTIMEO_OLD = 0x4000 SO_TIMESTAMP = 0x1d SO_TIMESTAMPING = 0x23 + SO_TIMESTAMPING_NEW = 0x43 + SO_TIMESTAMPING_OLD = 0x23 SO_TIMESTAMPNS = 0x21 + SO_TIMESTAMPNS_NEW = 0x42 + SO_TIMESTAMPNS_OLD = 0x21 + SO_TIMESTAMP_NEW = 0x46 + SO_TIMESTAMP_OLD = 0x1d SO_TXTIME = 0x3f SO_TYPE = 0x1008 SO_VM_SOCKETS_BUFFER_MAX_SIZE = 0x2 @@ -2113,6 +2289,7 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 + SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2163,6 +2340,8 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2327,6 +2506,7 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 + TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 @@ -2362,8 +2542,10 @@ const ( UBI_IOCMKVOL = 0x80986f00 UBI_IOCRMVOL = 0x80046f01 UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 UBI_IOCRSVOL = 0x800c6f02 UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 UBI_IOCVOLCRBLK = 0x80804f07 UBI_IOCVOLRMBLK = 0x20004f08 UBI_IOCVOLUP = 0x80084f00 @@ -2511,6 +2693,7 @@ const ( XDP_FLAGS_SKB_MODE = 0x2 XDP_FLAGS_UPDATE_IF_NOEXIST = 0x1 XDP_MMAP_OFFSETS = 0x1 + XDP_PACKET_HEADROOM = 0x100 XDP_PGOFF_RX_RING = 0x0 XDP_PGOFF_TX_RING = 0x80000000 XDP_RX_RING = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go new file mode 100644 index 00000000..ec5f92de --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go @@ -0,0 +1,1789 @@ +// mkerrors.sh -m64 +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build arm64,openbsd + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -m64 _const.go + +package unix + +import "syscall" + +const ( + AF_APPLETALK = 0x10 + AF_BLUETOOTH = 0x20 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1a + AF_ECMA = 0x8 + AF_ENCAP = 0x1c + AF_HYLINK = 0xf + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x18 + AF_IPX = 0x17 + AF_ISDN = 0x1a + AF_ISO = 0x7 + AF_KEY = 0x1e + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x24 + AF_MPLS = 0x21 + AF_NATM = 0x1b + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PUP = 0x4 + AF_ROUTE = 0x11 + AF_SIP = 0x1d + AF_SNA = 0xb + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + ALTWERASE = 0x200 + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDIRFILT = 0x4004427c + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc010427b + BIOCGETIF = 0x4020426b + BIOCGFILDROP = 0x40044278 + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044273 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x20004276 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDIRFILT = 0x8004427d + BIOCSDLT = 0x8004427a + BIOCSETF = 0x80104267 + BIOCSETIF = 0x8020426c + BIOCSETWF = 0x80104277 + BIOCSFILDROP = 0x80044279 + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044272 + BIOCSRTIMEOUT = 0x8010426d + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIRECTION_IN = 0x1 + BPF_DIRECTION_OUT = 0x2 + BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x200000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 + CREAD = 0x800 + CRTSCTS = 0x10000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0xff + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DIOCOSFPFLUSH = 0x2000444e + DLT_ARCNET = 0x7 + DLT_ATM_RFC1483 = 0xb + DLT_AX25 = 0x3 + DLT_CHAOS = 0x5 + DLT_C_HDLC = 0x68 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0xd + DLT_FDDI = 0xa + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_LOOP = 0xc + DLT_MPLS = 0xdb + DLT_NULL = 0x0 + DLT_OPENFLOW = 0x10b + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_SERIAL = 0x32 + DLT_PRONET = 0x4 + DLT_RAW = 0xe + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_USBPCAP = 0xf9 + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EMT_TAGOVF = 0x1 + EMUL_ENABLED = 0x1 + EMUL_NATIVE = 0x2 + ENDRUNDISC = 0x9 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_AOE = 0x88a2 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LLDP = 0x88cc + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PAE = 0x888e + ETHERTYPE_PBB = 0x88e7 + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_QINQ = 0x88a8 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOW = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_ALIGN = 0x2 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b + ETHER_MAX_LEN = 0x5ee + ETHER_MIN_LEN = 0x40 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 + EVFILT_AIO = -0x3 + EVFILT_DEVICE = -0x8 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x8 + EVFILT_TIMER = -0x7 + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FLUSHO = 0x800000 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0xa + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETOWN = 0x5 + F_ISATTY = 0xb + F_OK = 0x0 + F_RDLCK = 0x1 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETOWN = 0x6 + F_UNLCK = 0x2 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 + IFF_ALLMULTI = 0x200 + IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8e52 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb + IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 + IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BLUETOOTH = 0xf8 + IFT_BRIDGE = 0xd1 + IFT_BSC = 0x53 + IFT_CARP = 0xf7 + IFT_CCTEMUL = 0x3d + IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa + IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DUMMY = 0xf1 + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 + IFT_ETHER = 0x6 + IFT_FAITH = 0xf3 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 + IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 + IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 + IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a + IFT_IEEE1394 = 0x90 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 + IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 + IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 + IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MBIM = 0xfa + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf + IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PFLOG = 0xf5 + IFT_PFLOW = 0xf9 + IFT_PFSYNC = 0xf6 + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab + IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d + IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf2 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f + IFT_RS232 = 0x21 + IFT_RSRB = 0x4f + IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 + IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f + IFT_STARLAN = 0xb + IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 + IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 + IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_X213 = 0x5d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LOOPBACKNET = 0x7f + IN_RFC3021_HOST = 0x1 + IN_RFC3021_NET = 0xfffffffe + IN_RFC3021_NSHIFT = 0x1f + IPPROTO_AH = 0x33 + IPPROTO_CARP = 0x70 + IPPROTO_DIVERT = 0x102 + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GRE = 0x2f + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IGMP = 0x2 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPIP = 0x4 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x103 + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 + IPPROTO_NONE = 0x3b + IPPROTO_PFSYNC = 0xf0 + IPPROTO_PIM = 0x67 + IPPROTO_PUP = 0xc + IPPROTO_RAW = 0xff + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_UDP = 0x11 + IPV6_AUTH_LEVEL = 0x35 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_ESP_NETWORK_LEVEL = 0x37 + IPV6_ESP_TRANS_LEVEL = 0x36 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FRAGTTL = 0x78 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPCOMP_LEVEL = 0x3c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXPACKET = 0xffff + IPV6_MINHOPCOUNT = 0x41 + IPV6_MMTU = 0x500 + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_OPTIONS = 0x1 + IPV6_PATHMTU = 0x2c + IPV6_PIPEX = 0x3f + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVDSTPORT = 0x40 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTABLE = 0x1021 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x3d + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_AUTH_LEVEL = 0x14 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DROP_MEMBERSHIP = 0xd + IP_ESP_NETWORK_LEVEL = 0x16 + IP_ESP_TRANS_LEVEL = 0x15 + IP_HDRINCL = 0x2 + IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 + IP_IPSECFLOWINFO = 0x24 + IP_IPSEC_LOCAL_AUTH = 0x1b + IP_IPSEC_LOCAL_CRED = 0x19 + IP_IPSEC_LOCAL_ID = 0x17 + IP_IPSEC_REMOTE_AUTH = 0x1c + IP_IPSEC_REMOTE_CRED = 0x1a + IP_IPSEC_REMOTE_ID = 0x18 + IP_MAXPACKET = 0xffff + IP_MAX_MEMBERSHIPS = 0xfff + IP_MF = 0x2000 + IP_MINTTL = 0x20 + IP_MIN_MEMBERSHIPS = 0xf + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_OFFMASK = 0x1fff + IP_OPTIONS = 0x1 + IP_PIPEX = 0x22 + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVDSTPORT = 0x21 + IP_RECVIF = 0x1e + IP_RECVOPTS = 0x5 + IP_RECVRETOPTS = 0x6 + IP_RECVRTABLE = 0x23 + IP_RECVTTL = 0x1f + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 + IP_TOS = 0x3 + IP_TTL = 0x4 + ISIG = 0x80 + ISTRIP = 0x20 + IUCLC = 0x1000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LCNT_OVERLOAD_FLUSH = 0x6 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x6 + MADV_NORMAL = 0x0 + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 + MADV_WILLNEED = 0x3 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_CONCEAL = 0x8000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_FLAGMASK = 0xfff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x0 + MAP_SHARED = 0x1 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_DEFEXPORTED = 0x200 + MNT_DELEXPORT = 0x20000 + MNT_DOOMED = 0x8000000 + MNT_EXPORTANON = 0x400 + MNT_EXPORTED = 0x100 + MNT_EXRDONLY = 0x80 + MNT_FORCE = 0x80000 + MNT_LAZY = 0x3 + MNT_LOCAL = 0x1000 + MNT_NOATIME = 0x8000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOPERM = 0x20 + MNT_NOSUID = 0x8 + MNT_NOWAIT = 0x2 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_ROOTFS = 0x4000 + MNT_SOFTDEP = 0x4000000 + MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 + MNT_SYNCHRONOUS = 0x2 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0x400ffff + MNT_WAIT = 0x1 + MNT_WANTRDWR = 0x2000000 + MNT_WXALLOWED = 0x800 + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOR = 0x8 + MSG_MCAST = 0x200 + MSG_NOSIGNAL = 0x400 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MS_ASYNC = 0x1 + MS_INVALIDATE = 0x4 + MS_SYNC = 0x2 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_FLAGS = 0x2 + NET_RT_IFLIST = 0x3 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x7 + NET_RT_STATS = 0x4 + NET_RT_TABLE = 0x5 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ATTRIB = 0x8 + NOTE_CHANGE = 0x1 + NOTE_CHILD = 0x4 + NOTE_DELETE = 0x1 + NOTE_EOF = 0x2 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXTEND = 0x4 + NOTE_FORK = 0x40000000 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_PCTRLMASK = 0xf0000000 + NOTE_PDATAMASK = 0xfffff + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRUNCATE = 0x80 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OLCUC = 0x20 + ONLCR = 0x2 + ONLRET = 0x80 + ONOCR = 0x40 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x10000 + O_CREAT = 0x200 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x80 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x8000 + O_NOFOLLOW = 0x100 + O_NONBLOCK = 0x4 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_RSYNC = 0x80 + O_SHLOCK = 0x10 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PF_FLUSH = 0x1 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb + RTAX_BRD = 0x7 + RTAX_DNS = 0xc + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_LABEL = 0xa + RTAX_MAX = 0xf + RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe + RTAX_SRC = 0x8 + RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd + RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 + RTA_BRD = 0x80 + RTA_DNS = 0x1000 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_LABEL = 0x400 + RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 + RTA_SRC = 0x100 + RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 + RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 + RTF_CLONED = 0x10000 + RTF_CLONING = 0x100 + RTF_CONNECTED = 0x800000 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x110fc08 + RTF_GATEWAY = 0x2 + RTF_HOST = 0x4 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MPATH = 0x40000 + RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 + RTF_PERMANENT_ARP = 0x2000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x2000 + RTF_REJECT = 0x8 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 + RTM_ADD = 0x1 + RTM_BFD = 0x12 + RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DESYNC = 0x10 + RTM_GET = 0x4 + RTM_IFANNOUNCE = 0xf + RTM_IFINFO = 0xe + RTM_INVALIDATE = 0x11 + RTM_LOSING = 0x5 + RTM_MAXSIZE = 0x800 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_PROPOSAL = 0x13 + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff + RT_TABLEID_MAX = 0xff + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + RUSAGE_THREAD = 0x1 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x4 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 + SIOCATMARK = 0x40047307 + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d + SIOCBRDGDADDR = 0x81286947 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0186941 + SIOCBRDGGFD = 0xc0186952 + SIOCBRDGGHT = 0xc0186951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0186953 + SIOCBRDGGPARAM = 0xc0406958 + SIOCBRDGGPRI = 0xc0186950 + SIOCBRDGGRL = 0xc030694f + SIOCBRDGGTO = 0xc0186946 + SIOCBRDGIFS = 0xc0606942 + SIOCBRDGRTS = 0xc0206943 + SIOCBRDGSADDR = 0xc1286944 + SIOCBRDGSCACHE = 0x80186940 + SIOCBRDGSFD = 0x80186952 + SIOCBRDGSHT = 0x80186951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80186953 + SIOCBRDGSPRI = 0x80186950 + SIOCBRDGSPROTO = 0x8018695a + SIOCBRDGSTO = 0x80186945 + SIOCBRDGSTXHC = 0x80186959 + SIOCDELLABEL = 0x80206997 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 + SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af + SIOCGETKALIVE = 0xc01869a4 + SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae + SIOCGETPFLOW = 0xc02069fe + SIOCGETPFSYNC = 0xc02069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGETVLAN = 0xc0206990 + SIOCGIFADDR = 0xc0206921 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0xc020691b + SIOCGIFDESCR = 0xc0206981 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGATTR = 0xc028698b + SIOCGIFGENERIC = 0xc020693a + SIOCGIFGLIST = 0xc028698d + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFHARDMTU = 0xc02069a5 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc020697e + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 + SIOCGIFPRIORITY = 0xc020699c + SIOCGIFRDOMAIN = 0xc02069a0 + SIOCGIFRTLABEL = 0xc0206983 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 + SIOCGIFXFLAGS = 0xc020699e + SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 + SIOCGLIFPHYRTABLE = 0xc02069a2 + SIOCGLIFPHYTTL = 0xc02069a9 + SIOCGPGRP = 0x40047309 + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 + SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 + SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac + SIOCIFCREATE = 0x8020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106978 + SIOCSETKALIVE = 0x801869a3 + SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad + SIOCSETPFLOW = 0x802069fd + SIOCSETPFSYNC = 0x802069f7 + SIOCSETVLAN = 0x8020698f + SIOCSIFADDR = 0x8020690c + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFDESCR = 0x80206980 + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGATTR = 0x8028698c + SIOCSIFGENERIC = 0x80206939 + SIOCSIFLLADDR = 0x8020691f + SIOCSIFLLPRIO = 0x802069b5 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x8020697f + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 + SIOCSIFPRIORITY = 0x8020699b + SIOCSIFRDOMAIN = 0x8020699f + SIOCSIFRTLABEL = 0x80206982 + SIOCSIFXFLAGS = 0x8020699d + SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 + SIOCSLIFPHYRTABLE = 0x802069a1 + SIOCSLIFPHYTTL = 0x802069a8 + SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf + SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 + SIOCSVNETID = 0x802069a6 + SIOCSWGDPID = 0xc018695b + SIOCSWGMAXFLOW = 0xc0186960 + SIOCSWGMAXGROUP = 0xc018695d + SIOCSWSDPID = 0x8018695c + SIOCSWSPORTNO = 0xc060695f + SOCK_CLOEXEC = 0x8000 + SOCK_DGRAM = 0x2 + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BINDANY = 0x1000 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DONTROUTE = 0x10 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LINGER = 0x80 + SO_NETPROC = 0x1020 + SO_OOBINLINE = 0x100 + SO_PEERCRED = 0x1022 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_RTABLE = 0x1021 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_SPLICE = 0x1023 + SO_TIMESTAMP = 0x800 + SO_TYPE = 0x1008 + SO_USELOOPBACK = 0x40 + SO_ZEROIZE = 0x2000 + S_BLKSIZE = 0x200 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCP_MAXBURST = 0x4 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x3 + TCP_MAX_WINSHIFT = 0xe + TCP_MD5SIG = 0x4 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOPUSH = 0x10 + TCP_SACK_ENABLE = 0x8 + TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_PPS = 0x10 + TIOCFLAG_SOFTCAR = 0x1 + TIOCFLUSH = 0x80047410 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d + TIOCGPGRP = 0x40047477 + TIOCGSID = 0x40047463 + TIOCGTSTAMP = 0x4010745b + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGET = 0x4004746a + TIOCMODG = 0x4004746a + TIOCMODS = 0x8004746d + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSETVERAUTH = 0x8004741c + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x8004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTOP = 0x2000746f + TIOCSTSTAMP = 0x8008745a + TIOCSWINSZ = 0x80087467 + TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b + TOSTOP = 0x400000 + UTIME_NOW = -0x2 + UTIME_OMIT = -0x1 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMIN = 0x10 + VM_ANONMIN = 0x7 + VM_LOADAVG = 0x2 + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd + VM_MAXSLP = 0xa + VM_METER = 0x1 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VTIME = 0x11 + VWERASE = 0x4 + WALTSIG = 0x4 + WCONTINUED = 0x8 + WCOREFLAG = 0x80 + WNOHANG = 0x1 + WUNTRACED = 0x2 + XCASE = 0x1000000 +) + +// Errors +const ( + E2BIG = syscall.Errno(0x7) + EACCES = syscall.Errno(0xd) + EADDRINUSE = syscall.Errno(0x30) + EADDRNOTAVAIL = syscall.Errno(0x31) + EAFNOSUPPORT = syscall.Errno(0x2f) + EAGAIN = syscall.Errno(0x23) + EALREADY = syscall.Errno(0x25) + EAUTH = syscall.Errno(0x50) + EBADF = syscall.Errno(0x9) + EBADMSG = syscall.Errno(0x5c) + EBADRPC = syscall.Errno(0x48) + EBUSY = syscall.Errno(0x10) + ECANCELED = syscall.Errno(0x58) + ECHILD = syscall.Errno(0xa) + ECONNABORTED = syscall.Errno(0x35) + ECONNREFUSED = syscall.Errno(0x3d) + ECONNRESET = syscall.Errno(0x36) + EDEADLK = syscall.Errno(0xb) + EDESTADDRREQ = syscall.Errno(0x27) + EDOM = syscall.Errno(0x21) + EDQUOT = syscall.Errno(0x45) + EEXIST = syscall.Errno(0x11) + EFAULT = syscall.Errno(0xe) + EFBIG = syscall.Errno(0x1b) + EFTYPE = syscall.Errno(0x4f) + EHOSTDOWN = syscall.Errno(0x40) + EHOSTUNREACH = syscall.Errno(0x41) + EIDRM = syscall.Errno(0x59) + EILSEQ = syscall.Errno(0x54) + EINPROGRESS = syscall.Errno(0x24) + EINTR = syscall.Errno(0x4) + EINVAL = syscall.Errno(0x16) + EIO = syscall.Errno(0x5) + EIPSEC = syscall.Errno(0x52) + EISCONN = syscall.Errno(0x38) + EISDIR = syscall.Errno(0x15) + ELAST = syscall.Errno(0x5f) + ELOOP = syscall.Errno(0x3e) + EMEDIUMTYPE = syscall.Errno(0x56) + EMFILE = syscall.Errno(0x18) + EMLINK = syscall.Errno(0x1f) + EMSGSIZE = syscall.Errno(0x28) + ENAMETOOLONG = syscall.Errno(0x3f) + ENEEDAUTH = syscall.Errno(0x51) + ENETDOWN = syscall.Errno(0x32) + ENETRESET = syscall.Errno(0x34) + ENETUNREACH = syscall.Errno(0x33) + ENFILE = syscall.Errno(0x17) + ENOATTR = syscall.Errno(0x53) + ENOBUFS = syscall.Errno(0x37) + ENODEV = syscall.Errno(0x13) + ENOENT = syscall.Errno(0x2) + ENOEXEC = syscall.Errno(0x8) + ENOLCK = syscall.Errno(0x4d) + ENOMEDIUM = syscall.Errno(0x55) + ENOMEM = syscall.Errno(0xc) + ENOMSG = syscall.Errno(0x5a) + ENOPROTOOPT = syscall.Errno(0x2a) + ENOSPC = syscall.Errno(0x1c) + ENOSYS = syscall.Errno(0x4e) + ENOTBLK = syscall.Errno(0xf) + ENOTCONN = syscall.Errno(0x39) + ENOTDIR = syscall.Errno(0x14) + ENOTEMPTY = syscall.Errno(0x42) + ENOTRECOVERABLE = syscall.Errno(0x5d) + ENOTSOCK = syscall.Errno(0x26) + ENOTSUP = syscall.Errno(0x5b) + ENOTTY = syscall.Errno(0x19) + ENXIO = syscall.Errno(0x6) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) + EPERM = syscall.Errno(0x1) + EPFNOSUPPORT = syscall.Errno(0x2e) + EPIPE = syscall.Errno(0x20) + EPROCLIM = syscall.Errno(0x43) + EPROCUNAVAIL = syscall.Errno(0x4c) + EPROGMISMATCH = syscall.Errno(0x4b) + EPROGUNAVAIL = syscall.Errno(0x4a) + EPROTO = syscall.Errno(0x5f) + EPROTONOSUPPORT = syscall.Errno(0x2b) + EPROTOTYPE = syscall.Errno(0x29) + ERANGE = syscall.Errno(0x22) + EREMOTE = syscall.Errno(0x47) + EROFS = syscall.Errno(0x1e) + ERPCMISMATCH = syscall.Errno(0x49) + ESHUTDOWN = syscall.Errno(0x3a) + ESOCKTNOSUPPORT = syscall.Errno(0x2c) + ESPIPE = syscall.Errno(0x1d) + ESRCH = syscall.Errno(0x3) + ESTALE = syscall.Errno(0x46) + ETIMEDOUT = syscall.Errno(0x3c) + ETOOMANYREFS = syscall.Errno(0x3b) + ETXTBSY = syscall.Errno(0x1a) + EUSERS = syscall.Errno(0x44) + EWOULDBLOCK = syscall.Errno(0x23) + EXDEV = syscall.Errno(0x12) +) + +// Signals +const ( + SIGABRT = syscall.Signal(0x6) + SIGALRM = syscall.Signal(0xe) + SIGBUS = syscall.Signal(0xa) + SIGCHLD = syscall.Signal(0x14) + SIGCONT = syscall.Signal(0x13) + SIGEMT = syscall.Signal(0x7) + SIGFPE = syscall.Signal(0x8) + SIGHUP = syscall.Signal(0x1) + SIGILL = syscall.Signal(0x4) + SIGINFO = syscall.Signal(0x1d) + SIGINT = syscall.Signal(0x2) + SIGIO = syscall.Signal(0x17) + SIGIOT = syscall.Signal(0x6) + SIGKILL = syscall.Signal(0x9) + SIGPIPE = syscall.Signal(0xd) + SIGPROF = syscall.Signal(0x1b) + SIGQUIT = syscall.Signal(0x3) + SIGSEGV = syscall.Signal(0xb) + SIGSTOP = syscall.Signal(0x11) + SIGSYS = syscall.Signal(0xc) + SIGTERM = syscall.Signal(0xf) + SIGTHR = syscall.Signal(0x20) + SIGTRAP = syscall.Signal(0x5) + SIGTSTP = syscall.Signal(0x12) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x10) + SIGUSR1 = syscall.Signal(0x1e) + SIGUSR2 = syscall.Signal(0x1f) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "device not configured"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EDEADLK", "resource deadlock avoided"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "cross-device link"}, + {19, "ENODEV", "operation not supported by device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "result too large"}, + {35, "EAGAIN", "resource temporarily unavailable"}, + {36, "EINPROGRESS", "operation now in progress"}, + {37, "EALREADY", "operation already in progress"}, + {38, "ENOTSOCK", "socket operation on non-socket"}, + {39, "EDESTADDRREQ", "destination address required"}, + {40, "EMSGSIZE", "message too long"}, + {41, "EPROTOTYPE", "protocol wrong type for socket"}, + {42, "ENOPROTOOPT", "protocol not available"}, + {43, "EPROTONOSUPPORT", "protocol not supported"}, + {44, "ESOCKTNOSUPPORT", "socket type not supported"}, + {45, "EOPNOTSUPP", "operation not supported"}, + {46, "EPFNOSUPPORT", "protocol family not supported"}, + {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, + {48, "EADDRINUSE", "address already in use"}, + {49, "EADDRNOTAVAIL", "can't assign requested address"}, + {50, "ENETDOWN", "network is down"}, + {51, "ENETUNREACH", "network is unreachable"}, + {52, "ENETRESET", "network dropped connection on reset"}, + {53, "ECONNABORTED", "software caused connection abort"}, + {54, "ECONNRESET", "connection reset by peer"}, + {55, "ENOBUFS", "no buffer space available"}, + {56, "EISCONN", "socket is already connected"}, + {57, "ENOTCONN", "socket is not connected"}, + {58, "ESHUTDOWN", "can't send after socket shutdown"}, + {59, "ETOOMANYREFS", "too many references: can't splice"}, + {60, "ETIMEDOUT", "operation timed out"}, + {61, "ECONNREFUSED", "connection refused"}, + {62, "ELOOP", "too many levels of symbolic links"}, + {63, "ENAMETOOLONG", "file name too long"}, + {64, "EHOSTDOWN", "host is down"}, + {65, "EHOSTUNREACH", "no route to host"}, + {66, "ENOTEMPTY", "directory not empty"}, + {67, "EPROCLIM", "too many processes"}, + {68, "EUSERS", "too many users"}, + {69, "EDQUOT", "disk quota exceeded"}, + {70, "ESTALE", "stale NFS file handle"}, + {71, "EREMOTE", "too many levels of remote in path"}, + {72, "EBADRPC", "RPC struct is bad"}, + {73, "ERPCMISMATCH", "RPC version wrong"}, + {74, "EPROGUNAVAIL", "RPC program not available"}, + {75, "EPROGMISMATCH", "program version wrong"}, + {76, "EPROCUNAVAIL", "bad procedure for program"}, + {77, "ENOLCK", "no locks available"}, + {78, "ENOSYS", "function not implemented"}, + {79, "EFTYPE", "inappropriate file type or format"}, + {80, "EAUTH", "authentication error"}, + {81, "ENEEDAUTH", "need authenticator"}, + {82, "EIPSEC", "IPsec processing failure"}, + {83, "ENOATTR", "attribute not found"}, + {84, "EILSEQ", "illegal byte sequence"}, + {85, "ENOMEDIUM", "no medium found"}, + {86, "EMEDIUMTYPE", "wrong medium type"}, + {87, "EOVERFLOW", "value too large to be stored in data type"}, + {88, "ECANCELED", "operation canceled"}, + {89, "EIDRM", "identifier removed"}, + {90, "ENOMSG", "no message of desired type"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/BPT trap"}, + {6, "SIGABRT", "abort trap"}, + {7, "SIGEMT", "EMT trap"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad system call"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGURG", "urgent I/O condition"}, + {17, "SIGSTOP", "suspended (signal)"}, + {18, "SIGTSTP", "suspended"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGXCPU", "cputime limit exceeded"}, + {25, "SIGXFSZ", "filesize limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window size changes"}, + {29, "SIGINFO", "information request"}, + {30, "SIGUSR1", "user defined signal 1"}, + {31, "SIGUSR2", "user defined signal 2"}, + {32, "SIGTHR", "thread AST"}, +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index 79f6e056..ed657ff1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -83,6 +83,8 @@ int lstat(uintptr_t, uintptr_t); int pause(); int pread64(int, uintptr_t, size_t, long long); int pwrite64(int, uintptr_t, size_t, long long); +#define c_select select +int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int setregid(int, int); int setreuid(int, int); @@ -103,8 +105,8 @@ int getpeername(int, uintptr_t, uintptr_t); int getsockname(int, uintptr_t, uintptr_t); int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); -int recvmsg(int, uintptr_t, int); -int sendmsg(int, uintptr_t, int); +int nrecvmsg(int, uintptr_t, int); +int nsendmsg(int, uintptr_t, int); int munmap(uintptr_t, uintptr_t); int madvise(uintptr_t, size_t, int); int mprotect(uintptr_t, size_t, int); @@ -118,6 +120,8 @@ int poll(uintptr_t, int, int); int gettimeofday(uintptr_t, uintptr_t); int time(uintptr_t); int utime(uintptr_t, uintptr_t); +unsigned long long getsystemcfg(int); +int umount(uintptr_t); int getrlimit64(int, uintptr_t); int setrlimit64(int, uintptr_t); long long lseek64(int, long long, int); @@ -855,7 +859,7 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fstat(fd int, stat *Stat_t) (err error) { +func fstat(fd int, stat *Stat_t) (err error) { r0, er := C.fstat(C.int(fd), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) if r0 == -1 && er != nil { err = er @@ -865,7 +869,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { +func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) r0, er := C.fstatat(C.int(dirfd), C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat))), C.int(flags)) if r0 == -1 && er != nil { @@ -949,7 +953,7 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Lstat(path string, stat *Stat_t) (err error) { +func lstat(path string, stat *Stat_t) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) r0, er := C.lstat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) if r0 == -1 && er != nil { @@ -1004,6 +1008,17 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, er := C.c_select(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout)))) + n = int(r0) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, er := C.pselect(C.int(nfd), C.uintptr_t(uintptr(unsafe.Pointer(r))), C.uintptr_t(uintptr(unsafe.Pointer(w))), C.uintptr_t(uintptr(unsafe.Pointer(e))), C.uintptr_t(uintptr(unsafe.Pointer(timeout))), C.uintptr_t(uintptr(unsafe.Pointer(sigmask)))) n = int(r0) @@ -1056,9 +1071,9 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Stat(path string, stat *Stat_t) (err error) { +func stat(path string, statptr *Stat_t) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) - r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(stat)))) + r0, er := C.stat(C.uintptr_t(_p0), C.uintptr_t(uintptr(unsafe.Pointer(statptr)))) if r0 == -1 && er != nil { err = er } @@ -1225,7 +1240,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, er := C.recvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) + r0, er := C.nrecvmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) n = int(r0) if r0 == -1 && er != nil { err = er @@ -1236,7 +1251,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, er := C.sendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) + r0, er := C.nsendmsg(C.int(s), C.uintptr_t(uintptr(unsafe.Pointer(msg))), C.int(flags)) n = int(r0) if r0 == -1 && er != nil { err = er @@ -1409,6 +1424,25 @@ func Utime(path string, buf *Utimbuf) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getsystemcfg(label int) (n uint64) { + r0, _ := C.getsystemcfg(C.int(label)) + n = uint64(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func umount(target string) (err error) { + _p0 := uintptr(unsafe.Pointer(C.CString(target))) + r0, er := C.umount(C.uintptr_t(_p0)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getrlimit(resource int, rlim *Rlimit) (err error) { r0, er := C.getrlimit64(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim)))) if r0 == -1 && er != nil { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 52802bfc..664b293b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -803,7 +803,7 @@ func Fchown(fd int, uid int, gid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fstat(fd int, stat *Stat_t) (err error) { +func fstat(fd int, stat *Stat_t) (err error) { _, e1 := callfstat(fd, uintptr(unsafe.Pointer(stat))) if e1 != 0 { err = errnoErr(e1) @@ -813,7 +813,7 @@ func Fstat(fd int, stat *Stat_t) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { +func fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -905,7 +905,7 @@ func Listen(s int, n int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Lstat(path string, stat *Stat_t) (err error) { +func lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { @@ -960,6 +960,17 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, e1 := callselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, e1 := callpselect(nfd, uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) n = int(r0) @@ -1012,13 +1023,13 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Stat(path string, stat *Stat_t) (err error) { +func stat(path string, statptr *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat))) + _, e1 := callstat(uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statptr))) if e1 != 0 { err = errnoErr(e1) } @@ -1189,7 +1200,7 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, e1 := callrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags) + r0, e1 := callnrecvmsg(s, uintptr(unsafe.Pointer(msg)), flags) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1200,7 +1211,7 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, e1 := callsendmsg(s, uintptr(unsafe.Pointer(msg)), flags) + r0, e1 := callnsendmsg(s, uintptr(unsafe.Pointer(msg)), flags) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1375,6 +1386,21 @@ func Getsystemcfg(label int) (n uint64) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func umount(target string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(target) + if err != nil { + return + } + _, e1 := callumount(uintptr(unsafe.Pointer(_p0))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getrlimit(resource int, rlim *Rlimit) (err error) { _, e1 := callgetrlimit(resource, uintptr(unsafe.Pointer(rlim))) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index a2b24e4a..4b3a8ad7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -85,6 +85,7 @@ import ( //go:cgo_import_dynamic libc_pause pause "libc.a/shr_64.o" //go:cgo_import_dynamic libc_pread64 pread64 "libc.a/shr_64.o" //go:cgo_import_dynamic libc_pwrite64 pwrite64 "libc.a/shr_64.o" +//go:cgo_import_dynamic libc_select select "libc.a/shr_64.o" //go:cgo_import_dynamic libc_pselect pselect "libc.a/shr_64.o" //go:cgo_import_dynamic libc_setregid setregid "libc.a/shr_64.o" //go:cgo_import_dynamic libc_setreuid setreuid "libc.a/shr_64.o" @@ -105,8 +106,8 @@ import ( //go:cgo_import_dynamic libc_getsockname getsockname "libc.a/shr_64.o" //go:cgo_import_dynamic libc_recvfrom recvfrom "libc.a/shr_64.o" //go:cgo_import_dynamic libc_sendto sendto "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_recvmsg recvmsg "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_sendmsg sendmsg "libc.a/shr_64.o" +//go:cgo_import_dynamic libc_nrecvmsg nrecvmsg "libc.a/shr_64.o" +//go:cgo_import_dynamic libc_nsendmsg nsendmsg "libc.a/shr_64.o" //go:cgo_import_dynamic libc_munmap munmap "libc.a/shr_64.o" //go:cgo_import_dynamic libc_madvise madvise "libc.a/shr_64.o" //go:cgo_import_dynamic libc_mprotect mprotect "libc.a/shr_64.o" @@ -121,6 +122,7 @@ import ( //go:cgo_import_dynamic libc_time time "libc.a/shr_64.o" //go:cgo_import_dynamic libc_utime utime "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" +//go:cgo_import_dynamic libc_umount umount "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o" //go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o" //go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o" @@ -201,6 +203,7 @@ import ( //go:linkname libc_pause libc_pause //go:linkname libc_pread64 libc_pread64 //go:linkname libc_pwrite64 libc_pwrite64 +//go:linkname libc_select libc_select //go:linkname libc_pselect libc_pselect //go:linkname libc_setregid libc_setregid //go:linkname libc_setreuid libc_setreuid @@ -221,8 +224,8 @@ import ( //go:linkname libc_getsockname libc_getsockname //go:linkname libc_recvfrom libc_recvfrom //go:linkname libc_sendto libc_sendto -//go:linkname libc_recvmsg libc_recvmsg -//go:linkname libc_sendmsg libc_sendmsg +//go:linkname libc_nrecvmsg libc_nrecvmsg +//go:linkname libc_nsendmsg libc_nsendmsg //go:linkname libc_munmap libc_munmap //go:linkname libc_madvise libc_madvise //go:linkname libc_mprotect libc_mprotect @@ -237,6 +240,7 @@ import ( //go:linkname libc_time libc_time //go:linkname libc_utime libc_utime //go:linkname libc_getsystemcfg libc_getsystemcfg +//go:linkname libc_umount libc_umount //go:linkname libc_getrlimit libc_getrlimit //go:linkname libc_setrlimit libc_setrlimit //go:linkname libc_lseek libc_lseek @@ -320,6 +324,7 @@ var ( libc_pause, libc_pread64, libc_pwrite64, + libc_select, libc_pselect, libc_setregid, libc_setreuid, @@ -340,8 +345,8 @@ var ( libc_getsockname, libc_recvfrom, libc_sendto, - libc_recvmsg, - libc_sendmsg, + libc_nrecvmsg, + libc_nsendmsg, libc_munmap, libc_madvise, libc_mprotect, @@ -356,6 +361,7 @@ var ( libc_time, libc_utime, libc_getsystemcfg, + libc_umount, libc_getrlimit, libc_setrlimit, libc_lseek, @@ -893,6 +899,13 @@ func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_select)), 5, uintptr(nfd), r, w, e, timeout, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_pselect)), 6, uintptr(nfd), r, w, e, timeout, sigmask) return @@ -928,8 +941,8 @@ func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_stat)), 2, _p0, stat, 0, 0, 0, 0) +func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_stat)), 2, _p0, statptr, 0, 0, 0, 0) return } @@ -1033,15 +1046,15 @@ func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen u // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_recvmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) +func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nrecvmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_sendmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) +func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_nsendmsg)), 3, uintptr(s), msg, uintptr(flags), 0, 0, 0) return } @@ -1145,6 +1158,13 @@ func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callumount(_p0 uintptr) (r1 uintptr, e1 Errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_umount)), 1, _p0, 0, 0, 0, 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index 5491c89e..cde4dbc5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -83,6 +83,8 @@ int lstat(uintptr_t, uintptr_t); int pause(); int pread64(int, uintptr_t, size_t, long long); int pwrite64(int, uintptr_t, size_t, long long); +#define c_select select +int select(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int pselect(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); int setregid(int, int); int setreuid(int, int); @@ -103,8 +105,8 @@ int getpeername(int, uintptr_t, uintptr_t); int getsockname(int, uintptr_t, uintptr_t); int recvfrom(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); int sendto(int, uintptr_t, size_t, int, uintptr_t, uintptr_t); -int recvmsg(int, uintptr_t, int); -int sendmsg(int, uintptr_t, int); +int nrecvmsg(int, uintptr_t, int); +int nsendmsg(int, uintptr_t, int); int munmap(uintptr_t, uintptr_t); int madvise(uintptr_t, size_t, int); int mprotect(uintptr_t, size_t, int); @@ -119,6 +121,7 @@ int gettimeofday(uintptr_t, uintptr_t); int time(uintptr_t); int utime(uintptr_t, uintptr_t); unsigned long long getsystemcfg(int); +int umount(uintptr_t); int getrlimit(int, uintptr_t); int setrlimit(int, uintptr_t); long long lseek(int, long long, int); @@ -732,6 +735,14 @@ func callpwrite64(fd int, _p0 uintptr, _lenp0 int, offset int64) (r1 uintptr, e1 // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr) (r1 uintptr, e1 Errno) { + r1 = uintptr(C.c_select(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout))) + e1 = syscall.GetErrno() + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callpselect(nfd int, r uintptr, w uintptr, e uintptr, timeout uintptr, sigmask uintptr) (r1 uintptr, e1 Errno) { r1 = uintptr(C.pselect(C.int(nfd), C.uintptr_t(r), C.uintptr_t(w), C.uintptr_t(e), C.uintptr_t(timeout), C.uintptr_t(sigmask))) e1 = syscall.GetErrno() @@ -772,8 +783,8 @@ func callsplice(rfd int, roff uintptr, wfd int, woff uintptr, len int, flags int // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callstat(_p0 uintptr, stat uintptr) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.stat(C.uintptr_t(_p0), C.uintptr_t(stat))) +func callstat(_p0 uintptr, statptr uintptr) (r1 uintptr, e1 Errno) { + r1 = uintptr(C.stat(C.uintptr_t(_p0), C.uintptr_t(statptr))) e1 = syscall.GetErrno() return } @@ -892,16 +903,16 @@ func callsendto(s int, _p0 uintptr, _lenp0 int, flags int, to uintptr, addrlen u // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.recvmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) +func callnrecvmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { + r1 = uintptr(C.nrecvmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) e1 = syscall.GetErrno() return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.sendmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) +func callnsendmsg(s int, msg uintptr, flags int) (r1 uintptr, e1 Errno) { + r1 = uintptr(C.nsendmsg(C.int(s), C.uintptr_t(msg), C.int(flags))) e1 = syscall.GetErrno() return } @@ -1020,6 +1031,14 @@ func callgetsystemcfg(label int) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callumount(_p0 uintptr) (r1 uintptr, e1 Errno) { + r1 = uintptr(C.umount(C.uintptr_t(_p0))) + e1 = syscall.GetErrno() + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) { r1 = uintptr(C.getrlimit(C.int(resource), C.uintptr_t(rlim))) e1 = syscall.GetErrno() diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index ae9f1a21..cdfe9318 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -749,6 +749,23 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index 80903e47..a783306b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -387,6 +387,16 @@ func pipe2(p *[2]_C_int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace(request int, pid int, addr uintptr, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -1019,7 +1029,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index cd250ff0..f995520d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -387,6 +387,16 @@ func pipe2(p *[2]_C_int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace(request int, pid int, addr uintptr, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -1019,7 +1029,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 290a9c2c..d681acd4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -387,6 +387,16 @@ func pipe2(p *[2]_C_int, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace(request int, pid int, addr uintptr, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getcwd(buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { @@ -1019,7 +1029,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index c6df9d2e..5049b2ed 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -404,6 +404,16 @@ func Getcwd(buf []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace(request int, pid int, addr uintptr, data int) (err error) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { @@ -1019,7 +1029,7 @@ func getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdirentries_freebsd12(fd int, buf []byte, basep *uintptr) (n int, err error) { +func getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 9855afa7..c5e46e4c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 773e2511..da8819e4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index ccea621d..6ad9be6d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe(p *[2]_C_int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { @@ -2340,3 +2390,18 @@ func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(cmdline) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 712c7a32..f8833178 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 68b32510..8eebc6c7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index a8be4076..ecf62a67 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index 1351028a..1ba0f7b6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 327b4f97..20012b2f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index c145bd3c..2b520dea 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index cd8179c7..d9f044c9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index 2e90cf0f..9feed65e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index fe9c7e12..0a651508 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup2(oldfd int, newfd int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index d4a2100b..e27f6693 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -408,6 +408,26 @@ func Adjtimex(buf *Timex) (state int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Capget(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Capset(hdr *CapUserHeader, data *CapUserData) (err error) { + _, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1381,8 +1401,12 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Signalfd(fd int, mask *Sigset_t, flags int) { - SyscallNoError(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(mask)), uintptr(flags)) +func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) { + r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0) + newfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -1679,6 +1703,32 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 642db767..7e058266 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -389,7 +389,7 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdents(fd int, buf []byte) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index 59585fee..d94d076a 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -389,7 +389,7 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdents(fd int, buf []byte) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 6ec31434..cf5bf3d0 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -389,7 +389,7 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdents(fd int, buf []byte) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 603d1443..243a9317 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -389,7 +389,7 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdents(fd int, buf []byte) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index 6a489fac..a9532d07 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -387,7 +387,7 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdents(fd int, buf []byte) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 30cba434..0cb9f017 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -387,7 +387,7 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdents(fd int, buf []byte) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index fa1beda3..6fc99b54 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -387,7 +387,7 @@ func pipe(p *[2]_C_int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getdents(fd int, buf []byte) (n int, err error) { +func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go new file mode 100644 index 00000000..27878a72 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -0,0 +1,1692 @@ +// go run mksyscall.go -openbsd -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm64.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build openbsd,arm64 + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(ngid int, gid *_Gid_t) (n int, err error) { + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(ngid int, gid *_Gid_t) (err error) { + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { + r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(s int, how int) (err error) { + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { + r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimes(fd int, timeval *[2]Timeval) (err error) { + _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { + r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Madvise(b []byte, behav int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mlockall(flags int) (err error) { + _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlock(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Munlockall() (err error) { + _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe(p *[2]_C_int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { + _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chflags(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Close(fd int) (err error) { + _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(fd int) (nfd int, err error) { + r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) + nfd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(from int, to int) (err error) { + _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + Syscall(SYS_EXIT, uintptr(code), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchflags(fd int, flags int) (err error) { + _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Flock(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fpathconf(fd int, name int) (val int, err error) { + r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgrp() (pgrp int) { + r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) + pgrp = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (ppid int) { + r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) + ppid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrtable() (rtable int, err error) { + r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + rtable = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrusage(who int, rusage *Rusage) (err error) { + _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Issetugid() (tainted bool) { + r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) + tainted = bool(r0 != 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, signum syscall.Signal) (err error) { + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kqueue() (fd int, err error) { + r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, backlog int) (err error) { + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdirat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pathconf(path string, name int) (val int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(fromfd int, from string, tofd int, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Revoke(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) + newoffset = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { + _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setegid(egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seteuid(euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(gid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setlogin(name string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(name) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(which int, lim *Rlimit) (err error) { + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrtable(rtable int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Settimeofday(tp *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() (err error) { + _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(newmask int) (oldmask int) { + r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) + oldmask = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlinkat(dirfd int, path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unmount(path string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func writelen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index b005031a..37dcc74c 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -1,6 +1,8 @@ // mksysctl_openbsd.pl // Code generated by the command above; DO NOT EDIT. +// +build 386,openbsd + package unix type mibentry struct { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index d014451c..fe6caa6e 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -1,4 +1,4 @@ -// mksysctl_openbsd.pl +// go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. // +build amd64,openbsd diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index b005031a..6eb8c0b0 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -1,6 +1,8 @@ -// mksysctl_openbsd.pl +// go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +// +build arm,openbsd + package unix type mibentry struct { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go new file mode 100644 index 00000000..ba4304fd --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go @@ -0,0 +1,275 @@ +// go run mksysctl_openbsd.go +// Code generated by the command above; DO NOT EDIT. + +// +build arm64,openbsd + +package unix + +type mibentry struct { + ctlname string + ctloid []_C_int +} + +var sysctlMib = []mibentry{ + {"ddb.console", []_C_int{9, 6}}, + {"ddb.log", []_C_int{9, 7}}, + {"ddb.max_line", []_C_int{9, 3}}, + {"ddb.max_width", []_C_int{9, 2}}, + {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, + {"ddb.radix", []_C_int{9, 1}}, + {"ddb.tab_stop_width", []_C_int{9, 4}}, + {"ddb.trigger", []_C_int{9, 8}}, + {"fs.posix.setuid", []_C_int{3, 1, 1}}, + {"hw.allowpowerdown", []_C_int{6, 22}}, + {"hw.byteorder", []_C_int{6, 4}}, + {"hw.cpuspeed", []_C_int{6, 12}}, + {"hw.diskcount", []_C_int{6, 10}}, + {"hw.disknames", []_C_int{6, 8}}, + {"hw.diskstats", []_C_int{6, 9}}, + {"hw.machine", []_C_int{6, 1}}, + {"hw.model", []_C_int{6, 2}}, + {"hw.ncpu", []_C_int{6, 3}}, + {"hw.ncpufound", []_C_int{6, 21}}, + {"hw.ncpuonline", []_C_int{6, 25}}, + {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, + {"hw.physmem", []_C_int{6, 19}}, + {"hw.product", []_C_int{6, 15}}, + {"hw.serialno", []_C_int{6, 17}}, + {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, + {"hw.usermem", []_C_int{6, 20}}, + {"hw.uuid", []_C_int{6, 18}}, + {"hw.vendor", []_C_int{6, 14}}, + {"hw.version", []_C_int{6, 16}}, + {"kern.allowkmem", []_C_int{1, 52}}, + {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, + {"kern.boottime", []_C_int{1, 21}}, + {"kern.bufcachepercent", []_C_int{1, 72}}, + {"kern.ccpu", []_C_int{1, 45}}, + {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consdev", []_C_int{1, 75}}, + {"kern.cp_time", []_C_int{1, 40}}, + {"kern.cp_time2", []_C_int{1, 71}}, + {"kern.cpustats", []_C_int{1, 85}}, + {"kern.domainname", []_C_int{1, 22}}, + {"kern.file", []_C_int{1, 73}}, + {"kern.forkstat", []_C_int{1, 42}}, + {"kern.fscale", []_C_int{1, 46}}, + {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, + {"kern.hostid", []_C_int{1, 11}}, + {"kern.hostname", []_C_int{1, 10}}, + {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, + {"kern.job_control", []_C_int{1, 19}}, + {"kern.malloc.buckets", []_C_int{1, 39, 1}}, + {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, + {"kern.maxclusters", []_C_int{1, 67}}, + {"kern.maxfiles", []_C_int{1, 7}}, + {"kern.maxlocksperuid", []_C_int{1, 70}}, + {"kern.maxpartitions", []_C_int{1, 23}}, + {"kern.maxproc", []_C_int{1, 6}}, + {"kern.maxthread", []_C_int{1, 25}}, + {"kern.maxvnodes", []_C_int{1, 5}}, + {"kern.mbstat", []_C_int{1, 59}}, + {"kern.msgbuf", []_C_int{1, 48}}, + {"kern.msgbufsize", []_C_int{1, 38}}, + {"kern.nchstats", []_C_int{1, 41}}, + {"kern.netlivelocks", []_C_int{1, 76}}, + {"kern.nfiles", []_C_int{1, 56}}, + {"kern.ngroups", []_C_int{1, 18}}, + {"kern.nosuidcoredump", []_C_int{1, 32}}, + {"kern.nprocs", []_C_int{1, 47}}, + {"kern.nselcoll", []_C_int{1, 43}}, + {"kern.nthreads", []_C_int{1, 26}}, + {"kern.numvnodes", []_C_int{1, 58}}, + {"kern.osrelease", []_C_int{1, 2}}, + {"kern.osrevision", []_C_int{1, 3}}, + {"kern.ostype", []_C_int{1, 1}}, + {"kern.osversion", []_C_int{1, 27}}, + {"kern.pool_debug", []_C_int{1, 77}}, + {"kern.posix1version", []_C_int{1, 17}}, + {"kern.proc", []_C_int{1, 66}}, + {"kern.rawpartition", []_C_int{1, 24}}, + {"kern.saved_ids", []_C_int{1, 20}}, + {"kern.securelevel", []_C_int{1, 9}}, + {"kern.seminfo", []_C_int{1, 61}}, + {"kern.shminfo", []_C_int{1, 62}}, + {"kern.somaxconn", []_C_int{1, 28}}, + {"kern.sominconn", []_C_int{1, 29}}, + {"kern.splassert", []_C_int{1, 54}}, + {"kern.stackgap_random", []_C_int{1, 50}}, + {"kern.sysvipc_info", []_C_int{1, 51}}, + {"kern.sysvmsg", []_C_int{1, 34}}, + {"kern.sysvsem", []_C_int{1, 35}}, + {"kern.sysvshm", []_C_int{1, 36}}, + {"kern.timecounter.choice", []_C_int{1, 69, 4}}, + {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, + {"kern.timecounter.tick", []_C_int{1, 69, 1}}, + {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, + {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, + {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, + {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, + {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, + {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, + {"kern.ttycount", []_C_int{1, 57}}, + {"kern.version", []_C_int{1, 4}}, + {"kern.watchdog.auto", []_C_int{1, 64, 2}}, + {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, + {"kern.wxabort", []_C_int{1, 74}}, + {"net.bpf.bufsize", []_C_int{4, 31, 1}}, + {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, + {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, + {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, + {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, + {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, + {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, + {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, + {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, + {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, + {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, + {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, + {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, + {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, + {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, + {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, + {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, + {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, + {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, + {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, + {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, + {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, + {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, + {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, + {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, + {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, + {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, + {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, + {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, + {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, + {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, + {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, + {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, + {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, + {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, + {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, + {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, + {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, + {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, + {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, + {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, + {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, + {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, + {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, + {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, + {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, + {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, + {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, + {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, + {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, + {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, + {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, + {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, + {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, + {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, + {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, + {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, + {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, + {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, + {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, + {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, + {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, + {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, + {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, + {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, + {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, + {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, + {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, + {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, + {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, + {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, + {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, + {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, + {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, + {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, + {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, + {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, + {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, + {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, + {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, + {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, + {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, + {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, + {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, + {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, + {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, + {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, + {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, + {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, + {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, + {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, + {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, + {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, + {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, + {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, + {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, + {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, + {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, + {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, + {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, + {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, + {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, + {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, + {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, + {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, + {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, + {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, + {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, + {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, + {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, + {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, + {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, + {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, + {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, + {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, + {"net.key.sadb_dump", []_C_int{4, 30, 1}}, + {"net.key.spd_dump", []_C_int{4, 30, 2}}, + {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, + {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, + {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, + {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, + {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, + {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, + {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, + {"net.mpls.ttl", []_C_int{4, 33, 2}}, + {"net.pflow.stats", []_C_int{4, 34, 1}}, + {"net.pipex.enable", []_C_int{4, 35, 1}}, + {"vm.anonmin", []_C_int{2, 7}}, + {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, + {"vm.maxslp", []_C_int{2, 10}}, + {"vm.nkmempages", []_C_int{2, 6}}, + {"vm.psstrings", []_C_int{2, 3}}, + {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, + {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, + {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, + {"vm.uspace", []_C_int{2, 11}}, + {"vm.uvmexp", []_C_int{2, 4}}, + {"vm.vmmeter", []_C_int{2, 1}}, + {"vm.vnodemin", []_C_int{2, 9}}, + {"vm.vtextmin", []_C_int{2, 8}}, +} diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 55c3a329..9474974b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master +// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build 386,freebsd @@ -118,8 +118,6 @@ const ( SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } - SYS_FREEBSD6_PREAD = 173 // { ssize_t freebsd6_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } - SYS_FREEBSD6_PWRITE = 174 // { ssize_t freebsd6_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } @@ -133,10 +131,6 @@ const ( SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS_FREEBSD6_MMAP = 197 // { caddr_t freebsd6_mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } - SYS_FREEBSD6_LSEEK = 199 // { off_t freebsd6_lseek(int fd, int pad, off_t offset, int whence); } - SYS_FREEBSD6_TRUNCATE = 200 // { int freebsd6_truncate(char *path, int pad, off_t length); } - SYS_FREEBSD6_FTRUNCATE = 201 // { int freebsd6_ftruncate(int fd, int pad, off_t length); } SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } @@ -164,6 +158,7 @@ const ( SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } @@ -197,13 +192,10 @@ const ( SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_AIO_RETURN = 314 // { int aio_return(struct aiocb *aiocbp); } + SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } - SYS_OAIO_READ = 318 // { int oaio_read(struct oaiocb *aiocbp); } - SYS_OAIO_WRITE = 319 // { int oaio_write(struct oaiocb *aiocbp); } - SYS_OLIO_LISTIO = 320 // { int olio_listio(int mode, struct oaiocb * const *acb_list, int nent, struct osigevent *sig); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } @@ -236,7 +228,7 @@ const ( SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } @@ -258,7 +250,7 @@ const ( SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } @@ -293,8 +285,6 @@ const ( SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } - SYS__UMTX_LOCK = 434 // { int _umtx_lock(struct umtx *umtx); } - SYS__UMTX_UNLOCK = 435 // { int _umtx_unlock(struct umtx *umtx); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } @@ -400,4 +390,7 @@ const ( SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } + SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } + SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } + SYS_FDATASYNC = 550 // { int fdatasync(int fd); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index b39be6cb..48a7beae 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master +// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,freebsd @@ -118,8 +118,6 @@ const ( SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } - SYS_FREEBSD6_PREAD = 173 // { ssize_t freebsd6_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } - SYS_FREEBSD6_PWRITE = 174 // { ssize_t freebsd6_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } @@ -133,10 +131,6 @@ const ( SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS_FREEBSD6_MMAP = 197 // { caddr_t freebsd6_mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } - SYS_FREEBSD6_LSEEK = 199 // { off_t freebsd6_lseek(int fd, int pad, off_t offset, int whence); } - SYS_FREEBSD6_TRUNCATE = 200 // { int freebsd6_truncate(char *path, int pad, off_t length); } - SYS_FREEBSD6_FTRUNCATE = 201 // { int freebsd6_ftruncate(int fd, int pad, off_t length); } SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } @@ -164,6 +158,7 @@ const ( SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } @@ -197,13 +192,10 @@ const ( SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_AIO_RETURN = 314 // { int aio_return(struct aiocb *aiocbp); } + SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } - SYS_OAIO_READ = 318 // { int oaio_read(struct oaiocb *aiocbp); } - SYS_OAIO_WRITE = 319 // { int oaio_write(struct oaiocb *aiocbp); } - SYS_OLIO_LISTIO = 320 // { int olio_listio(int mode, struct oaiocb * const *acb_list, int nent, struct osigevent *sig); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } @@ -236,7 +228,7 @@ const ( SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } @@ -258,7 +250,7 @@ const ( SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } @@ -293,8 +285,6 @@ const ( SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } - SYS__UMTX_LOCK = 434 // { int _umtx_lock(struct umtx *umtx); } - SYS__UMTX_UNLOCK = 435 // { int _umtx_unlock(struct umtx *umtx); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } @@ -400,4 +390,7 @@ const ( SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } + SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } + SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } + SYS_FDATASYNC = 550 // { int fdatasync(int fd); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index 44ffd4ce..4a6dfd4a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master +// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm,freebsd @@ -118,8 +118,6 @@ const ( SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } - SYS_FREEBSD6_PREAD = 173 // { ssize_t freebsd6_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } - SYS_FREEBSD6_PWRITE = 174 // { ssize_t freebsd6_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } @@ -133,10 +131,6 @@ const ( SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS_FREEBSD6_MMAP = 197 // { caddr_t freebsd6_mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } - SYS_FREEBSD6_LSEEK = 199 // { off_t freebsd6_lseek(int fd, int pad, off_t offset, int whence); } - SYS_FREEBSD6_TRUNCATE = 200 // { int freebsd6_truncate(char *path, int pad, off_t length); } - SYS_FREEBSD6_FTRUNCATE = 201 // { int freebsd6_ftruncate(int fd, int pad, off_t length); } SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } @@ -164,6 +158,7 @@ const ( SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } @@ -197,13 +192,10 @@ const ( SYS_GETSID = 310 // { int getsid(pid_t pid); } SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } - SYS_AIO_RETURN = 314 // { int aio_return(struct aiocb *aiocbp); } + SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } - SYS_OAIO_READ = 318 // { int oaio_read(struct oaiocb *aiocbp); } - SYS_OAIO_WRITE = 319 // { int oaio_write(struct oaiocb *aiocbp); } - SYS_OLIO_LISTIO = 320 // { int olio_listio(int mode, struct oaiocb * const *acb_list, int nent, struct osigevent *sig); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } @@ -236,7 +228,7 @@ const ( SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } - SYS_AIO_WAITCOMPLETE = 359 // { int aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } @@ -258,7 +250,7 @@ const ( SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } @@ -293,8 +285,6 @@ const ( SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } - SYS__UMTX_LOCK = 434 // { int _umtx_lock(struct umtx *umtx); } - SYS__UMTX_UNLOCK = 435 // { int _umtx_unlock(struct umtx *umtx); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } @@ -400,4 +390,7 @@ const ( SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } + SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } + SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } + SYS_FDATASYNC = 550 // { int fdatasync(int fd); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 9f21e955..3e51af8e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -1,4 +1,4 @@ -// go run mksysnum.go https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master +// go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. // +build arm64,freebsd @@ -7,13 +7,13 @@ package unix const ( // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int - SYS_EXIT = 1 // { void sys_exit(int rval); } exit \ + SYS_EXIT = 1 // { void sys_exit(int rval); } exit sys_exit_args void SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, \ - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, \ + SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, \ + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } SYS_LINK = 9 // { int link(char *path, char *link); } SYS_UNLINK = 10 // { int unlink(char *path); } SYS_CHDIR = 12 // { int chdir(char *path); } @@ -21,20 +21,20 @@ const ( SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } SYS_CHMOD = 15 // { int chmod(char *path, int mode); } SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break \ + SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, \ + SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } SYS_SETUID = 23 // { int setuid(uid_t uid); } SYS_GETUID = 24 // { uid_t getuid(void); } SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, \ - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, \ - SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, \ - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, \ - SYS_ACCEPT = 30 // { int accept(int s, \ - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, \ - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, \ + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { int sendmsg(int s, struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, struct sockaddr * __restrict from, __socklen_t * __restrict fromlenaddr); } + SYS_ACCEPT = 30 // { int accept(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen); } + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, struct sockaddr * __restrict asa, __socklen_t * __restrict alen); } SYS_ACCESS = 33 // { int access(char *path, int amode); } SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } @@ -42,56 +42,57 @@ const ( SYS_KILL = 37 // { int kill(int pid, int signum); } SYS_GETPPID = 39 // { pid_t getppid(void); } SYS_DUP = 41 // { int dup(u_int fd); } + SYS_PIPE = 42 // { int pipe(void); } SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, \ - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, \ + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int \ + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, \ - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, \ + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } SYS_REBOOT = 55 // { int reboot(int opt); } SYS_REVOKE = 56 // { int revoke(char *path); } SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, \ - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, \ - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args \ + SYS_READLINK = 58 // { ssize_t readlink(char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, \ + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } SYS_VFORK = 66 // { int vfork(void); } SYS_SBRK = 69 // { int sbrk(int incr); } SYS_SSTK = 70 // { int sstk(int incr); } - SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise \ + SYS_OVADVISE = 72 // { int ovadvise(int anom); } vadvise ovadvise_args int SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, \ - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, \ - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, \ - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, \ - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, \ + SYS_MPROTECT = 74 // { int mprotect(const void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } SYS_GETPGRP = 81 // { int getpgrp(void); } SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct \ + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, \ + SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, \ + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, \ - SYS_SOCKET = 97 // { int socket(int domain, int type, \ - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, \ + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } + SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, \ - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, \ + SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, \ - SYS_GETRUSAGE = 117 // { int getrusage(int who, \ - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, \ - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, \ - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, \ - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, \ + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } @@ -99,24 +100,24 @@ const ( SYS_RENAME = 128 // { int rename(char *from, char *to); } SYS_FLOCK = 131 // { int flock(int fd, int how); } SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, \ + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, \ + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, \ - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, \ + SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, \ + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } SYS_NLM_SYSCALL = 154 // { int nlm_syscall(int debug_level, int grace_period, int addr_count, char **addrs); } SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } - SYS_LGETFH = 160 // { int lgetfh(char *fname, \ - SYS_GETFH = 161 // { int getfh(char *fname, \ + SYS_LGETFH = 160 // { int lgetfh(char *fname, struct fhandle *fhp); } + SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, \ - SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, \ - SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, \ - SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, \ + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } + SYS_SEMSYS = 169 // { int semsys(int which, int a2, int a3, int a4, int a5); } + SYS_MSGSYS = 170 // { int msgsys(int which, int a2, int a3, int a4, int a5, int a6); } + SYS_SHMSYS = 171 // { int shmsys(int which, int a2, int a3, int a4); } SYS_SETFIB = 175 // { int setfib(int fibnum); } SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } SYS_SETGID = 181 // { int setgid(gid_t gid); } @@ -127,269 +128,269 @@ const ( SYS_LSTAT = 190 // { int lstat(char *path, struct stat *ub); } SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, \ - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, \ - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, \ - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, \ + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int + SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } + SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } __sysctl sysctl_args int SYS_MLOCK = 203 // { int mlock(const void *addr, size_t len); } SYS_MUNLOCK = 204 // { int munlock(const void *addr, size_t len); } SYS_UNDELETE = 205 // { int undelete(char *path); } SYS_FUTIMES = 206 // { int futimes(int fd, struct timeval *tptr); } SYS_GETPGID = 207 // { int getpgid(pid_t pid); } - SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, \ - SYS_SEMGET = 221 // { int semget(key_t key, int nsems, \ - SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, \ + SYS_POLL = 209 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_SEMGET = 221 // { int semget(key_t key, int nsems, int semflg); } + SYS_SEMOP = 222 // { int semop(int semid, struct sembuf *sops, size_t nsops); } SYS_MSGGET = 225 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, \ - SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, \ - SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, \ + SYS_MSGSND = 226 // { int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { int msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { int shmat(int shmid, const void *shmaddr, int shmflg); } SYS_SHMDT = 230 // { int shmdt(const void *shmaddr); } - SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, \ - SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, \ - SYS_CLOCK_SETTIME = 233 // { int clock_settime( \ - SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, \ - SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, \ + SYS_SHMGET = 231 // { int shmget(key_t key, size_t size, int shmflg); } + SYS_CLOCK_GETTIME = 232 // { int clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 233 // { int clock_settime( clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 234 // { int clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_KTIMER_CREATE = 235 // { int ktimer_create(clockid_t clock_id, struct sigevent *evp, int *timerid); } SYS_KTIMER_DELETE = 236 // { int ktimer_delete(int timerid); } - SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, \ - SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct \ + SYS_KTIMER_SETTIME = 237 // { int ktimer_settime(int timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); } + SYS_KTIMER_GETTIME = 238 // { int ktimer_gettime(int timerid, struct itimerspec *value); } SYS_KTIMER_GETOVERRUN = 239 // { int ktimer_getoverrun(int timerid); } - SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, \ + SYS_NANOSLEEP = 240 // { int nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } SYS_FFCLOCK_GETCOUNTER = 241 // { int ffclock_getcounter(ffcounter *ffcount); } - SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( \ - SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( \ - SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, \ - SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,\ + SYS_FFCLOCK_SETESTIMATE = 242 // { int ffclock_setestimate( struct ffclock_estimate *cest); } + SYS_FFCLOCK_GETESTIMATE = 243 // { int ffclock_getestimate( struct ffclock_estimate *cest); } + SYS_CLOCK_NANOSLEEP = 244 // { int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp); } + SYS_CLOCK_GETCPUCLOCKID2 = 247 // { int clock_getcpuclockid2(id_t id,int which, clockid_t *clock_id); } SYS_NTP_GETTIME = 248 // { int ntp_gettime(struct ntptimeval *ntvp); } - SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, \ + SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } SYS_RFORK = 251 // { int rfork(int flags); } - SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, \ + SYS_OPENBSD_POLL = 252 // { int openbsd_poll(struct pollfd *fds, u_int nfds, int timeout); } SYS_ISSETUGID = 253 // { int issetugid(void); } SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_AIO_READ = 255 // { int aio_read(struct aiocb *aiocbp); } SYS_AIO_WRITE = 256 // { int aio_write(struct aiocb *aiocbp); } - SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, \ - SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, \ + SYS_LIO_LISTIO = 257 // { int lio_listio(int mode, struct aiocb * const *acb_list, int nent, struct sigevent *sig); } + SYS_GETDENTS = 272 // { int getdents(int fd, char *buf, size_t count); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } - SYS_LUTIMES = 276 // { int lutimes(char *path, \ + SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } SYS_NSTAT = 278 // { int nstat(char *path, struct nstat *ub); } SYS_NFSTAT = 279 // { int nfstat(int fd, struct nstat *sb); } SYS_NLSTAT = 280 // { int nlstat(char *path, struct nstat *ub); } - SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, \ - SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, \ - SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, \ - SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, \ + SYS_PREADV = 289 // { ssize_t preadv(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } + SYS_PWRITEV = 290 // { ssize_t pwritev(int fd, struct iovec *iovp, u_int iovcnt, off_t offset); } + SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } + SYS_FHSTAT = 299 // { int fhstat(const struct fhandle *u_fhp, struct stat *sb); } SYS_MODNEXT = 300 // { int modnext(int modid); } - SYS_MODSTAT = 301 // { int modstat(int modid, \ + SYS_MODSTAT = 301 // { int modstat(int modid, struct module_stat *stat); } SYS_MODFNEXT = 302 // { int modfnext(int modid); } SYS_MODFIND = 303 // { int modfind(const char *name); } SYS_KLDLOAD = 304 // { int kldload(const char *file); } SYS_KLDUNLOAD = 305 // { int kldunload(int fileid); } SYS_KLDFIND = 306 // { int kldfind(const char *file); } SYS_KLDNEXT = 307 // { int kldnext(int fileid); } - SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct \ + SYS_KLDSTAT = 308 // { int kldstat(int fileid, struct kld_file_stat* stat); } SYS_KLDFIRSTMOD = 309 // { int kldfirstmod(int fileid); } SYS_GETSID = 310 // { int getsid(pid_t pid); } - SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, \ - SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, \ + SYS_SETRESUID = 311 // { int setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_SETRESGID = 312 // { int setresgid(gid_t rgid, gid_t egid, gid_t sgid); } SYS_AIO_RETURN = 314 // { ssize_t aio_return(struct aiocb *aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend( \ - SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, \ + SYS_AIO_SUSPEND = 315 // { int aio_suspend( struct aiocb * const * aiocbp, int nent, const struct timespec *timeout); } + SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, struct aiocb *aiocbp); } SYS_AIO_ERROR = 317 // { int aio_error(struct aiocb *aiocbp); } SYS_YIELD = 321 // { int yield(void); } SYS_MLOCKALL = 324 // { int mlockall(int how); } SYS_MUNLOCKALL = 325 // { int munlockall(void); } SYS___GETCWD = 326 // { int __getcwd(char *buf, u_int buflen); } - SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, \ - SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct \ - SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int \ + SYS_SCHED_SETPARAM = 327 // { int sched_setparam (pid_t pid, const struct sched_param *param); } + SYS_SCHED_GETPARAM = 328 // { int sched_getparam (pid_t pid, struct sched_param *param); } + SYS_SCHED_SETSCHEDULER = 329 // { int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); } SYS_SCHED_GETSCHEDULER = 330 // { int sched_getscheduler (pid_t pid); } SYS_SCHED_YIELD = 331 // { int sched_yield (void); } SYS_SCHED_GET_PRIORITY_MAX = 332 // { int sched_get_priority_max (int policy); } SYS_SCHED_GET_PRIORITY_MIN = 333 // { int sched_get_priority_min (int policy); } - SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, \ + SYS_SCHED_RR_GET_INTERVAL = 334 // { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } SYS_UTRACE = 335 // { int utrace(const void *addr, size_t len); } - SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, \ + SYS_KLDSYM = 337 // { int kldsym(int fileid, int cmd, void *data); } SYS_JAIL = 338 // { int jail(struct jail *jail); } - SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, \ + SYS_SIGPROCMASK = 340 // { int sigprocmask(int how, const sigset_t *set, sigset_t *oset); } SYS_SIGSUSPEND = 341 // { int sigsuspend(const sigset_t *sigmask); } SYS_SIGPENDING = 343 // { int sigpending(sigset_t *set); } - SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, \ - SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, \ - SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, \ - SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, \ - SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, \ - SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, \ - SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, \ - SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, \ - SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, \ - SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, \ - SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, \ - SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( \ - SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( \ - SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, \ - SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( \ - SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, \ - SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, \ + SYS_SIGTIMEDWAIT = 345 // { int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *timeout); } + SYS_SIGWAITINFO = 346 // { int sigwaitinfo(const sigset_t *set, siginfo_t *info); } + SYS___ACL_GET_FILE = 347 // { int __acl_get_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_FILE = 348 // { int __acl_set_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_GET_FD = 349 // { int __acl_get_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_FD = 350 // { int __acl_set_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS___ACL_DELETE_FILE = 351 // { int __acl_delete_file(const char *path, acl_type_t type); } + SYS___ACL_DELETE_FD = 352 // { int __acl_delete_fd(int filedes, acl_type_t type); } + SYS___ACL_ACLCHECK_FILE = 353 // { int __acl_aclcheck_file(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_ACLCHECK_FD = 354 // { int __acl_aclcheck_fd(int filedes, acl_type_t type, struct acl *aclp); } + SYS_EXTATTRCTL = 355 // { int extattrctl(const char *path, int cmd, const char *filename, int attrnamespace, const char *attrname); } + SYS_EXTATTR_SET_FILE = 356 // { ssize_t extattr_set_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FILE = 357 // { ssize_t extattr_get_file( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FILE = 358 // { int extattr_delete_file(const char *path, int attrnamespace, const char *attrname); } + SYS_AIO_WAITCOMPLETE = 359 // { ssize_t aio_waitcomplete( struct aiocb **aiocbp, struct timespec *timeout); } + SYS_GETRESUID = 360 // { int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_GETRESGID = 361 // { int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, \ - SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, \ - SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, \ - SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, \ + SYS_KEVENT = 363 // { int kevent(int fd, struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_EXTATTR_SET_FD = 371 // { ssize_t extattr_set_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_FD = 372 // { ssize_t extattr_get_fd(int fd, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_FD = 373 // { int extattr_delete_fd(int fd, int attrnamespace, const char *attrname); } SYS___SETUGID = 374 // { int __setugid(int flag); } SYS_EACCESS = 376 // { int eaccess(char *path, int amode); } - SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, \ + SYS_NMOUNT = 378 // { int nmount(struct iovec *iovp, unsigned int iovcnt, int flags); } SYS___MAC_GET_PROC = 384 // { int __mac_get_proc(struct mac *mac_p); } SYS___MAC_SET_PROC = 385 // { int __mac_set_proc(struct mac *mac_p); } - SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, \ - SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, \ - SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, \ - SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, \ - SYS_KENV = 390 // { int kenv(int what, const char *name, \ - SYS_LCHFLAGS = 391 // { int lchflags(const char *path, \ - SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, \ - SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, \ - SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, \ - SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, \ - SYS_STATFS = 396 // { int statfs(char *path, \ + SYS___MAC_GET_FD = 386 // { int __mac_get_fd(int fd, struct mac *mac_p); } + SYS___MAC_GET_FILE = 387 // { int __mac_get_file(const char *path_p, struct mac *mac_p); } + SYS___MAC_SET_FD = 388 // { int __mac_set_fd(int fd, struct mac *mac_p); } + SYS___MAC_SET_FILE = 389 // { int __mac_set_file(const char *path_p, struct mac *mac_p); } + SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } + SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } + SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } + SYS_MAC_SYSCALL = 394 // { int mac_syscall(const char *policy, int call, void *arg); } + SYS_GETFSSTAT = 395 // { int getfsstat(struct statfs *buf, long bufsize, int mode); } + SYS_STATFS = 396 // { int statfs(char *path, struct statfs *buf); } SYS_FSTATFS = 397 // { int fstatfs(int fd, struct statfs *buf); } - SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, \ + SYS_FHSTATFS = 398 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_KSEM_CLOSE = 400 // { int ksem_close(semid_t id); } SYS_KSEM_POST = 401 // { int ksem_post(semid_t id); } SYS_KSEM_WAIT = 402 // { int ksem_wait(semid_t id); } SYS_KSEM_TRYWAIT = 403 // { int ksem_trywait(semid_t id); } - SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, \ - SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, \ + SYS_KSEM_INIT = 404 // { int ksem_init(semid_t *idp, unsigned int value); } + SYS_KSEM_OPEN = 405 // { int ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode, unsigned int value); } SYS_KSEM_UNLINK = 406 // { int ksem_unlink(const char *name); } SYS_KSEM_GETVALUE = 407 // { int ksem_getvalue(semid_t id, int *val); } SYS_KSEM_DESTROY = 408 // { int ksem_destroy(semid_t id); } - SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, \ - SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, \ - SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, \ - SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( \ - SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( \ - SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( \ - SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, \ - SYS_SIGACTION = 416 // { int sigaction(int sig, \ - SYS_SIGRETURN = 417 // { int sigreturn( \ + SYS___MAC_GET_PID = 409 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } + SYS___MAC_GET_LINK = 410 // { int __mac_get_link(const char *path_p, struct mac *mac_p); } + SYS___MAC_SET_LINK = 411 // { int __mac_set_link(const char *path_p, struct mac *mac_p); } + SYS_EXTATTR_SET_LINK = 412 // { ssize_t extattr_set_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_GET_LINK = 413 // { ssize_t extattr_get_link( const char *path, int attrnamespace, const char *attrname, void *data, size_t nbytes); } + SYS_EXTATTR_DELETE_LINK = 414 // { int extattr_delete_link( const char *path, int attrnamespace, const char *attrname); } + SYS___MAC_EXECVE = 415 // { int __mac_execve(char *fname, char **argv, char **envv, struct mac *mac_p); } + SYS_SIGACTION = 416 // { int sigaction(int sig, const struct sigaction *act, struct sigaction *oact); } + SYS_SIGRETURN = 417 // { int sigreturn( const struct __ucontext *sigcntxp); } SYS_GETCONTEXT = 421 // { int getcontext(struct __ucontext *ucp); } - SYS_SETCONTEXT = 422 // { int setcontext( \ - SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, \ + SYS_SETCONTEXT = 422 // { int setcontext( const struct __ucontext *ucp); } + SYS_SWAPCONTEXT = 423 // { int swapcontext(struct __ucontext *oucp, const struct __ucontext *ucp); } SYS_SWAPOFF = 424 // { int swapoff(const char *name); } - SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, \ - SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, \ - SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, \ - SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, \ - SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, \ - SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, \ + SYS___ACL_GET_LINK = 425 // { int __acl_get_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_SET_LINK = 426 // { int __acl_set_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS___ACL_DELETE_LINK = 427 // { int __acl_delete_link(const char *path, acl_type_t type); } + SYS___ACL_ACLCHECK_LINK = 428 // { int __acl_aclcheck_link(const char *path, acl_type_t type, struct acl *aclp); } + SYS_SIGWAIT = 429 // { int sigwait(const sigset_t *set, int *sig); } + SYS_THR_CREATE = 430 // { int thr_create(ucontext_t *ctx, long *id, int flags); } SYS_THR_EXIT = 431 // { void thr_exit(long *state); } SYS_THR_SELF = 432 // { int thr_self(long *id); } SYS_THR_KILL = 433 // { int thr_kill(long id, int sig); } SYS_JAIL_ATTACH = 436 // { int jail_attach(int jid); } - SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, \ - SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( \ - SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( \ - SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, \ - SYS_THR_SUSPEND = 442 // { int thr_suspend( \ + SYS_EXTATTR_LIST_FD = 437 // { ssize_t extattr_list_fd(int fd, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_FILE = 438 // { ssize_t extattr_list_file( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_EXTATTR_LIST_LINK = 439 // { ssize_t extattr_list_link( const char *path, int attrnamespace, void *data, size_t nbytes); } + SYS_KSEM_TIMEDWAIT = 441 // { int ksem_timedwait(semid_t id, const struct timespec *abstime); } + SYS_THR_SUSPEND = 442 // { int thr_suspend( const struct timespec *timeout); } SYS_THR_WAKE = 443 // { int thr_wake(long id); } SYS_KLDUNLOADF = 444 // { int kldunloadf(int fileid, int flags); } - SYS_AUDIT = 445 // { int audit(const void *record, \ - SYS_AUDITON = 446 // { int auditon(int cmd, void *data, \ + SYS_AUDIT = 445 // { int audit(const void *record, u_int length); } + SYS_AUDITON = 446 // { int auditon(int cmd, void *data, u_int length); } SYS_GETAUID = 447 // { int getauid(uid_t *auid); } SYS_SETAUID = 448 // { int setauid(uid_t *auid); } SYS_GETAUDIT = 449 // { int getaudit(struct auditinfo *auditinfo); } SYS_SETAUDIT = 450 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( \ - SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( \ + SYS_GETAUDIT_ADDR = 451 // { int getaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } + SYS_SETAUDIT_ADDR = 452 // { int setaudit_addr( struct auditinfo_addr *auditinfo_addr, u_int length); } SYS_AUDITCTL = 453 // { int auditctl(char *path); } - SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, \ - SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, \ + SYS__UMTX_OP = 454 // { int _umtx_op(void *obj, int op, u_long val, void *uaddr1, void *uaddr2); } + SYS_THR_NEW = 455 // { int thr_new(struct thr_param *param, int param_size); } SYS_SIGQUEUE = 456 // { int sigqueue(pid_t pid, int signum, void *value); } - SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, \ - SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, \ - SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, \ - SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, \ - SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, \ + SYS_KMQ_OPEN = 457 // { int kmq_open(const char *path, int flags, mode_t mode, const struct mq_attr *attr); } + SYS_KMQ_SETATTR = 458 // { int kmq_setattr(int mqd, const struct mq_attr *attr, struct mq_attr *oattr); } + SYS_KMQ_TIMEDRECEIVE = 459 // { int kmq_timedreceive(int mqd, char *msg_ptr, size_t msg_len, unsigned *msg_prio, const struct timespec *abs_timeout); } + SYS_KMQ_TIMEDSEND = 460 // { int kmq_timedsend(int mqd, const char *msg_ptr, size_t msg_len,unsigned msg_prio, const struct timespec *abs_timeout);} + SYS_KMQ_NOTIFY = 461 // { int kmq_notify(int mqd, const struct sigevent *sigev); } SYS_KMQ_UNLINK = 462 // { int kmq_unlink(const char *path); } SYS_ABORT2 = 463 // { int abort2(const char *why, int nargs, void **args); } SYS_THR_SET_NAME = 464 // { int thr_set_name(long id, const char *name); } SYS_AIO_FSYNC = 465 // { int aio_fsync(int op, struct aiocb *aiocbp); } - SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, \ + SYS_RTPRIO_THREAD = 466 // { int rtprio_thread(int function, lwpid_t lwpid, struct rtprio *rtp); } SYS_SCTP_PEELOFF = 471 // { int sctp_peeloff(int sd, uint32_t name); } - SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \ - SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \ - SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ - SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, \ - SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, \ - SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, \ - SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, \ + SYS_SCTP_GENERIC_SENDMSG = 472 // { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } + SYS_SCTP_GENERIC_SENDMSG_IOV = 473 // { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, caddr_t to, __socklen_t tolen, struct sctp_sndrcvinfo *sinfo, int flags); } + SYS_SCTP_GENERIC_RECVMSG = 474 // { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, struct sockaddr * from, __socklen_t *fromlenaddr, struct sctp_sndrcvinfo *sinfo, int *msg_flags); } + SYS_PREAD = 475 // { ssize_t pread(int fd, void *buf, size_t nbyte, off_t offset); } + SYS_PWRITE = 476 // { ssize_t pwrite(int fd, const void *buf, size_t nbyte, off_t offset); } + SYS_MMAP = 477 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } + SYS_LSEEK = 478 // { off_t lseek(int fd, off_t offset, int whence); } SYS_TRUNCATE = 479 // { int truncate(char *path, off_t length); } SYS_FTRUNCATE = 480 // { int ftruncate(int fd, off_t length); } SYS_THR_KILL2 = 481 // { int thr_kill2(pid_t pid, long id, int sig); } - SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, \ + SYS_SHM_OPEN = 482 // { int shm_open(const char *path, int flags, mode_t mode); } SYS_SHM_UNLINK = 483 // { int shm_unlink(const char *path); } SYS_CPUSET = 484 // { int cpuset(cpusetid_t *setid); } - SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, \ - SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, \ - SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, \ - SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, \ - SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, \ - SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, \ - SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, \ - SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, \ - SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, \ - SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, \ - SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, \ + SYS_CPUSET_SETID = 485 // { int cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); } + SYS_CPUSET_GETID = 486 // { int cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t *setid); } + SYS_CPUSET_GETAFFINITY = 487 // { int cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t *mask); } + SYS_CPUSET_SETAFFINITY = 488 // { int cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t *mask); } + SYS_FACCESSAT = 489 // { int faccessat(int fd, char *path, int amode, int flag); } + SYS_FCHMODAT = 490 // { int fchmodat(int fd, char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 491 // { int fchownat(int fd, char *path, uid_t uid, gid_t gid, int flag); } + SYS_FEXECVE = 492 // { int fexecve(int fd, char **argv, char **envv); } + SYS_FSTATAT = 493 // { int fstatat(int fd, char *path, struct stat *buf, int flag); } + SYS_FUTIMESAT = 494 // { int futimesat(int fd, char *path, struct timeval *times); } + SYS_LINKAT = 495 // { int linkat(int fd1, char *path1, int fd2, char *path2, int flag); } SYS_MKDIRAT = 496 // { int mkdirat(int fd, char *path, mode_t mode); } SYS_MKFIFOAT = 497 // { int mkfifoat(int fd, char *path, mode_t mode); } - SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, \ - SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, \ - SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, \ - SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, \ - SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, \ + SYS_MKNODAT = 498 // { int mknodat(int fd, char *path, mode_t mode, dev_t dev); } + SYS_OPENAT = 499 // { int openat(int fd, char *path, int flag, mode_t mode); } + SYS_READLINKAT = 500 // { int readlinkat(int fd, char *path, char *buf, size_t bufsize); } + SYS_RENAMEAT = 501 // { int renameat(int oldfd, char *old, int newfd, char *new); } + SYS_SYMLINKAT = 502 // { int symlinkat(char *path1, int fd, char *path2); } SYS_UNLINKAT = 503 // { int unlinkat(int fd, char *path, int flag); } SYS_POSIX_OPENPT = 504 // { int posix_openpt(int flags); } SYS_GSSD_SYSCALL = 505 // { int gssd_syscall(char *path); } - SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, \ - SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, \ + SYS_JAIL_GET = 506 // { int jail_get(struct iovec *iovp, unsigned int iovcnt, int flags); } + SYS_JAIL_SET = 507 // { int jail_set(struct iovec *iovp, unsigned int iovcnt, int flags); } SYS_JAIL_REMOVE = 508 // { int jail_remove(int jid); } SYS_CLOSEFROM = 509 // { int closefrom(int lowfd); } - SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, \ - SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, \ - SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, \ + SYS___SEMCTL = 510 // { int __semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_MSGCTL = 511 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SHMCTL = 512 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } SYS_LPATHCONF = 513 // { int lpathconf(char *path, int name); } - SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, \ + SYS___CAP_RIGHTS_GET = 515 // { int __cap_rights_get(int version, int fd, cap_rights_t *rightsp); } SYS_CAP_ENTER = 516 // { int cap_enter(void); } SYS_CAP_GETMODE = 517 // { int cap_getmode(u_int *modep); } SYS_PDFORK = 518 // { int pdfork(int *fdp, int flags); } SYS_PDKILL = 519 // { int pdkill(int fd, int signum); } SYS_PDGETPID = 520 // { int pdgetpid(int fd, pid_t *pidp); } - SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, \ - SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, \ + SYS_PSELECT = 522 // { int pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *sm); } + SYS_GETLOGINCLASS = 523 // { int getloginclass(char *namebuf, size_t namelen); } SYS_SETLOGINCLASS = 524 // { int setloginclass(const char *namebuf); } - SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, \ - SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, \ - SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, \ - SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, \ - SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, \ - SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, \ - SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, \ - SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, \ - SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, \ - SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, \ - SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, \ - SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, \ - SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, \ - SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, \ - SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, \ - SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, \ - SYS_ACCEPT4 = 541 // { int accept4(int s, \ + SYS_RCTL_GET_RACCT = 525 // { int rctl_get_racct(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_GET_RULES = 526 // { int rctl_get_rules(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_GET_LIMITS = 527 // { int rctl_get_limits(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_ADD_RULE = 528 // { int rctl_add_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_RCTL_REMOVE_RULE = 529 // { int rctl_remove_rule(const void *inbufp, size_t inbuflen, void *outbufp, size_t outbuflen); } + SYS_POSIX_FALLOCATE = 530 // { int posix_fallocate(int fd, off_t offset, off_t len); } + SYS_POSIX_FADVISE = 531 // { int posix_fadvise(int fd, off_t offset, off_t len, int advice); } + SYS_WAIT6 = 532 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } + SYS_CAP_RIGHTS_LIMIT = 533 // { int cap_rights_limit(int fd, cap_rights_t *rightsp); } + SYS_CAP_IOCTLS_LIMIT = 534 // { int cap_ioctls_limit(int fd, const u_long *cmds, size_t ncmds); } + SYS_CAP_IOCTLS_GET = 535 // { ssize_t cap_ioctls_get(int fd, u_long *cmds, size_t maxcmds); } + SYS_CAP_FCNTLS_LIMIT = 536 // { int cap_fcntls_limit(int fd, uint32_t fcntlrights); } + SYS_CAP_FCNTLS_GET = 537 // { int cap_fcntls_get(int fd, uint32_t *fcntlrightsp); } + SYS_BINDAT = 538 // { int bindat(int fd, int s, caddr_t name, int namelen); } + SYS_CONNECTAT = 539 // { int connectat(int fd, int s, caddr_t name, int namelen); } + SYS_CHFLAGSAT = 540 // { int chflagsat(int fd, const char *path, u_long flags, int atflag); } + SYS_ACCEPT4 = 541 // { int accept4(int s, struct sockaddr * __restrict name, __socklen_t * __restrict anamelen, int flags); } SYS_PIPE2 = 542 // { int pipe2(int *fildes, int flags); } SYS_AIO_MLOCK = 543 // { int aio_mlock(struct aiocb *aiocbp); } - SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, \ - SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, \ - SYS_FUTIMENS = 546 // { int futimens(int fd, \ - SYS_UTIMENSAT = 547 // { int utimensat(int fd, \ - SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, \ - SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, \ + SYS_PROCCTL = 544 // { int procctl(idtype_t idtype, id_t id, int com, void *data); } + SYS_PPOLL = 545 // { int ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *set); } + SYS_FUTIMENS = 546 // { int futimens(int fd, struct timespec *times); } + SYS_UTIMENSAT = 547 // { int utimensat(int fd, char *path, struct timespec *times, int flag); } + SYS_NUMA_GETAFFINITY = 548 // { int numa_getaffinity(cpuwhich_t which, id_t id, struct vm_domain_policy_entry *policy); } + SYS_NUMA_SETAFFINITY = 549 // { int numa_setaffinity(cpuwhich_t which, id_t id, const struct vm_domain_policy_entry *policy); } SYS_FDATASYNC = 550 // { int fdatasync(int fd); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 8d17873d..e869c060 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -6,387 +6,427 @@ package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86OLD = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_VM86 = 166 - SYS_QUERY_MODULE = 167 - SYS_POLL = 168 - SYS_NFSSERVCTL = 169 - SYS_SETRESGID = 170 - SYS_GETRESGID = 171 - SYS_PRCTL = 172 - SYS_RT_SIGRETURN = 173 - SYS_RT_SIGACTION = 174 - SYS_RT_SIGPROCMASK = 175 - SYS_RT_SIGPENDING = 176 - SYS_RT_SIGTIMEDWAIT = 177 - SYS_RT_SIGQUEUEINFO = 178 - SYS_RT_SIGSUSPEND = 179 - SYS_PREAD64 = 180 - SYS_PWRITE64 = 181 - SYS_CHOWN = 182 - SYS_GETCWD = 183 - SYS_CAPGET = 184 - SYS_CAPSET = 185 - SYS_SIGALTSTACK = 186 - SYS_SENDFILE = 187 - SYS_GETPMSG = 188 - SYS_PUTPMSG = 189 - SYS_VFORK = 190 - SYS_UGETRLIMIT = 191 - SYS_MMAP2 = 192 - SYS_TRUNCATE64 = 193 - SYS_FTRUNCATE64 = 194 - SYS_STAT64 = 195 - SYS_LSTAT64 = 196 - SYS_FSTAT64 = 197 - SYS_LCHOWN32 = 198 - SYS_GETUID32 = 199 - SYS_GETGID32 = 200 - SYS_GETEUID32 = 201 - SYS_GETEGID32 = 202 - SYS_SETREUID32 = 203 - SYS_SETREGID32 = 204 - SYS_GETGROUPS32 = 205 - SYS_SETGROUPS32 = 206 - SYS_FCHOWN32 = 207 - SYS_SETRESUID32 = 208 - SYS_GETRESUID32 = 209 - SYS_SETRESGID32 = 210 - SYS_GETRESGID32 = 211 - SYS_CHOWN32 = 212 - SYS_SETUID32 = 213 - SYS_SETGID32 = 214 - SYS_SETFSUID32 = 215 - SYS_SETFSGID32 = 216 - SYS_PIVOT_ROOT = 217 - SYS_MINCORE = 218 - SYS_MADVISE = 219 - SYS_GETDENTS64 = 220 - SYS_FCNTL64 = 221 - SYS_GETTID = 224 - SYS_READAHEAD = 225 - SYS_SETXATTR = 226 - SYS_LSETXATTR = 227 - SYS_FSETXATTR = 228 - SYS_GETXATTR = 229 - SYS_LGETXATTR = 230 - SYS_FGETXATTR = 231 - SYS_LISTXATTR = 232 - SYS_LLISTXATTR = 233 - SYS_FLISTXATTR = 234 - SYS_REMOVEXATTR = 235 - SYS_LREMOVEXATTR = 236 - SYS_FREMOVEXATTR = 237 - SYS_TKILL = 238 - SYS_SENDFILE64 = 239 - SYS_FUTEX = 240 - SYS_SCHED_SETAFFINITY = 241 - SYS_SCHED_GETAFFINITY = 242 - SYS_SET_THREAD_AREA = 243 - SYS_GET_THREAD_AREA = 244 - SYS_IO_SETUP = 245 - SYS_IO_DESTROY = 246 - SYS_IO_GETEVENTS = 247 - SYS_IO_SUBMIT = 248 - SYS_IO_CANCEL = 249 - SYS_FADVISE64 = 250 - SYS_EXIT_GROUP = 252 - SYS_LOOKUP_DCOOKIE = 253 - SYS_EPOLL_CREATE = 254 - SYS_EPOLL_CTL = 255 - SYS_EPOLL_WAIT = 256 - SYS_REMAP_FILE_PAGES = 257 - SYS_SET_TID_ADDRESS = 258 - SYS_TIMER_CREATE = 259 - SYS_TIMER_SETTIME = 260 - SYS_TIMER_GETTIME = 261 - SYS_TIMER_GETOVERRUN = 262 - SYS_TIMER_DELETE = 263 - SYS_CLOCK_SETTIME = 264 - SYS_CLOCK_GETTIME = 265 - SYS_CLOCK_GETRES = 266 - SYS_CLOCK_NANOSLEEP = 267 - SYS_STATFS64 = 268 - SYS_FSTATFS64 = 269 - SYS_TGKILL = 270 - SYS_UTIMES = 271 - SYS_FADVISE64_64 = 272 - SYS_VSERVER = 273 - SYS_MBIND = 274 - SYS_GET_MEMPOLICY = 275 - SYS_SET_MEMPOLICY = 276 - SYS_MQ_OPEN = 277 - SYS_MQ_UNLINK = 278 - SYS_MQ_TIMEDSEND = 279 - SYS_MQ_TIMEDRECEIVE = 280 - SYS_MQ_NOTIFY = 281 - SYS_MQ_GETSETATTR = 282 - SYS_KEXEC_LOAD = 283 - SYS_WAITID = 284 - SYS_ADD_KEY = 286 - SYS_REQUEST_KEY = 287 - SYS_KEYCTL = 288 - SYS_IOPRIO_SET = 289 - SYS_IOPRIO_GET = 290 - SYS_INOTIFY_INIT = 291 - SYS_INOTIFY_ADD_WATCH = 292 - SYS_INOTIFY_RM_WATCH = 293 - SYS_MIGRATE_PAGES = 294 - SYS_OPENAT = 295 - SYS_MKDIRAT = 296 - SYS_MKNODAT = 297 - SYS_FCHOWNAT = 298 - SYS_FUTIMESAT = 299 - SYS_FSTATAT64 = 300 - SYS_UNLINKAT = 301 - SYS_RENAMEAT = 302 - SYS_LINKAT = 303 - SYS_SYMLINKAT = 304 - SYS_READLINKAT = 305 - SYS_FCHMODAT = 306 - SYS_FACCESSAT = 307 - SYS_PSELECT6 = 308 - SYS_PPOLL = 309 - SYS_UNSHARE = 310 - SYS_SET_ROBUST_LIST = 311 - SYS_GET_ROBUST_LIST = 312 - SYS_SPLICE = 313 - SYS_SYNC_FILE_RANGE = 314 - SYS_TEE = 315 - SYS_VMSPLICE = 316 - SYS_MOVE_PAGES = 317 - SYS_GETCPU = 318 - SYS_EPOLL_PWAIT = 319 - SYS_UTIMENSAT = 320 - SYS_SIGNALFD = 321 - SYS_TIMERFD_CREATE = 322 - SYS_EVENTFD = 323 - SYS_FALLOCATE = 324 - SYS_TIMERFD_SETTIME = 325 - SYS_TIMERFD_GETTIME = 326 - SYS_SIGNALFD4 = 327 - SYS_EVENTFD2 = 328 - SYS_EPOLL_CREATE1 = 329 - SYS_DUP3 = 330 - SYS_PIPE2 = 331 - SYS_INOTIFY_INIT1 = 332 - SYS_PREADV = 333 - SYS_PWRITEV = 334 - SYS_RT_TGSIGQUEUEINFO = 335 - SYS_PERF_EVENT_OPEN = 336 - SYS_RECVMMSG = 337 - SYS_FANOTIFY_INIT = 338 - SYS_FANOTIFY_MARK = 339 - SYS_PRLIMIT64 = 340 - SYS_NAME_TO_HANDLE_AT = 341 - SYS_OPEN_BY_HANDLE_AT = 342 - SYS_CLOCK_ADJTIME = 343 - SYS_SYNCFS = 344 - SYS_SENDMMSG = 345 - SYS_SETNS = 346 - SYS_PROCESS_VM_READV = 347 - SYS_PROCESS_VM_WRITEV = 348 - SYS_KCMP = 349 - SYS_FINIT_MODULE = 350 - SYS_SCHED_SETATTR = 351 - SYS_SCHED_GETATTR = 352 - SYS_RENAMEAT2 = 353 - SYS_SECCOMP = 354 - SYS_GETRANDOM = 355 - SYS_MEMFD_CREATE = 356 - SYS_BPF = 357 - SYS_EXECVEAT = 358 - SYS_SOCKET = 359 - SYS_SOCKETPAIR = 360 - SYS_BIND = 361 - SYS_CONNECT = 362 - SYS_LISTEN = 363 - SYS_ACCEPT4 = 364 - SYS_GETSOCKOPT = 365 - SYS_SETSOCKOPT = 366 - SYS_GETSOCKNAME = 367 - SYS_GETPEERNAME = 368 - SYS_SENDTO = 369 - SYS_SENDMSG = 370 - SYS_RECVFROM = 371 - SYS_RECVMSG = 372 - SYS_SHUTDOWN = 373 - SYS_USERFAULTFD = 374 - SYS_MEMBARRIER = 375 - SYS_MLOCK2 = 376 - SYS_COPY_FILE_RANGE = 377 - SYS_PREADV2 = 378 - SYS_PWRITEV2 = 379 - SYS_PKEY_MPROTECT = 380 - SYS_PKEY_ALLOC = 381 - SYS_PKEY_FREE = 382 - SYS_STATX = 383 - SYS_ARCH_PRCTL = 384 - SYS_IO_PGETEVENTS = 385 - SYS_RSEQ = 386 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86OLD = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_VM86 = 166 + SYS_QUERY_MODULE = 167 + SYS_POLL = 168 + SYS_NFSSERVCTL = 169 + SYS_SETRESGID = 170 + SYS_GETRESGID = 171 + SYS_PRCTL = 172 + SYS_RT_SIGRETURN = 173 + SYS_RT_SIGACTION = 174 + SYS_RT_SIGPROCMASK = 175 + SYS_RT_SIGPENDING = 176 + SYS_RT_SIGTIMEDWAIT = 177 + SYS_RT_SIGQUEUEINFO = 178 + SYS_RT_SIGSUSPEND = 179 + SYS_PREAD64 = 180 + SYS_PWRITE64 = 181 + SYS_CHOWN = 182 + SYS_GETCWD = 183 + SYS_CAPGET = 184 + SYS_CAPSET = 185 + SYS_SIGALTSTACK = 186 + SYS_SENDFILE = 187 + SYS_GETPMSG = 188 + SYS_PUTPMSG = 189 + SYS_VFORK = 190 + SYS_UGETRLIMIT = 191 + SYS_MMAP2 = 192 + SYS_TRUNCATE64 = 193 + SYS_FTRUNCATE64 = 194 + SYS_STAT64 = 195 + SYS_LSTAT64 = 196 + SYS_FSTAT64 = 197 + SYS_LCHOWN32 = 198 + SYS_GETUID32 = 199 + SYS_GETGID32 = 200 + SYS_GETEUID32 = 201 + SYS_GETEGID32 = 202 + SYS_SETREUID32 = 203 + SYS_SETREGID32 = 204 + SYS_GETGROUPS32 = 205 + SYS_SETGROUPS32 = 206 + SYS_FCHOWN32 = 207 + SYS_SETRESUID32 = 208 + SYS_GETRESUID32 = 209 + SYS_SETRESGID32 = 210 + SYS_GETRESGID32 = 211 + SYS_CHOWN32 = 212 + SYS_SETUID32 = 213 + SYS_SETGID32 = 214 + SYS_SETFSUID32 = 215 + SYS_SETFSGID32 = 216 + SYS_PIVOT_ROOT = 217 + SYS_MINCORE = 218 + SYS_MADVISE = 219 + SYS_GETDENTS64 = 220 + SYS_FCNTL64 = 221 + SYS_GETTID = 224 + SYS_READAHEAD = 225 + SYS_SETXATTR = 226 + SYS_LSETXATTR = 227 + SYS_FSETXATTR = 228 + SYS_GETXATTR = 229 + SYS_LGETXATTR = 230 + SYS_FGETXATTR = 231 + SYS_LISTXATTR = 232 + SYS_LLISTXATTR = 233 + SYS_FLISTXATTR = 234 + SYS_REMOVEXATTR = 235 + SYS_LREMOVEXATTR = 236 + SYS_FREMOVEXATTR = 237 + SYS_TKILL = 238 + SYS_SENDFILE64 = 239 + SYS_FUTEX = 240 + SYS_SCHED_SETAFFINITY = 241 + SYS_SCHED_GETAFFINITY = 242 + SYS_SET_THREAD_AREA = 243 + SYS_GET_THREAD_AREA = 244 + SYS_IO_SETUP = 245 + SYS_IO_DESTROY = 246 + SYS_IO_GETEVENTS = 247 + SYS_IO_SUBMIT = 248 + SYS_IO_CANCEL = 249 + SYS_FADVISE64 = 250 + SYS_EXIT_GROUP = 252 + SYS_LOOKUP_DCOOKIE = 253 + SYS_EPOLL_CREATE = 254 + SYS_EPOLL_CTL = 255 + SYS_EPOLL_WAIT = 256 + SYS_REMAP_FILE_PAGES = 257 + SYS_SET_TID_ADDRESS = 258 + SYS_TIMER_CREATE = 259 + SYS_TIMER_SETTIME = 260 + SYS_TIMER_GETTIME = 261 + SYS_TIMER_GETOVERRUN = 262 + SYS_TIMER_DELETE = 263 + SYS_CLOCK_SETTIME = 264 + SYS_CLOCK_GETTIME = 265 + SYS_CLOCK_GETRES = 266 + SYS_CLOCK_NANOSLEEP = 267 + SYS_STATFS64 = 268 + SYS_FSTATFS64 = 269 + SYS_TGKILL = 270 + SYS_UTIMES = 271 + SYS_FADVISE64_64 = 272 + SYS_VSERVER = 273 + SYS_MBIND = 274 + SYS_GET_MEMPOLICY = 275 + SYS_SET_MEMPOLICY = 276 + SYS_MQ_OPEN = 277 + SYS_MQ_UNLINK = 278 + SYS_MQ_TIMEDSEND = 279 + SYS_MQ_TIMEDRECEIVE = 280 + SYS_MQ_NOTIFY = 281 + SYS_MQ_GETSETATTR = 282 + SYS_KEXEC_LOAD = 283 + SYS_WAITID = 284 + SYS_ADD_KEY = 286 + SYS_REQUEST_KEY = 287 + SYS_KEYCTL = 288 + SYS_IOPRIO_SET = 289 + SYS_IOPRIO_GET = 290 + SYS_INOTIFY_INIT = 291 + SYS_INOTIFY_ADD_WATCH = 292 + SYS_INOTIFY_RM_WATCH = 293 + SYS_MIGRATE_PAGES = 294 + SYS_OPENAT = 295 + SYS_MKDIRAT = 296 + SYS_MKNODAT = 297 + SYS_FCHOWNAT = 298 + SYS_FUTIMESAT = 299 + SYS_FSTATAT64 = 300 + SYS_UNLINKAT = 301 + SYS_RENAMEAT = 302 + SYS_LINKAT = 303 + SYS_SYMLINKAT = 304 + SYS_READLINKAT = 305 + SYS_FCHMODAT = 306 + SYS_FACCESSAT = 307 + SYS_PSELECT6 = 308 + SYS_PPOLL = 309 + SYS_UNSHARE = 310 + SYS_SET_ROBUST_LIST = 311 + SYS_GET_ROBUST_LIST = 312 + SYS_SPLICE = 313 + SYS_SYNC_FILE_RANGE = 314 + SYS_TEE = 315 + SYS_VMSPLICE = 316 + SYS_MOVE_PAGES = 317 + SYS_GETCPU = 318 + SYS_EPOLL_PWAIT = 319 + SYS_UTIMENSAT = 320 + SYS_SIGNALFD = 321 + SYS_TIMERFD_CREATE = 322 + SYS_EVENTFD = 323 + SYS_FALLOCATE = 324 + SYS_TIMERFD_SETTIME = 325 + SYS_TIMERFD_GETTIME = 326 + SYS_SIGNALFD4 = 327 + SYS_EVENTFD2 = 328 + SYS_EPOLL_CREATE1 = 329 + SYS_DUP3 = 330 + SYS_PIPE2 = 331 + SYS_INOTIFY_INIT1 = 332 + SYS_PREADV = 333 + SYS_PWRITEV = 334 + SYS_RT_TGSIGQUEUEINFO = 335 + SYS_PERF_EVENT_OPEN = 336 + SYS_RECVMMSG = 337 + SYS_FANOTIFY_INIT = 338 + SYS_FANOTIFY_MARK = 339 + SYS_PRLIMIT64 = 340 + SYS_NAME_TO_HANDLE_AT = 341 + SYS_OPEN_BY_HANDLE_AT = 342 + SYS_CLOCK_ADJTIME = 343 + SYS_SYNCFS = 344 + SYS_SENDMMSG = 345 + SYS_SETNS = 346 + SYS_PROCESS_VM_READV = 347 + SYS_PROCESS_VM_WRITEV = 348 + SYS_KCMP = 349 + SYS_FINIT_MODULE = 350 + SYS_SCHED_SETATTR = 351 + SYS_SCHED_GETATTR = 352 + SYS_RENAMEAT2 = 353 + SYS_SECCOMP = 354 + SYS_GETRANDOM = 355 + SYS_MEMFD_CREATE = 356 + SYS_BPF = 357 + SYS_EXECVEAT = 358 + SYS_SOCKET = 359 + SYS_SOCKETPAIR = 360 + SYS_BIND = 361 + SYS_CONNECT = 362 + SYS_LISTEN = 363 + SYS_ACCEPT4 = 364 + SYS_GETSOCKOPT = 365 + SYS_SETSOCKOPT = 366 + SYS_GETSOCKNAME = 367 + SYS_GETPEERNAME = 368 + SYS_SENDTO = 369 + SYS_SENDMSG = 370 + SYS_RECVFROM = 371 + SYS_RECVMSG = 372 + SYS_SHUTDOWN = 373 + SYS_USERFAULTFD = 374 + SYS_MEMBARRIER = 375 + SYS_MLOCK2 = 376 + SYS_COPY_FILE_RANGE = 377 + SYS_PREADV2 = 378 + SYS_PWRITEV2 = 379 + SYS_PKEY_MPROTECT = 380 + SYS_PKEY_ALLOC = 381 + SYS_PKEY_FREE = 382 + SYS_STATX = 383 + SYS_ARCH_PRCTL = 384 + SYS_IO_PGETEVENTS = 385 + SYS_RSEQ = 386 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_CLOCK_GETTIME64 = 403 + SYS_CLOCK_SETTIME64 = 404 + SYS_CLOCK_ADJTIME64 = 405 + SYS_CLOCK_GETRES_TIME64 = 406 + SYS_CLOCK_NANOSLEEP_TIME64 = 407 + SYS_TIMER_GETTIME64 = 408 + SYS_TIMER_SETTIME64 = 409 + SYS_TIMERFD_GETTIME64 = 410 + SYS_TIMERFD_SETTIME64 = 411 + SYS_UTIMENSAT_TIME64 = 412 + SYS_PSELECT6_TIME64 = 413 + SYS_PPOLL_TIME64 = 414 + SYS_IO_PGETEVENTS_TIME64 = 416 + SYS_RECVMMSG_TIME64 = 417 + SYS_MQ_TIMEDSEND_TIME64 = 418 + SYS_MQ_TIMEDRECEIVE_TIME64 = 419 + SYS_SEMTIMEDOP_TIME64 = 420 + SYS_RT_SIGTIMEDWAIT_TIME64 = 421 + SYS_FUTEX_TIME64 = 422 + SYS_SCHED_RR_GET_INTERVAL_TIME64 = 423 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index b3d8ad79..4917b8ab 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -341,4 +341,14 @@ const ( SYS_STATX = 332 SYS_IO_PGETEVENTS = 333 SYS_RSEQ = 334 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index e092822f..f85fcb4f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -6,359 +6,391 @@ package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_PTRACE = 26 - SYS_PAUSE = 29 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_SETPGID = 57 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SYMLINK = 83 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_VHANGUP = 111 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_POLL = 168 - SYS_NFSSERVCTL = 169 - SYS_SETRESGID = 170 - SYS_GETRESGID = 171 - SYS_PRCTL = 172 - SYS_RT_SIGRETURN = 173 - SYS_RT_SIGACTION = 174 - SYS_RT_SIGPROCMASK = 175 - SYS_RT_SIGPENDING = 176 - SYS_RT_SIGTIMEDWAIT = 177 - SYS_RT_SIGQUEUEINFO = 178 - SYS_RT_SIGSUSPEND = 179 - SYS_PREAD64 = 180 - SYS_PWRITE64 = 181 - SYS_CHOWN = 182 - SYS_GETCWD = 183 - SYS_CAPGET = 184 - SYS_CAPSET = 185 - SYS_SIGALTSTACK = 186 - SYS_SENDFILE = 187 - SYS_VFORK = 190 - SYS_UGETRLIMIT = 191 - SYS_MMAP2 = 192 - SYS_TRUNCATE64 = 193 - SYS_FTRUNCATE64 = 194 - SYS_STAT64 = 195 - SYS_LSTAT64 = 196 - SYS_FSTAT64 = 197 - SYS_LCHOWN32 = 198 - SYS_GETUID32 = 199 - SYS_GETGID32 = 200 - SYS_GETEUID32 = 201 - SYS_GETEGID32 = 202 - SYS_SETREUID32 = 203 - SYS_SETREGID32 = 204 - SYS_GETGROUPS32 = 205 - SYS_SETGROUPS32 = 206 - SYS_FCHOWN32 = 207 - SYS_SETRESUID32 = 208 - SYS_GETRESUID32 = 209 - SYS_SETRESGID32 = 210 - SYS_GETRESGID32 = 211 - SYS_CHOWN32 = 212 - SYS_SETUID32 = 213 - SYS_SETGID32 = 214 - SYS_SETFSUID32 = 215 - SYS_SETFSGID32 = 216 - SYS_GETDENTS64 = 217 - SYS_PIVOT_ROOT = 218 - SYS_MINCORE = 219 - SYS_MADVISE = 220 - SYS_FCNTL64 = 221 - SYS_GETTID = 224 - SYS_READAHEAD = 225 - SYS_SETXATTR = 226 - SYS_LSETXATTR = 227 - SYS_FSETXATTR = 228 - SYS_GETXATTR = 229 - SYS_LGETXATTR = 230 - SYS_FGETXATTR = 231 - SYS_LISTXATTR = 232 - SYS_LLISTXATTR = 233 - SYS_FLISTXATTR = 234 - SYS_REMOVEXATTR = 235 - SYS_LREMOVEXATTR = 236 - SYS_FREMOVEXATTR = 237 - SYS_TKILL = 238 - SYS_SENDFILE64 = 239 - SYS_FUTEX = 240 - SYS_SCHED_SETAFFINITY = 241 - SYS_SCHED_GETAFFINITY = 242 - SYS_IO_SETUP = 243 - SYS_IO_DESTROY = 244 - SYS_IO_GETEVENTS = 245 - SYS_IO_SUBMIT = 246 - SYS_IO_CANCEL = 247 - SYS_EXIT_GROUP = 248 - SYS_LOOKUP_DCOOKIE = 249 - SYS_EPOLL_CREATE = 250 - SYS_EPOLL_CTL = 251 - SYS_EPOLL_WAIT = 252 - SYS_REMAP_FILE_PAGES = 253 - SYS_SET_TID_ADDRESS = 256 - SYS_TIMER_CREATE = 257 - SYS_TIMER_SETTIME = 258 - SYS_TIMER_GETTIME = 259 - SYS_TIMER_GETOVERRUN = 260 - SYS_TIMER_DELETE = 261 - SYS_CLOCK_SETTIME = 262 - SYS_CLOCK_GETTIME = 263 - SYS_CLOCK_GETRES = 264 - SYS_CLOCK_NANOSLEEP = 265 - SYS_STATFS64 = 266 - SYS_FSTATFS64 = 267 - SYS_TGKILL = 268 - SYS_UTIMES = 269 - SYS_ARM_FADVISE64_64 = 270 - SYS_PCICONFIG_IOBASE = 271 - SYS_PCICONFIG_READ = 272 - SYS_PCICONFIG_WRITE = 273 - SYS_MQ_OPEN = 274 - SYS_MQ_UNLINK = 275 - SYS_MQ_TIMEDSEND = 276 - SYS_MQ_TIMEDRECEIVE = 277 - SYS_MQ_NOTIFY = 278 - SYS_MQ_GETSETATTR = 279 - SYS_WAITID = 280 - SYS_SOCKET = 281 - SYS_BIND = 282 - SYS_CONNECT = 283 - SYS_LISTEN = 284 - SYS_ACCEPT = 285 - SYS_GETSOCKNAME = 286 - SYS_GETPEERNAME = 287 - SYS_SOCKETPAIR = 288 - SYS_SEND = 289 - SYS_SENDTO = 290 - SYS_RECV = 291 - SYS_RECVFROM = 292 - SYS_SHUTDOWN = 293 - SYS_SETSOCKOPT = 294 - SYS_GETSOCKOPT = 295 - SYS_SENDMSG = 296 - SYS_RECVMSG = 297 - SYS_SEMOP = 298 - SYS_SEMGET = 299 - SYS_SEMCTL = 300 - SYS_MSGSND = 301 - SYS_MSGRCV = 302 - SYS_MSGGET = 303 - SYS_MSGCTL = 304 - SYS_SHMAT = 305 - SYS_SHMDT = 306 - SYS_SHMGET = 307 - SYS_SHMCTL = 308 - SYS_ADD_KEY = 309 - SYS_REQUEST_KEY = 310 - SYS_KEYCTL = 311 - SYS_SEMTIMEDOP = 312 - SYS_VSERVER = 313 - SYS_IOPRIO_SET = 314 - SYS_IOPRIO_GET = 315 - SYS_INOTIFY_INIT = 316 - SYS_INOTIFY_ADD_WATCH = 317 - SYS_INOTIFY_RM_WATCH = 318 - SYS_MBIND = 319 - SYS_GET_MEMPOLICY = 320 - SYS_SET_MEMPOLICY = 321 - SYS_OPENAT = 322 - SYS_MKDIRAT = 323 - SYS_MKNODAT = 324 - SYS_FCHOWNAT = 325 - SYS_FUTIMESAT = 326 - SYS_FSTATAT64 = 327 - SYS_UNLINKAT = 328 - SYS_RENAMEAT = 329 - SYS_LINKAT = 330 - SYS_SYMLINKAT = 331 - SYS_READLINKAT = 332 - SYS_FCHMODAT = 333 - SYS_FACCESSAT = 334 - SYS_PSELECT6 = 335 - SYS_PPOLL = 336 - SYS_UNSHARE = 337 - SYS_SET_ROBUST_LIST = 338 - SYS_GET_ROBUST_LIST = 339 - SYS_SPLICE = 340 - SYS_ARM_SYNC_FILE_RANGE = 341 - SYS_TEE = 342 - SYS_VMSPLICE = 343 - SYS_MOVE_PAGES = 344 - SYS_GETCPU = 345 - SYS_EPOLL_PWAIT = 346 - SYS_KEXEC_LOAD = 347 - SYS_UTIMENSAT = 348 - SYS_SIGNALFD = 349 - SYS_TIMERFD_CREATE = 350 - SYS_EVENTFD = 351 - SYS_FALLOCATE = 352 - SYS_TIMERFD_SETTIME = 353 - SYS_TIMERFD_GETTIME = 354 - SYS_SIGNALFD4 = 355 - SYS_EVENTFD2 = 356 - SYS_EPOLL_CREATE1 = 357 - SYS_DUP3 = 358 - SYS_PIPE2 = 359 - SYS_INOTIFY_INIT1 = 360 - SYS_PREADV = 361 - SYS_PWRITEV = 362 - SYS_RT_TGSIGQUEUEINFO = 363 - SYS_PERF_EVENT_OPEN = 364 - SYS_RECVMMSG = 365 - SYS_ACCEPT4 = 366 - SYS_FANOTIFY_INIT = 367 - SYS_FANOTIFY_MARK = 368 - SYS_PRLIMIT64 = 369 - SYS_NAME_TO_HANDLE_AT = 370 - SYS_OPEN_BY_HANDLE_AT = 371 - SYS_CLOCK_ADJTIME = 372 - SYS_SYNCFS = 373 - SYS_SENDMMSG = 374 - SYS_SETNS = 375 - SYS_PROCESS_VM_READV = 376 - SYS_PROCESS_VM_WRITEV = 377 - SYS_KCMP = 378 - SYS_FINIT_MODULE = 379 - SYS_SCHED_SETATTR = 380 - SYS_SCHED_GETATTR = 381 - SYS_RENAMEAT2 = 382 - SYS_SECCOMP = 383 - SYS_GETRANDOM = 384 - SYS_MEMFD_CREATE = 385 - SYS_BPF = 386 - SYS_EXECVEAT = 387 - SYS_USERFAULTFD = 388 - SYS_MEMBARRIER = 389 - SYS_MLOCK2 = 390 - SYS_COPY_FILE_RANGE = 391 - SYS_PREADV2 = 392 - SYS_PWRITEV2 = 393 - SYS_PKEY_MPROTECT = 394 - SYS_PKEY_ALLOC = 395 - SYS_PKEY_FREE = 396 - SYS_STATX = 397 - SYS_RSEQ = 398 - SYS_IO_PGETEVENTS = 399 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_PTRACE = 26 + SYS_PAUSE = 29 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_SETPGID = 57 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SYMLINK = 83 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_VHANGUP = 111 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_POLL = 168 + SYS_NFSSERVCTL = 169 + SYS_SETRESGID = 170 + SYS_GETRESGID = 171 + SYS_PRCTL = 172 + SYS_RT_SIGRETURN = 173 + SYS_RT_SIGACTION = 174 + SYS_RT_SIGPROCMASK = 175 + SYS_RT_SIGPENDING = 176 + SYS_RT_SIGTIMEDWAIT = 177 + SYS_RT_SIGQUEUEINFO = 178 + SYS_RT_SIGSUSPEND = 179 + SYS_PREAD64 = 180 + SYS_PWRITE64 = 181 + SYS_CHOWN = 182 + SYS_GETCWD = 183 + SYS_CAPGET = 184 + SYS_CAPSET = 185 + SYS_SIGALTSTACK = 186 + SYS_SENDFILE = 187 + SYS_VFORK = 190 + SYS_UGETRLIMIT = 191 + SYS_MMAP2 = 192 + SYS_TRUNCATE64 = 193 + SYS_FTRUNCATE64 = 194 + SYS_STAT64 = 195 + SYS_LSTAT64 = 196 + SYS_FSTAT64 = 197 + SYS_LCHOWN32 = 198 + SYS_GETUID32 = 199 + SYS_GETGID32 = 200 + SYS_GETEUID32 = 201 + SYS_GETEGID32 = 202 + SYS_SETREUID32 = 203 + SYS_SETREGID32 = 204 + SYS_GETGROUPS32 = 205 + SYS_SETGROUPS32 = 206 + SYS_FCHOWN32 = 207 + SYS_SETRESUID32 = 208 + SYS_GETRESUID32 = 209 + SYS_SETRESGID32 = 210 + SYS_GETRESGID32 = 211 + SYS_CHOWN32 = 212 + SYS_SETUID32 = 213 + SYS_SETGID32 = 214 + SYS_SETFSUID32 = 215 + SYS_SETFSGID32 = 216 + SYS_GETDENTS64 = 217 + SYS_PIVOT_ROOT = 218 + SYS_MINCORE = 219 + SYS_MADVISE = 220 + SYS_FCNTL64 = 221 + SYS_GETTID = 224 + SYS_READAHEAD = 225 + SYS_SETXATTR = 226 + SYS_LSETXATTR = 227 + SYS_FSETXATTR = 228 + SYS_GETXATTR = 229 + SYS_LGETXATTR = 230 + SYS_FGETXATTR = 231 + SYS_LISTXATTR = 232 + SYS_LLISTXATTR = 233 + SYS_FLISTXATTR = 234 + SYS_REMOVEXATTR = 235 + SYS_LREMOVEXATTR = 236 + SYS_FREMOVEXATTR = 237 + SYS_TKILL = 238 + SYS_SENDFILE64 = 239 + SYS_FUTEX = 240 + SYS_SCHED_SETAFFINITY = 241 + SYS_SCHED_GETAFFINITY = 242 + SYS_IO_SETUP = 243 + SYS_IO_DESTROY = 244 + SYS_IO_GETEVENTS = 245 + SYS_IO_SUBMIT = 246 + SYS_IO_CANCEL = 247 + SYS_EXIT_GROUP = 248 + SYS_LOOKUP_DCOOKIE = 249 + SYS_EPOLL_CREATE = 250 + SYS_EPOLL_CTL = 251 + SYS_EPOLL_WAIT = 252 + SYS_REMAP_FILE_PAGES = 253 + SYS_SET_TID_ADDRESS = 256 + SYS_TIMER_CREATE = 257 + SYS_TIMER_SETTIME = 258 + SYS_TIMER_GETTIME = 259 + SYS_TIMER_GETOVERRUN = 260 + SYS_TIMER_DELETE = 261 + SYS_CLOCK_SETTIME = 262 + SYS_CLOCK_GETTIME = 263 + SYS_CLOCK_GETRES = 264 + SYS_CLOCK_NANOSLEEP = 265 + SYS_STATFS64 = 266 + SYS_FSTATFS64 = 267 + SYS_TGKILL = 268 + SYS_UTIMES = 269 + SYS_ARM_FADVISE64_64 = 270 + SYS_PCICONFIG_IOBASE = 271 + SYS_PCICONFIG_READ = 272 + SYS_PCICONFIG_WRITE = 273 + SYS_MQ_OPEN = 274 + SYS_MQ_UNLINK = 275 + SYS_MQ_TIMEDSEND = 276 + SYS_MQ_TIMEDRECEIVE = 277 + SYS_MQ_NOTIFY = 278 + SYS_MQ_GETSETATTR = 279 + SYS_WAITID = 280 + SYS_SOCKET = 281 + SYS_BIND = 282 + SYS_CONNECT = 283 + SYS_LISTEN = 284 + SYS_ACCEPT = 285 + SYS_GETSOCKNAME = 286 + SYS_GETPEERNAME = 287 + SYS_SOCKETPAIR = 288 + SYS_SEND = 289 + SYS_SENDTO = 290 + SYS_RECV = 291 + SYS_RECVFROM = 292 + SYS_SHUTDOWN = 293 + SYS_SETSOCKOPT = 294 + SYS_GETSOCKOPT = 295 + SYS_SENDMSG = 296 + SYS_RECVMSG = 297 + SYS_SEMOP = 298 + SYS_SEMGET = 299 + SYS_SEMCTL = 300 + SYS_MSGSND = 301 + SYS_MSGRCV = 302 + SYS_MSGGET = 303 + SYS_MSGCTL = 304 + SYS_SHMAT = 305 + SYS_SHMDT = 306 + SYS_SHMGET = 307 + SYS_SHMCTL = 308 + SYS_ADD_KEY = 309 + SYS_REQUEST_KEY = 310 + SYS_KEYCTL = 311 + SYS_SEMTIMEDOP = 312 + SYS_VSERVER = 313 + SYS_IOPRIO_SET = 314 + SYS_IOPRIO_GET = 315 + SYS_INOTIFY_INIT = 316 + SYS_INOTIFY_ADD_WATCH = 317 + SYS_INOTIFY_RM_WATCH = 318 + SYS_MBIND = 319 + SYS_GET_MEMPOLICY = 320 + SYS_SET_MEMPOLICY = 321 + SYS_OPENAT = 322 + SYS_MKDIRAT = 323 + SYS_MKNODAT = 324 + SYS_FCHOWNAT = 325 + SYS_FUTIMESAT = 326 + SYS_FSTATAT64 = 327 + SYS_UNLINKAT = 328 + SYS_RENAMEAT = 329 + SYS_LINKAT = 330 + SYS_SYMLINKAT = 331 + SYS_READLINKAT = 332 + SYS_FCHMODAT = 333 + SYS_FACCESSAT = 334 + SYS_PSELECT6 = 335 + SYS_PPOLL = 336 + SYS_UNSHARE = 337 + SYS_SET_ROBUST_LIST = 338 + SYS_GET_ROBUST_LIST = 339 + SYS_SPLICE = 340 + SYS_ARM_SYNC_FILE_RANGE = 341 + SYS_TEE = 342 + SYS_VMSPLICE = 343 + SYS_MOVE_PAGES = 344 + SYS_GETCPU = 345 + SYS_EPOLL_PWAIT = 346 + SYS_KEXEC_LOAD = 347 + SYS_UTIMENSAT = 348 + SYS_SIGNALFD = 349 + SYS_TIMERFD_CREATE = 350 + SYS_EVENTFD = 351 + SYS_FALLOCATE = 352 + SYS_TIMERFD_SETTIME = 353 + SYS_TIMERFD_GETTIME = 354 + SYS_SIGNALFD4 = 355 + SYS_EVENTFD2 = 356 + SYS_EPOLL_CREATE1 = 357 + SYS_DUP3 = 358 + SYS_PIPE2 = 359 + SYS_INOTIFY_INIT1 = 360 + SYS_PREADV = 361 + SYS_PWRITEV = 362 + SYS_RT_TGSIGQUEUEINFO = 363 + SYS_PERF_EVENT_OPEN = 364 + SYS_RECVMMSG = 365 + SYS_ACCEPT4 = 366 + SYS_FANOTIFY_INIT = 367 + SYS_FANOTIFY_MARK = 368 + SYS_PRLIMIT64 = 369 + SYS_NAME_TO_HANDLE_AT = 370 + SYS_OPEN_BY_HANDLE_AT = 371 + SYS_CLOCK_ADJTIME = 372 + SYS_SYNCFS = 373 + SYS_SENDMMSG = 374 + SYS_SETNS = 375 + SYS_PROCESS_VM_READV = 376 + SYS_PROCESS_VM_WRITEV = 377 + SYS_KCMP = 378 + SYS_FINIT_MODULE = 379 + SYS_SCHED_SETATTR = 380 + SYS_SCHED_GETATTR = 381 + SYS_RENAMEAT2 = 382 + SYS_SECCOMP = 383 + SYS_GETRANDOM = 384 + SYS_MEMFD_CREATE = 385 + SYS_BPF = 386 + SYS_EXECVEAT = 387 + SYS_USERFAULTFD = 388 + SYS_MEMBARRIER = 389 + SYS_MLOCK2 = 390 + SYS_COPY_FILE_RANGE = 391 + SYS_PREADV2 = 392 + SYS_PWRITEV2 = 393 + SYS_PKEY_MPROTECT = 394 + SYS_PKEY_ALLOC = 395 + SYS_PKEY_FREE = 396 + SYS_STATX = 397 + SYS_RSEQ = 398 + SYS_IO_PGETEVENTS = 399 + SYS_MIGRATE_PAGES = 400 + SYS_KEXEC_FILE_LOAD = 401 + SYS_CLOCK_GETTIME64 = 403 + SYS_CLOCK_SETTIME64 = 404 + SYS_CLOCK_ADJTIME64 = 405 + SYS_CLOCK_GETRES_TIME64 = 406 + SYS_CLOCK_NANOSLEEP_TIME64 = 407 + SYS_TIMER_GETTIME64 = 408 + SYS_TIMER_SETTIME64 = 409 + SYS_TIMERFD_GETTIME64 = 410 + SYS_TIMERFD_SETTIME64 = 411 + SYS_UTIMENSAT_TIME64 = 412 + SYS_PSELECT6_TIME64 = 413 + SYS_PPOLL_TIME64 = 414 + SYS_IO_PGETEVENTS_TIME64 = 416 + SYS_RECVMMSG_TIME64 = 417 + SYS_MQ_TIMEDSEND_TIME64 = 418 + SYS_MQ_TIMEDRECEIVE_TIME64 = 419 + SYS_SEMTIMEDOP_TIME64 = 420 + SYS_RT_SIGTIMEDWAIT_TIME64 = 421 + SYS_FUTEX_TIME64 = 422 + SYS_SCHED_RR_GET_INTERVAL_TIME64 = 423 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index b81d508a..678a119b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -286,4 +286,14 @@ const ( SYS_IO_PGETEVENTS = 292 SYS_RSEQ = 293 SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 6893a5bd..222c9f9a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -6,372 +6,412 @@ package unix const ( - SYS_SYSCALL = 4000 - SYS_EXIT = 4001 - SYS_FORK = 4002 - SYS_READ = 4003 - SYS_WRITE = 4004 - SYS_OPEN = 4005 - SYS_CLOSE = 4006 - SYS_WAITPID = 4007 - SYS_CREAT = 4008 - SYS_LINK = 4009 - SYS_UNLINK = 4010 - SYS_EXECVE = 4011 - SYS_CHDIR = 4012 - SYS_TIME = 4013 - SYS_MKNOD = 4014 - SYS_CHMOD = 4015 - SYS_LCHOWN = 4016 - SYS_BREAK = 4017 - SYS_UNUSED18 = 4018 - SYS_LSEEK = 4019 - SYS_GETPID = 4020 - SYS_MOUNT = 4021 - SYS_UMOUNT = 4022 - SYS_SETUID = 4023 - SYS_GETUID = 4024 - SYS_STIME = 4025 - SYS_PTRACE = 4026 - SYS_ALARM = 4027 - SYS_UNUSED28 = 4028 - SYS_PAUSE = 4029 - SYS_UTIME = 4030 - SYS_STTY = 4031 - SYS_GTTY = 4032 - SYS_ACCESS = 4033 - SYS_NICE = 4034 - SYS_FTIME = 4035 - SYS_SYNC = 4036 - SYS_KILL = 4037 - SYS_RENAME = 4038 - SYS_MKDIR = 4039 - SYS_RMDIR = 4040 - SYS_DUP = 4041 - SYS_PIPE = 4042 - SYS_TIMES = 4043 - SYS_PROF = 4044 - SYS_BRK = 4045 - SYS_SETGID = 4046 - SYS_GETGID = 4047 - SYS_SIGNAL = 4048 - SYS_GETEUID = 4049 - SYS_GETEGID = 4050 - SYS_ACCT = 4051 - SYS_UMOUNT2 = 4052 - SYS_LOCK = 4053 - SYS_IOCTL = 4054 - SYS_FCNTL = 4055 - SYS_MPX = 4056 - SYS_SETPGID = 4057 - SYS_ULIMIT = 4058 - SYS_UNUSED59 = 4059 - SYS_UMASK = 4060 - SYS_CHROOT = 4061 - SYS_USTAT = 4062 - SYS_DUP2 = 4063 - SYS_GETPPID = 4064 - SYS_GETPGRP = 4065 - SYS_SETSID = 4066 - SYS_SIGACTION = 4067 - SYS_SGETMASK = 4068 - SYS_SSETMASK = 4069 - SYS_SETREUID = 4070 - SYS_SETREGID = 4071 - SYS_SIGSUSPEND = 4072 - SYS_SIGPENDING = 4073 - SYS_SETHOSTNAME = 4074 - SYS_SETRLIMIT = 4075 - SYS_GETRLIMIT = 4076 - SYS_GETRUSAGE = 4077 - SYS_GETTIMEOFDAY = 4078 - SYS_SETTIMEOFDAY = 4079 - SYS_GETGROUPS = 4080 - SYS_SETGROUPS = 4081 - SYS_RESERVED82 = 4082 - SYS_SYMLINK = 4083 - SYS_UNUSED84 = 4084 - SYS_READLINK = 4085 - SYS_USELIB = 4086 - SYS_SWAPON = 4087 - SYS_REBOOT = 4088 - SYS_READDIR = 4089 - SYS_MMAP = 4090 - SYS_MUNMAP = 4091 - SYS_TRUNCATE = 4092 - SYS_FTRUNCATE = 4093 - SYS_FCHMOD = 4094 - SYS_FCHOWN = 4095 - SYS_GETPRIORITY = 4096 - SYS_SETPRIORITY = 4097 - SYS_PROFIL = 4098 - SYS_STATFS = 4099 - SYS_FSTATFS = 4100 - SYS_IOPERM = 4101 - SYS_SOCKETCALL = 4102 - SYS_SYSLOG = 4103 - SYS_SETITIMER = 4104 - SYS_GETITIMER = 4105 - SYS_STAT = 4106 - SYS_LSTAT = 4107 - SYS_FSTAT = 4108 - SYS_UNUSED109 = 4109 - SYS_IOPL = 4110 - SYS_VHANGUP = 4111 - SYS_IDLE = 4112 - SYS_VM86 = 4113 - SYS_WAIT4 = 4114 - SYS_SWAPOFF = 4115 - SYS_SYSINFO = 4116 - SYS_IPC = 4117 - SYS_FSYNC = 4118 - SYS_SIGRETURN = 4119 - SYS_CLONE = 4120 - SYS_SETDOMAINNAME = 4121 - SYS_UNAME = 4122 - SYS_MODIFY_LDT = 4123 - SYS_ADJTIMEX = 4124 - SYS_MPROTECT = 4125 - SYS_SIGPROCMASK = 4126 - SYS_CREATE_MODULE = 4127 - SYS_INIT_MODULE = 4128 - SYS_DELETE_MODULE = 4129 - SYS_GET_KERNEL_SYMS = 4130 - SYS_QUOTACTL = 4131 - SYS_GETPGID = 4132 - SYS_FCHDIR = 4133 - SYS_BDFLUSH = 4134 - SYS_SYSFS = 4135 - SYS_PERSONALITY = 4136 - SYS_AFS_SYSCALL = 4137 - SYS_SETFSUID = 4138 - SYS_SETFSGID = 4139 - SYS__LLSEEK = 4140 - SYS_GETDENTS = 4141 - SYS__NEWSELECT = 4142 - SYS_FLOCK = 4143 - SYS_MSYNC = 4144 - SYS_READV = 4145 - SYS_WRITEV = 4146 - SYS_CACHEFLUSH = 4147 - SYS_CACHECTL = 4148 - SYS_SYSMIPS = 4149 - SYS_UNUSED150 = 4150 - SYS_GETSID = 4151 - SYS_FDATASYNC = 4152 - SYS__SYSCTL = 4153 - SYS_MLOCK = 4154 - SYS_MUNLOCK = 4155 - SYS_MLOCKALL = 4156 - SYS_MUNLOCKALL = 4157 - SYS_SCHED_SETPARAM = 4158 - SYS_SCHED_GETPARAM = 4159 - SYS_SCHED_SETSCHEDULER = 4160 - SYS_SCHED_GETSCHEDULER = 4161 - SYS_SCHED_YIELD = 4162 - SYS_SCHED_GET_PRIORITY_MAX = 4163 - SYS_SCHED_GET_PRIORITY_MIN = 4164 - SYS_SCHED_RR_GET_INTERVAL = 4165 - SYS_NANOSLEEP = 4166 - SYS_MREMAP = 4167 - SYS_ACCEPT = 4168 - SYS_BIND = 4169 - SYS_CONNECT = 4170 - SYS_GETPEERNAME = 4171 - SYS_GETSOCKNAME = 4172 - SYS_GETSOCKOPT = 4173 - SYS_LISTEN = 4174 - SYS_RECV = 4175 - SYS_RECVFROM = 4176 - SYS_RECVMSG = 4177 - SYS_SEND = 4178 - SYS_SENDMSG = 4179 - SYS_SENDTO = 4180 - SYS_SETSOCKOPT = 4181 - SYS_SHUTDOWN = 4182 - SYS_SOCKET = 4183 - SYS_SOCKETPAIR = 4184 - SYS_SETRESUID = 4185 - SYS_GETRESUID = 4186 - SYS_QUERY_MODULE = 4187 - SYS_POLL = 4188 - SYS_NFSSERVCTL = 4189 - SYS_SETRESGID = 4190 - SYS_GETRESGID = 4191 - SYS_PRCTL = 4192 - SYS_RT_SIGRETURN = 4193 - SYS_RT_SIGACTION = 4194 - SYS_RT_SIGPROCMASK = 4195 - SYS_RT_SIGPENDING = 4196 - SYS_RT_SIGTIMEDWAIT = 4197 - SYS_RT_SIGQUEUEINFO = 4198 - SYS_RT_SIGSUSPEND = 4199 - SYS_PREAD64 = 4200 - SYS_PWRITE64 = 4201 - SYS_CHOWN = 4202 - SYS_GETCWD = 4203 - SYS_CAPGET = 4204 - SYS_CAPSET = 4205 - SYS_SIGALTSTACK = 4206 - SYS_SENDFILE = 4207 - SYS_GETPMSG = 4208 - SYS_PUTPMSG = 4209 - SYS_MMAP2 = 4210 - SYS_TRUNCATE64 = 4211 - SYS_FTRUNCATE64 = 4212 - SYS_STAT64 = 4213 - SYS_LSTAT64 = 4214 - SYS_FSTAT64 = 4215 - SYS_PIVOT_ROOT = 4216 - SYS_MINCORE = 4217 - SYS_MADVISE = 4218 - SYS_GETDENTS64 = 4219 - SYS_FCNTL64 = 4220 - SYS_RESERVED221 = 4221 - SYS_GETTID = 4222 - SYS_READAHEAD = 4223 - SYS_SETXATTR = 4224 - SYS_LSETXATTR = 4225 - SYS_FSETXATTR = 4226 - SYS_GETXATTR = 4227 - SYS_LGETXATTR = 4228 - SYS_FGETXATTR = 4229 - SYS_LISTXATTR = 4230 - SYS_LLISTXATTR = 4231 - SYS_FLISTXATTR = 4232 - SYS_REMOVEXATTR = 4233 - SYS_LREMOVEXATTR = 4234 - SYS_FREMOVEXATTR = 4235 - SYS_TKILL = 4236 - SYS_SENDFILE64 = 4237 - SYS_FUTEX = 4238 - SYS_SCHED_SETAFFINITY = 4239 - SYS_SCHED_GETAFFINITY = 4240 - SYS_IO_SETUP = 4241 - SYS_IO_DESTROY = 4242 - SYS_IO_GETEVENTS = 4243 - SYS_IO_SUBMIT = 4244 - SYS_IO_CANCEL = 4245 - SYS_EXIT_GROUP = 4246 - SYS_LOOKUP_DCOOKIE = 4247 - SYS_EPOLL_CREATE = 4248 - SYS_EPOLL_CTL = 4249 - SYS_EPOLL_WAIT = 4250 - SYS_REMAP_FILE_PAGES = 4251 - SYS_SET_TID_ADDRESS = 4252 - SYS_RESTART_SYSCALL = 4253 - SYS_FADVISE64 = 4254 - SYS_STATFS64 = 4255 - SYS_FSTATFS64 = 4256 - SYS_TIMER_CREATE = 4257 - SYS_TIMER_SETTIME = 4258 - SYS_TIMER_GETTIME = 4259 - SYS_TIMER_GETOVERRUN = 4260 - SYS_TIMER_DELETE = 4261 - SYS_CLOCK_SETTIME = 4262 - SYS_CLOCK_GETTIME = 4263 - SYS_CLOCK_GETRES = 4264 - SYS_CLOCK_NANOSLEEP = 4265 - SYS_TGKILL = 4266 - SYS_UTIMES = 4267 - SYS_MBIND = 4268 - SYS_GET_MEMPOLICY = 4269 - SYS_SET_MEMPOLICY = 4270 - SYS_MQ_OPEN = 4271 - SYS_MQ_UNLINK = 4272 - SYS_MQ_TIMEDSEND = 4273 - SYS_MQ_TIMEDRECEIVE = 4274 - SYS_MQ_NOTIFY = 4275 - SYS_MQ_GETSETATTR = 4276 - SYS_VSERVER = 4277 - SYS_WAITID = 4278 - SYS_ADD_KEY = 4280 - SYS_REQUEST_KEY = 4281 - SYS_KEYCTL = 4282 - SYS_SET_THREAD_AREA = 4283 - SYS_INOTIFY_INIT = 4284 - SYS_INOTIFY_ADD_WATCH = 4285 - SYS_INOTIFY_RM_WATCH = 4286 - SYS_MIGRATE_PAGES = 4287 - SYS_OPENAT = 4288 - SYS_MKDIRAT = 4289 - SYS_MKNODAT = 4290 - SYS_FCHOWNAT = 4291 - SYS_FUTIMESAT = 4292 - SYS_FSTATAT64 = 4293 - SYS_UNLINKAT = 4294 - SYS_RENAMEAT = 4295 - SYS_LINKAT = 4296 - SYS_SYMLINKAT = 4297 - SYS_READLINKAT = 4298 - SYS_FCHMODAT = 4299 - SYS_FACCESSAT = 4300 - SYS_PSELECT6 = 4301 - SYS_PPOLL = 4302 - SYS_UNSHARE = 4303 - SYS_SPLICE = 4304 - SYS_SYNC_FILE_RANGE = 4305 - SYS_TEE = 4306 - SYS_VMSPLICE = 4307 - SYS_MOVE_PAGES = 4308 - SYS_SET_ROBUST_LIST = 4309 - SYS_GET_ROBUST_LIST = 4310 - SYS_KEXEC_LOAD = 4311 - SYS_GETCPU = 4312 - SYS_EPOLL_PWAIT = 4313 - SYS_IOPRIO_SET = 4314 - SYS_IOPRIO_GET = 4315 - SYS_UTIMENSAT = 4316 - SYS_SIGNALFD = 4317 - SYS_TIMERFD = 4318 - SYS_EVENTFD = 4319 - SYS_FALLOCATE = 4320 - SYS_TIMERFD_CREATE = 4321 - SYS_TIMERFD_GETTIME = 4322 - SYS_TIMERFD_SETTIME = 4323 - SYS_SIGNALFD4 = 4324 - SYS_EVENTFD2 = 4325 - SYS_EPOLL_CREATE1 = 4326 - SYS_DUP3 = 4327 - SYS_PIPE2 = 4328 - SYS_INOTIFY_INIT1 = 4329 - SYS_PREADV = 4330 - SYS_PWRITEV = 4331 - SYS_RT_TGSIGQUEUEINFO = 4332 - SYS_PERF_EVENT_OPEN = 4333 - SYS_ACCEPT4 = 4334 - SYS_RECVMMSG = 4335 - SYS_FANOTIFY_INIT = 4336 - SYS_FANOTIFY_MARK = 4337 - SYS_PRLIMIT64 = 4338 - SYS_NAME_TO_HANDLE_AT = 4339 - SYS_OPEN_BY_HANDLE_AT = 4340 - SYS_CLOCK_ADJTIME = 4341 - SYS_SYNCFS = 4342 - SYS_SENDMMSG = 4343 - SYS_SETNS = 4344 - SYS_PROCESS_VM_READV = 4345 - SYS_PROCESS_VM_WRITEV = 4346 - SYS_KCMP = 4347 - SYS_FINIT_MODULE = 4348 - SYS_SCHED_SETATTR = 4349 - SYS_SCHED_GETATTR = 4350 - SYS_RENAMEAT2 = 4351 - SYS_SECCOMP = 4352 - SYS_GETRANDOM = 4353 - SYS_MEMFD_CREATE = 4354 - SYS_BPF = 4355 - SYS_EXECVEAT = 4356 - SYS_USERFAULTFD = 4357 - SYS_MEMBARRIER = 4358 - SYS_MLOCK2 = 4359 - SYS_COPY_FILE_RANGE = 4360 - SYS_PREADV2 = 4361 - SYS_PWRITEV2 = 4362 - SYS_PKEY_MPROTECT = 4363 - SYS_PKEY_ALLOC = 4364 - SYS_PKEY_FREE = 4365 - SYS_STATX = 4366 - SYS_RSEQ = 4367 - SYS_IO_PGETEVENTS = 4368 + SYS_SYSCALL = 4000 + SYS_EXIT = 4001 + SYS_FORK = 4002 + SYS_READ = 4003 + SYS_WRITE = 4004 + SYS_OPEN = 4005 + SYS_CLOSE = 4006 + SYS_WAITPID = 4007 + SYS_CREAT = 4008 + SYS_LINK = 4009 + SYS_UNLINK = 4010 + SYS_EXECVE = 4011 + SYS_CHDIR = 4012 + SYS_TIME = 4013 + SYS_MKNOD = 4014 + SYS_CHMOD = 4015 + SYS_LCHOWN = 4016 + SYS_BREAK = 4017 + SYS_UNUSED18 = 4018 + SYS_LSEEK = 4019 + SYS_GETPID = 4020 + SYS_MOUNT = 4021 + SYS_UMOUNT = 4022 + SYS_SETUID = 4023 + SYS_GETUID = 4024 + SYS_STIME = 4025 + SYS_PTRACE = 4026 + SYS_ALARM = 4027 + SYS_UNUSED28 = 4028 + SYS_PAUSE = 4029 + SYS_UTIME = 4030 + SYS_STTY = 4031 + SYS_GTTY = 4032 + SYS_ACCESS = 4033 + SYS_NICE = 4034 + SYS_FTIME = 4035 + SYS_SYNC = 4036 + SYS_KILL = 4037 + SYS_RENAME = 4038 + SYS_MKDIR = 4039 + SYS_RMDIR = 4040 + SYS_DUP = 4041 + SYS_PIPE = 4042 + SYS_TIMES = 4043 + SYS_PROF = 4044 + SYS_BRK = 4045 + SYS_SETGID = 4046 + SYS_GETGID = 4047 + SYS_SIGNAL = 4048 + SYS_GETEUID = 4049 + SYS_GETEGID = 4050 + SYS_ACCT = 4051 + SYS_UMOUNT2 = 4052 + SYS_LOCK = 4053 + SYS_IOCTL = 4054 + SYS_FCNTL = 4055 + SYS_MPX = 4056 + SYS_SETPGID = 4057 + SYS_ULIMIT = 4058 + SYS_UNUSED59 = 4059 + SYS_UMASK = 4060 + SYS_CHROOT = 4061 + SYS_USTAT = 4062 + SYS_DUP2 = 4063 + SYS_GETPPID = 4064 + SYS_GETPGRP = 4065 + SYS_SETSID = 4066 + SYS_SIGACTION = 4067 + SYS_SGETMASK = 4068 + SYS_SSETMASK = 4069 + SYS_SETREUID = 4070 + SYS_SETREGID = 4071 + SYS_SIGSUSPEND = 4072 + SYS_SIGPENDING = 4073 + SYS_SETHOSTNAME = 4074 + SYS_SETRLIMIT = 4075 + SYS_GETRLIMIT = 4076 + SYS_GETRUSAGE = 4077 + SYS_GETTIMEOFDAY = 4078 + SYS_SETTIMEOFDAY = 4079 + SYS_GETGROUPS = 4080 + SYS_SETGROUPS = 4081 + SYS_RESERVED82 = 4082 + SYS_SYMLINK = 4083 + SYS_UNUSED84 = 4084 + SYS_READLINK = 4085 + SYS_USELIB = 4086 + SYS_SWAPON = 4087 + SYS_REBOOT = 4088 + SYS_READDIR = 4089 + SYS_MMAP = 4090 + SYS_MUNMAP = 4091 + SYS_TRUNCATE = 4092 + SYS_FTRUNCATE = 4093 + SYS_FCHMOD = 4094 + SYS_FCHOWN = 4095 + SYS_GETPRIORITY = 4096 + SYS_SETPRIORITY = 4097 + SYS_PROFIL = 4098 + SYS_STATFS = 4099 + SYS_FSTATFS = 4100 + SYS_IOPERM = 4101 + SYS_SOCKETCALL = 4102 + SYS_SYSLOG = 4103 + SYS_SETITIMER = 4104 + SYS_GETITIMER = 4105 + SYS_STAT = 4106 + SYS_LSTAT = 4107 + SYS_FSTAT = 4108 + SYS_UNUSED109 = 4109 + SYS_IOPL = 4110 + SYS_VHANGUP = 4111 + SYS_IDLE = 4112 + SYS_VM86 = 4113 + SYS_WAIT4 = 4114 + SYS_SWAPOFF = 4115 + SYS_SYSINFO = 4116 + SYS_IPC = 4117 + SYS_FSYNC = 4118 + SYS_SIGRETURN = 4119 + SYS_CLONE = 4120 + SYS_SETDOMAINNAME = 4121 + SYS_UNAME = 4122 + SYS_MODIFY_LDT = 4123 + SYS_ADJTIMEX = 4124 + SYS_MPROTECT = 4125 + SYS_SIGPROCMASK = 4126 + SYS_CREATE_MODULE = 4127 + SYS_INIT_MODULE = 4128 + SYS_DELETE_MODULE = 4129 + SYS_GET_KERNEL_SYMS = 4130 + SYS_QUOTACTL = 4131 + SYS_GETPGID = 4132 + SYS_FCHDIR = 4133 + SYS_BDFLUSH = 4134 + SYS_SYSFS = 4135 + SYS_PERSONALITY = 4136 + SYS_AFS_SYSCALL = 4137 + SYS_SETFSUID = 4138 + SYS_SETFSGID = 4139 + SYS__LLSEEK = 4140 + SYS_GETDENTS = 4141 + SYS__NEWSELECT = 4142 + SYS_FLOCK = 4143 + SYS_MSYNC = 4144 + SYS_READV = 4145 + SYS_WRITEV = 4146 + SYS_CACHEFLUSH = 4147 + SYS_CACHECTL = 4148 + SYS_SYSMIPS = 4149 + SYS_UNUSED150 = 4150 + SYS_GETSID = 4151 + SYS_FDATASYNC = 4152 + SYS__SYSCTL = 4153 + SYS_MLOCK = 4154 + SYS_MUNLOCK = 4155 + SYS_MLOCKALL = 4156 + SYS_MUNLOCKALL = 4157 + SYS_SCHED_SETPARAM = 4158 + SYS_SCHED_GETPARAM = 4159 + SYS_SCHED_SETSCHEDULER = 4160 + SYS_SCHED_GETSCHEDULER = 4161 + SYS_SCHED_YIELD = 4162 + SYS_SCHED_GET_PRIORITY_MAX = 4163 + SYS_SCHED_GET_PRIORITY_MIN = 4164 + SYS_SCHED_RR_GET_INTERVAL = 4165 + SYS_NANOSLEEP = 4166 + SYS_MREMAP = 4167 + SYS_ACCEPT = 4168 + SYS_BIND = 4169 + SYS_CONNECT = 4170 + SYS_GETPEERNAME = 4171 + SYS_GETSOCKNAME = 4172 + SYS_GETSOCKOPT = 4173 + SYS_LISTEN = 4174 + SYS_RECV = 4175 + SYS_RECVFROM = 4176 + SYS_RECVMSG = 4177 + SYS_SEND = 4178 + SYS_SENDMSG = 4179 + SYS_SENDTO = 4180 + SYS_SETSOCKOPT = 4181 + SYS_SHUTDOWN = 4182 + SYS_SOCKET = 4183 + SYS_SOCKETPAIR = 4184 + SYS_SETRESUID = 4185 + SYS_GETRESUID = 4186 + SYS_QUERY_MODULE = 4187 + SYS_POLL = 4188 + SYS_NFSSERVCTL = 4189 + SYS_SETRESGID = 4190 + SYS_GETRESGID = 4191 + SYS_PRCTL = 4192 + SYS_RT_SIGRETURN = 4193 + SYS_RT_SIGACTION = 4194 + SYS_RT_SIGPROCMASK = 4195 + SYS_RT_SIGPENDING = 4196 + SYS_RT_SIGTIMEDWAIT = 4197 + SYS_RT_SIGQUEUEINFO = 4198 + SYS_RT_SIGSUSPEND = 4199 + SYS_PREAD64 = 4200 + SYS_PWRITE64 = 4201 + SYS_CHOWN = 4202 + SYS_GETCWD = 4203 + SYS_CAPGET = 4204 + SYS_CAPSET = 4205 + SYS_SIGALTSTACK = 4206 + SYS_SENDFILE = 4207 + SYS_GETPMSG = 4208 + SYS_PUTPMSG = 4209 + SYS_MMAP2 = 4210 + SYS_TRUNCATE64 = 4211 + SYS_FTRUNCATE64 = 4212 + SYS_STAT64 = 4213 + SYS_LSTAT64 = 4214 + SYS_FSTAT64 = 4215 + SYS_PIVOT_ROOT = 4216 + SYS_MINCORE = 4217 + SYS_MADVISE = 4218 + SYS_GETDENTS64 = 4219 + SYS_FCNTL64 = 4220 + SYS_RESERVED221 = 4221 + SYS_GETTID = 4222 + SYS_READAHEAD = 4223 + SYS_SETXATTR = 4224 + SYS_LSETXATTR = 4225 + SYS_FSETXATTR = 4226 + SYS_GETXATTR = 4227 + SYS_LGETXATTR = 4228 + SYS_FGETXATTR = 4229 + SYS_LISTXATTR = 4230 + SYS_LLISTXATTR = 4231 + SYS_FLISTXATTR = 4232 + SYS_REMOVEXATTR = 4233 + SYS_LREMOVEXATTR = 4234 + SYS_FREMOVEXATTR = 4235 + SYS_TKILL = 4236 + SYS_SENDFILE64 = 4237 + SYS_FUTEX = 4238 + SYS_SCHED_SETAFFINITY = 4239 + SYS_SCHED_GETAFFINITY = 4240 + SYS_IO_SETUP = 4241 + SYS_IO_DESTROY = 4242 + SYS_IO_GETEVENTS = 4243 + SYS_IO_SUBMIT = 4244 + SYS_IO_CANCEL = 4245 + SYS_EXIT_GROUP = 4246 + SYS_LOOKUP_DCOOKIE = 4247 + SYS_EPOLL_CREATE = 4248 + SYS_EPOLL_CTL = 4249 + SYS_EPOLL_WAIT = 4250 + SYS_REMAP_FILE_PAGES = 4251 + SYS_SET_TID_ADDRESS = 4252 + SYS_RESTART_SYSCALL = 4253 + SYS_FADVISE64 = 4254 + SYS_STATFS64 = 4255 + SYS_FSTATFS64 = 4256 + SYS_TIMER_CREATE = 4257 + SYS_TIMER_SETTIME = 4258 + SYS_TIMER_GETTIME = 4259 + SYS_TIMER_GETOVERRUN = 4260 + SYS_TIMER_DELETE = 4261 + SYS_CLOCK_SETTIME = 4262 + SYS_CLOCK_GETTIME = 4263 + SYS_CLOCK_GETRES = 4264 + SYS_CLOCK_NANOSLEEP = 4265 + SYS_TGKILL = 4266 + SYS_UTIMES = 4267 + SYS_MBIND = 4268 + SYS_GET_MEMPOLICY = 4269 + SYS_SET_MEMPOLICY = 4270 + SYS_MQ_OPEN = 4271 + SYS_MQ_UNLINK = 4272 + SYS_MQ_TIMEDSEND = 4273 + SYS_MQ_TIMEDRECEIVE = 4274 + SYS_MQ_NOTIFY = 4275 + SYS_MQ_GETSETATTR = 4276 + SYS_VSERVER = 4277 + SYS_WAITID = 4278 + SYS_ADD_KEY = 4280 + SYS_REQUEST_KEY = 4281 + SYS_KEYCTL = 4282 + SYS_SET_THREAD_AREA = 4283 + SYS_INOTIFY_INIT = 4284 + SYS_INOTIFY_ADD_WATCH = 4285 + SYS_INOTIFY_RM_WATCH = 4286 + SYS_MIGRATE_PAGES = 4287 + SYS_OPENAT = 4288 + SYS_MKDIRAT = 4289 + SYS_MKNODAT = 4290 + SYS_FCHOWNAT = 4291 + SYS_FUTIMESAT = 4292 + SYS_FSTATAT64 = 4293 + SYS_UNLINKAT = 4294 + SYS_RENAMEAT = 4295 + SYS_LINKAT = 4296 + SYS_SYMLINKAT = 4297 + SYS_READLINKAT = 4298 + SYS_FCHMODAT = 4299 + SYS_FACCESSAT = 4300 + SYS_PSELECT6 = 4301 + SYS_PPOLL = 4302 + SYS_UNSHARE = 4303 + SYS_SPLICE = 4304 + SYS_SYNC_FILE_RANGE = 4305 + SYS_TEE = 4306 + SYS_VMSPLICE = 4307 + SYS_MOVE_PAGES = 4308 + SYS_SET_ROBUST_LIST = 4309 + SYS_GET_ROBUST_LIST = 4310 + SYS_KEXEC_LOAD = 4311 + SYS_GETCPU = 4312 + SYS_EPOLL_PWAIT = 4313 + SYS_IOPRIO_SET = 4314 + SYS_IOPRIO_GET = 4315 + SYS_UTIMENSAT = 4316 + SYS_SIGNALFD = 4317 + SYS_TIMERFD = 4318 + SYS_EVENTFD = 4319 + SYS_FALLOCATE = 4320 + SYS_TIMERFD_CREATE = 4321 + SYS_TIMERFD_GETTIME = 4322 + SYS_TIMERFD_SETTIME = 4323 + SYS_SIGNALFD4 = 4324 + SYS_EVENTFD2 = 4325 + SYS_EPOLL_CREATE1 = 4326 + SYS_DUP3 = 4327 + SYS_PIPE2 = 4328 + SYS_INOTIFY_INIT1 = 4329 + SYS_PREADV = 4330 + SYS_PWRITEV = 4331 + SYS_RT_TGSIGQUEUEINFO = 4332 + SYS_PERF_EVENT_OPEN = 4333 + SYS_ACCEPT4 = 4334 + SYS_RECVMMSG = 4335 + SYS_FANOTIFY_INIT = 4336 + SYS_FANOTIFY_MARK = 4337 + SYS_PRLIMIT64 = 4338 + SYS_NAME_TO_HANDLE_AT = 4339 + SYS_OPEN_BY_HANDLE_AT = 4340 + SYS_CLOCK_ADJTIME = 4341 + SYS_SYNCFS = 4342 + SYS_SENDMMSG = 4343 + SYS_SETNS = 4344 + SYS_PROCESS_VM_READV = 4345 + SYS_PROCESS_VM_WRITEV = 4346 + SYS_KCMP = 4347 + SYS_FINIT_MODULE = 4348 + SYS_SCHED_SETATTR = 4349 + SYS_SCHED_GETATTR = 4350 + SYS_RENAMEAT2 = 4351 + SYS_SECCOMP = 4352 + SYS_GETRANDOM = 4353 + SYS_MEMFD_CREATE = 4354 + SYS_BPF = 4355 + SYS_EXECVEAT = 4356 + SYS_USERFAULTFD = 4357 + SYS_MEMBARRIER = 4358 + SYS_MLOCK2 = 4359 + SYS_COPY_FILE_RANGE = 4360 + SYS_PREADV2 = 4361 + SYS_PWRITEV2 = 4362 + SYS_PKEY_MPROTECT = 4363 + SYS_PKEY_ALLOC = 4364 + SYS_PKEY_FREE = 4365 + SYS_STATX = 4366 + SYS_RSEQ = 4367 + SYS_IO_PGETEVENTS = 4368 + SYS_SEMGET = 4393 + SYS_SEMCTL = 4394 + SYS_SHMGET = 4395 + SYS_SHMCTL = 4396 + SYS_SHMAT = 4397 + SYS_SHMDT = 4398 + SYS_MSGGET = 4399 + SYS_MSGSND = 4400 + SYS_MSGRCV = 4401 + SYS_MSGCTL = 4402 + SYS_CLOCK_GETTIME64 = 4403 + SYS_CLOCK_SETTIME64 = 4404 + SYS_CLOCK_ADJTIME64 = 4405 + SYS_CLOCK_GETRES_TIME64 = 4406 + SYS_CLOCK_NANOSLEEP_TIME64 = 4407 + SYS_TIMER_GETTIME64 = 4408 + SYS_TIMER_SETTIME64 = 4409 + SYS_TIMERFD_GETTIME64 = 4410 + SYS_TIMERFD_SETTIME64 = 4411 + SYS_UTIMENSAT_TIME64 = 4412 + SYS_PSELECT6_TIME64 = 4413 + SYS_PPOLL_TIME64 = 4414 + SYS_IO_PGETEVENTS_TIME64 = 4416 + SYS_RECVMMSG_TIME64 = 4417 + SYS_MQ_TIMEDSEND_TIME64 = 4418 + SYS_MQ_TIMEDRECEIVE_TIME64 = 4419 + SYS_SEMTIMEDOP_TIME64 = 4420 + SYS_RT_SIGTIMEDWAIT_TIME64 = 4421 + SYS_FUTEX_TIME64 = 4422 + SYS_SCHED_RR_GET_INTERVAL_TIME64 = 4423 + SYS_PIDFD_SEND_SIGNAL = 4424 + SYS_IO_URING_SETUP = 4425 + SYS_IO_URING_ENTER = 4426 + SYS_IO_URING_REGISTER = 4427 + SYS_OPEN_TREE = 4428 + SYS_MOVE_MOUNT = 4429 + SYS_FSOPEN = 4430 + SYS_FSCONFIG = 4431 + SYS_FSMOUNT = 4432 + SYS_FSPICK = 4433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 40164cac..28e6d0e9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -334,4 +334,14 @@ const ( SYS_STATX = 5326 SYS_RSEQ = 5327 SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 8a909738..e643c6f6 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -334,4 +334,14 @@ const ( SYS_STATX = 5326 SYS_RSEQ = 5327 SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 8d781842..01d93c42 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -6,372 +6,412 @@ package unix const ( - SYS_SYSCALL = 4000 - SYS_EXIT = 4001 - SYS_FORK = 4002 - SYS_READ = 4003 - SYS_WRITE = 4004 - SYS_OPEN = 4005 - SYS_CLOSE = 4006 - SYS_WAITPID = 4007 - SYS_CREAT = 4008 - SYS_LINK = 4009 - SYS_UNLINK = 4010 - SYS_EXECVE = 4011 - SYS_CHDIR = 4012 - SYS_TIME = 4013 - SYS_MKNOD = 4014 - SYS_CHMOD = 4015 - SYS_LCHOWN = 4016 - SYS_BREAK = 4017 - SYS_UNUSED18 = 4018 - SYS_LSEEK = 4019 - SYS_GETPID = 4020 - SYS_MOUNT = 4021 - SYS_UMOUNT = 4022 - SYS_SETUID = 4023 - SYS_GETUID = 4024 - SYS_STIME = 4025 - SYS_PTRACE = 4026 - SYS_ALARM = 4027 - SYS_UNUSED28 = 4028 - SYS_PAUSE = 4029 - SYS_UTIME = 4030 - SYS_STTY = 4031 - SYS_GTTY = 4032 - SYS_ACCESS = 4033 - SYS_NICE = 4034 - SYS_FTIME = 4035 - SYS_SYNC = 4036 - SYS_KILL = 4037 - SYS_RENAME = 4038 - SYS_MKDIR = 4039 - SYS_RMDIR = 4040 - SYS_DUP = 4041 - SYS_PIPE = 4042 - SYS_TIMES = 4043 - SYS_PROF = 4044 - SYS_BRK = 4045 - SYS_SETGID = 4046 - SYS_GETGID = 4047 - SYS_SIGNAL = 4048 - SYS_GETEUID = 4049 - SYS_GETEGID = 4050 - SYS_ACCT = 4051 - SYS_UMOUNT2 = 4052 - SYS_LOCK = 4053 - SYS_IOCTL = 4054 - SYS_FCNTL = 4055 - SYS_MPX = 4056 - SYS_SETPGID = 4057 - SYS_ULIMIT = 4058 - SYS_UNUSED59 = 4059 - SYS_UMASK = 4060 - SYS_CHROOT = 4061 - SYS_USTAT = 4062 - SYS_DUP2 = 4063 - SYS_GETPPID = 4064 - SYS_GETPGRP = 4065 - SYS_SETSID = 4066 - SYS_SIGACTION = 4067 - SYS_SGETMASK = 4068 - SYS_SSETMASK = 4069 - SYS_SETREUID = 4070 - SYS_SETREGID = 4071 - SYS_SIGSUSPEND = 4072 - SYS_SIGPENDING = 4073 - SYS_SETHOSTNAME = 4074 - SYS_SETRLIMIT = 4075 - SYS_GETRLIMIT = 4076 - SYS_GETRUSAGE = 4077 - SYS_GETTIMEOFDAY = 4078 - SYS_SETTIMEOFDAY = 4079 - SYS_GETGROUPS = 4080 - SYS_SETGROUPS = 4081 - SYS_RESERVED82 = 4082 - SYS_SYMLINK = 4083 - SYS_UNUSED84 = 4084 - SYS_READLINK = 4085 - SYS_USELIB = 4086 - SYS_SWAPON = 4087 - SYS_REBOOT = 4088 - SYS_READDIR = 4089 - SYS_MMAP = 4090 - SYS_MUNMAP = 4091 - SYS_TRUNCATE = 4092 - SYS_FTRUNCATE = 4093 - SYS_FCHMOD = 4094 - SYS_FCHOWN = 4095 - SYS_GETPRIORITY = 4096 - SYS_SETPRIORITY = 4097 - SYS_PROFIL = 4098 - SYS_STATFS = 4099 - SYS_FSTATFS = 4100 - SYS_IOPERM = 4101 - SYS_SOCKETCALL = 4102 - SYS_SYSLOG = 4103 - SYS_SETITIMER = 4104 - SYS_GETITIMER = 4105 - SYS_STAT = 4106 - SYS_LSTAT = 4107 - SYS_FSTAT = 4108 - SYS_UNUSED109 = 4109 - SYS_IOPL = 4110 - SYS_VHANGUP = 4111 - SYS_IDLE = 4112 - SYS_VM86 = 4113 - SYS_WAIT4 = 4114 - SYS_SWAPOFF = 4115 - SYS_SYSINFO = 4116 - SYS_IPC = 4117 - SYS_FSYNC = 4118 - SYS_SIGRETURN = 4119 - SYS_CLONE = 4120 - SYS_SETDOMAINNAME = 4121 - SYS_UNAME = 4122 - SYS_MODIFY_LDT = 4123 - SYS_ADJTIMEX = 4124 - SYS_MPROTECT = 4125 - SYS_SIGPROCMASK = 4126 - SYS_CREATE_MODULE = 4127 - SYS_INIT_MODULE = 4128 - SYS_DELETE_MODULE = 4129 - SYS_GET_KERNEL_SYMS = 4130 - SYS_QUOTACTL = 4131 - SYS_GETPGID = 4132 - SYS_FCHDIR = 4133 - SYS_BDFLUSH = 4134 - SYS_SYSFS = 4135 - SYS_PERSONALITY = 4136 - SYS_AFS_SYSCALL = 4137 - SYS_SETFSUID = 4138 - SYS_SETFSGID = 4139 - SYS__LLSEEK = 4140 - SYS_GETDENTS = 4141 - SYS__NEWSELECT = 4142 - SYS_FLOCK = 4143 - SYS_MSYNC = 4144 - SYS_READV = 4145 - SYS_WRITEV = 4146 - SYS_CACHEFLUSH = 4147 - SYS_CACHECTL = 4148 - SYS_SYSMIPS = 4149 - SYS_UNUSED150 = 4150 - SYS_GETSID = 4151 - SYS_FDATASYNC = 4152 - SYS__SYSCTL = 4153 - SYS_MLOCK = 4154 - SYS_MUNLOCK = 4155 - SYS_MLOCKALL = 4156 - SYS_MUNLOCKALL = 4157 - SYS_SCHED_SETPARAM = 4158 - SYS_SCHED_GETPARAM = 4159 - SYS_SCHED_SETSCHEDULER = 4160 - SYS_SCHED_GETSCHEDULER = 4161 - SYS_SCHED_YIELD = 4162 - SYS_SCHED_GET_PRIORITY_MAX = 4163 - SYS_SCHED_GET_PRIORITY_MIN = 4164 - SYS_SCHED_RR_GET_INTERVAL = 4165 - SYS_NANOSLEEP = 4166 - SYS_MREMAP = 4167 - SYS_ACCEPT = 4168 - SYS_BIND = 4169 - SYS_CONNECT = 4170 - SYS_GETPEERNAME = 4171 - SYS_GETSOCKNAME = 4172 - SYS_GETSOCKOPT = 4173 - SYS_LISTEN = 4174 - SYS_RECV = 4175 - SYS_RECVFROM = 4176 - SYS_RECVMSG = 4177 - SYS_SEND = 4178 - SYS_SENDMSG = 4179 - SYS_SENDTO = 4180 - SYS_SETSOCKOPT = 4181 - SYS_SHUTDOWN = 4182 - SYS_SOCKET = 4183 - SYS_SOCKETPAIR = 4184 - SYS_SETRESUID = 4185 - SYS_GETRESUID = 4186 - SYS_QUERY_MODULE = 4187 - SYS_POLL = 4188 - SYS_NFSSERVCTL = 4189 - SYS_SETRESGID = 4190 - SYS_GETRESGID = 4191 - SYS_PRCTL = 4192 - SYS_RT_SIGRETURN = 4193 - SYS_RT_SIGACTION = 4194 - SYS_RT_SIGPROCMASK = 4195 - SYS_RT_SIGPENDING = 4196 - SYS_RT_SIGTIMEDWAIT = 4197 - SYS_RT_SIGQUEUEINFO = 4198 - SYS_RT_SIGSUSPEND = 4199 - SYS_PREAD64 = 4200 - SYS_PWRITE64 = 4201 - SYS_CHOWN = 4202 - SYS_GETCWD = 4203 - SYS_CAPGET = 4204 - SYS_CAPSET = 4205 - SYS_SIGALTSTACK = 4206 - SYS_SENDFILE = 4207 - SYS_GETPMSG = 4208 - SYS_PUTPMSG = 4209 - SYS_MMAP2 = 4210 - SYS_TRUNCATE64 = 4211 - SYS_FTRUNCATE64 = 4212 - SYS_STAT64 = 4213 - SYS_LSTAT64 = 4214 - SYS_FSTAT64 = 4215 - SYS_PIVOT_ROOT = 4216 - SYS_MINCORE = 4217 - SYS_MADVISE = 4218 - SYS_GETDENTS64 = 4219 - SYS_FCNTL64 = 4220 - SYS_RESERVED221 = 4221 - SYS_GETTID = 4222 - SYS_READAHEAD = 4223 - SYS_SETXATTR = 4224 - SYS_LSETXATTR = 4225 - SYS_FSETXATTR = 4226 - SYS_GETXATTR = 4227 - SYS_LGETXATTR = 4228 - SYS_FGETXATTR = 4229 - SYS_LISTXATTR = 4230 - SYS_LLISTXATTR = 4231 - SYS_FLISTXATTR = 4232 - SYS_REMOVEXATTR = 4233 - SYS_LREMOVEXATTR = 4234 - SYS_FREMOVEXATTR = 4235 - SYS_TKILL = 4236 - SYS_SENDFILE64 = 4237 - SYS_FUTEX = 4238 - SYS_SCHED_SETAFFINITY = 4239 - SYS_SCHED_GETAFFINITY = 4240 - SYS_IO_SETUP = 4241 - SYS_IO_DESTROY = 4242 - SYS_IO_GETEVENTS = 4243 - SYS_IO_SUBMIT = 4244 - SYS_IO_CANCEL = 4245 - SYS_EXIT_GROUP = 4246 - SYS_LOOKUP_DCOOKIE = 4247 - SYS_EPOLL_CREATE = 4248 - SYS_EPOLL_CTL = 4249 - SYS_EPOLL_WAIT = 4250 - SYS_REMAP_FILE_PAGES = 4251 - SYS_SET_TID_ADDRESS = 4252 - SYS_RESTART_SYSCALL = 4253 - SYS_FADVISE64 = 4254 - SYS_STATFS64 = 4255 - SYS_FSTATFS64 = 4256 - SYS_TIMER_CREATE = 4257 - SYS_TIMER_SETTIME = 4258 - SYS_TIMER_GETTIME = 4259 - SYS_TIMER_GETOVERRUN = 4260 - SYS_TIMER_DELETE = 4261 - SYS_CLOCK_SETTIME = 4262 - SYS_CLOCK_GETTIME = 4263 - SYS_CLOCK_GETRES = 4264 - SYS_CLOCK_NANOSLEEP = 4265 - SYS_TGKILL = 4266 - SYS_UTIMES = 4267 - SYS_MBIND = 4268 - SYS_GET_MEMPOLICY = 4269 - SYS_SET_MEMPOLICY = 4270 - SYS_MQ_OPEN = 4271 - SYS_MQ_UNLINK = 4272 - SYS_MQ_TIMEDSEND = 4273 - SYS_MQ_TIMEDRECEIVE = 4274 - SYS_MQ_NOTIFY = 4275 - SYS_MQ_GETSETATTR = 4276 - SYS_VSERVER = 4277 - SYS_WAITID = 4278 - SYS_ADD_KEY = 4280 - SYS_REQUEST_KEY = 4281 - SYS_KEYCTL = 4282 - SYS_SET_THREAD_AREA = 4283 - SYS_INOTIFY_INIT = 4284 - SYS_INOTIFY_ADD_WATCH = 4285 - SYS_INOTIFY_RM_WATCH = 4286 - SYS_MIGRATE_PAGES = 4287 - SYS_OPENAT = 4288 - SYS_MKDIRAT = 4289 - SYS_MKNODAT = 4290 - SYS_FCHOWNAT = 4291 - SYS_FUTIMESAT = 4292 - SYS_FSTATAT64 = 4293 - SYS_UNLINKAT = 4294 - SYS_RENAMEAT = 4295 - SYS_LINKAT = 4296 - SYS_SYMLINKAT = 4297 - SYS_READLINKAT = 4298 - SYS_FCHMODAT = 4299 - SYS_FACCESSAT = 4300 - SYS_PSELECT6 = 4301 - SYS_PPOLL = 4302 - SYS_UNSHARE = 4303 - SYS_SPLICE = 4304 - SYS_SYNC_FILE_RANGE = 4305 - SYS_TEE = 4306 - SYS_VMSPLICE = 4307 - SYS_MOVE_PAGES = 4308 - SYS_SET_ROBUST_LIST = 4309 - SYS_GET_ROBUST_LIST = 4310 - SYS_KEXEC_LOAD = 4311 - SYS_GETCPU = 4312 - SYS_EPOLL_PWAIT = 4313 - SYS_IOPRIO_SET = 4314 - SYS_IOPRIO_GET = 4315 - SYS_UTIMENSAT = 4316 - SYS_SIGNALFD = 4317 - SYS_TIMERFD = 4318 - SYS_EVENTFD = 4319 - SYS_FALLOCATE = 4320 - SYS_TIMERFD_CREATE = 4321 - SYS_TIMERFD_GETTIME = 4322 - SYS_TIMERFD_SETTIME = 4323 - SYS_SIGNALFD4 = 4324 - SYS_EVENTFD2 = 4325 - SYS_EPOLL_CREATE1 = 4326 - SYS_DUP3 = 4327 - SYS_PIPE2 = 4328 - SYS_INOTIFY_INIT1 = 4329 - SYS_PREADV = 4330 - SYS_PWRITEV = 4331 - SYS_RT_TGSIGQUEUEINFO = 4332 - SYS_PERF_EVENT_OPEN = 4333 - SYS_ACCEPT4 = 4334 - SYS_RECVMMSG = 4335 - SYS_FANOTIFY_INIT = 4336 - SYS_FANOTIFY_MARK = 4337 - SYS_PRLIMIT64 = 4338 - SYS_NAME_TO_HANDLE_AT = 4339 - SYS_OPEN_BY_HANDLE_AT = 4340 - SYS_CLOCK_ADJTIME = 4341 - SYS_SYNCFS = 4342 - SYS_SENDMMSG = 4343 - SYS_SETNS = 4344 - SYS_PROCESS_VM_READV = 4345 - SYS_PROCESS_VM_WRITEV = 4346 - SYS_KCMP = 4347 - SYS_FINIT_MODULE = 4348 - SYS_SCHED_SETATTR = 4349 - SYS_SCHED_GETATTR = 4350 - SYS_RENAMEAT2 = 4351 - SYS_SECCOMP = 4352 - SYS_GETRANDOM = 4353 - SYS_MEMFD_CREATE = 4354 - SYS_BPF = 4355 - SYS_EXECVEAT = 4356 - SYS_USERFAULTFD = 4357 - SYS_MEMBARRIER = 4358 - SYS_MLOCK2 = 4359 - SYS_COPY_FILE_RANGE = 4360 - SYS_PREADV2 = 4361 - SYS_PWRITEV2 = 4362 - SYS_PKEY_MPROTECT = 4363 - SYS_PKEY_ALLOC = 4364 - SYS_PKEY_FREE = 4365 - SYS_STATX = 4366 - SYS_RSEQ = 4367 - SYS_IO_PGETEVENTS = 4368 + SYS_SYSCALL = 4000 + SYS_EXIT = 4001 + SYS_FORK = 4002 + SYS_READ = 4003 + SYS_WRITE = 4004 + SYS_OPEN = 4005 + SYS_CLOSE = 4006 + SYS_WAITPID = 4007 + SYS_CREAT = 4008 + SYS_LINK = 4009 + SYS_UNLINK = 4010 + SYS_EXECVE = 4011 + SYS_CHDIR = 4012 + SYS_TIME = 4013 + SYS_MKNOD = 4014 + SYS_CHMOD = 4015 + SYS_LCHOWN = 4016 + SYS_BREAK = 4017 + SYS_UNUSED18 = 4018 + SYS_LSEEK = 4019 + SYS_GETPID = 4020 + SYS_MOUNT = 4021 + SYS_UMOUNT = 4022 + SYS_SETUID = 4023 + SYS_GETUID = 4024 + SYS_STIME = 4025 + SYS_PTRACE = 4026 + SYS_ALARM = 4027 + SYS_UNUSED28 = 4028 + SYS_PAUSE = 4029 + SYS_UTIME = 4030 + SYS_STTY = 4031 + SYS_GTTY = 4032 + SYS_ACCESS = 4033 + SYS_NICE = 4034 + SYS_FTIME = 4035 + SYS_SYNC = 4036 + SYS_KILL = 4037 + SYS_RENAME = 4038 + SYS_MKDIR = 4039 + SYS_RMDIR = 4040 + SYS_DUP = 4041 + SYS_PIPE = 4042 + SYS_TIMES = 4043 + SYS_PROF = 4044 + SYS_BRK = 4045 + SYS_SETGID = 4046 + SYS_GETGID = 4047 + SYS_SIGNAL = 4048 + SYS_GETEUID = 4049 + SYS_GETEGID = 4050 + SYS_ACCT = 4051 + SYS_UMOUNT2 = 4052 + SYS_LOCK = 4053 + SYS_IOCTL = 4054 + SYS_FCNTL = 4055 + SYS_MPX = 4056 + SYS_SETPGID = 4057 + SYS_ULIMIT = 4058 + SYS_UNUSED59 = 4059 + SYS_UMASK = 4060 + SYS_CHROOT = 4061 + SYS_USTAT = 4062 + SYS_DUP2 = 4063 + SYS_GETPPID = 4064 + SYS_GETPGRP = 4065 + SYS_SETSID = 4066 + SYS_SIGACTION = 4067 + SYS_SGETMASK = 4068 + SYS_SSETMASK = 4069 + SYS_SETREUID = 4070 + SYS_SETREGID = 4071 + SYS_SIGSUSPEND = 4072 + SYS_SIGPENDING = 4073 + SYS_SETHOSTNAME = 4074 + SYS_SETRLIMIT = 4075 + SYS_GETRLIMIT = 4076 + SYS_GETRUSAGE = 4077 + SYS_GETTIMEOFDAY = 4078 + SYS_SETTIMEOFDAY = 4079 + SYS_GETGROUPS = 4080 + SYS_SETGROUPS = 4081 + SYS_RESERVED82 = 4082 + SYS_SYMLINK = 4083 + SYS_UNUSED84 = 4084 + SYS_READLINK = 4085 + SYS_USELIB = 4086 + SYS_SWAPON = 4087 + SYS_REBOOT = 4088 + SYS_READDIR = 4089 + SYS_MMAP = 4090 + SYS_MUNMAP = 4091 + SYS_TRUNCATE = 4092 + SYS_FTRUNCATE = 4093 + SYS_FCHMOD = 4094 + SYS_FCHOWN = 4095 + SYS_GETPRIORITY = 4096 + SYS_SETPRIORITY = 4097 + SYS_PROFIL = 4098 + SYS_STATFS = 4099 + SYS_FSTATFS = 4100 + SYS_IOPERM = 4101 + SYS_SOCKETCALL = 4102 + SYS_SYSLOG = 4103 + SYS_SETITIMER = 4104 + SYS_GETITIMER = 4105 + SYS_STAT = 4106 + SYS_LSTAT = 4107 + SYS_FSTAT = 4108 + SYS_UNUSED109 = 4109 + SYS_IOPL = 4110 + SYS_VHANGUP = 4111 + SYS_IDLE = 4112 + SYS_VM86 = 4113 + SYS_WAIT4 = 4114 + SYS_SWAPOFF = 4115 + SYS_SYSINFO = 4116 + SYS_IPC = 4117 + SYS_FSYNC = 4118 + SYS_SIGRETURN = 4119 + SYS_CLONE = 4120 + SYS_SETDOMAINNAME = 4121 + SYS_UNAME = 4122 + SYS_MODIFY_LDT = 4123 + SYS_ADJTIMEX = 4124 + SYS_MPROTECT = 4125 + SYS_SIGPROCMASK = 4126 + SYS_CREATE_MODULE = 4127 + SYS_INIT_MODULE = 4128 + SYS_DELETE_MODULE = 4129 + SYS_GET_KERNEL_SYMS = 4130 + SYS_QUOTACTL = 4131 + SYS_GETPGID = 4132 + SYS_FCHDIR = 4133 + SYS_BDFLUSH = 4134 + SYS_SYSFS = 4135 + SYS_PERSONALITY = 4136 + SYS_AFS_SYSCALL = 4137 + SYS_SETFSUID = 4138 + SYS_SETFSGID = 4139 + SYS__LLSEEK = 4140 + SYS_GETDENTS = 4141 + SYS__NEWSELECT = 4142 + SYS_FLOCK = 4143 + SYS_MSYNC = 4144 + SYS_READV = 4145 + SYS_WRITEV = 4146 + SYS_CACHEFLUSH = 4147 + SYS_CACHECTL = 4148 + SYS_SYSMIPS = 4149 + SYS_UNUSED150 = 4150 + SYS_GETSID = 4151 + SYS_FDATASYNC = 4152 + SYS__SYSCTL = 4153 + SYS_MLOCK = 4154 + SYS_MUNLOCK = 4155 + SYS_MLOCKALL = 4156 + SYS_MUNLOCKALL = 4157 + SYS_SCHED_SETPARAM = 4158 + SYS_SCHED_GETPARAM = 4159 + SYS_SCHED_SETSCHEDULER = 4160 + SYS_SCHED_GETSCHEDULER = 4161 + SYS_SCHED_YIELD = 4162 + SYS_SCHED_GET_PRIORITY_MAX = 4163 + SYS_SCHED_GET_PRIORITY_MIN = 4164 + SYS_SCHED_RR_GET_INTERVAL = 4165 + SYS_NANOSLEEP = 4166 + SYS_MREMAP = 4167 + SYS_ACCEPT = 4168 + SYS_BIND = 4169 + SYS_CONNECT = 4170 + SYS_GETPEERNAME = 4171 + SYS_GETSOCKNAME = 4172 + SYS_GETSOCKOPT = 4173 + SYS_LISTEN = 4174 + SYS_RECV = 4175 + SYS_RECVFROM = 4176 + SYS_RECVMSG = 4177 + SYS_SEND = 4178 + SYS_SENDMSG = 4179 + SYS_SENDTO = 4180 + SYS_SETSOCKOPT = 4181 + SYS_SHUTDOWN = 4182 + SYS_SOCKET = 4183 + SYS_SOCKETPAIR = 4184 + SYS_SETRESUID = 4185 + SYS_GETRESUID = 4186 + SYS_QUERY_MODULE = 4187 + SYS_POLL = 4188 + SYS_NFSSERVCTL = 4189 + SYS_SETRESGID = 4190 + SYS_GETRESGID = 4191 + SYS_PRCTL = 4192 + SYS_RT_SIGRETURN = 4193 + SYS_RT_SIGACTION = 4194 + SYS_RT_SIGPROCMASK = 4195 + SYS_RT_SIGPENDING = 4196 + SYS_RT_SIGTIMEDWAIT = 4197 + SYS_RT_SIGQUEUEINFO = 4198 + SYS_RT_SIGSUSPEND = 4199 + SYS_PREAD64 = 4200 + SYS_PWRITE64 = 4201 + SYS_CHOWN = 4202 + SYS_GETCWD = 4203 + SYS_CAPGET = 4204 + SYS_CAPSET = 4205 + SYS_SIGALTSTACK = 4206 + SYS_SENDFILE = 4207 + SYS_GETPMSG = 4208 + SYS_PUTPMSG = 4209 + SYS_MMAP2 = 4210 + SYS_TRUNCATE64 = 4211 + SYS_FTRUNCATE64 = 4212 + SYS_STAT64 = 4213 + SYS_LSTAT64 = 4214 + SYS_FSTAT64 = 4215 + SYS_PIVOT_ROOT = 4216 + SYS_MINCORE = 4217 + SYS_MADVISE = 4218 + SYS_GETDENTS64 = 4219 + SYS_FCNTL64 = 4220 + SYS_RESERVED221 = 4221 + SYS_GETTID = 4222 + SYS_READAHEAD = 4223 + SYS_SETXATTR = 4224 + SYS_LSETXATTR = 4225 + SYS_FSETXATTR = 4226 + SYS_GETXATTR = 4227 + SYS_LGETXATTR = 4228 + SYS_FGETXATTR = 4229 + SYS_LISTXATTR = 4230 + SYS_LLISTXATTR = 4231 + SYS_FLISTXATTR = 4232 + SYS_REMOVEXATTR = 4233 + SYS_LREMOVEXATTR = 4234 + SYS_FREMOVEXATTR = 4235 + SYS_TKILL = 4236 + SYS_SENDFILE64 = 4237 + SYS_FUTEX = 4238 + SYS_SCHED_SETAFFINITY = 4239 + SYS_SCHED_GETAFFINITY = 4240 + SYS_IO_SETUP = 4241 + SYS_IO_DESTROY = 4242 + SYS_IO_GETEVENTS = 4243 + SYS_IO_SUBMIT = 4244 + SYS_IO_CANCEL = 4245 + SYS_EXIT_GROUP = 4246 + SYS_LOOKUP_DCOOKIE = 4247 + SYS_EPOLL_CREATE = 4248 + SYS_EPOLL_CTL = 4249 + SYS_EPOLL_WAIT = 4250 + SYS_REMAP_FILE_PAGES = 4251 + SYS_SET_TID_ADDRESS = 4252 + SYS_RESTART_SYSCALL = 4253 + SYS_FADVISE64 = 4254 + SYS_STATFS64 = 4255 + SYS_FSTATFS64 = 4256 + SYS_TIMER_CREATE = 4257 + SYS_TIMER_SETTIME = 4258 + SYS_TIMER_GETTIME = 4259 + SYS_TIMER_GETOVERRUN = 4260 + SYS_TIMER_DELETE = 4261 + SYS_CLOCK_SETTIME = 4262 + SYS_CLOCK_GETTIME = 4263 + SYS_CLOCK_GETRES = 4264 + SYS_CLOCK_NANOSLEEP = 4265 + SYS_TGKILL = 4266 + SYS_UTIMES = 4267 + SYS_MBIND = 4268 + SYS_GET_MEMPOLICY = 4269 + SYS_SET_MEMPOLICY = 4270 + SYS_MQ_OPEN = 4271 + SYS_MQ_UNLINK = 4272 + SYS_MQ_TIMEDSEND = 4273 + SYS_MQ_TIMEDRECEIVE = 4274 + SYS_MQ_NOTIFY = 4275 + SYS_MQ_GETSETATTR = 4276 + SYS_VSERVER = 4277 + SYS_WAITID = 4278 + SYS_ADD_KEY = 4280 + SYS_REQUEST_KEY = 4281 + SYS_KEYCTL = 4282 + SYS_SET_THREAD_AREA = 4283 + SYS_INOTIFY_INIT = 4284 + SYS_INOTIFY_ADD_WATCH = 4285 + SYS_INOTIFY_RM_WATCH = 4286 + SYS_MIGRATE_PAGES = 4287 + SYS_OPENAT = 4288 + SYS_MKDIRAT = 4289 + SYS_MKNODAT = 4290 + SYS_FCHOWNAT = 4291 + SYS_FUTIMESAT = 4292 + SYS_FSTATAT64 = 4293 + SYS_UNLINKAT = 4294 + SYS_RENAMEAT = 4295 + SYS_LINKAT = 4296 + SYS_SYMLINKAT = 4297 + SYS_READLINKAT = 4298 + SYS_FCHMODAT = 4299 + SYS_FACCESSAT = 4300 + SYS_PSELECT6 = 4301 + SYS_PPOLL = 4302 + SYS_UNSHARE = 4303 + SYS_SPLICE = 4304 + SYS_SYNC_FILE_RANGE = 4305 + SYS_TEE = 4306 + SYS_VMSPLICE = 4307 + SYS_MOVE_PAGES = 4308 + SYS_SET_ROBUST_LIST = 4309 + SYS_GET_ROBUST_LIST = 4310 + SYS_KEXEC_LOAD = 4311 + SYS_GETCPU = 4312 + SYS_EPOLL_PWAIT = 4313 + SYS_IOPRIO_SET = 4314 + SYS_IOPRIO_GET = 4315 + SYS_UTIMENSAT = 4316 + SYS_SIGNALFD = 4317 + SYS_TIMERFD = 4318 + SYS_EVENTFD = 4319 + SYS_FALLOCATE = 4320 + SYS_TIMERFD_CREATE = 4321 + SYS_TIMERFD_GETTIME = 4322 + SYS_TIMERFD_SETTIME = 4323 + SYS_SIGNALFD4 = 4324 + SYS_EVENTFD2 = 4325 + SYS_EPOLL_CREATE1 = 4326 + SYS_DUP3 = 4327 + SYS_PIPE2 = 4328 + SYS_INOTIFY_INIT1 = 4329 + SYS_PREADV = 4330 + SYS_PWRITEV = 4331 + SYS_RT_TGSIGQUEUEINFO = 4332 + SYS_PERF_EVENT_OPEN = 4333 + SYS_ACCEPT4 = 4334 + SYS_RECVMMSG = 4335 + SYS_FANOTIFY_INIT = 4336 + SYS_FANOTIFY_MARK = 4337 + SYS_PRLIMIT64 = 4338 + SYS_NAME_TO_HANDLE_AT = 4339 + SYS_OPEN_BY_HANDLE_AT = 4340 + SYS_CLOCK_ADJTIME = 4341 + SYS_SYNCFS = 4342 + SYS_SENDMMSG = 4343 + SYS_SETNS = 4344 + SYS_PROCESS_VM_READV = 4345 + SYS_PROCESS_VM_WRITEV = 4346 + SYS_KCMP = 4347 + SYS_FINIT_MODULE = 4348 + SYS_SCHED_SETATTR = 4349 + SYS_SCHED_GETATTR = 4350 + SYS_RENAMEAT2 = 4351 + SYS_SECCOMP = 4352 + SYS_GETRANDOM = 4353 + SYS_MEMFD_CREATE = 4354 + SYS_BPF = 4355 + SYS_EXECVEAT = 4356 + SYS_USERFAULTFD = 4357 + SYS_MEMBARRIER = 4358 + SYS_MLOCK2 = 4359 + SYS_COPY_FILE_RANGE = 4360 + SYS_PREADV2 = 4361 + SYS_PWRITEV2 = 4362 + SYS_PKEY_MPROTECT = 4363 + SYS_PKEY_ALLOC = 4364 + SYS_PKEY_FREE = 4365 + SYS_STATX = 4366 + SYS_RSEQ = 4367 + SYS_IO_PGETEVENTS = 4368 + SYS_SEMGET = 4393 + SYS_SEMCTL = 4394 + SYS_SHMGET = 4395 + SYS_SHMCTL = 4396 + SYS_SHMAT = 4397 + SYS_SHMDT = 4398 + SYS_MSGGET = 4399 + SYS_MSGSND = 4400 + SYS_MSGRCV = 4401 + SYS_MSGCTL = 4402 + SYS_CLOCK_GETTIME64 = 4403 + SYS_CLOCK_SETTIME64 = 4404 + SYS_CLOCK_ADJTIME64 = 4405 + SYS_CLOCK_GETRES_TIME64 = 4406 + SYS_CLOCK_NANOSLEEP_TIME64 = 4407 + SYS_TIMER_GETTIME64 = 4408 + SYS_TIMER_SETTIME64 = 4409 + SYS_TIMERFD_GETTIME64 = 4410 + SYS_TIMERFD_SETTIME64 = 4411 + SYS_UTIMENSAT_TIME64 = 4412 + SYS_PSELECT6_TIME64 = 4413 + SYS_PPOLL_TIME64 = 4414 + SYS_IO_PGETEVENTS_TIME64 = 4416 + SYS_RECVMMSG_TIME64 = 4417 + SYS_MQ_TIMEDSEND_TIME64 = 4418 + SYS_MQ_TIMEDRECEIVE_TIME64 = 4419 + SYS_SEMTIMEDOP_TIME64 = 4420 + SYS_RT_SIGTIMEDWAIT_TIME64 = 4421 + SYS_FUTEX_TIME64 = 4422 + SYS_SCHED_RR_GET_INTERVAL_TIME64 = 4423 + SYS_PIDFD_SEND_SIGNAL = 4424 + SYS_IO_URING_SETUP = 4425 + SYS_IO_URING_ENTER = 4426 + SYS_IO_URING_REGISTER = 4427 + SYS_OPEN_TREE = 4428 + SYS_MOVE_MOUNT = 4429 + SYS_FSOPEN = 4430 + SYS_FSCONFIG = 4431 + SYS_FSMOUNT = 4432 + SYS_FSPICK = 4433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index ec5bde3d..5744149e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -372,4 +372,25 @@ const ( SYS_PKEY_MPROTECT = 386 SYS_RSEQ = 387 SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index bdbabdbc..21c83204 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -372,4 +372,25 @@ const ( SYS_PKEY_MPROTECT = 386 SYS_RSEQ = 387 SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 2c8c46a2..c1bb6d8f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -285,4 +285,14 @@ const ( SYS_IO_PGETEVENTS = 292 SYS_RSEQ = 293 SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 6eb7c257..bc3cc6b5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -334,4 +334,28 @@ const ( SYS_KEXEC_FILE_LOAD = 381 SYS_IO_PGETEVENTS = 382 SYS_RSEQ = 383 + SYS_PKEY_MPROTECT = 384 + SYS_PKEY_ALLOC = 385 + SYS_PKEY_FREE = 386 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 6ed30637..0a2841ba 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -348,4 +348,29 @@ const ( SYS_PWRITEV2 = 359 SYS_STATX = 360 SYS_IO_PGETEVENTS = 361 + SYS_PKEY_MPROTECT = 362 + SYS_PKEY_ALLOC = 363 + SYS_PKEY_FREE = 364 + SYS_RSEQ = 365 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go new file mode 100644 index 00000000..fe2b689b --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go @@ -0,0 +1,217 @@ +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build arm64,openbsd + +package unix + +const ( + SYS_EXIT = 1 // { void sys_exit(int rval); } + SYS_FORK = 2 // { int sys_fork(void); } + SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_CLOSE = 6 // { int sys_close(int fd); } + SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } + SYS_UNLINK = 10 // { int sys_unlink(const char *path); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_CHDIR = 12 // { int sys_chdir(const char *path); } + SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break + SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETPID = 20 // { pid_t sys_getpid(void); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } + SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t sys_getuid(void); } + SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } + SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } + SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } + SYS_SYNC = 36 // { void sys_sync(void); } + SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } + SYS_GETPPID = 39 // { pid_t sys_getppid(void); } + SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } + SYS_DUP = 41 // { int sys_dup(int fd); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_GETEGID = 43 // { gid_t sys_getegid(void); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_GETGID = 47 // { gid_t sys_getgid(void); } + SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } + SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } + SYS_ACCT = 51 // { int sys_acct(const char *path); } + SYS_SIGPENDING = 52 // { int sys_sigpending(void); } + SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_REBOOT = 55 // { int sys_reboot(int opt); } + SYS_REVOKE = 56 // { int sys_revoke(const char *path); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } + SYS_CHROOT = 61 // { int sys_chroot(const char *path); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } + SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_VFORK = 66 // { int sys_vfork(void); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } + SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } + SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } + SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } + SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_GETPGRP = 81 // { int sys_getpgrp(void); } + SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } + SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } + SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS_FSYNC = 95 // { int sys_fsync(int fd); } + SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } + SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } + SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } + SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } + SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } + SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } + SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } + SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } + SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } + SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } + SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_KILL = 122 // { int sys_kill(int pid, int signum); } + SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } + SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } + SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } + SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); } + SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } + SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } + SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } + SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } + SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } + SYS_SETSID = 147 // { int sys_setsid(void); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } + SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } + SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } + SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } + SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } + SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } + SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } + SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } + SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } + SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_ISSETUGID = 253 // { int sys_issetugid(void); } + SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } + SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } + SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } + SYS_PIPE = 263 // { int sys_pipe(int *fdp); } + SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_KQUEUE = 269 // { int sys_kqueue(void); } + SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } + SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } + SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } + SYS_GETRTABLE = 311 // { int sys_getrtable(void); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } + SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index cedc9b0f..2c1f815e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -30,11 +30,6 @@ type Timespec struct { Nsec int32 } -type StTimespec struct { - Sec int32 - Nsec int32 -} - type Timeval struct { Sec int32 Usec int32 @@ -101,9 +96,9 @@ type Stat_t struct { Gid uint32 Rdev uint32 Size int32 - Atim StTimespec - Mtim StTimespec - Ctim StTimespec + Atim Timespec + Mtim Timespec + Ctim Timespec Blksize int32 Blocks int32 Vfstype int32 @@ -148,6 +143,17 @@ type RawSockaddrUnix struct { Path [1023]uint8 } +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [120]uint8 +} + type RawSockaddr struct { Len uint8 Family uint8 @@ -207,17 +213,18 @@ type Msghdr struct { } const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x404 - SizeofSockaddrUnix = 0x401 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc - SizeofICMPv6Filter = 0x20 + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x404 + SizeofSockaddrUnix = 0x401 + SizeofSockaddrDatalink = 0x80 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc + SizeofICMPv6Filter = 0x20 ) const ( diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index f46482d2..b4a069ec 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -30,12 +30,6 @@ type Timespec struct { Nsec int64 } -type StTimespec struct { - Sec int64 - Nsec int32 - _ [4]byte -} - type Timeval struct { Sec int64 Usec int32 @@ -103,10 +97,9 @@ type Stat_t struct { Gid uint32 Rdev uint64 Ssize int32 - _ [4]byte - Atim StTimespec - Mtim StTimespec - Ctim StTimespec + Atim Timespec + Mtim Timespec + Ctim Timespec Blksize int64 Blocks int64 Vfstype int32 @@ -154,6 +147,17 @@ type RawSockaddrUnix struct { Path [1023]uint8 } +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [120]uint8 +} + type RawSockaddr struct { Len uint8 Family uint8 @@ -205,27 +209,26 @@ type Linger struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Control *byte Controllen uint32 Flags int32 } const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x404 - SizeofSockaddrUnix = 0x401 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofMsghdr = 0x30 - SizeofCmsghdr = 0xc - SizeofICMPv6Filter = 0x20 + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x404 + SizeofSockaddrUnix = 0x401 + SizeofSockaddrDatalink = 0x80 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofICMPv6Filter = 0x20 ) const ( @@ -339,7 +342,6 @@ type Statfs_t struct { Ffree uint64 Fsid Fsid64_t Vfstype int32 - _ [4]byte Fsize uint64 Vfsnumber int32 Vfsoff int32 diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go index cefe2f8e..9f47b87c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go @@ -59,24 +59,24 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index c6bb883c..966798a8 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -63,25 +63,25 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - _ [4]byte - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + _ [4]byte + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go index 94c23bc2..4fe4c9cd 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go @@ -60,24 +60,24 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index c82a930c..21999e4b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -63,25 +63,25 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - _ [4]byte - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 + Dev int32 + Mode uint16 + Nlink uint16 + Ino uint64 + Uid uint32 + Gid uint32 + Rdev int32 + _ [4]byte + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare [2]int64 } type Statfs_t struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index 7b34e2e2..c206f2b0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -57,25 +57,25 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Ino uint64 - Nlink uint32 - Dev uint32 - Mode uint16 - Padding1 uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare1 int64 - Qspare2 int64 + Ino uint64 + Nlink uint32 + Dev uint32 + Mode uint16 + _1 uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Lspare int32 + Qspare1 int64 + Qspare2 int64 } type Statfs_t struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index c146c1ad..7312e95f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -62,50 +62,50 @@ const ( ) type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - Atim_ext int32 - Atim Timespec - Mtim_ext int32 - Mtim Timespec - Ctim_ext int32 - Ctim Timespec - Btim_ext int32 - Birthtim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint16 + _0 int16 + Uid uint32 + Gid uint32 + _1 int32 + Rdev uint64 + _ int32 + Atim Timespec + _ int32 + Mtim Timespec + _ int32 + Ctim Timespec + _ int32 + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint64 + Spare [10]uint64 } type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Birthtim Timespec - _ [8]byte + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Btim Timespec + _ [8]byte } type Statfs_t struct { @@ -324,11 +324,108 @@ const ( ) const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 + PTRACE_ATTACH = 0xa + PTRACE_CONT = 0x7 + PTRACE_DETACH = 0xb + PTRACE_GETFPREGS = 0x23 + PTRACE_GETFSBASE = 0x47 + PTRACE_GETLWPLIST = 0xf + PTRACE_GETNUMLWPS = 0xe + PTRACE_GETREGS = 0x21 + PTRACE_GETXSTATE = 0x45 + PTRACE_IO = 0xc + PTRACE_KILL = 0x8 + PTRACE_LWPEVENTS = 0x18 + PTRACE_LWPINFO = 0xd + PTRACE_SETFPREGS = 0x24 + PTRACE_SETREGS = 0x22 + PTRACE_SINGLESTEP = 0x9 + PTRACE_TRACEME = 0x0 ) +const ( + PIOD_READ_D = 0x1 + PIOD_WRITE_D = 0x2 + PIOD_READ_I = 0x3 + PIOD_WRITE_I = 0x4 +) + +const ( + PL_FLAG_BORN = 0x100 + PL_FLAG_EXITED = 0x200 + PL_FLAG_SI = 0x20 +) + +const ( + TRAP_BRKPT = 0x1 + TRAP_TRACE = 0x2 +) + +type PtraceLwpInfoStruct struct { + Lwpid int32 + Event int32 + Flags int32 + Sigmask Sigset_t + Siglist Sigset_t + Siginfo __Siginfo + Tdname [20]int8 + Child_pid int32 + Syscall_code uint32 + Syscall_narg uint32 +} + +type __Siginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr *byte + Value [4]byte + X_reason [32]byte +} + +type Sigset_t struct { + Val [4]uint32 +} + +type Reg struct { + Fs uint32 + Es uint32 + Ds uint32 + Edi uint32 + Esi uint32 + Ebp uint32 + Isp uint32 + Ebx uint32 + Edx uint32 + Ecx uint32 + Eax uint32 + Trapno uint32 + Err uint32 + Eip uint32 + Cs uint32 + Eflags uint32 + Esp uint32 + Ss uint32 + Gs uint32 +} + +type FpReg struct { + Env [7]uint32 + Acc [8][10]uint8 + Ex_sw uint32 + Pad [64]uint8 +} + +type PtraceIoDesc struct { + Op int32 + Offs *byte + Addr *byte + Len uint +} + type Kevent_t struct { Ident uint32 Filter int16 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index ac33a8dd..29ba2f5b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -62,45 +62,45 @@ const ( ) type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Birthtim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint16 + _0 int16 + Uid uint32 + Gid uint32 + _1 int32 + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint64 + Spare [10]uint64 } type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Birthtim Timespec + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Btim Timespec } type Statfs_t struct { @@ -322,11 +322,115 @@ const ( ) const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 + PTRACE_ATTACH = 0xa + PTRACE_CONT = 0x7 + PTRACE_DETACH = 0xb + PTRACE_GETFPREGS = 0x23 + PTRACE_GETFSBASE = 0x47 + PTRACE_GETLWPLIST = 0xf + PTRACE_GETNUMLWPS = 0xe + PTRACE_GETREGS = 0x21 + PTRACE_GETXSTATE = 0x45 + PTRACE_IO = 0xc + PTRACE_KILL = 0x8 + PTRACE_LWPEVENTS = 0x18 + PTRACE_LWPINFO = 0xd + PTRACE_SETFPREGS = 0x24 + PTRACE_SETREGS = 0x22 + PTRACE_SINGLESTEP = 0x9 + PTRACE_TRACEME = 0x0 ) +const ( + PIOD_READ_D = 0x1 + PIOD_WRITE_D = 0x2 + PIOD_READ_I = 0x3 + PIOD_WRITE_I = 0x4 +) + +const ( + PL_FLAG_BORN = 0x100 + PL_FLAG_EXITED = 0x200 + PL_FLAG_SI = 0x20 +) + +const ( + TRAP_BRKPT = 0x1 + TRAP_TRACE = 0x2 +) + +type PtraceLwpInfoStruct struct { + Lwpid int32 + Event int32 + Flags int32 + Sigmask Sigset_t + Siglist Sigset_t + Siginfo __Siginfo + Tdname [20]int8 + Child_pid int32 + Syscall_code uint32 + Syscall_narg uint32 +} + +type __Siginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr *byte + Value [8]byte + _ [40]byte +} + +type Sigset_t struct { + Val [4]uint32 +} + +type Reg struct { + R15 int64 + R14 int64 + R13 int64 + R12 int64 + R11 int64 + R10 int64 + R9 int64 + R8 int64 + Rdi int64 + Rsi int64 + Rbp int64 + Rbx int64 + Rdx int64 + Rcx int64 + Rax int64 + Trapno uint32 + Fs uint16 + Gs uint16 + Err uint32 + Es uint16 + Ds uint16 + Rip int64 + Cs int64 + Rflags int64 + Rsp int64 + Ss int64 +} + +type FpReg struct { + Env [4]uint64 + Acc [8][16]uint8 + Xacc [16][16]uint8 + Spare [12]uint64 +} + +type PtraceIoDesc struct { + Op int32 + Offs *byte + Addr *byte + Len uint +} + type Kevent_t struct { Ident uint64 Filter int16 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index e27511a6..b4090ef3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -64,45 +64,45 @@ const ( ) type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Birthtim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint16 + _0 int16 + Uid uint32 + Gid uint32 + _1 int32 + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint64 + Spare [10]uint64 } type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Birthtim Timespec + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Btim Timespec } type Statfs_t struct { @@ -322,11 +322,92 @@ const ( ) const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 + PTRACE_ATTACH = 0xa + PTRACE_CONT = 0x7 + PTRACE_DETACH = 0xb + PTRACE_GETFPREGS = 0x23 + PTRACE_GETFSBASE = 0x47 + PTRACE_GETLWPLIST = 0xf + PTRACE_GETNUMLWPS = 0xe + PTRACE_GETREGS = 0x21 + PTRACE_GETXSTATE = 0x45 + PTRACE_IO = 0xc + PTRACE_KILL = 0x8 + PTRACE_LWPEVENTS = 0x18 + PTRACE_LWPINFO = 0xd + PTRACE_SETFPREGS = 0x24 + PTRACE_SETREGS = 0x22 + PTRACE_SINGLESTEP = 0x9 + PTRACE_TRACEME = 0x0 ) +const ( + PIOD_READ_D = 0x1 + PIOD_WRITE_D = 0x2 + PIOD_READ_I = 0x3 + PIOD_WRITE_I = 0x4 +) + +const ( + PL_FLAG_BORN = 0x100 + PL_FLAG_EXITED = 0x200 + PL_FLAG_SI = 0x20 +) + +const ( + TRAP_BRKPT = 0x1 + TRAP_TRACE = 0x2 +) + +type PtraceLwpInfoStruct struct { + Lwpid int32 + Event int32 + Flags int32 + Sigmask Sigset_t + Siglist Sigset_t + Siginfo __Siginfo + Tdname [20]int8 + Child_pid int32 + Syscall_code uint32 + Syscall_narg uint32 +} + +type __Siginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr *byte + Value [4]byte + X_reason [32]byte +} + +type Sigset_t struct { + Val [4]uint32 +} + +type Reg struct { + R [13]uint32 + R_sp uint32 + R_lr uint32 + R_pc uint32 + R_cpsr uint32 +} + +type FpReg struct { + Fpr_fpsr uint32 + Fpr [8][3]uint32 +} + +type PtraceIoDesc struct { + Op int32 + Offs *byte + Addr *byte + Len uint +} + type Kevent_t struct { Ident uint32 Filter int16 diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index 2aadc1a4..1542a877 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -62,45 +62,45 @@ const ( ) type Stat_t struct { - Dev uint64 - Ino uint64 - Nlink uint64 - Mode uint16 - _0 int16 - Uid uint32 - Gid uint32 - _1 int32 - Rdev uint64 - Atim Timespec - Mtim Timespec - Ctim Timespec - Birthtim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint64 - Spare [10]uint64 + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint16 + _0 int16 + Uid uint32 + Gid uint32 + _1 int32 + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint64 + Spare [10]uint64 } type stat_freebsd11_t struct { - Dev uint32 - Ino uint32 - Mode uint16 - Nlink uint16 - Uid uint32 - Gid uint32 - Rdev uint32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Birthtim Timespec + Dev uint32 + Ino uint32 + Mode uint16 + Nlink uint16 + Uid uint32 + Gid uint32 + Rdev uint32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + Lspare int32 + Btim Timespec } type Statfs_t struct { @@ -322,11 +322,93 @@ const ( ) const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 + PTRACE_ATTACH = 0xa + PTRACE_CONT = 0x7 + PTRACE_DETACH = 0xb + PTRACE_GETFPREGS = 0x23 + PTRACE_GETFSBASE = 0x47 + PTRACE_GETLWPLIST = 0xf + PTRACE_GETNUMLWPS = 0xe + PTRACE_GETREGS = 0x21 + PTRACE_GETXSTATE = 0x45 + PTRACE_IO = 0xc + PTRACE_KILL = 0x8 + PTRACE_LWPEVENTS = 0x18 + PTRACE_LWPINFO = 0xd + PTRACE_SETFPREGS = 0x24 + PTRACE_SETREGS = 0x22 + PTRACE_SINGLESTEP = 0x9 + PTRACE_TRACEME = 0x0 ) +const ( + PIOD_READ_D = 0x1 + PIOD_WRITE_D = 0x2 + PIOD_READ_I = 0x3 + PIOD_WRITE_I = 0x4 +) + +const ( + PL_FLAG_BORN = 0x100 + PL_FLAG_EXITED = 0x200 + PL_FLAG_SI = 0x20 +) + +const ( + TRAP_BRKPT = 0x1 + TRAP_TRACE = 0x2 +) + +type PtraceLwpInfoStruct struct { + Lwpid int32 + Event int32 + Flags int32 + Sigmask Sigset_t + Siglist Sigset_t + Siginfo __Siginfo + Tdname [20]int8 + Child_pid int32 + Syscall_code uint32 + Syscall_narg uint32 +} + +type __Siginfo struct { + Signo int32 + Errno int32 + Code int32 + Pid int32 + Uid uint32 + Status int32 + Addr *byte + Value [8]byte + X_reason [40]byte +} + +type Sigset_t struct { + Val [4]uint32 +} + +type Reg struct { + X [30]uint64 + Lr uint64 + Sp uint64 + Elr uint64 + Spsr uint32 +} + +type FpReg struct { + Fp_q [32]uint128 + Fp_sr uint32 + Fp_cr uint32 +} + +type PtraceIoDesc struct { + Op int32 + Offs *byte + Addr *byte + Len uint +} + type Kevent_t struct { Ident uint64 Filter int16 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 6dfe56be..50bc4128 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -443,139 +443,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -652,6 +694,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -777,6 +829,8 @@ type Sigset_t struct { Val [32]uint32 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1400,6 +1454,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2081,3 +2150,374 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint16 + Inode uint32 + Rdevice uint16 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint32 + Reserved [4]int8 +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 9f8cbf4c..055eaa76 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -444,139 +444,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -653,6 +695,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -790,6 +842,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1412,6 +1466,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2094,3 +2163,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint64 + Inode uint64 + Rdevice uint64 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]int8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index cbbf19a4..66019c9c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -447,139 +447,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -656,6 +698,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -766,6 +818,8 @@ type Sigset_t struct { Val [32]uint32 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1390,6 +1444,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2072,3 +2141,374 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]uint8 + Driver_name [64]uint8 + Module_name [64]uint8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]uint8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]uint8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]uint8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]uint8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]uint8 +} + +type CryptoReportLarval struct { + Type [64]uint8 +} + +type CryptoReportHash struct { + Type [64]uint8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]uint8 +} + +type CryptoReportRNG struct { + Type [64]uint8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]uint8 +} + +type CryptoReportKPP struct { + Type [64]uint8 +} + +type CryptoReportAcomp struct { + Type [64]uint8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint16 + Inode uint32 + Rdevice uint16 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint32 + Reserved [4]uint8 +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index be21189d..3104798c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -445,139 +445,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -654,6 +696,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -769,6 +821,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1391,6 +1445,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2073,3 +2142,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint64 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]int8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index d599ca27..46c86021 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -446,139 +446,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -655,6 +697,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -771,6 +823,8 @@ type Sigset_t struct { Val [32]uint32 } +const _C__NSIG = 0x80 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1396,6 +1450,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2078,3 +2147,374 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint32 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint32 + Reserved [4]int8 +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 011be86b..c2fe1a62 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -445,139 +445,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -654,6 +696,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -771,6 +823,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x80 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1393,6 +1447,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2075,3 +2144,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint64 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]int8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 81634451..f1eb0d39 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -445,139 +445,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -654,6 +696,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -771,6 +823,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x80 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1393,6 +1447,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2075,3 +2144,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint64 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]int8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 4ecf7a8c..8759bc36 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -446,139 +446,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -655,6 +697,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x8 @@ -771,6 +823,8 @@ type Sigset_t struct { Val [32]uint32 } +const _C__NSIG = 0x80 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1396,6 +1450,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2078,3 +2147,374 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint32 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint32 + Reserved [4]int8 +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index ea817baf..a8120054 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -446,139 +446,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -655,6 +697,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -779,6 +831,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1401,6 +1455,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2083,3 +2152,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]uint8 + Driver_name [64]uint8 + Module_name [64]uint8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]uint8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]uint8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]uint8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]uint8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]uint8 +} + +type CryptoReportLarval struct { + Type [64]uint8 +} + +type CryptoReportHash struct { + Type [64]uint8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]uint8 +} + +type CryptoReportRNG struct { + Type [64]uint8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]uint8 +} + +type CryptoReportKPP struct { + Type [64]uint8 +} + +type CryptoReportAcomp struct { + Type [64]uint8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint64 + Inode uint64 + Rdevice uint64 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]uint8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 192ea3b1..74b7a919 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -446,139 +446,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -655,6 +697,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -779,6 +831,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1401,6 +1455,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2083,3 +2152,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]uint8 + Driver_name [64]uint8 + Module_name [64]uint8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]uint8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]uint8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]uint8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]uint8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]uint8 +} + +type CryptoReportLarval struct { + Type [64]uint8 +} + +type CryptoReportHash struct { + Type [64]uint8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]uint8 +} + +type CryptoReportRNG struct { + Type [64]uint8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]uint8 +} + +type CryptoReportKPP struct { + Type [64]uint8 +} + +type CryptoReportAcomp struct { + Type [64]uint8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint64 + Inode uint64 + Rdevice uint64 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]uint8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 673e5e79..8344583e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -445,139 +445,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -654,6 +696,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -796,6 +848,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1418,6 +1472,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2100,3 +2169,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]uint8 + Driver_name [64]uint8 + Module_name [64]uint8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]uint8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]uint8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]uint8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]uint8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]uint8 +} + +type CryptoReportLarval struct { + Type [64]uint8 +} + +type CryptoReportHash struct { + Type [64]uint8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]uint8 +} + +type CryptoReportRNG struct { + Type [64]uint8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]uint8 +} + +type CryptoReportKPP struct { + Type [64]uint8 +} + +type CryptoReportAcomp struct { + Type [64]uint8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint64 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]uint8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index faafcddf..d8fc0bc1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -444,139 +444,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -653,6 +695,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -792,6 +844,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1415,6 +1469,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2097,3 +2166,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint16 + Inode uint64 + Rdevice uint16 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]int8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 392dd737..5e0ab932 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -448,139 +448,181 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_INFO_KIND = 0x1 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_MAX = 0x33 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_MAX = 0x33 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -657,6 +699,16 @@ type NdUseroptmsg struct { Pad3 uint32 } +type NdMsg struct { + Family uint8 + Pad1 uint8 + Pad2 uint16 + Ifindex int32 + State uint16 + Flags uint8 + Type uint8 +} + const ( SizeofSockFilter = 0x8 SizeofSockFprog = 0x10 @@ -774,6 +826,8 @@ type Sigset_t struct { Val [16]uint64 } +const _C__NSIG = 0x41 + type SignalfdSiginfo struct { Signo uint32 Errno int32 @@ -1396,6 +1450,21 @@ type TpacketBlockDesc struct { Hdr [40]byte } +type TpacketBDTS struct { + Sec uint32 + Usec uint32 +} + +type TpacketHdrV1 struct { + Block_status uint32 + Num_pkts uint32 + Offset_to_first_pkt uint32 + Blk_len uint32 + Seq_num uint64 + Ts_first_pkt TpacketBDTS + Ts_last_pkt TpacketBDTS +} + type TpacketReq struct { Block_size uint32 Block_nr uint32 @@ -2078,3 +2147,375 @@ type FanotifyResponse struct { Fd int32 Response uint32 } + +const ( + CRYPTO_MSG_BASE = 0x10 + CRYPTO_MSG_NEWALG = 0x10 + CRYPTO_MSG_DELALG = 0x11 + CRYPTO_MSG_UPDATEALG = 0x12 + CRYPTO_MSG_GETALG = 0x13 + CRYPTO_MSG_DELRNG = 0x14 + CRYPTO_MSG_GETSTAT = 0x15 +) + +const ( + CRYPTOCFGA_UNSPEC = 0x0 + CRYPTOCFGA_PRIORITY_VAL = 0x1 + CRYPTOCFGA_REPORT_LARVAL = 0x2 + CRYPTOCFGA_REPORT_HASH = 0x3 + CRYPTOCFGA_REPORT_BLKCIPHER = 0x4 + CRYPTOCFGA_REPORT_AEAD = 0x5 + CRYPTOCFGA_REPORT_COMPRESS = 0x6 + CRYPTOCFGA_REPORT_RNG = 0x7 + CRYPTOCFGA_REPORT_CIPHER = 0x8 + CRYPTOCFGA_REPORT_AKCIPHER = 0x9 + CRYPTOCFGA_REPORT_KPP = 0xa + CRYPTOCFGA_REPORT_ACOMP = 0xb + CRYPTOCFGA_STAT_LARVAL = 0xc + CRYPTOCFGA_STAT_HASH = 0xd + CRYPTOCFGA_STAT_BLKCIPHER = 0xe + CRYPTOCFGA_STAT_AEAD = 0xf + CRYPTOCFGA_STAT_COMPRESS = 0x10 + CRYPTOCFGA_STAT_RNG = 0x11 + CRYPTOCFGA_STAT_CIPHER = 0x12 + CRYPTOCFGA_STAT_AKCIPHER = 0x13 + CRYPTOCFGA_STAT_KPP = 0x14 + CRYPTOCFGA_STAT_ACOMP = 0x15 +) + +type CryptoUserAlg struct { + Name [64]int8 + Driver_name [64]int8 + Module_name [64]int8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]int8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]int8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]int8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]int8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]int8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]int8 +} + +type CryptoReportLarval struct { + Type [64]int8 +} + +type CryptoReportHash struct { + Type [64]int8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]int8 + Geniv [64]int8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]int8 +} + +type CryptoReportRNG struct { + Type [64]int8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]int8 +} + +type CryptoReportKPP struct { + Type [64]int8 +} + +type CryptoReportAcomp struct { + Type [64]int8 +} + +const ( + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 +) + +type CapUserHeader struct { + Version uint32 + Pid int32 +} + +type CapUserData struct { + Effective uint32 + Permitted uint32 + Inheritable uint32 +} + +const ( + LINUX_CAPABILITY_VERSION_1 = 0x19980330 + LINUX_CAPABILITY_VERSION_2 = 0x20071026 + LINUX_CAPABILITY_VERSION_3 = 0x20080522 +) + +const ( + LO_FLAGS_READ_ONLY = 0x1 + LO_FLAGS_AUTOCLEAR = 0x4 + LO_FLAGS_PARTSCAN = 0x8 + LO_FLAGS_DIRECT_IO = 0x10 +) + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint64 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]int8 + Encrypt_key [32]uint8 + Init [2]uint64 + Reserved [4]int8 + _ [4]byte +} +type LoopInfo64 struct { + Device uint64 + Inode uint64 + Rdevice uint64 + Offset uint64 + Sizelimit uint64 + Number uint32 + Encrypt_type uint32 + Encrypt_key_size uint32 + Flags uint32 + File_name [64]uint8 + Crypt_name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index 2dae0c17..86736ab6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -57,23 +57,23 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - Mode uint32 - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev uint64 - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 + Dev uint64 + Mode uint32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 } type Statfs_t [0]byte @@ -411,6 +411,7 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x200 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 1f0e76c0..3427811f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -58,26 +58,26 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - Mode uint32 - Pad_cgo_0 [4]byte - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Pad_cgo_1 [4]byte - Rdev uint64 - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 - Pad_cgo_2 [4]byte + Dev uint64 + Mode uint32 + _ [4]byte + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + _ [4]byte + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 + _ [4]byte } type Statfs_t [0]byte @@ -418,6 +418,7 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x200 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index 53f2159c..399f37a4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -59,26 +59,26 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - Mode uint32 - Pad_cgo_0 [4]byte - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Pad_cgo_1 [4]byte - Rdev uint64 - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 - Pad_cgo_2 [4]byte + Dev uint64 + Mode uint32 + _ [4]byte + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + _ [4]byte + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 + _ [4]byte } type Statfs_t [0]byte @@ -416,6 +416,7 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x200 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go index 43da2c41..32f0c15d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -58,26 +58,26 @@ type Rlimit struct { type _Gid_t uint32 type Stat_t struct { - Dev uint64 - Mode uint32 - Pad_cgo_0 [4]byte - Ino uint64 - Nlink uint32 - Uid uint32 - Gid uint32 - Pad_cgo_1 [4]byte - Rdev uint64 - Atimespec Timespec - Mtimespec Timespec - Ctimespec Timespec - Birthtimespec Timespec - Size int64 - Blocks int64 - Blksize uint32 - Flags uint32 - Gen uint32 - Spare [2]uint32 - Pad_cgo_2 [4]byte + Dev uint64 + Mode uint32 + _ [4]byte + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + _ [4]byte + Rdev uint64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Btim Timespec + Size int64 + Blocks int64 + Blksize uint32 + Flags uint32 + Gen uint32 + Spare [2]uint32 + _ [4]byte } type Statfs_t [0]byte @@ -418,6 +418,7 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x200 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 900fb446..61ea0019 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -436,6 +436,7 @@ type Winsize struct { const ( AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x4 AT_SYMLINK_NOFOLLOW = 0x2 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 028fa78d..87a493f6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -436,6 +436,7 @@ type Winsize struct { const ( AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x4 AT_SYMLINK_NOFOLLOW = 0x2 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index b45d5eed..d80836ef 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -437,6 +437,7 @@ type Winsize struct { const ( AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x4 AT_SYMLINK_NOFOLLOW = 0x2 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go new file mode 100644 index 00000000..4e158746 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -0,0 +1,565 @@ +// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +// +build arm64,openbsd + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type _Gid_t uint32 + +type Stat_t struct { + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + _ Timespec +} + +type Statfs_t struct { + F_flags uint32 + F_bsize uint32 + F_iosize uint32 + F_blocks uint64 + F_bfree uint64 + F_bavail int64 + F_files uint64 + F_ffree uint64 + F_favail int64 + F_syncwrites uint64 + F_syncreads uint64 + F_asyncwrites uint64 + F_asyncreads uint64 + F_fsid Fsid + F_namemax uint32 + F_owner uint32 + F_ctime uint64 + F_fstypename [16]int8 + F_mntonname [90]int8 + F_mntfromname [90]int8 + F_mntfromspec [90]int8 + _ [2]byte + Mount_info [160]byte +} + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 +} + +type Dirent struct { + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + _ [4]uint8 + Name [256]int8 +} + +type Fsid struct { + Val [2]int32 +} + +const ( + PathMax = 0x400 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [24]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x20 + SizeofLinger = 0x8 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type Kevent_t struct { + Ident uint64 + Filter int16 + Flags uint16 + Fflags uint32 + Data int64 + Udata *byte +} + +type FdSet struct { + Bits [32]uint32 +} + +const ( + SizeofIfMsghdr = 0xa8 + SizeofIfData = 0x90 + SizeofIfaMsghdr = 0x18 + SizeofIfAnnounceMsghdr = 0x1a + SizeofRtMsghdr = 0x60 + SizeofRtMetrics = 0x38 +) + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Xflags int32 + Data IfData +} + +type IfData struct { + Type uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Mtu uint32 + Metric uint32 + Rdomain uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Capabilities uint32 + Lastchange Timeval +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Metric int32 +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + What uint16 + Name [16]int8 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Priority uint8 + Mpls uint8 + Addrs int32 + Flags int32 + Fmask int32 + Pid int32 + Seq int32 + Errno int32 + Inits uint32 + Rmx RtMetrics +} + +type RtMetrics struct { + Pksent uint64 + Expire int64 + Locks uint32 + Mtu uint32 + Refcnt uint32 + Hopcount uint32 + Recvpipe uint32 + Sendpipe uint32 + Ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Pad uint32 +} + +type Mclpool struct{} + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x8 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x14 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint32 + Drop uint32 +} + +type BpfProgram struct { + Len uint32 + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + _ [2]byte +} + +type BpfTimeval struct { + Sec uint32 + Usec uint32 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed int32 + Ospeed int32 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +const ( + AT_FDCWD = -0x64 + AT_SYMLINK_FOLLOW = 0x4 + AT_SYMLINK_NOFOLLOW = 0x2 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLERR = 0x8 + POLLHUP = 0x10 + POLLIN = 0x1 + POLLNVAL = 0x20 + POLLOUT = 0x4 + POLLPRI = 0x2 + POLLRDBAND = 0x80 + POLLRDNORM = 0x40 + POLLWRBAND = 0x100 + POLLWRNORM = 0x4 +) + +type Sigset_t uint32 + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} + +const SizeofUvmexp = 0x158 + +type Uvmexp struct { + Pagesize int32 + Pagemask int32 + Pageshift int32 + Npages int32 + Free int32 + Active int32 + Inactive int32 + Paging int32 + Wired int32 + Zeropages int32 + Reserve_pagedaemon int32 + Reserve_kernel int32 + Unused01 int32 + Vnodepages int32 + Vtextpages int32 + Freemin int32 + Freetarg int32 + Inactarg int32 + Wiredmax int32 + Anonmin int32 + Vtextmin int32 + Vnodemin int32 + Anonminpct int32 + Vtextminpct int32 + Vnodeminpct int32 + Nswapdev int32 + Swpages int32 + Swpginuse int32 + Swpgonly int32 + Nswget int32 + Nanon int32 + Unused05 int32 + Unused06 int32 + Faults int32 + Traps int32 + Intrs int32 + Swtch int32 + Softs int32 + Syscalls int32 + Pageins int32 + Unused07 int32 + Unused08 int32 + Pgswapin int32 + Pgswapout int32 + Forks int32 + Forks_ppwait int32 + Forks_sharevm int32 + Pga_zerohit int32 + Pga_zeromiss int32 + Unused09 int32 + Fltnoram int32 + Fltnoanon int32 + Fltnoamap int32 + Fltpgwait int32 + Fltpgrele int32 + Fltrelck int32 + Fltrelckok int32 + Fltanget int32 + Fltanretry int32 + Fltamcopy int32 + Fltnamap int32 + Fltnomap int32 + Fltlget int32 + Fltget int32 + Flt_anon int32 + Flt_acow int32 + Flt_obj int32 + Flt_prcopy int32 + Flt_przero int32 + Pdwoke int32 + Pdrevs int32 + Pdswout int32 + Pdfreed int32 + Pdscans int32 + Pdanscan int32 + Pdobscan int32 + Pdreact int32 + Pdbusy int32 + Pdpageouts int32 + Pdpending int32 + Pddeact int32 + Unused11 int32 + Unused12 int32 + Unused13 int32 + Fpswtch int32 + Kmapent int32 +} + +const SizeofClockinfo = 0x14 + +type Clockinfo struct { + Hz int32 + Tick int32 + Tickadj int32 + Stathz int32 + Profhz int32 +} diff --git a/vendor/golang.org/x/sys/windows/env_windows.go b/vendor/golang.org/x/sys/windows/env_windows.go index bdc71e24..f482a9fa 100644 --- a/vendor/golang.org/x/sys/windows/env_windows.go +++ b/vendor/golang.org/x/sys/windows/env_windows.go @@ -6,7 +6,11 @@ package windows -import "syscall" +import ( + "syscall" + "unicode/utf16" + "unsafe" +) func Getenv(key string) (value string, found bool) { return syscall.Getenv(key) @@ -24,6 +28,34 @@ func Environ() []string { return syscall.Environ() } +// Returns a default environment associated with the token, rather than the current +// process. If inheritExisting is true, then this environment also inherits the +// environment of the current process. +func (token Token) Environ(inheritExisting bool) (env []string, err error) { + var block *uint16 + err = CreateEnvironmentBlock(&block, token, inheritExisting) + if err != nil { + return nil, err + } + defer DestroyEnvironmentBlock(block) + blockp := uintptr(unsafe.Pointer(block)) + for { + entry := (*[(1 << 30) - 1]uint16)(unsafe.Pointer(blockp))[:] + for i, v := range entry { + if v == 0 { + entry = entry[:i] + break + } + } + if len(entry) == 0 { + break + } + env = append(env, string(utf16.Decode(entry))) + blockp += 2 * (uintptr(len(entry)) + 1) + } + return env, nil +} + func Unsetenv(key string) error { return syscall.Unsetenv(key) } diff --git a/vendor/golang.org/x/sys/windows/mkerrors.bash b/vendor/golang.org/x/sys/windows/mkerrors.bash new file mode 100644 index 00000000..2163843a --- /dev/null +++ b/vendor/golang.org/x/sys/windows/mkerrors.bash @@ -0,0 +1,63 @@ +#!/bin/bash + +# Copyright 2019 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +set -e +shopt -s nullglob + +winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" +[[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } + +declare -A errors + +{ + echo "// Code generated by 'mkerrors.bash'; DO NOT EDIT." + echo + echo "package windows" + echo "import \"syscall\"" + echo "const (" + + while read -r line; do + unset vtype + if [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?([A-Z][A-Z0-9_]+k?)\)? ]]; then + key="${BASH_REMATCH[1]}" + value="${BASH_REMATCH[3]}" + elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +([A-Z0-9_]+\()?((0x)?[0-9A-Fa-f]+)L?\)? ]]; then + key="${BASH_REMATCH[1]}" + value="${BASH_REMATCH[3]}" + vtype="${BASH_REMATCH[2]}" + elif [[ $line =~ ^#define\ +([A-Z0-9_]+k?)\ +\(\(([A-Z]+)\)((0x)?[0-9A-Fa-f]+)L?\) ]]; then + key="${BASH_REMATCH[1]}" + value="${BASH_REMATCH[3]}" + vtype="${BASH_REMATCH[2]}" + else + continue + fi + [[ -n $key && -n $value ]] || continue + [[ -z ${errors["$key"]} ]] || continue + errors["$key"]="$value" + if [[ -v vtype ]]; then + if [[ $key == FACILITY_* || $key == NO_ERROR ]]; then + vtype="" + elif [[ $vtype == *HANDLE* || $vtype == *HRESULT* ]]; then + vtype="Handle" + else + vtype="syscall.Errno" + fi + last_vtype="$vtype" + else + vtype="" + if [[ $last_vtype == Handle && $value == NO_ERROR ]]; then + value="S_OK" + elif [[ $last_vtype == syscall.Errno && $value == NO_ERROR ]]; then + value="ERROR_SUCCESS" + fi + fi + + echo "$key $vtype = $value" + done < "$winerror" + + echo ")" +} | gofmt > "zerrors_windows.go" diff --git a/vendor/golang.org/x/sys/windows/mkknownfolderids.bash b/vendor/golang.org/x/sys/windows/mkknownfolderids.bash new file mode 100644 index 00000000..ab8924e9 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/mkknownfolderids.bash @@ -0,0 +1,27 @@ +#!/bin/bash + +# Copyright 2019 The Go Authors. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +set -e +shopt -s nullglob + +knownfolders="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/um/KnownFolders.h | sort -Vr | head -n 1)" +[[ -n $knownfolders ]] || { echo "Unable to find KnownFolders.h" >&2; exit 1; } + +{ + echo "// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT." + echo + echo "package windows" + echo "type KNOWNFOLDERID GUID" + echo "var (" + while read -r line; do + [[ $line =~ DEFINE_KNOWN_FOLDER\((FOLDERID_[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+),[\t\ ]*(0x[^,]+)\) ]] || continue + printf "%s = &KNOWNFOLDERID{0x%08x, 0x%04x, 0x%04x, [8]byte{0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x}}\n" \ + "${BASH_REMATCH[1]}" $(( "${BASH_REMATCH[2]}" )) $(( "${BASH_REMATCH[3]}" )) $(( "${BASH_REMATCH[4]}" )) \ + $(( "${BASH_REMATCH[5]}" )) $(( "${BASH_REMATCH[6]}" )) $(( "${BASH_REMATCH[7]}" )) $(( "${BASH_REMATCH[8]}" )) \ + $(( "${BASH_REMATCH[9]}" )) $(( "${BASH_REMATCH[10]}" )) $(( "${BASH_REMATCH[11]}" )) $(( "${BASH_REMATCH[12]}" )) + done < "$knownfolders" + echo ")" +} | gofmt > "zknownfolderids_windows.go" diff --git a/vendor/golang.org/x/sys/windows/mksyscall.go b/vendor/golang.org/x/sys/windows/mksyscall.go index fb7db0ef..62770572 100644 --- a/vendor/golang.org/x/sys/windows/mksyscall.go +++ b/vendor/golang.org/x/sys/windows/mksyscall.go @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build generate + package windows //go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index da06406c..61b49647 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -170,15 +170,20 @@ const ( //sys CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) = advapi32.CopySid //sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) = advapi32.AllocateAndInitializeSid //sys createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) = advapi32.CreateWellKnownSid +//sys isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) = advapi32.IsWellKnownSid //sys FreeSid(sid *SID) (err error) [failretval!=0] = advapi32.FreeSid //sys EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) = advapi32.EqualSid +//sys getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) = advapi32.GetSidIdentifierAuthority +//sys getSidSubAuthorityCount(sid *SID) (count *uint8) = advapi32.GetSidSubAuthorityCount +//sys getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) = advapi32.GetSidSubAuthority +//sys isValidSid(sid *SID) (isValid bool) = advapi32.IsValidSid // The security identifier (SID) structure is a variable-length // structure used to uniquely identify users or groups. type SID struct{} // StringToSid converts a string-format security identifier -// sid into a valid, functional sid. +// SID into a valid, functional SID. func StringToSid(s string) (*SID, error) { var sid *SID p, e := UTF16PtrFromString(s) @@ -193,7 +198,7 @@ func StringToSid(s string) (*SID, error) { return sid.Copy() } -// LookupSID retrieves a security identifier sid for the account +// LookupSID retrieves a security identifier SID for the account // and the name of the domain on which the account was found. // System specify target computer to search. func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) { @@ -230,7 +235,7 @@ func LookupSID(system, account string) (sid *SID, domain string, accType uint32, } } -// String converts sid to a string format +// String converts SID to a string format // suitable for display, storage, or transmission. func (sid *SID) String() (string, error) { var s *uint16 @@ -242,12 +247,12 @@ func (sid *SID) String() (string, error) { return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]), nil } -// Len returns the length, in bytes, of a valid security identifier sid. +// Len returns the length, in bytes, of a valid security identifier SID. func (sid *SID) Len() int { return int(GetLengthSid(sid)) } -// Copy creates a duplicate of security identifier sid. +// Copy creates a duplicate of security identifier SID. func (sid *SID) Copy() (*SID, error) { b := make([]byte, sid.Len()) sid2 := (*SID)(unsafe.Pointer(&b[0])) @@ -258,8 +263,42 @@ func (sid *SID) Copy() (*SID, error) { return sid2, nil } -// LookupAccount retrieves the name of the account for this sid -// and the name of the first domain on which this sid is found. +// IdentifierAuthority returns the identifier authority of the SID. +func (sid *SID) IdentifierAuthority() SidIdentifierAuthority { + return *getSidIdentifierAuthority(sid) +} + +// SubAuthorityCount returns the number of sub-authorities in the SID. +func (sid *SID) SubAuthorityCount() uint8 { + return *getSidSubAuthorityCount(sid) +} + +// SubAuthority returns the sub-authority of the SID as specified by +// the index, which must be less than sid.SubAuthorityCount(). +func (sid *SID) SubAuthority(idx uint32) uint32 { + if idx >= uint32(sid.SubAuthorityCount()) { + panic("sub-authority index out of range") + } + return *getSidSubAuthority(sid, idx) +} + +// IsValid returns whether the SID has a valid revision and length. +func (sid *SID) IsValid() bool { + return isValidSid(sid) +} + +// Equals compares two SIDs for equality. +func (sid *SID) Equals(sid2 *SID) bool { + return EqualSid(sid, sid2) +} + +// IsWellKnown determines whether the SID matches the well-known sidType. +func (sid *SID) IsWellKnown(sidType WELL_KNOWN_SID_TYPE) bool { + return isWellKnownSid(sid, sidType) +} + +// LookupAccount retrieves the name of the account for this SID +// and the name of the first domain on which this SID is found. // System specify target computer to search for. func (sid *SID) LookupAccount(system string) (account, domain string, accType uint32, err error) { var sys *uint16 @@ -287,7 +326,7 @@ func (sid *SID) LookupAccount(system string) (account, domain string, accType ui } } -// Various types of pre-specified sids that can be synthesized at runtime. +// Various types of pre-specified SIDs that can be synthesized and compared at runtime. type WELL_KNOWN_SID_TYPE uint32 const ( @@ -413,13 +452,13 @@ const ( WinBuiltinDeviceOwnersSid = 119 ) -// Creates a sid for a well-known predefined alias, generally using the constants of the form +// Creates a SID for a well-known predefined alias, generally using the constants of the form // Win*Sid, for the local machine. func CreateWellKnownSid(sidType WELL_KNOWN_SID_TYPE) (*SID, error) { return CreateWellKnownDomainSid(sidType, nil) } -// Creates a sid for a well-known predefined alias, generally using the constants of the form +// Creates a SID for a well-known predefined alias, generally using the constants of the form // Win*Sid, for the domain specified by the domainSid parameter. func CreateWellKnownDomainSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID) (*SID, error) { n := uint32(50) @@ -502,6 +541,53 @@ const ( MaxTokenInfoClass ) +// Group attributes inside of Tokengroups.Groups[i].Attributes +const ( + SE_GROUP_MANDATORY = 0x00000001 + SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002 + SE_GROUP_ENABLED = 0x00000004 + SE_GROUP_OWNER = 0x00000008 + SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010 + SE_GROUP_INTEGRITY = 0x00000020 + SE_GROUP_INTEGRITY_ENABLED = 0x00000040 + SE_GROUP_LOGON_ID = 0xC0000000 + SE_GROUP_RESOURCE = 0x20000000 + SE_GROUP_VALID_ATTRIBUTES = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED | SE_GROUP_OWNER | SE_GROUP_USE_FOR_DENY_ONLY | SE_GROUP_LOGON_ID | SE_GROUP_RESOURCE | SE_GROUP_INTEGRITY | SE_GROUP_INTEGRITY_ENABLED +) + +// Privilege attributes +const ( + SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001 + SE_PRIVILEGE_ENABLED = 0x00000002 + SE_PRIVILEGE_REMOVED = 0x00000004 + SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000 + SE_PRIVILEGE_VALID_ATTRIBUTES = SE_PRIVILEGE_ENABLED_BY_DEFAULT | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS +) + +// Token types +const ( + TokenPrimary = 1 + TokenImpersonation = 2 +) + +// Impersonation levels +const ( + SecurityAnonymous = 0 + SecurityIdentification = 1 + SecurityImpersonation = 2 + SecurityDelegation = 3 +) + +type LUID struct { + LowPart uint32 + HighPart int32 +} + +type LUIDAndAttributes struct { + Luid LUID + Attributes uint32 +} + type SIDAndAttributes struct { Sid *SID Attributes uint32 @@ -517,13 +603,45 @@ type Tokenprimarygroup struct { type Tokengroups struct { GroupCount uint32 - Groups [1]SIDAndAttributes + Groups [1]SIDAndAttributes // Use AllGroups() for iterating. +} + +// AllGroups returns a slice that can be used to iterate over the groups in g. +func (g *Tokengroups) AllGroups() []SIDAndAttributes { + return (*[(1 << 28) - 1]SIDAndAttributes)(unsafe.Pointer(&g.Groups[0]))[:g.GroupCount:g.GroupCount] +} + +type Tokenprivileges struct { + PrivilegeCount uint32 + Privileges [1]LUIDAndAttributes // Use AllPrivileges() for iterating. +} + +// AllPrivileges returns a slice that can be used to iterate over the privileges in p. +func (p *Tokenprivileges) AllPrivileges() []LUIDAndAttributes { + return (*[(1 << 27) - 1]LUIDAndAttributes)(unsafe.Pointer(&p.Privileges[0]))[:p.PrivilegeCount:p.PrivilegeCount] +} + +type Tokenmandatorylabel struct { + Label SIDAndAttributes +} + +func (tml *Tokenmandatorylabel) Size() uint32 { + return uint32(unsafe.Sizeof(Tokenmandatorylabel{})) + GetLengthSid(tml.Label.Sid) } // Authorization Functions -//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership -//sys OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken -//sys GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation +//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership +//sys OpenProcessToken(process Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken +//sys OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) = advapi32.OpenThreadToken +//sys ImpersonateSelf(impersonationlevel uint32) (err error) = advapi32.ImpersonateSelf +//sys RevertToSelf() (err error) = advapi32.RevertToSelf +//sys SetThreadToken(thread *Handle, token Token) (err error) = advapi32.SetThreadToken +//sys LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) = advapi32.LookupPrivilegeValueW +//sys AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) = advapi32.AdjustTokenPrivileges +//sys AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) = advapi32.AdjustTokenGroups +//sys GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation +//sys SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) = advapi32.SetTokenInformation +//sys DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) = advapi32.DuplicateTokenEx //sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW //sys getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) = kernel32.GetSystemDirectoryW @@ -537,7 +655,9 @@ type Tokengroups struct { type Token Handle // OpenCurrentProcessToken opens the access token -// associated with current process. +// associated with current process. It is a real +// token that needs to be closed, unlike +// GetCurrentProcessToken. func OpenCurrentProcessToken() (Token, error) { p, e := GetCurrentProcess() if e != nil { @@ -551,6 +671,27 @@ func OpenCurrentProcessToken() (Token, error) { return t, nil } +// GetCurrentProcessToken returns the access token associated with +// the current process. It is a pseudo token that does not need +// to be closed. +func GetCurrentProcessToken() Token { + return Token(^uintptr(4 - 1)) +} + +// GetCurrentThreadToken return the access token associated with +// the current thread. It is a pseudo token that does not need +// to be closed. +func GetCurrentThreadToken() Token { + return Token(^uintptr(5 - 1)) +} + +// GetCurrentThreadEffectiveToken returns the effective access token +// associated with the current thread. It is a pseudo token that does +// not need to be closed. +func GetCurrentThreadEffectiveToken() Token { + return Token(^uintptr(6 - 1)) +} + // Close releases access to access token. func (t Token) Close() error { return CloseHandle(Handle(t)) @@ -622,6 +763,28 @@ func (t Token) GetUserProfileDirectory() (string, error) { } } +// IsElevated returns whether the current token is elevated from a UAC perspective. +func (token Token) IsElevated() bool { + var isElevated uint32 + var outLen uint32 + err := GetTokenInformation(token, TokenElevation, (*byte)(unsafe.Pointer(&isElevated)), uint32(unsafe.Sizeof(isElevated)), &outLen) + if err != nil { + return false + } + return outLen == uint32(unsafe.Sizeof(isElevated)) && isElevated != 0 +} + +// GetLinkedToken returns the linked token, which may be an elevated UAC token. +func (token Token) GetLinkedToken() (Token, error) { + var linkedToken Token + var outLen uint32 + err := GetTokenInformation(token, TokenLinkedToken, (*byte)(unsafe.Pointer(&linkedToken)), uint32(unsafe.Sizeof(linkedToken)), &outLen) + if err != nil { + return Token(0), err + } + return linkedToken, nil +} + // GetSystemDirectory retrieves path to current location of the system // directory, which is typically, though not always, C:\Windows\System32. func GetSystemDirectory() (string, error) { @@ -647,3 +810,45 @@ func (t Token) IsMember(sid *SID) (bool, error) { } return b != 0, nil } + +const ( + WTS_CONSOLE_CONNECT = 0x1 + WTS_CONSOLE_DISCONNECT = 0x2 + WTS_REMOTE_CONNECT = 0x3 + WTS_REMOTE_DISCONNECT = 0x4 + WTS_SESSION_LOGON = 0x5 + WTS_SESSION_LOGOFF = 0x6 + WTS_SESSION_LOCK = 0x7 + WTS_SESSION_UNLOCK = 0x8 + WTS_SESSION_REMOTE_CONTROL = 0x9 + WTS_SESSION_CREATE = 0xa + WTS_SESSION_TERMINATE = 0xb +) + +const ( + WTSActive = 0 + WTSConnected = 1 + WTSConnectQuery = 2 + WTSShadow = 3 + WTSDisconnected = 4 + WTSIdle = 5 + WTSListen = 6 + WTSReset = 7 + WTSDown = 8 + WTSInit = 9 +) + +type WTSSESSION_NOTIFICATION struct { + Size uint32 + SessionID uint32 +} + +type WTS_SESSION_INFO struct { + SessionID uint32 + WindowStationName *uint16 + State uint32 +} + +//sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken +//sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW +//sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go index 62fc31b4..03383f1d 100644 --- a/vendor/golang.org/x/sys/windows/service.go +++ b/vendor/golang.org/x/sys/windows/service.go @@ -85,23 +85,47 @@ const ( SERVICE_INACTIVE = 2 SERVICE_STATE_ALL = 3 - SERVICE_QUERY_CONFIG = 1 - SERVICE_CHANGE_CONFIG = 2 - SERVICE_QUERY_STATUS = 4 - SERVICE_ENUMERATE_DEPENDENTS = 8 - SERVICE_START = 16 - SERVICE_STOP = 32 - SERVICE_PAUSE_CONTINUE = 64 - SERVICE_INTERROGATE = 128 - SERVICE_USER_DEFINED_CONTROL = 256 - SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL - SERVICE_RUNS_IN_SYSTEM_PROCESS = 1 - SERVICE_CONFIG_DESCRIPTION = 1 - SERVICE_CONFIG_FAILURE_ACTIONS = 2 + SERVICE_QUERY_CONFIG = 1 + SERVICE_CHANGE_CONFIG = 2 + SERVICE_QUERY_STATUS = 4 + SERVICE_ENUMERATE_DEPENDENTS = 8 + SERVICE_START = 16 + SERVICE_STOP = 32 + SERVICE_PAUSE_CONTINUE = 64 + SERVICE_INTERROGATE = 128 + SERVICE_USER_DEFINED_CONTROL = 256 + SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL - NO_ERROR = 0 + SERVICE_RUNS_IN_SYSTEM_PROCESS = 1 + + SERVICE_CONFIG_DESCRIPTION = 1 + SERVICE_CONFIG_FAILURE_ACTIONS = 2 + SERVICE_CONFIG_DELAYED_AUTO_START_INFO = 3 + SERVICE_CONFIG_FAILURE_ACTIONS_FLAG = 4 + SERVICE_CONFIG_SERVICE_SID_INFO = 5 + SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO = 6 + SERVICE_CONFIG_PRESHUTDOWN_INFO = 7 + SERVICE_CONFIG_TRIGGER_INFO = 8 + SERVICE_CONFIG_PREFERRED_NODE = 9 + SERVICE_CONFIG_LAUNCH_PROTECTED = 12 + + SERVICE_SID_TYPE_NONE = 0 + SERVICE_SID_TYPE_UNRESTRICTED = 1 + SERVICE_SID_TYPE_RESTRICTED = 2 | SERVICE_SID_TYPE_UNRESTRICTED SC_ENUM_PROCESS_INFO = 0 + + SERVICE_NOTIFY_STATUS_CHANGE = 2 + SERVICE_NOTIFY_STOPPED = 0x00000001 + SERVICE_NOTIFY_START_PENDING = 0x00000002 + SERVICE_NOTIFY_STOP_PENDING = 0x00000004 + SERVICE_NOTIFY_RUNNING = 0x00000008 + SERVICE_NOTIFY_CONTINUE_PENDING = 0x00000010 + SERVICE_NOTIFY_PAUSE_PENDING = 0x00000020 + SERVICE_NOTIFY_PAUSED = 0x00000040 + SERVICE_NOTIFY_CREATED = 0x00000080 + SERVICE_NOTIFY_DELETED = 0x00000100 + SERVICE_NOTIFY_DELETE_PENDING = 0x00000200 ) type SERVICE_STATUS struct { @@ -153,6 +177,16 @@ type ENUM_SERVICE_STATUS_PROCESS struct { ServiceStatusProcess SERVICE_STATUS_PROCESS } +type SERVICE_NOTIFY struct { + Version uint32 + NotifyCallback uintptr + Context uintptr + NotificationStatus uint32 + ServiceStatus SERVICE_STATUS_PROCESS + NotificationTriggered uint32 + ServiceNames *uint16 +} + type SERVICE_FAILURE_ACTIONS struct { ResetPeriod uint32 RebootMsg *uint16 @@ -166,12 +200,19 @@ type SC_ACTION struct { Delay uint32 } +type QUERY_SERVICE_LOCK_STATUS struct { + IsLocked uint32 + LockOwner *uint16 + LockDuration uint32 +} + //sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle //sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW //sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW //sys DeleteService(service Handle) (err error) = advapi32.DeleteService //sys StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) = advapi32.StartServiceW //sys QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) = advapi32.QueryServiceStatus +//sys QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceLockStatusW //sys ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) = advapi32.ControlService //sys StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) = advapi32.StartServiceCtrlDispatcherW //sys SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) = advapi32.SetServiceStatus @@ -180,4 +221,5 @@ type SC_ACTION struct { //sys ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) = advapi32.ChangeServiceConfig2W //sys QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfig2W //sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW -//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx +//sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx +//sys NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) = advapi32.NotifyServiceStatusChangeW diff --git a/vendor/golang.org/x/sys/windows/svc/go12.c b/vendor/golang.org/x/sys/windows/svc/go12.c new file mode 100644 index 00000000..6f1be1fa --- /dev/null +++ b/vendor/golang.org/x/sys/windows/svc/go12.c @@ -0,0 +1,24 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build windows +// +build !go1.3 + +// copied from pkg/runtime +typedef unsigned int uint32; +typedef unsigned long long int uint64; +#ifdef _64BIT +typedef uint64 uintptr; +#else +typedef uint32 uintptr; +#endif + +// from sys_386.s or sys_amd64.s +void ·servicemain(void); + +void +·getServiceMain(uintptr *r) +{ + *r = (uintptr)·servicemain; +} diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 7aff0d02..b2305092 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -10,6 +10,7 @@ import ( errorspkg "errors" "sync" "syscall" + "time" "unicode/utf16" "unsafe" ) @@ -55,6 +56,10 @@ const ( FILE_UNICODE_ON_DISK = 0x00000004 FILE_VOLUME_IS_COMPRESSED = 0x00008000 FILE_VOLUME_QUOTAS = 0x00000020 + + // Return values of SleepEx and other APC functions + STATUS_USER_APC = 0x000000C0 + WAIT_IO_COMPLETION = STATUS_USER_APC ) // StringToUTF16 is deprecated. Use UTF16FromString instead. @@ -134,7 +139,8 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetVersion() (ver uint32, err error) //sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW //sys ExitProcess(exitcode uint32) -//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW +//sys IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process +//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW //sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) @@ -146,6 +152,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW //sys FindClose(handle Handle) (err error) //sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) +//sys GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) //sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW //sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW //sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW @@ -165,11 +172,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CancelIo(s Handle) (err error) //sys CancelIoEx(s Handle, o *Overlapped) (err error) //sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW -//sys OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) +//sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) +//sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) = shell32.ShellExecuteW +//sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath //sys TerminateProcess(handle Handle, exitcode uint32) (err error) //sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) //sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW //sys GetCurrentProcess() (pseudoHandle Handle, err error) +//sys GetCurrentThread() (pseudoHandle Handle, err error) //sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) //sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) //sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] @@ -184,6 +194,9 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys FreeEnvironmentStrings(envs *uint16) (err error) = kernel32.FreeEnvironmentStringsW //sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) = kernel32.GetEnvironmentVariableW //sys SetEnvironmentVariable(name *uint16, value *uint16) (err error) = kernel32.SetEnvironmentVariableW +//sys CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) = userenv.CreateEnvironmentBlock +//sys DestroyEnvironmentBlock(block *uint16) (err error) = userenv.DestroyEnvironmentBlock +//sys getTickCount64() (ms uint64) = kernel32.GetTickCount64 //sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) //sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW //sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW @@ -222,7 +235,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW //sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW //sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW -//sys getCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId +//sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId //sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo @@ -231,6 +244,8 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot //sys Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32FirstW //sys Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32NextW +//sys Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) +//sys Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) //sys DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) // This function returns 1 byte BOOLEAN rather than the 4 byte BOOL. //sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW @@ -242,6 +257,18 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys SetEvent(event Handle) (err error) = kernel32.SetEvent //sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent //sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent +//sys SleepEx(milliseconds uint32, alertable bool) (ret uint32) = kernel32.SleepEx +//sys CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) = kernel32.CreateJobObjectW +//sys AssignProcessToJobObject(job Handle, process Handle) (err error) = kernel32.AssignProcessToJobObject +//sys TerminateJobObject(job Handle, exitCode uint32) (err error) = kernel32.TerminateJobObject +//sys SetErrorMode(mode uint32) (ret uint32) = kernel32.SetErrorMode +//sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread +//sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass +//sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass +//sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) +//sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) +//sys GetProcessId(process Handle) (id uint32, err error) +//sys OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) // Volume Management Functions //sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW @@ -263,6 +290,12 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW //sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW //sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW +//sys MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW +//sys clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) = ole32.CLSIDFromString +//sys stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) = ole32.StringFromGUID2 +//sys coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid +//sys CoTaskMemFree(address unsafe.Pointer) = ole32.CoTaskMemFree +//sys rtlGetVersion(info *OsVersionInfoEx) (ret error) = ntdll.RtlGetVersion // syscall interface implementation for other packages @@ -477,6 +510,10 @@ func ComputerName() (name string, err error) { return string(utf16.Decode(b[0:n])), nil } +func DurationSinceBoot() time.Duration { + return time.Duration(getTickCount64()) * time.Millisecond +} + func Ftruncate(fd Handle, length int64) (err error) { curoffset, e := Seek(fd, 0, 1) if e != nil { @@ -560,9 +597,6 @@ func Fsync(fd Handle) (err error) { } func Chmod(path string, mode uint32) (err error) { - if mode == 0 { - return syscall.EINVAL - } p, e := UTF16PtrFromString(path) if e != nil { return e @@ -1089,7 +1123,7 @@ func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return syscall.EWINDOWS } -func Getpid() (pid int) { return int(getCurrentProcessId()) } +func Getpid() (pid int) { return int(GetCurrentProcessId()) } func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) { // NOTE(rsc): The Win32finddata struct is wrong for the system call: @@ -1217,3 +1251,70 @@ func Readlink(path string, buf []byte) (n int, err error) { return n, nil } + +// GUIDFromString parses a string in the form of +// "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" into a GUID. +func GUIDFromString(str string) (GUID, error) { + guid := GUID{} + str16, err := syscall.UTF16PtrFromString(str) + if err != nil { + return guid, err + } + err = clsidFromString(str16, &guid) + if err != nil { + return guid, err + } + return guid, nil +} + +// GenerateGUID creates a new random GUID. +func GenerateGUID() (GUID, error) { + guid := GUID{} + err := coCreateGuid(&guid) + if err != nil { + return guid, err + } + return guid, nil +} + +// String returns the canonical string form of the GUID, +// in the form of "{XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}". +func (guid GUID) String() string { + var str [100]uint16 + chars := stringFromGUID2(&guid, &str[0], int32(len(str))) + if chars <= 1 { + return "" + } + return string(utf16.Decode(str[:chars-1])) +} + +// KnownFolderPath returns a well-known folder path for the current user, specified by one of +// the FOLDERID_ constants, and chosen and optionally created based on a KF_ flag. +func KnownFolderPath(folderID *KNOWNFOLDERID, flags uint32) (string, error) { + return Token(0).KnownFolderPath(folderID, flags) +} + +// KnownFolderPath returns a well-known folder path for the user token, specified by one of +// the FOLDERID_ constants, and chosen and optionally created based on a KF_ flag. +func (t Token) KnownFolderPath(folderID *KNOWNFOLDERID, flags uint32) (string, error) { + var p *uint16 + err := shGetKnownFolderPath(folderID, flags, t, &p) + if err != nil { + return "", err + } + defer CoTaskMemFree(unsafe.Pointer(p)) + return UTF16ToString((*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))[:]), nil +} + +// RtlGetVersion returns the true version of the underlying operating system, ignoring +// any manifesting or compatibility layers on top of the win32 layer. +func RtlGetVersion() *OsVersionInfoEx { + info := &OsVersionInfoEx{} + info.osVersionInfoSize = uint32(unsafe.Sizeof(*info)) + // According to documentation, this function always succeeds. + // The function doesn't even check the validity of the + // osVersionInfoSize member. Disassembling ntdll.dll indicates + // that the documentation is indeed correct about that. + _ = rtlGetVersion(info) + return info +} diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index bbf19f0d..1e3947f0 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -4,33 +4,10 @@ package windows -import "syscall" - -const ( - // Windows errors. - ERROR_FILE_NOT_FOUND syscall.Errno = 2 - ERROR_PATH_NOT_FOUND syscall.Errno = 3 - ERROR_ACCESS_DENIED syscall.Errno = 5 - ERROR_NO_MORE_FILES syscall.Errno = 18 - ERROR_HANDLE_EOF syscall.Errno = 38 - ERROR_NETNAME_DELETED syscall.Errno = 64 - ERROR_FILE_EXISTS syscall.Errno = 80 - ERROR_BROKEN_PIPE syscall.Errno = 109 - ERROR_BUFFER_OVERFLOW syscall.Errno = 111 - ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 - ERROR_MOD_NOT_FOUND syscall.Errno = 126 - ERROR_PROC_NOT_FOUND syscall.Errno = 127 - ERROR_ALREADY_EXISTS syscall.Errno = 183 - ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203 - ERROR_MORE_DATA syscall.Errno = 234 - ERROR_OPERATION_ABORTED syscall.Errno = 995 - ERROR_IO_PENDING syscall.Errno = 997 - ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066 - ERROR_NOT_FOUND syscall.Errno = 1168 - ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 - WSAEACCES syscall.Errno = 10013 - WSAEMSGSIZE syscall.Errno = 10040 - WSAECONNRESET syscall.Errno = 10054 +import ( + "net" + "syscall" + "unsafe" ) const ( @@ -177,22 +154,54 @@ const ( IGNORE = 0 INFINITE = 0xffffffff - WAIT_TIMEOUT = 258 WAIT_ABANDONED = 0x00000080 WAIT_OBJECT_0 = 0x00000000 WAIT_FAILED = 0xFFFFFFFF - PROCESS_TERMINATE = 1 - PROCESS_QUERY_INFORMATION = 0x00000400 - SYNCHRONIZE = 0x00100000 + // Standard access rights. + DELETE = 0x00010000 + READ_CONTROL = 0x00020000 + SYNCHRONIZE = 0x00100000 + WRITE_DAC = 0x00040000 + WRITE_OWNER = 0x00080000 + + // Access rights for process. + PROCESS_CREATE_PROCESS = 0x0080 + PROCESS_CREATE_THREAD = 0x0002 + PROCESS_DUP_HANDLE = 0x0040 + PROCESS_QUERY_INFORMATION = 0x0400 + PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 + PROCESS_SET_INFORMATION = 0x0200 + PROCESS_SET_QUOTA = 0x0100 + PROCESS_SUSPEND_RESUME = 0x0800 + PROCESS_TERMINATE = 0x0001 + PROCESS_VM_OPERATION = 0x0008 + PROCESS_VM_READ = 0x0010 + PROCESS_VM_WRITE = 0x0020 + + // Access rights for thread. + THREAD_DIRECT_IMPERSONATION = 0x0200 + THREAD_GET_CONTEXT = 0x0008 + THREAD_IMPERSONATE = 0x0100 + THREAD_QUERY_INFORMATION = 0x0040 + THREAD_QUERY_LIMITED_INFORMATION = 0x0800 + THREAD_SET_CONTEXT = 0x0010 + THREAD_SET_INFORMATION = 0x0020 + THREAD_SET_LIMITED_INFORMATION = 0x0400 + THREAD_SET_THREAD_TOKEN = 0x0080 + THREAD_SUSPEND_RESUME = 0x0002 + THREAD_TERMINATE = 0x0001 FILE_MAP_COPY = 0x01 FILE_MAP_WRITE = 0x02 FILE_MAP_READ = 0x04 FILE_MAP_EXECUTE = 0x20 - CTRL_C_EVENT = 0 - CTRL_BREAK_EVENT = 1 + CTRL_C_EVENT = 0 + CTRL_BREAK_EVENT = 1 + CTRL_CLOSE_EVENT = 2 + CTRL_LOGOFF_EVENT = 5 + CTRL_SHUTDOWN_EVENT = 6 // Windows reserves errors >= 1<<29 for application use. APPLICATION_ERROR = 1 << 29 @@ -412,12 +421,6 @@ const ( CERT_CHAIN_POLICY_EV = 8 CERT_CHAIN_POLICY_SSL_F12 = 9 - CERT_E_EXPIRED = 0x800B0101 - CERT_E_ROLE = 0x800B0103 - CERT_E_PURPOSE = 0x800B0106 - CERT_E_UNTRUSTEDROOT = 0x800B0109 - CERT_E_CN_NO_MATCH = 0x800B010F - /* AuthType values for SSLExtraCertChainPolicyPara struct */ AUTHTYPE_CLIENT = 1 AUTHTYPE_SERVER = 2 @@ -430,6 +433,26 @@ const ( SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000 ) +const ( + // flags for SetErrorMode + SEM_FAILCRITICALERRORS = 0x0001 + SEM_NOALIGNMENTFAULTEXCEPT = 0x0004 + SEM_NOGPFAULTERRORBOX = 0x0002 + SEM_NOOPENFILEERRORBOX = 0x8000 +) + +const ( + // Priority class. + ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000 + BELOW_NORMAL_PRIORITY_CLASS = 0x00004000 + HIGH_PRIORITY_CLASS = 0x00000080 + IDLE_PRIORITY_CLASS = 0x00000040 + NORMAL_PRIORITY_CLASS = 0x00000020 + PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000 + PROCESS_MODE_BACKGROUND_END = 0x00200000 + REALTIME_PRIORITY_CLASS = 0x00000100 +) + var ( OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00") OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00") @@ -639,6 +662,16 @@ type ProcessEntry32 struct { ExeFile [MAX_PATH]uint16 } +type ThreadEntry32 struct { + Size uint32 + Usage uint32 + ThreadID uint32 + OwnerProcessID uint32 + BasePri int32 + DeltaPri int32 + Flags uint32 +} + type Systemtime struct { Year uint16 Month uint16 @@ -859,10 +892,6 @@ const ( DNS_TYPE_NBSTAT = 0xff01 ) -const ( - DNS_INFO_NO_RECORDS = 0x251D -) - const ( // flags inside DNSRecord.Dw DnsSectionQuestion = 0x0000 @@ -1324,6 +1353,41 @@ const ( ComputerNameMax = 8 ) +// For MessageBox() +const ( + MB_OK = 0x00000000 + MB_OKCANCEL = 0x00000001 + MB_ABORTRETRYIGNORE = 0x00000002 + MB_YESNOCANCEL = 0x00000003 + MB_YESNO = 0x00000004 + MB_RETRYCANCEL = 0x00000005 + MB_CANCELTRYCONTINUE = 0x00000006 + MB_ICONHAND = 0x00000010 + MB_ICONQUESTION = 0x00000020 + MB_ICONEXCLAMATION = 0x00000030 + MB_ICONASTERISK = 0x00000040 + MB_USERICON = 0x00000080 + MB_ICONWARNING = MB_ICONEXCLAMATION + MB_ICONERROR = MB_ICONHAND + MB_ICONINFORMATION = MB_ICONASTERISK + MB_ICONSTOP = MB_ICONHAND + MB_DEFBUTTON1 = 0x00000000 + MB_DEFBUTTON2 = 0x00000100 + MB_DEFBUTTON3 = 0x00000200 + MB_DEFBUTTON4 = 0x00000300 + MB_APPLMODAL = 0x00000000 + MB_SYSTEMMODAL = 0x00001000 + MB_TASKMODAL = 0x00002000 + MB_HELP = 0x00004000 + MB_NOFOCUS = 0x00008000 + MB_SETFOREGROUND = 0x00010000 + MB_DEFAULT_DESKTOP_ONLY = 0x00020000 + MB_TOPMOST = 0x00040000 + MB_RIGHT = 0x00080000 + MB_RTLREADING = 0x00100000 + MB_SERVICE_NOTIFICATION = 0x00200000 +) + const ( MOVEFILE_REPLACE_EXISTING = 0x1 MOVEFILE_COPY_ALLOWED = 0x2 @@ -1352,6 +1416,16 @@ type SocketAddress struct { SockaddrLength int32 } +// IP returns an IPv4 or IPv6 address, or nil if the underlying SocketAddress is neither. +func (addr *SocketAddress) IP() net.IP { + if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet4{}) && addr.Sockaddr.Addr.Family == AF_INET { + return (*RawSockaddrInet4)(unsafe.Pointer(addr.Sockaddr)).Addr[:] + } else if uintptr(addr.SockaddrLength) >= unsafe.Sizeof(RawSockaddrInet6{}) && addr.Sockaddr.Addr.Family == AF_INET6 { + return (*RawSockaddrInet6)(unsafe.Pointer(addr.Sockaddr)).Addr[:] + } + return nil +} + type IpAdapterUnicastAddress struct { Length uint32 Flags uint32 @@ -1477,3 +1551,118 @@ type ConsoleScreenBufferInfo struct { } const UNIX_PATH_MAX = 108 // defined in afunix.h + +const ( + // flags for JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags + JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x00000008 + JOB_OBJECT_LIMIT_AFFINITY = 0x00000010 + JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800 + JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x00000400 + JOB_OBJECT_LIMIT_JOB_MEMORY = 0x00000200 + JOB_OBJECT_LIMIT_JOB_TIME = 0x00000004 + JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000 + JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x00000040 + JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x00000020 + JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100 + JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002 + JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x00000080 + JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000 + JOB_OBJECT_LIMIT_SUBSET_AFFINITY = 0x00004000 + JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001 +) + +type JOBOBJECT_BASIC_LIMIT_INFORMATION struct { + PerProcessUserTimeLimit int64 + PerJobUserTimeLimit int64 + LimitFlags uint32 + MinimumWorkingSetSize uintptr + MaximumWorkingSetSize uintptr + ActiveProcessLimit uint32 + Affinity uintptr + PriorityClass uint32 + SchedulingClass uint32 +} + +type IO_COUNTERS struct { + ReadOperationCount uint64 + WriteOperationCount uint64 + OtherOperationCount uint64 + ReadTransferCount uint64 + WriteTransferCount uint64 + OtherTransferCount uint64 +} + +type JOBOBJECT_EXTENDED_LIMIT_INFORMATION struct { + BasicLimitInformation JOBOBJECT_BASIC_LIMIT_INFORMATION + IoInfo IO_COUNTERS + ProcessMemoryLimit uintptr + JobMemoryLimit uintptr + PeakProcessMemoryUsed uintptr + PeakJobMemoryUsed uintptr +} + +const ( + // UIRestrictionsClass + JOB_OBJECT_UILIMIT_DESKTOP = 0x00000040 + JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = 0x00000010 + JOB_OBJECT_UILIMIT_EXITWINDOWS = 0x00000080 + JOB_OBJECT_UILIMIT_GLOBALATOMS = 0x00000020 + JOB_OBJECT_UILIMIT_HANDLES = 0x00000001 + JOB_OBJECT_UILIMIT_READCLIPBOARD = 0x00000002 + JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = 0x00000008 + JOB_OBJECT_UILIMIT_WRITECLIPBOARD = 0x00000004 +) + +type JOBOBJECT_BASIC_UI_RESTRICTIONS struct { + UIRestrictionsClass uint32 +} + +const ( + // JobObjectInformationClass + JobObjectAssociateCompletionPortInformation = 7 + JobObjectBasicLimitInformation = 2 + JobObjectBasicUIRestrictions = 4 + JobObjectCpuRateControlInformation = 15 + JobObjectEndOfJobTimeInformation = 6 + JobObjectExtendedLimitInformation = 9 + JobObjectGroupInformation = 11 + JobObjectGroupInformationEx = 14 + JobObjectLimitViolationInformation2 = 35 + JobObjectNetRateControlInformation = 32 + JobObjectNotificationLimitInformation = 12 + JobObjectNotificationLimitInformation2 = 34 + JobObjectSecurityLimitInformation = 5 +) + +const ( + KF_FLAG_DEFAULT = 0x00000000 + KF_FLAG_FORCE_APP_DATA_REDIRECTION = 0x00080000 + KF_FLAG_RETURN_FILTER_REDIRECTION_TARGET = 0x00040000 + KF_FLAG_FORCE_PACKAGE_REDIRECTION = 0x00020000 + KF_FLAG_NO_PACKAGE_REDIRECTION = 0x00010000 + KF_FLAG_FORCE_APPCONTAINER_REDIRECTION = 0x00020000 + KF_FLAG_NO_APPCONTAINER_REDIRECTION = 0x00010000 + KF_FLAG_CREATE = 0x00008000 + KF_FLAG_DONT_VERIFY = 0x00004000 + KF_FLAG_DONT_UNEXPAND = 0x00002000 + KF_FLAG_NO_ALIAS = 0x00001000 + KF_FLAG_INIT = 0x00000800 + KF_FLAG_DEFAULT_PATH = 0x00000400 + KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200 + KF_FLAG_SIMPLE_IDLIST = 0x00000100 + KF_FLAG_ALIAS_ONLY = 0x80000000 +) + +type OsVersionInfoEx struct { + osVersionInfoSize uint32 + MajorVersion uint32 + MinorVersion uint32 + BuildNumber uint32 + PlatformId uint32 + CsdVersion [128]uint16 + ServicePackMajor uint16 + ServicePackMinor uint16 + SuiteMask uint16 + ProductType byte + _ byte +} diff --git a/vendor/golang.org/x/sys/windows/zerrors_windows.go b/vendor/golang.org/x/sys/windows/zerrors_windows.go new file mode 100644 index 00000000..f0212003 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/zerrors_windows.go @@ -0,0 +1,6853 @@ +// Code generated by 'mkerrors.bash'; DO NOT EDIT. + +package windows + +import "syscall" + +const ( + FACILITY_NULL = 0 + FACILITY_RPC = 1 + FACILITY_DISPATCH = 2 + FACILITY_STORAGE = 3 + FACILITY_ITF = 4 + FACILITY_WIN32 = 7 + FACILITY_WINDOWS = 8 + FACILITY_SSPI = 9 + FACILITY_SECURITY = 9 + FACILITY_CONTROL = 10 + FACILITY_CERT = 11 + FACILITY_INTERNET = 12 + FACILITY_MEDIASERVER = 13 + FACILITY_MSMQ = 14 + FACILITY_SETUPAPI = 15 + FACILITY_SCARD = 16 + FACILITY_COMPLUS = 17 + FACILITY_AAF = 18 + FACILITY_URT = 19 + FACILITY_ACS = 20 + FACILITY_DPLAY = 21 + FACILITY_UMI = 22 + FACILITY_SXS = 23 + FACILITY_WINDOWS_CE = 24 + FACILITY_HTTP = 25 + FACILITY_USERMODE_COMMONLOG = 26 + FACILITY_WER = 27 + FACILITY_USERMODE_FILTER_MANAGER = 31 + FACILITY_BACKGROUNDCOPY = 32 + FACILITY_CONFIGURATION = 33 + FACILITY_WIA = 33 + FACILITY_STATE_MANAGEMENT = 34 + FACILITY_METADIRECTORY = 35 + FACILITY_WINDOWSUPDATE = 36 + FACILITY_DIRECTORYSERVICE = 37 + FACILITY_GRAPHICS = 38 + FACILITY_SHELL = 39 + FACILITY_NAP = 39 + FACILITY_TPM_SERVICES = 40 + FACILITY_TPM_SOFTWARE = 41 + FACILITY_UI = 42 + FACILITY_XAML = 43 + FACILITY_ACTION_QUEUE = 44 + FACILITY_PLA = 48 + FACILITY_WINDOWS_SETUP = 48 + FACILITY_FVE = 49 + FACILITY_FWP = 50 + FACILITY_WINRM = 51 + FACILITY_NDIS = 52 + FACILITY_USERMODE_HYPERVISOR = 53 + FACILITY_CMI = 54 + FACILITY_USERMODE_VIRTUALIZATION = 55 + FACILITY_USERMODE_VOLMGR = 56 + FACILITY_BCD = 57 + FACILITY_USERMODE_VHD = 58 + FACILITY_USERMODE_HNS = 59 + FACILITY_SDIAG = 60 + FACILITY_WEBSERVICES = 61 + FACILITY_WINPE = 61 + FACILITY_WPN = 62 + FACILITY_WINDOWS_STORE = 63 + FACILITY_INPUT = 64 + FACILITY_EAP = 66 + FACILITY_WINDOWS_DEFENDER = 80 + FACILITY_OPC = 81 + FACILITY_XPS = 82 + FACILITY_MBN = 84 + FACILITY_POWERSHELL = 84 + FACILITY_RAS = 83 + FACILITY_P2P_INT = 98 + FACILITY_P2P = 99 + FACILITY_DAF = 100 + FACILITY_BLUETOOTH_ATT = 101 + FACILITY_AUDIO = 102 + FACILITY_STATEREPOSITORY = 103 + FACILITY_VISUALCPP = 109 + FACILITY_SCRIPT = 112 + FACILITY_PARSE = 113 + FACILITY_BLB = 120 + FACILITY_BLB_CLI = 121 + FACILITY_WSBAPP = 122 + FACILITY_BLBUI = 128 + FACILITY_USN = 129 + FACILITY_USERMODE_VOLSNAP = 130 + FACILITY_TIERING = 131 + FACILITY_WSB_ONLINE = 133 + FACILITY_ONLINE_ID = 134 + FACILITY_DEVICE_UPDATE_AGENT = 135 + FACILITY_DRVSERVICING = 136 + FACILITY_DLS = 153 + FACILITY_DELIVERY_OPTIMIZATION = 208 + FACILITY_USERMODE_SPACES = 231 + FACILITY_USER_MODE_SECURITY_CORE = 232 + FACILITY_USERMODE_LICENSING = 234 + FACILITY_SOS = 160 + FACILITY_DEBUGGERS = 176 + FACILITY_SPP = 256 + FACILITY_RESTORE = 256 + FACILITY_DMSERVER = 256 + FACILITY_DEPLOYMENT_SERVICES_SERVER = 257 + FACILITY_DEPLOYMENT_SERVICES_IMAGING = 258 + FACILITY_DEPLOYMENT_SERVICES_MANAGEMENT = 259 + FACILITY_DEPLOYMENT_SERVICES_UTIL = 260 + FACILITY_DEPLOYMENT_SERVICES_BINLSVC = 261 + FACILITY_DEPLOYMENT_SERVICES_PXE = 263 + FACILITY_DEPLOYMENT_SERVICES_TFTP = 264 + FACILITY_DEPLOYMENT_SERVICES_TRANSPORT_MANAGEMENT = 272 + FACILITY_DEPLOYMENT_SERVICES_DRIVER_PROVISIONING = 278 + FACILITY_DEPLOYMENT_SERVICES_MULTICAST_SERVER = 289 + FACILITY_DEPLOYMENT_SERVICES_MULTICAST_CLIENT = 290 + FACILITY_DEPLOYMENT_SERVICES_CONTENT_PROVIDER = 293 + FACILITY_LINGUISTIC_SERVICES = 305 + FACILITY_AUDIOSTREAMING = 1094 + FACILITY_ACCELERATOR = 1536 + FACILITY_WMAAECMA = 1996 + FACILITY_DIRECTMUSIC = 2168 + FACILITY_DIRECT3D10 = 2169 + FACILITY_DXGI = 2170 + FACILITY_DXGI_DDI = 2171 + FACILITY_DIRECT3D11 = 2172 + FACILITY_DIRECT3D11_DEBUG = 2173 + FACILITY_DIRECT3D12 = 2174 + FACILITY_DIRECT3D12_DEBUG = 2175 + FACILITY_LEAP = 2184 + FACILITY_AUDCLNT = 2185 + FACILITY_WINCODEC_DWRITE_DWM = 2200 + FACILITY_WINML = 2192 + FACILITY_DIRECT2D = 2201 + FACILITY_DEFRAG = 2304 + FACILITY_USERMODE_SDBUS = 2305 + FACILITY_JSCRIPT = 2306 + FACILITY_PIDGENX = 2561 + FACILITY_EAS = 85 + FACILITY_WEB = 885 + FACILITY_WEB_SOCKET = 886 + FACILITY_MOBILE = 1793 + FACILITY_SQLITE = 1967 + FACILITY_UTC = 1989 + FACILITY_WEP = 2049 + FACILITY_SYNCENGINE = 2050 + FACILITY_XBOX = 2339 + FACILITY_PIX = 2748 + ERROR_SUCCESS syscall.Errno = 0 + NO_ERROR = 0 + SEC_E_OK Handle = 0x00000000 + ERROR_INVALID_FUNCTION syscall.Errno = 1 + ERROR_FILE_NOT_FOUND syscall.Errno = 2 + ERROR_PATH_NOT_FOUND syscall.Errno = 3 + ERROR_TOO_MANY_OPEN_FILES syscall.Errno = 4 + ERROR_ACCESS_DENIED syscall.Errno = 5 + ERROR_INVALID_HANDLE syscall.Errno = 6 + ERROR_ARENA_TRASHED syscall.Errno = 7 + ERROR_NOT_ENOUGH_MEMORY syscall.Errno = 8 + ERROR_INVALID_BLOCK syscall.Errno = 9 + ERROR_BAD_ENVIRONMENT syscall.Errno = 10 + ERROR_BAD_FORMAT syscall.Errno = 11 + ERROR_INVALID_ACCESS syscall.Errno = 12 + ERROR_INVALID_DATA syscall.Errno = 13 + ERROR_OUTOFMEMORY syscall.Errno = 14 + ERROR_INVALID_DRIVE syscall.Errno = 15 + ERROR_CURRENT_DIRECTORY syscall.Errno = 16 + ERROR_NOT_SAME_DEVICE syscall.Errno = 17 + ERROR_NO_MORE_FILES syscall.Errno = 18 + ERROR_WRITE_PROTECT syscall.Errno = 19 + ERROR_BAD_UNIT syscall.Errno = 20 + ERROR_NOT_READY syscall.Errno = 21 + ERROR_BAD_COMMAND syscall.Errno = 22 + ERROR_CRC syscall.Errno = 23 + ERROR_BAD_LENGTH syscall.Errno = 24 + ERROR_SEEK syscall.Errno = 25 + ERROR_NOT_DOS_DISK syscall.Errno = 26 + ERROR_SECTOR_NOT_FOUND syscall.Errno = 27 + ERROR_OUT_OF_PAPER syscall.Errno = 28 + ERROR_WRITE_FAULT syscall.Errno = 29 + ERROR_READ_FAULT syscall.Errno = 30 + ERROR_GEN_FAILURE syscall.Errno = 31 + ERROR_SHARING_VIOLATION syscall.Errno = 32 + ERROR_LOCK_VIOLATION syscall.Errno = 33 + ERROR_WRONG_DISK syscall.Errno = 34 + ERROR_SHARING_BUFFER_EXCEEDED syscall.Errno = 36 + ERROR_HANDLE_EOF syscall.Errno = 38 + ERROR_HANDLE_DISK_FULL syscall.Errno = 39 + ERROR_NOT_SUPPORTED syscall.Errno = 50 + ERROR_REM_NOT_LIST syscall.Errno = 51 + ERROR_DUP_NAME syscall.Errno = 52 + ERROR_BAD_NETPATH syscall.Errno = 53 + ERROR_NETWORK_BUSY syscall.Errno = 54 + ERROR_DEV_NOT_EXIST syscall.Errno = 55 + ERROR_TOO_MANY_CMDS syscall.Errno = 56 + ERROR_ADAP_HDW_ERR syscall.Errno = 57 + ERROR_BAD_NET_RESP syscall.Errno = 58 + ERROR_UNEXP_NET_ERR syscall.Errno = 59 + ERROR_BAD_REM_ADAP syscall.Errno = 60 + ERROR_PRINTQ_FULL syscall.Errno = 61 + ERROR_NO_SPOOL_SPACE syscall.Errno = 62 + ERROR_PRINT_CANCELLED syscall.Errno = 63 + ERROR_NETNAME_DELETED syscall.Errno = 64 + ERROR_NETWORK_ACCESS_DENIED syscall.Errno = 65 + ERROR_BAD_DEV_TYPE syscall.Errno = 66 + ERROR_BAD_NET_NAME syscall.Errno = 67 + ERROR_TOO_MANY_NAMES syscall.Errno = 68 + ERROR_TOO_MANY_SESS syscall.Errno = 69 + ERROR_SHARING_PAUSED syscall.Errno = 70 + ERROR_REQ_NOT_ACCEP syscall.Errno = 71 + ERROR_REDIR_PAUSED syscall.Errno = 72 + ERROR_FILE_EXISTS syscall.Errno = 80 + ERROR_CANNOT_MAKE syscall.Errno = 82 + ERROR_FAIL_I24 syscall.Errno = 83 + ERROR_OUT_OF_STRUCTURES syscall.Errno = 84 + ERROR_ALREADY_ASSIGNED syscall.Errno = 85 + ERROR_INVALID_PASSWORD syscall.Errno = 86 + ERROR_INVALID_PARAMETER syscall.Errno = 87 + ERROR_NET_WRITE_FAULT syscall.Errno = 88 + ERROR_NO_PROC_SLOTS syscall.Errno = 89 + ERROR_TOO_MANY_SEMAPHORES syscall.Errno = 100 + ERROR_EXCL_SEM_ALREADY_OWNED syscall.Errno = 101 + ERROR_SEM_IS_SET syscall.Errno = 102 + ERROR_TOO_MANY_SEM_REQUESTS syscall.Errno = 103 + ERROR_INVALID_AT_INTERRUPT_TIME syscall.Errno = 104 + ERROR_SEM_OWNER_DIED syscall.Errno = 105 + ERROR_SEM_USER_LIMIT syscall.Errno = 106 + ERROR_DISK_CHANGE syscall.Errno = 107 + ERROR_DRIVE_LOCKED syscall.Errno = 108 + ERROR_BROKEN_PIPE syscall.Errno = 109 + ERROR_OPEN_FAILED syscall.Errno = 110 + ERROR_BUFFER_OVERFLOW syscall.Errno = 111 + ERROR_DISK_FULL syscall.Errno = 112 + ERROR_NO_MORE_SEARCH_HANDLES syscall.Errno = 113 + ERROR_INVALID_TARGET_HANDLE syscall.Errno = 114 + ERROR_INVALID_CATEGORY syscall.Errno = 117 + ERROR_INVALID_VERIFY_SWITCH syscall.Errno = 118 + ERROR_BAD_DRIVER_LEVEL syscall.Errno = 119 + ERROR_CALL_NOT_IMPLEMENTED syscall.Errno = 120 + ERROR_SEM_TIMEOUT syscall.Errno = 121 + ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 + ERROR_INVALID_NAME syscall.Errno = 123 + ERROR_INVALID_LEVEL syscall.Errno = 124 + ERROR_NO_VOLUME_LABEL syscall.Errno = 125 + ERROR_MOD_NOT_FOUND syscall.Errno = 126 + ERROR_PROC_NOT_FOUND syscall.Errno = 127 + ERROR_WAIT_NO_CHILDREN syscall.Errno = 128 + ERROR_CHILD_NOT_COMPLETE syscall.Errno = 129 + ERROR_DIRECT_ACCESS_HANDLE syscall.Errno = 130 + ERROR_NEGATIVE_SEEK syscall.Errno = 131 + ERROR_SEEK_ON_DEVICE syscall.Errno = 132 + ERROR_IS_JOIN_TARGET syscall.Errno = 133 + ERROR_IS_JOINED syscall.Errno = 134 + ERROR_IS_SUBSTED syscall.Errno = 135 + ERROR_NOT_JOINED syscall.Errno = 136 + ERROR_NOT_SUBSTED syscall.Errno = 137 + ERROR_JOIN_TO_JOIN syscall.Errno = 138 + ERROR_SUBST_TO_SUBST syscall.Errno = 139 + ERROR_JOIN_TO_SUBST syscall.Errno = 140 + ERROR_SUBST_TO_JOIN syscall.Errno = 141 + ERROR_BUSY_DRIVE syscall.Errno = 142 + ERROR_SAME_DRIVE syscall.Errno = 143 + ERROR_DIR_NOT_ROOT syscall.Errno = 144 + ERROR_DIR_NOT_EMPTY syscall.Errno = 145 + ERROR_IS_SUBST_PATH syscall.Errno = 146 + ERROR_IS_JOIN_PATH syscall.Errno = 147 + ERROR_PATH_BUSY syscall.Errno = 148 + ERROR_IS_SUBST_TARGET syscall.Errno = 149 + ERROR_SYSTEM_TRACE syscall.Errno = 150 + ERROR_INVALID_EVENT_COUNT syscall.Errno = 151 + ERROR_TOO_MANY_MUXWAITERS syscall.Errno = 152 + ERROR_INVALID_LIST_FORMAT syscall.Errno = 153 + ERROR_LABEL_TOO_LONG syscall.Errno = 154 + ERROR_TOO_MANY_TCBS syscall.Errno = 155 + ERROR_SIGNAL_REFUSED syscall.Errno = 156 + ERROR_DISCARDED syscall.Errno = 157 + ERROR_NOT_LOCKED syscall.Errno = 158 + ERROR_BAD_THREADID_ADDR syscall.Errno = 159 + ERROR_BAD_ARGUMENTS syscall.Errno = 160 + ERROR_BAD_PATHNAME syscall.Errno = 161 + ERROR_SIGNAL_PENDING syscall.Errno = 162 + ERROR_MAX_THRDS_REACHED syscall.Errno = 164 + ERROR_LOCK_FAILED syscall.Errno = 167 + ERROR_BUSY syscall.Errno = 170 + ERROR_DEVICE_SUPPORT_IN_PROGRESS syscall.Errno = 171 + ERROR_CANCEL_VIOLATION syscall.Errno = 173 + ERROR_ATOMIC_LOCKS_NOT_SUPPORTED syscall.Errno = 174 + ERROR_INVALID_SEGMENT_NUMBER syscall.Errno = 180 + ERROR_INVALID_ORDINAL syscall.Errno = 182 + ERROR_ALREADY_EXISTS syscall.Errno = 183 + ERROR_INVALID_FLAG_NUMBER syscall.Errno = 186 + ERROR_SEM_NOT_FOUND syscall.Errno = 187 + ERROR_INVALID_STARTING_CODESEG syscall.Errno = 188 + ERROR_INVALID_STACKSEG syscall.Errno = 189 + ERROR_INVALID_MODULETYPE syscall.Errno = 190 + ERROR_INVALID_EXE_SIGNATURE syscall.Errno = 191 + ERROR_EXE_MARKED_INVALID syscall.Errno = 192 + ERROR_BAD_EXE_FORMAT syscall.Errno = 193 + ERROR_ITERATED_DATA_EXCEEDS_64k syscall.Errno = 194 + ERROR_INVALID_MINALLOCSIZE syscall.Errno = 195 + ERROR_DYNLINK_FROM_INVALID_RING syscall.Errno = 196 + ERROR_IOPL_NOT_ENABLED syscall.Errno = 197 + ERROR_INVALID_SEGDPL syscall.Errno = 198 + ERROR_AUTODATASEG_EXCEEDS_64k syscall.Errno = 199 + ERROR_RING2SEG_MUST_BE_MOVABLE syscall.Errno = 200 + ERROR_RELOC_CHAIN_XEEDS_SEGLIM syscall.Errno = 201 + ERROR_INFLOOP_IN_RELOC_CHAIN syscall.Errno = 202 + ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203 + ERROR_NO_SIGNAL_SENT syscall.Errno = 205 + ERROR_FILENAME_EXCED_RANGE syscall.Errno = 206 + ERROR_RING2_STACK_IN_USE syscall.Errno = 207 + ERROR_META_EXPANSION_TOO_LONG syscall.Errno = 208 + ERROR_INVALID_SIGNAL_NUMBER syscall.Errno = 209 + ERROR_THREAD_1_INACTIVE syscall.Errno = 210 + ERROR_LOCKED syscall.Errno = 212 + ERROR_TOO_MANY_MODULES syscall.Errno = 214 + ERROR_NESTING_NOT_ALLOWED syscall.Errno = 215 + ERROR_EXE_MACHINE_TYPE_MISMATCH syscall.Errno = 216 + ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY syscall.Errno = 217 + ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY syscall.Errno = 218 + ERROR_FILE_CHECKED_OUT syscall.Errno = 220 + ERROR_CHECKOUT_REQUIRED syscall.Errno = 221 + ERROR_BAD_FILE_TYPE syscall.Errno = 222 + ERROR_FILE_TOO_LARGE syscall.Errno = 223 + ERROR_FORMS_AUTH_REQUIRED syscall.Errno = 224 + ERROR_VIRUS_INFECTED syscall.Errno = 225 + ERROR_VIRUS_DELETED syscall.Errno = 226 + ERROR_PIPE_LOCAL syscall.Errno = 229 + ERROR_BAD_PIPE syscall.Errno = 230 + ERROR_PIPE_BUSY syscall.Errno = 231 + ERROR_NO_DATA syscall.Errno = 232 + ERROR_PIPE_NOT_CONNECTED syscall.Errno = 233 + ERROR_MORE_DATA syscall.Errno = 234 + ERROR_NO_WORK_DONE syscall.Errno = 235 + ERROR_VC_DISCONNECTED syscall.Errno = 240 + ERROR_INVALID_EA_NAME syscall.Errno = 254 + ERROR_EA_LIST_INCONSISTENT syscall.Errno = 255 + WAIT_TIMEOUT syscall.Errno = 258 + ERROR_NO_MORE_ITEMS syscall.Errno = 259 + ERROR_CANNOT_COPY syscall.Errno = 266 + ERROR_DIRECTORY syscall.Errno = 267 + ERROR_EAS_DIDNT_FIT syscall.Errno = 275 + ERROR_EA_FILE_CORRUPT syscall.Errno = 276 + ERROR_EA_TABLE_FULL syscall.Errno = 277 + ERROR_INVALID_EA_HANDLE syscall.Errno = 278 + ERROR_EAS_NOT_SUPPORTED syscall.Errno = 282 + ERROR_NOT_OWNER syscall.Errno = 288 + ERROR_TOO_MANY_POSTS syscall.Errno = 298 + ERROR_PARTIAL_COPY syscall.Errno = 299 + ERROR_OPLOCK_NOT_GRANTED syscall.Errno = 300 + ERROR_INVALID_OPLOCK_PROTOCOL syscall.Errno = 301 + ERROR_DISK_TOO_FRAGMENTED syscall.Errno = 302 + ERROR_DELETE_PENDING syscall.Errno = 303 + ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING syscall.Errno = 304 + ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME syscall.Errno = 305 + ERROR_SECURITY_STREAM_IS_INCONSISTENT syscall.Errno = 306 + ERROR_INVALID_LOCK_RANGE syscall.Errno = 307 + ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT syscall.Errno = 308 + ERROR_NOTIFICATION_GUID_ALREADY_DEFINED syscall.Errno = 309 + ERROR_INVALID_EXCEPTION_HANDLER syscall.Errno = 310 + ERROR_DUPLICATE_PRIVILEGES syscall.Errno = 311 + ERROR_NO_RANGES_PROCESSED syscall.Errno = 312 + ERROR_NOT_ALLOWED_ON_SYSTEM_FILE syscall.Errno = 313 + ERROR_DISK_RESOURCES_EXHAUSTED syscall.Errno = 314 + ERROR_INVALID_TOKEN syscall.Errno = 315 + ERROR_DEVICE_FEATURE_NOT_SUPPORTED syscall.Errno = 316 + ERROR_MR_MID_NOT_FOUND syscall.Errno = 317 + ERROR_SCOPE_NOT_FOUND syscall.Errno = 318 + ERROR_UNDEFINED_SCOPE syscall.Errno = 319 + ERROR_INVALID_CAP syscall.Errno = 320 + ERROR_DEVICE_UNREACHABLE syscall.Errno = 321 + ERROR_DEVICE_NO_RESOURCES syscall.Errno = 322 + ERROR_DATA_CHECKSUM_ERROR syscall.Errno = 323 + ERROR_INTERMIXED_KERNEL_EA_OPERATION syscall.Errno = 324 + ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED syscall.Errno = 326 + ERROR_OFFSET_ALIGNMENT_VIOLATION syscall.Errno = 327 + ERROR_INVALID_FIELD_IN_PARAMETER_LIST syscall.Errno = 328 + ERROR_OPERATION_IN_PROGRESS syscall.Errno = 329 + ERROR_BAD_DEVICE_PATH syscall.Errno = 330 + ERROR_TOO_MANY_DESCRIPTORS syscall.Errno = 331 + ERROR_SCRUB_DATA_DISABLED syscall.Errno = 332 + ERROR_NOT_REDUNDANT_STORAGE syscall.Errno = 333 + ERROR_RESIDENT_FILE_NOT_SUPPORTED syscall.Errno = 334 + ERROR_COMPRESSED_FILE_NOT_SUPPORTED syscall.Errno = 335 + ERROR_DIRECTORY_NOT_SUPPORTED syscall.Errno = 336 + ERROR_NOT_READ_FROM_COPY syscall.Errno = 337 + ERROR_FT_WRITE_FAILURE syscall.Errno = 338 + ERROR_FT_DI_SCAN_REQUIRED syscall.Errno = 339 + ERROR_INVALID_KERNEL_INFO_VERSION syscall.Errno = 340 + ERROR_INVALID_PEP_INFO_VERSION syscall.Errno = 341 + ERROR_OBJECT_NOT_EXTERNALLY_BACKED syscall.Errno = 342 + ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN syscall.Errno = 343 + ERROR_COMPRESSION_NOT_BENEFICIAL syscall.Errno = 344 + ERROR_STORAGE_TOPOLOGY_ID_MISMATCH syscall.Errno = 345 + ERROR_BLOCKED_BY_PARENTAL_CONTROLS syscall.Errno = 346 + ERROR_BLOCK_TOO_MANY_REFERENCES syscall.Errno = 347 + ERROR_MARKED_TO_DISALLOW_WRITES syscall.Errno = 348 + ERROR_ENCLAVE_FAILURE syscall.Errno = 349 + ERROR_FAIL_NOACTION_REBOOT syscall.Errno = 350 + ERROR_FAIL_SHUTDOWN syscall.Errno = 351 + ERROR_FAIL_RESTART syscall.Errno = 352 + ERROR_MAX_SESSIONS_REACHED syscall.Errno = 353 + ERROR_NETWORK_ACCESS_DENIED_EDP syscall.Errno = 354 + ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL syscall.Errno = 355 + ERROR_EDP_POLICY_DENIES_OPERATION syscall.Errno = 356 + ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED syscall.Errno = 357 + ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT syscall.Errno = 358 + ERROR_DEVICE_IN_MAINTENANCE syscall.Errno = 359 + ERROR_NOT_SUPPORTED_ON_DAX syscall.Errno = 360 + ERROR_DAX_MAPPING_EXISTS syscall.Errno = 361 + ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING syscall.Errno = 362 + ERROR_CLOUD_FILE_METADATA_CORRUPT syscall.Errno = 363 + ERROR_CLOUD_FILE_METADATA_TOO_LARGE syscall.Errno = 364 + ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE syscall.Errno = 365 + ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH syscall.Errno = 366 + ERROR_CHILD_PROCESS_BLOCKED syscall.Errno = 367 + ERROR_STORAGE_LOST_DATA_PERSISTENCE syscall.Errno = 368 + ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE syscall.Errno = 369 + ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT syscall.Errno = 370 + ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY syscall.Errno = 371 + ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN syscall.Errno = 372 + ERROR_GDI_HANDLE_LEAK syscall.Errno = 373 + ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS syscall.Errno = 374 + ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED syscall.Errno = 375 + ERROR_NOT_A_CLOUD_FILE syscall.Errno = 376 + ERROR_CLOUD_FILE_NOT_IN_SYNC syscall.Errno = 377 + ERROR_CLOUD_FILE_ALREADY_CONNECTED syscall.Errno = 378 + ERROR_CLOUD_FILE_NOT_SUPPORTED syscall.Errno = 379 + ERROR_CLOUD_FILE_INVALID_REQUEST syscall.Errno = 380 + ERROR_CLOUD_FILE_READ_ONLY_VOLUME syscall.Errno = 381 + ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY syscall.Errno = 382 + ERROR_CLOUD_FILE_VALIDATION_FAILED syscall.Errno = 383 + ERROR_SMB1_NOT_AVAILABLE syscall.Errno = 384 + ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION syscall.Errno = 385 + ERROR_CLOUD_FILE_AUTHENTICATION_FAILED syscall.Errno = 386 + ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES syscall.Errno = 387 + ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE syscall.Errno = 388 + ERROR_CLOUD_FILE_UNSUCCESSFUL syscall.Errno = 389 + ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT syscall.Errno = 390 + ERROR_CLOUD_FILE_IN_USE syscall.Errno = 391 + ERROR_CLOUD_FILE_PINNED syscall.Errno = 392 + ERROR_CLOUD_FILE_REQUEST_ABORTED syscall.Errno = 393 + ERROR_CLOUD_FILE_PROPERTY_CORRUPT syscall.Errno = 394 + ERROR_CLOUD_FILE_ACCESS_DENIED syscall.Errno = 395 + ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS syscall.Errno = 396 + ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT syscall.Errno = 397 + ERROR_CLOUD_FILE_REQUEST_CANCELED syscall.Errno = 398 + ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED syscall.Errno = 399 + ERROR_THREAD_MODE_ALREADY_BACKGROUND syscall.Errno = 400 + ERROR_THREAD_MODE_NOT_BACKGROUND syscall.Errno = 401 + ERROR_PROCESS_MODE_ALREADY_BACKGROUND syscall.Errno = 402 + ERROR_PROCESS_MODE_NOT_BACKGROUND syscall.Errno = 403 + ERROR_CLOUD_FILE_PROVIDER_TERMINATED syscall.Errno = 404 + ERROR_NOT_A_CLOUD_SYNC_ROOT syscall.Errno = 405 + ERROR_FILE_PROTECTED_UNDER_DPL syscall.Errno = 406 + ERROR_VOLUME_NOT_CLUSTER_ALIGNED syscall.Errno = 407 + ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND syscall.Errno = 408 + ERROR_APPX_FILE_NOT_ENCRYPTED syscall.Errno = 409 + ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED syscall.Errno = 410 + ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET syscall.Errno = 411 + ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE syscall.Errno = 412 + ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER syscall.Errno = 413 + ERROR_LINUX_SUBSYSTEM_NOT_PRESENT syscall.Errno = 414 + ERROR_FT_READ_FAILURE syscall.Errno = 415 + ERROR_STORAGE_RESERVE_ID_INVALID syscall.Errno = 416 + ERROR_STORAGE_RESERVE_DOES_NOT_EXIST syscall.Errno = 417 + ERROR_STORAGE_RESERVE_ALREADY_EXISTS syscall.Errno = 418 + ERROR_STORAGE_RESERVE_NOT_EMPTY syscall.Errno = 419 + ERROR_NOT_A_DAX_VOLUME syscall.Errno = 420 + ERROR_NOT_DAX_MAPPABLE syscall.Errno = 421 + ERROR_TIME_CRITICAL_THREAD syscall.Errno = 422 + ERROR_DPL_NOT_SUPPORTED_FOR_USER syscall.Errno = 423 + ERROR_CASE_DIFFERING_NAMES_IN_DIR syscall.Errno = 424 + ERROR_CAPAUTHZ_NOT_DEVUNLOCKED syscall.Errno = 450 + ERROR_CAPAUTHZ_CHANGE_TYPE syscall.Errno = 451 + ERROR_CAPAUTHZ_NOT_PROVISIONED syscall.Errno = 452 + ERROR_CAPAUTHZ_NOT_AUTHORIZED syscall.Errno = 453 + ERROR_CAPAUTHZ_NO_POLICY syscall.Errno = 454 + ERROR_CAPAUTHZ_DB_CORRUPTED syscall.Errno = 455 + ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG syscall.Errno = 456 + ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY syscall.Errno = 457 + ERROR_CAPAUTHZ_SCCD_PARSE_ERROR syscall.Errno = 458 + ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED syscall.Errno = 459 + ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH syscall.Errno = 460 + ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT syscall.Errno = 480 + ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT syscall.Errno = 481 + ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT syscall.Errno = 482 + ERROR_DEVICE_HARDWARE_ERROR syscall.Errno = 483 + ERROR_INVALID_ADDRESS syscall.Errno = 487 + ERROR_VRF_CFG_ENABLED syscall.Errno = 1183 + ERROR_PARTITION_TERMINATING syscall.Errno = 1184 + ERROR_USER_PROFILE_LOAD syscall.Errno = 500 + ERROR_ARITHMETIC_OVERFLOW syscall.Errno = 534 + ERROR_PIPE_CONNECTED syscall.Errno = 535 + ERROR_PIPE_LISTENING syscall.Errno = 536 + ERROR_VERIFIER_STOP syscall.Errno = 537 + ERROR_ABIOS_ERROR syscall.Errno = 538 + ERROR_WX86_WARNING syscall.Errno = 539 + ERROR_WX86_ERROR syscall.Errno = 540 + ERROR_TIMER_NOT_CANCELED syscall.Errno = 541 + ERROR_UNWIND syscall.Errno = 542 + ERROR_BAD_STACK syscall.Errno = 543 + ERROR_INVALID_UNWIND_TARGET syscall.Errno = 544 + ERROR_INVALID_PORT_ATTRIBUTES syscall.Errno = 545 + ERROR_PORT_MESSAGE_TOO_LONG syscall.Errno = 546 + ERROR_INVALID_QUOTA_LOWER syscall.Errno = 547 + ERROR_DEVICE_ALREADY_ATTACHED syscall.Errno = 548 + ERROR_INSTRUCTION_MISALIGNMENT syscall.Errno = 549 + ERROR_PROFILING_NOT_STARTED syscall.Errno = 550 + ERROR_PROFILING_NOT_STOPPED syscall.Errno = 551 + ERROR_COULD_NOT_INTERPRET syscall.Errno = 552 + ERROR_PROFILING_AT_LIMIT syscall.Errno = 553 + ERROR_CANT_WAIT syscall.Errno = 554 + ERROR_CANT_TERMINATE_SELF syscall.Errno = 555 + ERROR_UNEXPECTED_MM_CREATE_ERR syscall.Errno = 556 + ERROR_UNEXPECTED_MM_MAP_ERROR syscall.Errno = 557 + ERROR_UNEXPECTED_MM_EXTEND_ERR syscall.Errno = 558 + ERROR_BAD_FUNCTION_TABLE syscall.Errno = 559 + ERROR_NO_GUID_TRANSLATION syscall.Errno = 560 + ERROR_INVALID_LDT_SIZE syscall.Errno = 561 + ERROR_INVALID_LDT_OFFSET syscall.Errno = 563 + ERROR_INVALID_LDT_DESCRIPTOR syscall.Errno = 564 + ERROR_TOO_MANY_THREADS syscall.Errno = 565 + ERROR_THREAD_NOT_IN_PROCESS syscall.Errno = 566 + ERROR_PAGEFILE_QUOTA_EXCEEDED syscall.Errno = 567 + ERROR_LOGON_SERVER_CONFLICT syscall.Errno = 568 + ERROR_SYNCHRONIZATION_REQUIRED syscall.Errno = 569 + ERROR_NET_OPEN_FAILED syscall.Errno = 570 + ERROR_IO_PRIVILEGE_FAILED syscall.Errno = 571 + ERROR_CONTROL_C_EXIT syscall.Errno = 572 + ERROR_MISSING_SYSTEMFILE syscall.Errno = 573 + ERROR_UNHANDLED_EXCEPTION syscall.Errno = 574 + ERROR_APP_INIT_FAILURE syscall.Errno = 575 + ERROR_PAGEFILE_CREATE_FAILED syscall.Errno = 576 + ERROR_INVALID_IMAGE_HASH syscall.Errno = 577 + ERROR_NO_PAGEFILE syscall.Errno = 578 + ERROR_ILLEGAL_FLOAT_CONTEXT syscall.Errno = 579 + ERROR_NO_EVENT_PAIR syscall.Errno = 580 + ERROR_DOMAIN_CTRLR_CONFIG_ERROR syscall.Errno = 581 + ERROR_ILLEGAL_CHARACTER syscall.Errno = 582 + ERROR_UNDEFINED_CHARACTER syscall.Errno = 583 + ERROR_FLOPPY_VOLUME syscall.Errno = 584 + ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT syscall.Errno = 585 + ERROR_BACKUP_CONTROLLER syscall.Errno = 586 + ERROR_MUTANT_LIMIT_EXCEEDED syscall.Errno = 587 + ERROR_FS_DRIVER_REQUIRED syscall.Errno = 588 + ERROR_CANNOT_LOAD_REGISTRY_FILE syscall.Errno = 589 + ERROR_DEBUG_ATTACH_FAILED syscall.Errno = 590 + ERROR_SYSTEM_PROCESS_TERMINATED syscall.Errno = 591 + ERROR_DATA_NOT_ACCEPTED syscall.Errno = 592 + ERROR_VDM_HARD_ERROR syscall.Errno = 593 + ERROR_DRIVER_CANCEL_TIMEOUT syscall.Errno = 594 + ERROR_REPLY_MESSAGE_MISMATCH syscall.Errno = 595 + ERROR_LOST_WRITEBEHIND_DATA syscall.Errno = 596 + ERROR_CLIENT_SERVER_PARAMETERS_INVALID syscall.Errno = 597 + ERROR_NOT_TINY_STREAM syscall.Errno = 598 + ERROR_STACK_OVERFLOW_READ syscall.Errno = 599 + ERROR_CONVERT_TO_LARGE syscall.Errno = 600 + ERROR_FOUND_OUT_OF_SCOPE syscall.Errno = 601 + ERROR_ALLOCATE_BUCKET syscall.Errno = 602 + ERROR_MARSHALL_OVERFLOW syscall.Errno = 603 + ERROR_INVALID_VARIANT syscall.Errno = 604 + ERROR_BAD_COMPRESSION_BUFFER syscall.Errno = 605 + ERROR_AUDIT_FAILED syscall.Errno = 606 + ERROR_TIMER_RESOLUTION_NOT_SET syscall.Errno = 607 + ERROR_INSUFFICIENT_LOGON_INFO syscall.Errno = 608 + ERROR_BAD_DLL_ENTRYPOINT syscall.Errno = 609 + ERROR_BAD_SERVICE_ENTRYPOINT syscall.Errno = 610 + ERROR_IP_ADDRESS_CONFLICT1 syscall.Errno = 611 + ERROR_IP_ADDRESS_CONFLICT2 syscall.Errno = 612 + ERROR_REGISTRY_QUOTA_LIMIT syscall.Errno = 613 + ERROR_NO_CALLBACK_ACTIVE syscall.Errno = 614 + ERROR_PWD_TOO_SHORT syscall.Errno = 615 + ERROR_PWD_TOO_RECENT syscall.Errno = 616 + ERROR_PWD_HISTORY_CONFLICT syscall.Errno = 617 + ERROR_UNSUPPORTED_COMPRESSION syscall.Errno = 618 + ERROR_INVALID_HW_PROFILE syscall.Errno = 619 + ERROR_INVALID_PLUGPLAY_DEVICE_PATH syscall.Errno = 620 + ERROR_QUOTA_LIST_INCONSISTENT syscall.Errno = 621 + ERROR_EVALUATION_EXPIRATION syscall.Errno = 622 + ERROR_ILLEGAL_DLL_RELOCATION syscall.Errno = 623 + ERROR_DLL_INIT_FAILED_LOGOFF syscall.Errno = 624 + ERROR_VALIDATE_CONTINUE syscall.Errno = 625 + ERROR_NO_MORE_MATCHES syscall.Errno = 626 + ERROR_RANGE_LIST_CONFLICT syscall.Errno = 627 + ERROR_SERVER_SID_MISMATCH syscall.Errno = 628 + ERROR_CANT_ENABLE_DENY_ONLY syscall.Errno = 629 + ERROR_FLOAT_MULTIPLE_FAULTS syscall.Errno = 630 + ERROR_FLOAT_MULTIPLE_TRAPS syscall.Errno = 631 + ERROR_NOINTERFACE syscall.Errno = 632 + ERROR_DRIVER_FAILED_SLEEP syscall.Errno = 633 + ERROR_CORRUPT_SYSTEM_FILE syscall.Errno = 634 + ERROR_COMMITMENT_MINIMUM syscall.Errno = 635 + ERROR_PNP_RESTART_ENUMERATION syscall.Errno = 636 + ERROR_SYSTEM_IMAGE_BAD_SIGNATURE syscall.Errno = 637 + ERROR_PNP_REBOOT_REQUIRED syscall.Errno = 638 + ERROR_INSUFFICIENT_POWER syscall.Errno = 639 + ERROR_MULTIPLE_FAULT_VIOLATION syscall.Errno = 640 + ERROR_SYSTEM_SHUTDOWN syscall.Errno = 641 + ERROR_PORT_NOT_SET syscall.Errno = 642 + ERROR_DS_VERSION_CHECK_FAILURE syscall.Errno = 643 + ERROR_RANGE_NOT_FOUND syscall.Errno = 644 + ERROR_NOT_SAFE_MODE_DRIVER syscall.Errno = 646 + ERROR_FAILED_DRIVER_ENTRY syscall.Errno = 647 + ERROR_DEVICE_ENUMERATION_ERROR syscall.Errno = 648 + ERROR_MOUNT_POINT_NOT_RESOLVED syscall.Errno = 649 + ERROR_INVALID_DEVICE_OBJECT_PARAMETER syscall.Errno = 650 + ERROR_MCA_OCCURED syscall.Errno = 651 + ERROR_DRIVER_DATABASE_ERROR syscall.Errno = 652 + ERROR_SYSTEM_HIVE_TOO_LARGE syscall.Errno = 653 + ERROR_DRIVER_FAILED_PRIOR_UNLOAD syscall.Errno = 654 + ERROR_VOLSNAP_PREPARE_HIBERNATE syscall.Errno = 655 + ERROR_HIBERNATION_FAILURE syscall.Errno = 656 + ERROR_PWD_TOO_LONG syscall.Errno = 657 + ERROR_FILE_SYSTEM_LIMITATION syscall.Errno = 665 + ERROR_ASSERTION_FAILURE syscall.Errno = 668 + ERROR_ACPI_ERROR syscall.Errno = 669 + ERROR_WOW_ASSERTION syscall.Errno = 670 + ERROR_PNP_BAD_MPS_TABLE syscall.Errno = 671 + ERROR_PNP_TRANSLATION_FAILED syscall.Errno = 672 + ERROR_PNP_IRQ_TRANSLATION_FAILED syscall.Errno = 673 + ERROR_PNP_INVALID_ID syscall.Errno = 674 + ERROR_WAKE_SYSTEM_DEBUGGER syscall.Errno = 675 + ERROR_HANDLES_CLOSED syscall.Errno = 676 + ERROR_EXTRANEOUS_INFORMATION syscall.Errno = 677 + ERROR_RXACT_COMMIT_NECESSARY syscall.Errno = 678 + ERROR_MEDIA_CHECK syscall.Errno = 679 + ERROR_GUID_SUBSTITUTION_MADE syscall.Errno = 680 + ERROR_STOPPED_ON_SYMLINK syscall.Errno = 681 + ERROR_LONGJUMP syscall.Errno = 682 + ERROR_PLUGPLAY_QUERY_VETOED syscall.Errno = 683 + ERROR_UNWIND_CONSOLIDATE syscall.Errno = 684 + ERROR_REGISTRY_HIVE_RECOVERED syscall.Errno = 685 + ERROR_DLL_MIGHT_BE_INSECURE syscall.Errno = 686 + ERROR_DLL_MIGHT_BE_INCOMPATIBLE syscall.Errno = 687 + ERROR_DBG_EXCEPTION_NOT_HANDLED syscall.Errno = 688 + ERROR_DBG_REPLY_LATER syscall.Errno = 689 + ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE syscall.Errno = 690 + ERROR_DBG_TERMINATE_THREAD syscall.Errno = 691 + ERROR_DBG_TERMINATE_PROCESS syscall.Errno = 692 + ERROR_DBG_CONTROL_C syscall.Errno = 693 + ERROR_DBG_PRINTEXCEPTION_C syscall.Errno = 694 + ERROR_DBG_RIPEXCEPTION syscall.Errno = 695 + ERROR_DBG_CONTROL_BREAK syscall.Errno = 696 + ERROR_DBG_COMMAND_EXCEPTION syscall.Errno = 697 + ERROR_OBJECT_NAME_EXISTS syscall.Errno = 698 + ERROR_THREAD_WAS_SUSPENDED syscall.Errno = 699 + ERROR_IMAGE_NOT_AT_BASE syscall.Errno = 700 + ERROR_RXACT_STATE_CREATED syscall.Errno = 701 + ERROR_SEGMENT_NOTIFICATION syscall.Errno = 702 + ERROR_BAD_CURRENT_DIRECTORY syscall.Errno = 703 + ERROR_FT_READ_RECOVERY_FROM_BACKUP syscall.Errno = 704 + ERROR_FT_WRITE_RECOVERY syscall.Errno = 705 + ERROR_IMAGE_MACHINE_TYPE_MISMATCH syscall.Errno = 706 + ERROR_RECEIVE_PARTIAL syscall.Errno = 707 + ERROR_RECEIVE_EXPEDITED syscall.Errno = 708 + ERROR_RECEIVE_PARTIAL_EXPEDITED syscall.Errno = 709 + ERROR_EVENT_DONE syscall.Errno = 710 + ERROR_EVENT_PENDING syscall.Errno = 711 + ERROR_CHECKING_FILE_SYSTEM syscall.Errno = 712 + ERROR_FATAL_APP_EXIT syscall.Errno = 713 + ERROR_PREDEFINED_HANDLE syscall.Errno = 714 + ERROR_WAS_UNLOCKED syscall.Errno = 715 + ERROR_SERVICE_NOTIFICATION syscall.Errno = 716 + ERROR_WAS_LOCKED syscall.Errno = 717 + ERROR_LOG_HARD_ERROR syscall.Errno = 718 + ERROR_ALREADY_WIN32 syscall.Errno = 719 + ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE syscall.Errno = 720 + ERROR_NO_YIELD_PERFORMED syscall.Errno = 721 + ERROR_TIMER_RESUME_IGNORED syscall.Errno = 722 + ERROR_ARBITRATION_UNHANDLED syscall.Errno = 723 + ERROR_CARDBUS_NOT_SUPPORTED syscall.Errno = 724 + ERROR_MP_PROCESSOR_MISMATCH syscall.Errno = 725 + ERROR_HIBERNATED syscall.Errno = 726 + ERROR_RESUME_HIBERNATION syscall.Errno = 727 + ERROR_FIRMWARE_UPDATED syscall.Errno = 728 + ERROR_DRIVERS_LEAKING_LOCKED_PAGES syscall.Errno = 729 + ERROR_WAKE_SYSTEM syscall.Errno = 730 + ERROR_WAIT_1 syscall.Errno = 731 + ERROR_WAIT_2 syscall.Errno = 732 + ERROR_WAIT_3 syscall.Errno = 733 + ERROR_WAIT_63 syscall.Errno = 734 + ERROR_ABANDONED_WAIT_0 syscall.Errno = 735 + ERROR_ABANDONED_WAIT_63 syscall.Errno = 736 + ERROR_USER_APC syscall.Errno = 737 + ERROR_KERNEL_APC syscall.Errno = 738 + ERROR_ALERTED syscall.Errno = 739 + ERROR_ELEVATION_REQUIRED syscall.Errno = 740 + ERROR_REPARSE syscall.Errno = 741 + ERROR_OPLOCK_BREAK_IN_PROGRESS syscall.Errno = 742 + ERROR_VOLUME_MOUNTED syscall.Errno = 743 + ERROR_RXACT_COMMITTED syscall.Errno = 744 + ERROR_NOTIFY_CLEANUP syscall.Errno = 745 + ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED syscall.Errno = 746 + ERROR_PAGE_FAULT_TRANSITION syscall.Errno = 747 + ERROR_PAGE_FAULT_DEMAND_ZERO syscall.Errno = 748 + ERROR_PAGE_FAULT_COPY_ON_WRITE syscall.Errno = 749 + ERROR_PAGE_FAULT_GUARD_PAGE syscall.Errno = 750 + ERROR_PAGE_FAULT_PAGING_FILE syscall.Errno = 751 + ERROR_CACHE_PAGE_LOCKED syscall.Errno = 752 + ERROR_CRASH_DUMP syscall.Errno = 753 + ERROR_BUFFER_ALL_ZEROS syscall.Errno = 754 + ERROR_REPARSE_OBJECT syscall.Errno = 755 + ERROR_RESOURCE_REQUIREMENTS_CHANGED syscall.Errno = 756 + ERROR_TRANSLATION_COMPLETE syscall.Errno = 757 + ERROR_NOTHING_TO_TERMINATE syscall.Errno = 758 + ERROR_PROCESS_NOT_IN_JOB syscall.Errno = 759 + ERROR_PROCESS_IN_JOB syscall.Errno = 760 + ERROR_VOLSNAP_HIBERNATE_READY syscall.Errno = 761 + ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY syscall.Errno = 762 + ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED syscall.Errno = 763 + ERROR_INTERRUPT_STILL_CONNECTED syscall.Errno = 764 + ERROR_WAIT_FOR_OPLOCK syscall.Errno = 765 + ERROR_DBG_EXCEPTION_HANDLED syscall.Errno = 766 + ERROR_DBG_CONTINUE syscall.Errno = 767 + ERROR_CALLBACK_POP_STACK syscall.Errno = 768 + ERROR_COMPRESSION_DISABLED syscall.Errno = 769 + ERROR_CANTFETCHBACKWARDS syscall.Errno = 770 + ERROR_CANTSCROLLBACKWARDS syscall.Errno = 771 + ERROR_ROWSNOTRELEASED syscall.Errno = 772 + ERROR_BAD_ACCESSOR_FLAGS syscall.Errno = 773 + ERROR_ERRORS_ENCOUNTERED syscall.Errno = 774 + ERROR_NOT_CAPABLE syscall.Errno = 775 + ERROR_REQUEST_OUT_OF_SEQUENCE syscall.Errno = 776 + ERROR_VERSION_PARSE_ERROR syscall.Errno = 777 + ERROR_BADSTARTPOSITION syscall.Errno = 778 + ERROR_MEMORY_HARDWARE syscall.Errno = 779 + ERROR_DISK_REPAIR_DISABLED syscall.Errno = 780 + ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE syscall.Errno = 781 + ERROR_SYSTEM_POWERSTATE_TRANSITION syscall.Errno = 782 + ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION syscall.Errno = 783 + ERROR_MCA_EXCEPTION syscall.Errno = 784 + ERROR_ACCESS_AUDIT_BY_POLICY syscall.Errno = 785 + ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY syscall.Errno = 786 + ERROR_ABANDON_HIBERFILE syscall.Errno = 787 + ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED syscall.Errno = 788 + ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR syscall.Errno = 789 + ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR syscall.Errno = 790 + ERROR_BAD_MCFG_TABLE syscall.Errno = 791 + ERROR_DISK_REPAIR_REDIRECTED syscall.Errno = 792 + ERROR_DISK_REPAIR_UNSUCCESSFUL syscall.Errno = 793 + ERROR_CORRUPT_LOG_OVERFULL syscall.Errno = 794 + ERROR_CORRUPT_LOG_CORRUPTED syscall.Errno = 795 + ERROR_CORRUPT_LOG_UNAVAILABLE syscall.Errno = 796 + ERROR_CORRUPT_LOG_DELETED_FULL syscall.Errno = 797 + ERROR_CORRUPT_LOG_CLEARED syscall.Errno = 798 + ERROR_ORPHAN_NAME_EXHAUSTED syscall.Errno = 799 + ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE syscall.Errno = 800 + ERROR_CANNOT_GRANT_REQUESTED_OPLOCK syscall.Errno = 801 + ERROR_CANNOT_BREAK_OPLOCK syscall.Errno = 802 + ERROR_OPLOCK_HANDLE_CLOSED syscall.Errno = 803 + ERROR_NO_ACE_CONDITION syscall.Errno = 804 + ERROR_INVALID_ACE_CONDITION syscall.Errno = 805 + ERROR_FILE_HANDLE_REVOKED syscall.Errno = 806 + ERROR_IMAGE_AT_DIFFERENT_BASE syscall.Errno = 807 + ERROR_ENCRYPTED_IO_NOT_POSSIBLE syscall.Errno = 808 + ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS syscall.Errno = 809 + ERROR_QUOTA_ACTIVITY syscall.Errno = 810 + ERROR_HANDLE_REVOKED syscall.Errno = 811 + ERROR_CALLBACK_INVOKE_INLINE syscall.Errno = 812 + ERROR_CPU_SET_INVALID syscall.Errno = 813 + ERROR_ENCLAVE_NOT_TERMINATED syscall.Errno = 814 + ERROR_ENCLAVE_VIOLATION syscall.Errno = 815 + ERROR_EA_ACCESS_DENIED syscall.Errno = 994 + ERROR_OPERATION_ABORTED syscall.Errno = 995 + ERROR_IO_INCOMPLETE syscall.Errno = 996 + ERROR_IO_PENDING syscall.Errno = 997 + ERROR_NOACCESS syscall.Errno = 998 + ERROR_SWAPERROR syscall.Errno = 999 + ERROR_STACK_OVERFLOW syscall.Errno = 1001 + ERROR_INVALID_MESSAGE syscall.Errno = 1002 + ERROR_CAN_NOT_COMPLETE syscall.Errno = 1003 + ERROR_INVALID_FLAGS syscall.Errno = 1004 + ERROR_UNRECOGNIZED_VOLUME syscall.Errno = 1005 + ERROR_FILE_INVALID syscall.Errno = 1006 + ERROR_FULLSCREEN_MODE syscall.Errno = 1007 + ERROR_NO_TOKEN syscall.Errno = 1008 + ERROR_BADDB syscall.Errno = 1009 + ERROR_BADKEY syscall.Errno = 1010 + ERROR_CANTOPEN syscall.Errno = 1011 + ERROR_CANTREAD syscall.Errno = 1012 + ERROR_CANTWRITE syscall.Errno = 1013 + ERROR_REGISTRY_RECOVERED syscall.Errno = 1014 + ERROR_REGISTRY_CORRUPT syscall.Errno = 1015 + ERROR_REGISTRY_IO_FAILED syscall.Errno = 1016 + ERROR_NOT_REGISTRY_FILE syscall.Errno = 1017 + ERROR_KEY_DELETED syscall.Errno = 1018 + ERROR_NO_LOG_SPACE syscall.Errno = 1019 + ERROR_KEY_HAS_CHILDREN syscall.Errno = 1020 + ERROR_CHILD_MUST_BE_VOLATILE syscall.Errno = 1021 + ERROR_NOTIFY_ENUM_DIR syscall.Errno = 1022 + ERROR_DEPENDENT_SERVICES_RUNNING syscall.Errno = 1051 + ERROR_INVALID_SERVICE_CONTROL syscall.Errno = 1052 + ERROR_SERVICE_REQUEST_TIMEOUT syscall.Errno = 1053 + ERROR_SERVICE_NO_THREAD syscall.Errno = 1054 + ERROR_SERVICE_DATABASE_LOCKED syscall.Errno = 1055 + ERROR_SERVICE_ALREADY_RUNNING syscall.Errno = 1056 + ERROR_INVALID_SERVICE_ACCOUNT syscall.Errno = 1057 + ERROR_SERVICE_DISABLED syscall.Errno = 1058 + ERROR_CIRCULAR_DEPENDENCY syscall.Errno = 1059 + ERROR_SERVICE_DOES_NOT_EXIST syscall.Errno = 1060 + ERROR_SERVICE_CANNOT_ACCEPT_CTRL syscall.Errno = 1061 + ERROR_SERVICE_NOT_ACTIVE syscall.Errno = 1062 + ERROR_FAILED_SERVICE_CONTROLLER_CONNECT syscall.Errno = 1063 + ERROR_EXCEPTION_IN_SERVICE syscall.Errno = 1064 + ERROR_DATABASE_DOES_NOT_EXIST syscall.Errno = 1065 + ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066 + ERROR_PROCESS_ABORTED syscall.Errno = 1067 + ERROR_SERVICE_DEPENDENCY_FAIL syscall.Errno = 1068 + ERROR_SERVICE_LOGON_FAILED syscall.Errno = 1069 + ERROR_SERVICE_START_HANG syscall.Errno = 1070 + ERROR_INVALID_SERVICE_LOCK syscall.Errno = 1071 + ERROR_SERVICE_MARKED_FOR_DELETE syscall.Errno = 1072 + ERROR_SERVICE_EXISTS syscall.Errno = 1073 + ERROR_ALREADY_RUNNING_LKG syscall.Errno = 1074 + ERROR_SERVICE_DEPENDENCY_DELETED syscall.Errno = 1075 + ERROR_BOOT_ALREADY_ACCEPTED syscall.Errno = 1076 + ERROR_SERVICE_NEVER_STARTED syscall.Errno = 1077 + ERROR_DUPLICATE_SERVICE_NAME syscall.Errno = 1078 + ERROR_DIFFERENT_SERVICE_ACCOUNT syscall.Errno = 1079 + ERROR_CANNOT_DETECT_DRIVER_FAILURE syscall.Errno = 1080 + ERROR_CANNOT_DETECT_PROCESS_ABORT syscall.Errno = 1081 + ERROR_NO_RECOVERY_PROGRAM syscall.Errno = 1082 + ERROR_SERVICE_NOT_IN_EXE syscall.Errno = 1083 + ERROR_NOT_SAFEBOOT_SERVICE syscall.Errno = 1084 + ERROR_END_OF_MEDIA syscall.Errno = 1100 + ERROR_FILEMARK_DETECTED syscall.Errno = 1101 + ERROR_BEGINNING_OF_MEDIA syscall.Errno = 1102 + ERROR_SETMARK_DETECTED syscall.Errno = 1103 + ERROR_NO_DATA_DETECTED syscall.Errno = 1104 + ERROR_PARTITION_FAILURE syscall.Errno = 1105 + ERROR_INVALID_BLOCK_LENGTH syscall.Errno = 1106 + ERROR_DEVICE_NOT_PARTITIONED syscall.Errno = 1107 + ERROR_UNABLE_TO_LOCK_MEDIA syscall.Errno = 1108 + ERROR_UNABLE_TO_UNLOAD_MEDIA syscall.Errno = 1109 + ERROR_MEDIA_CHANGED syscall.Errno = 1110 + ERROR_BUS_RESET syscall.Errno = 1111 + ERROR_NO_MEDIA_IN_DRIVE syscall.Errno = 1112 + ERROR_NO_UNICODE_TRANSLATION syscall.Errno = 1113 + ERROR_DLL_INIT_FAILED syscall.Errno = 1114 + ERROR_SHUTDOWN_IN_PROGRESS syscall.Errno = 1115 + ERROR_NO_SHUTDOWN_IN_PROGRESS syscall.Errno = 1116 + ERROR_IO_DEVICE syscall.Errno = 1117 + ERROR_SERIAL_NO_DEVICE syscall.Errno = 1118 + ERROR_IRQ_BUSY syscall.Errno = 1119 + ERROR_MORE_WRITES syscall.Errno = 1120 + ERROR_COUNTER_TIMEOUT syscall.Errno = 1121 + ERROR_FLOPPY_ID_MARK_NOT_FOUND syscall.Errno = 1122 + ERROR_FLOPPY_WRONG_CYLINDER syscall.Errno = 1123 + ERROR_FLOPPY_UNKNOWN_ERROR syscall.Errno = 1124 + ERROR_FLOPPY_BAD_REGISTERS syscall.Errno = 1125 + ERROR_DISK_RECALIBRATE_FAILED syscall.Errno = 1126 + ERROR_DISK_OPERATION_FAILED syscall.Errno = 1127 + ERROR_DISK_RESET_FAILED syscall.Errno = 1128 + ERROR_EOM_OVERFLOW syscall.Errno = 1129 + ERROR_NOT_ENOUGH_SERVER_MEMORY syscall.Errno = 1130 + ERROR_POSSIBLE_DEADLOCK syscall.Errno = 1131 + ERROR_MAPPED_ALIGNMENT syscall.Errno = 1132 + ERROR_SET_POWER_STATE_VETOED syscall.Errno = 1140 + ERROR_SET_POWER_STATE_FAILED syscall.Errno = 1141 + ERROR_TOO_MANY_LINKS syscall.Errno = 1142 + ERROR_OLD_WIN_VERSION syscall.Errno = 1150 + ERROR_APP_WRONG_OS syscall.Errno = 1151 + ERROR_SINGLE_INSTANCE_APP syscall.Errno = 1152 + ERROR_RMODE_APP syscall.Errno = 1153 + ERROR_INVALID_DLL syscall.Errno = 1154 + ERROR_NO_ASSOCIATION syscall.Errno = 1155 + ERROR_DDE_FAIL syscall.Errno = 1156 + ERROR_DLL_NOT_FOUND syscall.Errno = 1157 + ERROR_NO_MORE_USER_HANDLES syscall.Errno = 1158 + ERROR_MESSAGE_SYNC_ONLY syscall.Errno = 1159 + ERROR_SOURCE_ELEMENT_EMPTY syscall.Errno = 1160 + ERROR_DESTINATION_ELEMENT_FULL syscall.Errno = 1161 + ERROR_ILLEGAL_ELEMENT_ADDRESS syscall.Errno = 1162 + ERROR_MAGAZINE_NOT_PRESENT syscall.Errno = 1163 + ERROR_DEVICE_REINITIALIZATION_NEEDED syscall.Errno = 1164 + ERROR_DEVICE_REQUIRES_CLEANING syscall.Errno = 1165 + ERROR_DEVICE_DOOR_OPEN syscall.Errno = 1166 + ERROR_DEVICE_NOT_CONNECTED syscall.Errno = 1167 + ERROR_NOT_FOUND syscall.Errno = 1168 + ERROR_NO_MATCH syscall.Errno = 1169 + ERROR_SET_NOT_FOUND syscall.Errno = 1170 + ERROR_POINT_NOT_FOUND syscall.Errno = 1171 + ERROR_NO_TRACKING_SERVICE syscall.Errno = 1172 + ERROR_NO_VOLUME_ID syscall.Errno = 1173 + ERROR_UNABLE_TO_REMOVE_REPLACED syscall.Errno = 1175 + ERROR_UNABLE_TO_MOVE_REPLACEMENT syscall.Errno = 1176 + ERROR_UNABLE_TO_MOVE_REPLACEMENT_2 syscall.Errno = 1177 + ERROR_JOURNAL_DELETE_IN_PROGRESS syscall.Errno = 1178 + ERROR_JOURNAL_NOT_ACTIVE syscall.Errno = 1179 + ERROR_POTENTIAL_FILE_FOUND syscall.Errno = 1180 + ERROR_JOURNAL_ENTRY_DELETED syscall.Errno = 1181 + ERROR_SHUTDOWN_IS_SCHEDULED syscall.Errno = 1190 + ERROR_SHUTDOWN_USERS_LOGGED_ON syscall.Errno = 1191 + ERROR_BAD_DEVICE syscall.Errno = 1200 + ERROR_CONNECTION_UNAVAIL syscall.Errno = 1201 + ERROR_DEVICE_ALREADY_REMEMBERED syscall.Errno = 1202 + ERROR_NO_NET_OR_BAD_PATH syscall.Errno = 1203 + ERROR_BAD_PROVIDER syscall.Errno = 1204 + ERROR_CANNOT_OPEN_PROFILE syscall.Errno = 1205 + ERROR_BAD_PROFILE syscall.Errno = 1206 + ERROR_NOT_CONTAINER syscall.Errno = 1207 + ERROR_EXTENDED_ERROR syscall.Errno = 1208 + ERROR_INVALID_GROUPNAME syscall.Errno = 1209 + ERROR_INVALID_COMPUTERNAME syscall.Errno = 1210 + ERROR_INVALID_EVENTNAME syscall.Errno = 1211 + ERROR_INVALID_DOMAINNAME syscall.Errno = 1212 + ERROR_INVALID_SERVICENAME syscall.Errno = 1213 + ERROR_INVALID_NETNAME syscall.Errno = 1214 + ERROR_INVALID_SHARENAME syscall.Errno = 1215 + ERROR_INVALID_PASSWORDNAME syscall.Errno = 1216 + ERROR_INVALID_MESSAGENAME syscall.Errno = 1217 + ERROR_INVALID_MESSAGEDEST syscall.Errno = 1218 + ERROR_SESSION_CREDENTIAL_CONFLICT syscall.Errno = 1219 + ERROR_REMOTE_SESSION_LIMIT_EXCEEDED syscall.Errno = 1220 + ERROR_DUP_DOMAINNAME syscall.Errno = 1221 + ERROR_NO_NETWORK syscall.Errno = 1222 + ERROR_CANCELLED syscall.Errno = 1223 + ERROR_USER_MAPPED_FILE syscall.Errno = 1224 + ERROR_CONNECTION_REFUSED syscall.Errno = 1225 + ERROR_GRACEFUL_DISCONNECT syscall.Errno = 1226 + ERROR_ADDRESS_ALREADY_ASSOCIATED syscall.Errno = 1227 + ERROR_ADDRESS_NOT_ASSOCIATED syscall.Errno = 1228 + ERROR_CONNECTION_INVALID syscall.Errno = 1229 + ERROR_CONNECTION_ACTIVE syscall.Errno = 1230 + ERROR_NETWORK_UNREACHABLE syscall.Errno = 1231 + ERROR_HOST_UNREACHABLE syscall.Errno = 1232 + ERROR_PROTOCOL_UNREACHABLE syscall.Errno = 1233 + ERROR_PORT_UNREACHABLE syscall.Errno = 1234 + ERROR_REQUEST_ABORTED syscall.Errno = 1235 + ERROR_CONNECTION_ABORTED syscall.Errno = 1236 + ERROR_RETRY syscall.Errno = 1237 + ERROR_CONNECTION_COUNT_LIMIT syscall.Errno = 1238 + ERROR_LOGIN_TIME_RESTRICTION syscall.Errno = 1239 + ERROR_LOGIN_WKSTA_RESTRICTION syscall.Errno = 1240 + ERROR_INCORRECT_ADDRESS syscall.Errno = 1241 + ERROR_ALREADY_REGISTERED syscall.Errno = 1242 + ERROR_SERVICE_NOT_FOUND syscall.Errno = 1243 + ERROR_NOT_AUTHENTICATED syscall.Errno = 1244 + ERROR_NOT_LOGGED_ON syscall.Errno = 1245 + ERROR_CONTINUE syscall.Errno = 1246 + ERROR_ALREADY_INITIALIZED syscall.Errno = 1247 + ERROR_NO_MORE_DEVICES syscall.Errno = 1248 + ERROR_NO_SUCH_SITE syscall.Errno = 1249 + ERROR_DOMAIN_CONTROLLER_EXISTS syscall.Errno = 1250 + ERROR_ONLY_IF_CONNECTED syscall.Errno = 1251 + ERROR_OVERRIDE_NOCHANGES syscall.Errno = 1252 + ERROR_BAD_USER_PROFILE syscall.Errno = 1253 + ERROR_NOT_SUPPORTED_ON_SBS syscall.Errno = 1254 + ERROR_SERVER_SHUTDOWN_IN_PROGRESS syscall.Errno = 1255 + ERROR_HOST_DOWN syscall.Errno = 1256 + ERROR_NON_ACCOUNT_SID syscall.Errno = 1257 + ERROR_NON_DOMAIN_SID syscall.Errno = 1258 + ERROR_APPHELP_BLOCK syscall.Errno = 1259 + ERROR_ACCESS_DISABLED_BY_POLICY syscall.Errno = 1260 + ERROR_REG_NAT_CONSUMPTION syscall.Errno = 1261 + ERROR_CSCSHARE_OFFLINE syscall.Errno = 1262 + ERROR_PKINIT_FAILURE syscall.Errno = 1263 + ERROR_SMARTCARD_SUBSYSTEM_FAILURE syscall.Errno = 1264 + ERROR_DOWNGRADE_DETECTED syscall.Errno = 1265 + ERROR_MACHINE_LOCKED syscall.Errno = 1271 + ERROR_SMB_GUEST_LOGON_BLOCKED syscall.Errno = 1272 + ERROR_CALLBACK_SUPPLIED_INVALID_DATA syscall.Errno = 1273 + ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED syscall.Errno = 1274 + ERROR_DRIVER_BLOCKED syscall.Errno = 1275 + ERROR_INVALID_IMPORT_OF_NON_DLL syscall.Errno = 1276 + ERROR_ACCESS_DISABLED_WEBBLADE syscall.Errno = 1277 + ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER syscall.Errno = 1278 + ERROR_RECOVERY_FAILURE syscall.Errno = 1279 + ERROR_ALREADY_FIBER syscall.Errno = 1280 + ERROR_ALREADY_THREAD syscall.Errno = 1281 + ERROR_STACK_BUFFER_OVERRUN syscall.Errno = 1282 + ERROR_PARAMETER_QUOTA_EXCEEDED syscall.Errno = 1283 + ERROR_DEBUGGER_INACTIVE syscall.Errno = 1284 + ERROR_DELAY_LOAD_FAILED syscall.Errno = 1285 + ERROR_VDM_DISALLOWED syscall.Errno = 1286 + ERROR_UNIDENTIFIED_ERROR syscall.Errno = 1287 + ERROR_INVALID_CRUNTIME_PARAMETER syscall.Errno = 1288 + ERROR_BEYOND_VDL syscall.Errno = 1289 + ERROR_INCOMPATIBLE_SERVICE_SID_TYPE syscall.Errno = 1290 + ERROR_DRIVER_PROCESS_TERMINATED syscall.Errno = 1291 + ERROR_IMPLEMENTATION_LIMIT syscall.Errno = 1292 + ERROR_PROCESS_IS_PROTECTED syscall.Errno = 1293 + ERROR_SERVICE_NOTIFY_CLIENT_LAGGING syscall.Errno = 1294 + ERROR_DISK_QUOTA_EXCEEDED syscall.Errno = 1295 + ERROR_CONTENT_BLOCKED syscall.Errno = 1296 + ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE syscall.Errno = 1297 + ERROR_APP_HANG syscall.Errno = 1298 + ERROR_INVALID_LABEL syscall.Errno = 1299 + ERROR_NOT_ALL_ASSIGNED syscall.Errno = 1300 + ERROR_SOME_NOT_MAPPED syscall.Errno = 1301 + ERROR_NO_QUOTAS_FOR_ACCOUNT syscall.Errno = 1302 + ERROR_LOCAL_USER_SESSION_KEY syscall.Errno = 1303 + ERROR_NULL_LM_PASSWORD syscall.Errno = 1304 + ERROR_UNKNOWN_REVISION syscall.Errno = 1305 + ERROR_REVISION_MISMATCH syscall.Errno = 1306 + ERROR_INVALID_OWNER syscall.Errno = 1307 + ERROR_INVALID_PRIMARY_GROUP syscall.Errno = 1308 + ERROR_NO_IMPERSONATION_TOKEN syscall.Errno = 1309 + ERROR_CANT_DISABLE_MANDATORY syscall.Errno = 1310 + ERROR_NO_LOGON_SERVERS syscall.Errno = 1311 + ERROR_NO_SUCH_LOGON_SESSION syscall.Errno = 1312 + ERROR_NO_SUCH_PRIVILEGE syscall.Errno = 1313 + ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 + ERROR_INVALID_ACCOUNT_NAME syscall.Errno = 1315 + ERROR_USER_EXISTS syscall.Errno = 1316 + ERROR_NO_SUCH_USER syscall.Errno = 1317 + ERROR_GROUP_EXISTS syscall.Errno = 1318 + ERROR_NO_SUCH_GROUP syscall.Errno = 1319 + ERROR_MEMBER_IN_GROUP syscall.Errno = 1320 + ERROR_MEMBER_NOT_IN_GROUP syscall.Errno = 1321 + ERROR_LAST_ADMIN syscall.Errno = 1322 + ERROR_WRONG_PASSWORD syscall.Errno = 1323 + ERROR_ILL_FORMED_PASSWORD syscall.Errno = 1324 + ERROR_PASSWORD_RESTRICTION syscall.Errno = 1325 + ERROR_LOGON_FAILURE syscall.Errno = 1326 + ERROR_ACCOUNT_RESTRICTION syscall.Errno = 1327 + ERROR_INVALID_LOGON_HOURS syscall.Errno = 1328 + ERROR_INVALID_WORKSTATION syscall.Errno = 1329 + ERROR_PASSWORD_EXPIRED syscall.Errno = 1330 + ERROR_ACCOUNT_DISABLED syscall.Errno = 1331 + ERROR_NONE_MAPPED syscall.Errno = 1332 + ERROR_TOO_MANY_LUIDS_REQUESTED syscall.Errno = 1333 + ERROR_LUIDS_EXHAUSTED syscall.Errno = 1334 + ERROR_INVALID_SUB_AUTHORITY syscall.Errno = 1335 + ERROR_INVALID_ACL syscall.Errno = 1336 + ERROR_INVALID_SID syscall.Errno = 1337 + ERROR_INVALID_SECURITY_DESCR syscall.Errno = 1338 + ERROR_BAD_INHERITANCE_ACL syscall.Errno = 1340 + ERROR_SERVER_DISABLED syscall.Errno = 1341 + ERROR_SERVER_NOT_DISABLED syscall.Errno = 1342 + ERROR_INVALID_ID_AUTHORITY syscall.Errno = 1343 + ERROR_ALLOTTED_SPACE_EXCEEDED syscall.Errno = 1344 + ERROR_INVALID_GROUP_ATTRIBUTES syscall.Errno = 1345 + ERROR_BAD_IMPERSONATION_LEVEL syscall.Errno = 1346 + ERROR_CANT_OPEN_ANONYMOUS syscall.Errno = 1347 + ERROR_BAD_VALIDATION_CLASS syscall.Errno = 1348 + ERROR_BAD_TOKEN_TYPE syscall.Errno = 1349 + ERROR_NO_SECURITY_ON_OBJECT syscall.Errno = 1350 + ERROR_CANT_ACCESS_DOMAIN_INFO syscall.Errno = 1351 + ERROR_INVALID_SERVER_STATE syscall.Errno = 1352 + ERROR_INVALID_DOMAIN_STATE syscall.Errno = 1353 + ERROR_INVALID_DOMAIN_ROLE syscall.Errno = 1354 + ERROR_NO_SUCH_DOMAIN syscall.Errno = 1355 + ERROR_DOMAIN_EXISTS syscall.Errno = 1356 + ERROR_DOMAIN_LIMIT_EXCEEDED syscall.Errno = 1357 + ERROR_INTERNAL_DB_CORRUPTION syscall.Errno = 1358 + ERROR_INTERNAL_ERROR syscall.Errno = 1359 + ERROR_GENERIC_NOT_MAPPED syscall.Errno = 1360 + ERROR_BAD_DESCRIPTOR_FORMAT syscall.Errno = 1361 + ERROR_NOT_LOGON_PROCESS syscall.Errno = 1362 + ERROR_LOGON_SESSION_EXISTS syscall.Errno = 1363 + ERROR_NO_SUCH_PACKAGE syscall.Errno = 1364 + ERROR_BAD_LOGON_SESSION_STATE syscall.Errno = 1365 + ERROR_LOGON_SESSION_COLLISION syscall.Errno = 1366 + ERROR_INVALID_LOGON_TYPE syscall.Errno = 1367 + ERROR_CANNOT_IMPERSONATE syscall.Errno = 1368 + ERROR_RXACT_INVALID_STATE syscall.Errno = 1369 + ERROR_RXACT_COMMIT_FAILURE syscall.Errno = 1370 + ERROR_SPECIAL_ACCOUNT syscall.Errno = 1371 + ERROR_SPECIAL_GROUP syscall.Errno = 1372 + ERROR_SPECIAL_USER syscall.Errno = 1373 + ERROR_MEMBERS_PRIMARY_GROUP syscall.Errno = 1374 + ERROR_TOKEN_ALREADY_IN_USE syscall.Errno = 1375 + ERROR_NO_SUCH_ALIAS syscall.Errno = 1376 + ERROR_MEMBER_NOT_IN_ALIAS syscall.Errno = 1377 + ERROR_MEMBER_IN_ALIAS syscall.Errno = 1378 + ERROR_ALIAS_EXISTS syscall.Errno = 1379 + ERROR_LOGON_NOT_GRANTED syscall.Errno = 1380 + ERROR_TOO_MANY_SECRETS syscall.Errno = 1381 + ERROR_SECRET_TOO_LONG syscall.Errno = 1382 + ERROR_INTERNAL_DB_ERROR syscall.Errno = 1383 + ERROR_TOO_MANY_CONTEXT_IDS syscall.Errno = 1384 + ERROR_LOGON_TYPE_NOT_GRANTED syscall.Errno = 1385 + ERROR_NT_CROSS_ENCRYPTION_REQUIRED syscall.Errno = 1386 + ERROR_NO_SUCH_MEMBER syscall.Errno = 1387 + ERROR_INVALID_MEMBER syscall.Errno = 1388 + ERROR_TOO_MANY_SIDS syscall.Errno = 1389 + ERROR_LM_CROSS_ENCRYPTION_REQUIRED syscall.Errno = 1390 + ERROR_NO_INHERITANCE syscall.Errno = 1391 + ERROR_FILE_CORRUPT syscall.Errno = 1392 + ERROR_DISK_CORRUPT syscall.Errno = 1393 + ERROR_NO_USER_SESSION_KEY syscall.Errno = 1394 + ERROR_LICENSE_QUOTA_EXCEEDED syscall.Errno = 1395 + ERROR_WRONG_TARGET_NAME syscall.Errno = 1396 + ERROR_MUTUAL_AUTH_FAILED syscall.Errno = 1397 + ERROR_TIME_SKEW syscall.Errno = 1398 + ERROR_CURRENT_DOMAIN_NOT_ALLOWED syscall.Errno = 1399 + ERROR_INVALID_WINDOW_HANDLE syscall.Errno = 1400 + ERROR_INVALID_MENU_HANDLE syscall.Errno = 1401 + ERROR_INVALID_CURSOR_HANDLE syscall.Errno = 1402 + ERROR_INVALID_ACCEL_HANDLE syscall.Errno = 1403 + ERROR_INVALID_HOOK_HANDLE syscall.Errno = 1404 + ERROR_INVALID_DWP_HANDLE syscall.Errno = 1405 + ERROR_TLW_WITH_WSCHILD syscall.Errno = 1406 + ERROR_CANNOT_FIND_WND_CLASS syscall.Errno = 1407 + ERROR_WINDOW_OF_OTHER_THREAD syscall.Errno = 1408 + ERROR_HOTKEY_ALREADY_REGISTERED syscall.Errno = 1409 + ERROR_CLASS_ALREADY_EXISTS syscall.Errno = 1410 + ERROR_CLASS_DOES_NOT_EXIST syscall.Errno = 1411 + ERROR_CLASS_HAS_WINDOWS syscall.Errno = 1412 + ERROR_INVALID_INDEX syscall.Errno = 1413 + ERROR_INVALID_ICON_HANDLE syscall.Errno = 1414 + ERROR_PRIVATE_DIALOG_INDEX syscall.Errno = 1415 + ERROR_LISTBOX_ID_NOT_FOUND syscall.Errno = 1416 + ERROR_NO_WILDCARD_CHARACTERS syscall.Errno = 1417 + ERROR_CLIPBOARD_NOT_OPEN syscall.Errno = 1418 + ERROR_HOTKEY_NOT_REGISTERED syscall.Errno = 1419 + ERROR_WINDOW_NOT_DIALOG syscall.Errno = 1420 + ERROR_CONTROL_ID_NOT_FOUND syscall.Errno = 1421 + ERROR_INVALID_COMBOBOX_MESSAGE syscall.Errno = 1422 + ERROR_WINDOW_NOT_COMBOBOX syscall.Errno = 1423 + ERROR_INVALID_EDIT_HEIGHT syscall.Errno = 1424 + ERROR_DC_NOT_FOUND syscall.Errno = 1425 + ERROR_INVALID_HOOK_FILTER syscall.Errno = 1426 + ERROR_INVALID_FILTER_PROC syscall.Errno = 1427 + ERROR_HOOK_NEEDS_HMOD syscall.Errno = 1428 + ERROR_GLOBAL_ONLY_HOOK syscall.Errno = 1429 + ERROR_JOURNAL_HOOK_SET syscall.Errno = 1430 + ERROR_HOOK_NOT_INSTALLED syscall.Errno = 1431 + ERROR_INVALID_LB_MESSAGE syscall.Errno = 1432 + ERROR_SETCOUNT_ON_BAD_LB syscall.Errno = 1433 + ERROR_LB_WITHOUT_TABSTOPS syscall.Errno = 1434 + ERROR_DESTROY_OBJECT_OF_OTHER_THREAD syscall.Errno = 1435 + ERROR_CHILD_WINDOW_MENU syscall.Errno = 1436 + ERROR_NO_SYSTEM_MENU syscall.Errno = 1437 + ERROR_INVALID_MSGBOX_STYLE syscall.Errno = 1438 + ERROR_INVALID_SPI_VALUE syscall.Errno = 1439 + ERROR_SCREEN_ALREADY_LOCKED syscall.Errno = 1440 + ERROR_HWNDS_HAVE_DIFF_PARENT syscall.Errno = 1441 + ERROR_NOT_CHILD_WINDOW syscall.Errno = 1442 + ERROR_INVALID_GW_COMMAND syscall.Errno = 1443 + ERROR_INVALID_THREAD_ID syscall.Errno = 1444 + ERROR_NON_MDICHILD_WINDOW syscall.Errno = 1445 + ERROR_POPUP_ALREADY_ACTIVE syscall.Errno = 1446 + ERROR_NO_SCROLLBARS syscall.Errno = 1447 + ERROR_INVALID_SCROLLBAR_RANGE syscall.Errno = 1448 + ERROR_INVALID_SHOWWIN_COMMAND syscall.Errno = 1449 + ERROR_NO_SYSTEM_RESOURCES syscall.Errno = 1450 + ERROR_NONPAGED_SYSTEM_RESOURCES syscall.Errno = 1451 + ERROR_PAGED_SYSTEM_RESOURCES syscall.Errno = 1452 + ERROR_WORKING_SET_QUOTA syscall.Errno = 1453 + ERROR_PAGEFILE_QUOTA syscall.Errno = 1454 + ERROR_COMMITMENT_LIMIT syscall.Errno = 1455 + ERROR_MENU_ITEM_NOT_FOUND syscall.Errno = 1456 + ERROR_INVALID_KEYBOARD_HANDLE syscall.Errno = 1457 + ERROR_HOOK_TYPE_NOT_ALLOWED syscall.Errno = 1458 + ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION syscall.Errno = 1459 + ERROR_TIMEOUT syscall.Errno = 1460 + ERROR_INVALID_MONITOR_HANDLE syscall.Errno = 1461 + ERROR_INCORRECT_SIZE syscall.Errno = 1462 + ERROR_SYMLINK_CLASS_DISABLED syscall.Errno = 1463 + ERROR_SYMLINK_NOT_SUPPORTED syscall.Errno = 1464 + ERROR_XML_PARSE_ERROR syscall.Errno = 1465 + ERROR_XMLDSIG_ERROR syscall.Errno = 1466 + ERROR_RESTART_APPLICATION syscall.Errno = 1467 + ERROR_WRONG_COMPARTMENT syscall.Errno = 1468 + ERROR_AUTHIP_FAILURE syscall.Errno = 1469 + ERROR_NO_NVRAM_RESOURCES syscall.Errno = 1470 + ERROR_NOT_GUI_PROCESS syscall.Errno = 1471 + ERROR_EVENTLOG_FILE_CORRUPT syscall.Errno = 1500 + ERROR_EVENTLOG_CANT_START syscall.Errno = 1501 + ERROR_LOG_FILE_FULL syscall.Errno = 1502 + ERROR_EVENTLOG_FILE_CHANGED syscall.Errno = 1503 + ERROR_CONTAINER_ASSIGNED syscall.Errno = 1504 + ERROR_JOB_NO_CONTAINER syscall.Errno = 1505 + ERROR_INVALID_TASK_NAME syscall.Errno = 1550 + ERROR_INVALID_TASK_INDEX syscall.Errno = 1551 + ERROR_THREAD_ALREADY_IN_TASK syscall.Errno = 1552 + ERROR_INSTALL_SERVICE_FAILURE syscall.Errno = 1601 + ERROR_INSTALL_USEREXIT syscall.Errno = 1602 + ERROR_INSTALL_FAILURE syscall.Errno = 1603 + ERROR_INSTALL_SUSPEND syscall.Errno = 1604 + ERROR_UNKNOWN_PRODUCT syscall.Errno = 1605 + ERROR_UNKNOWN_FEATURE syscall.Errno = 1606 + ERROR_UNKNOWN_COMPONENT syscall.Errno = 1607 + ERROR_UNKNOWN_PROPERTY syscall.Errno = 1608 + ERROR_INVALID_HANDLE_STATE syscall.Errno = 1609 + ERROR_BAD_CONFIGURATION syscall.Errno = 1610 + ERROR_INDEX_ABSENT syscall.Errno = 1611 + ERROR_INSTALL_SOURCE_ABSENT syscall.Errno = 1612 + ERROR_INSTALL_PACKAGE_VERSION syscall.Errno = 1613 + ERROR_PRODUCT_UNINSTALLED syscall.Errno = 1614 + ERROR_BAD_QUERY_SYNTAX syscall.Errno = 1615 + ERROR_INVALID_FIELD syscall.Errno = 1616 + ERROR_DEVICE_REMOVED syscall.Errno = 1617 + ERROR_INSTALL_ALREADY_RUNNING syscall.Errno = 1618 + ERROR_INSTALL_PACKAGE_OPEN_FAILED syscall.Errno = 1619 + ERROR_INSTALL_PACKAGE_INVALID syscall.Errno = 1620 + ERROR_INSTALL_UI_FAILURE syscall.Errno = 1621 + ERROR_INSTALL_LOG_FAILURE syscall.Errno = 1622 + ERROR_INSTALL_LANGUAGE_UNSUPPORTED syscall.Errno = 1623 + ERROR_INSTALL_TRANSFORM_FAILURE syscall.Errno = 1624 + ERROR_INSTALL_PACKAGE_REJECTED syscall.Errno = 1625 + ERROR_FUNCTION_NOT_CALLED syscall.Errno = 1626 + ERROR_FUNCTION_FAILED syscall.Errno = 1627 + ERROR_INVALID_TABLE syscall.Errno = 1628 + ERROR_DATATYPE_MISMATCH syscall.Errno = 1629 + ERROR_UNSUPPORTED_TYPE syscall.Errno = 1630 + ERROR_CREATE_FAILED syscall.Errno = 1631 + ERROR_INSTALL_TEMP_UNWRITABLE syscall.Errno = 1632 + ERROR_INSTALL_PLATFORM_UNSUPPORTED syscall.Errno = 1633 + ERROR_INSTALL_NOTUSED syscall.Errno = 1634 + ERROR_PATCH_PACKAGE_OPEN_FAILED syscall.Errno = 1635 + ERROR_PATCH_PACKAGE_INVALID syscall.Errno = 1636 + ERROR_PATCH_PACKAGE_UNSUPPORTED syscall.Errno = 1637 + ERROR_PRODUCT_VERSION syscall.Errno = 1638 + ERROR_INVALID_COMMAND_LINE syscall.Errno = 1639 + ERROR_INSTALL_REMOTE_DISALLOWED syscall.Errno = 1640 + ERROR_SUCCESS_REBOOT_INITIATED syscall.Errno = 1641 + ERROR_PATCH_TARGET_NOT_FOUND syscall.Errno = 1642 + ERROR_PATCH_PACKAGE_REJECTED syscall.Errno = 1643 + ERROR_INSTALL_TRANSFORM_REJECTED syscall.Errno = 1644 + ERROR_INSTALL_REMOTE_PROHIBITED syscall.Errno = 1645 + ERROR_PATCH_REMOVAL_UNSUPPORTED syscall.Errno = 1646 + ERROR_UNKNOWN_PATCH syscall.Errno = 1647 + ERROR_PATCH_NO_SEQUENCE syscall.Errno = 1648 + ERROR_PATCH_REMOVAL_DISALLOWED syscall.Errno = 1649 + ERROR_INVALID_PATCH_XML syscall.Errno = 1650 + ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT syscall.Errno = 1651 + ERROR_INSTALL_SERVICE_SAFEBOOT syscall.Errno = 1652 + ERROR_FAIL_FAST_EXCEPTION syscall.Errno = 1653 + ERROR_INSTALL_REJECTED syscall.Errno = 1654 + ERROR_DYNAMIC_CODE_BLOCKED syscall.Errno = 1655 + ERROR_NOT_SAME_OBJECT syscall.Errno = 1656 + ERROR_STRICT_CFG_VIOLATION syscall.Errno = 1657 + ERROR_SET_CONTEXT_DENIED syscall.Errno = 1660 + ERROR_CROSS_PARTITION_VIOLATION syscall.Errno = 1661 + RPC_S_INVALID_STRING_BINDING syscall.Errno = 1700 + RPC_S_WRONG_KIND_OF_BINDING syscall.Errno = 1701 + RPC_S_INVALID_BINDING syscall.Errno = 1702 + RPC_S_PROTSEQ_NOT_SUPPORTED syscall.Errno = 1703 + RPC_S_INVALID_RPC_PROTSEQ syscall.Errno = 1704 + RPC_S_INVALID_STRING_UUID syscall.Errno = 1705 + RPC_S_INVALID_ENDPOINT_FORMAT syscall.Errno = 1706 + RPC_S_INVALID_NET_ADDR syscall.Errno = 1707 + RPC_S_NO_ENDPOINT_FOUND syscall.Errno = 1708 + RPC_S_INVALID_TIMEOUT syscall.Errno = 1709 + RPC_S_OBJECT_NOT_FOUND syscall.Errno = 1710 + RPC_S_ALREADY_REGISTERED syscall.Errno = 1711 + RPC_S_TYPE_ALREADY_REGISTERED syscall.Errno = 1712 + RPC_S_ALREADY_LISTENING syscall.Errno = 1713 + RPC_S_NO_PROTSEQS_REGISTERED syscall.Errno = 1714 + RPC_S_NOT_LISTENING syscall.Errno = 1715 + RPC_S_UNKNOWN_MGR_TYPE syscall.Errno = 1716 + RPC_S_UNKNOWN_IF syscall.Errno = 1717 + RPC_S_NO_BINDINGS syscall.Errno = 1718 + RPC_S_NO_PROTSEQS syscall.Errno = 1719 + RPC_S_CANT_CREATE_ENDPOINT syscall.Errno = 1720 + RPC_S_OUT_OF_RESOURCES syscall.Errno = 1721 + RPC_S_SERVER_UNAVAILABLE syscall.Errno = 1722 + RPC_S_SERVER_TOO_BUSY syscall.Errno = 1723 + RPC_S_INVALID_NETWORK_OPTIONS syscall.Errno = 1724 + RPC_S_NO_CALL_ACTIVE syscall.Errno = 1725 + RPC_S_CALL_FAILED syscall.Errno = 1726 + RPC_S_CALL_FAILED_DNE syscall.Errno = 1727 + RPC_S_PROTOCOL_ERROR syscall.Errno = 1728 + RPC_S_PROXY_ACCESS_DENIED syscall.Errno = 1729 + RPC_S_UNSUPPORTED_TRANS_SYN syscall.Errno = 1730 + RPC_S_UNSUPPORTED_TYPE syscall.Errno = 1732 + RPC_S_INVALID_TAG syscall.Errno = 1733 + RPC_S_INVALID_BOUND syscall.Errno = 1734 + RPC_S_NO_ENTRY_NAME syscall.Errno = 1735 + RPC_S_INVALID_NAME_SYNTAX syscall.Errno = 1736 + RPC_S_UNSUPPORTED_NAME_SYNTAX syscall.Errno = 1737 + RPC_S_UUID_NO_ADDRESS syscall.Errno = 1739 + RPC_S_DUPLICATE_ENDPOINT syscall.Errno = 1740 + RPC_S_UNKNOWN_AUTHN_TYPE syscall.Errno = 1741 + RPC_S_MAX_CALLS_TOO_SMALL syscall.Errno = 1742 + RPC_S_STRING_TOO_LONG syscall.Errno = 1743 + RPC_S_PROTSEQ_NOT_FOUND syscall.Errno = 1744 + RPC_S_PROCNUM_OUT_OF_RANGE syscall.Errno = 1745 + RPC_S_BINDING_HAS_NO_AUTH syscall.Errno = 1746 + RPC_S_UNKNOWN_AUTHN_SERVICE syscall.Errno = 1747 + RPC_S_UNKNOWN_AUTHN_LEVEL syscall.Errno = 1748 + RPC_S_INVALID_AUTH_IDENTITY syscall.Errno = 1749 + RPC_S_UNKNOWN_AUTHZ_SERVICE syscall.Errno = 1750 + EPT_S_INVALID_ENTRY syscall.Errno = 1751 + EPT_S_CANT_PERFORM_OP syscall.Errno = 1752 + EPT_S_NOT_REGISTERED syscall.Errno = 1753 + RPC_S_NOTHING_TO_EXPORT syscall.Errno = 1754 + RPC_S_INCOMPLETE_NAME syscall.Errno = 1755 + RPC_S_INVALID_VERS_OPTION syscall.Errno = 1756 + RPC_S_NO_MORE_MEMBERS syscall.Errno = 1757 + RPC_S_NOT_ALL_OBJS_UNEXPORTED syscall.Errno = 1758 + RPC_S_INTERFACE_NOT_FOUND syscall.Errno = 1759 + RPC_S_ENTRY_ALREADY_EXISTS syscall.Errno = 1760 + RPC_S_ENTRY_NOT_FOUND syscall.Errno = 1761 + RPC_S_NAME_SERVICE_UNAVAILABLE syscall.Errno = 1762 + RPC_S_INVALID_NAF_ID syscall.Errno = 1763 + RPC_S_CANNOT_SUPPORT syscall.Errno = 1764 + RPC_S_NO_CONTEXT_AVAILABLE syscall.Errno = 1765 + RPC_S_INTERNAL_ERROR syscall.Errno = 1766 + RPC_S_ZERO_DIVIDE syscall.Errno = 1767 + RPC_S_ADDRESS_ERROR syscall.Errno = 1768 + RPC_S_FP_DIV_ZERO syscall.Errno = 1769 + RPC_S_FP_UNDERFLOW syscall.Errno = 1770 + RPC_S_FP_OVERFLOW syscall.Errno = 1771 + RPC_X_NO_MORE_ENTRIES syscall.Errno = 1772 + RPC_X_SS_CHAR_TRANS_OPEN_FAIL syscall.Errno = 1773 + RPC_X_SS_CHAR_TRANS_SHORT_FILE syscall.Errno = 1774 + RPC_X_SS_IN_NULL_CONTEXT syscall.Errno = 1775 + RPC_X_SS_CONTEXT_DAMAGED syscall.Errno = 1777 + RPC_X_SS_HANDLES_MISMATCH syscall.Errno = 1778 + RPC_X_SS_CANNOT_GET_CALL_HANDLE syscall.Errno = 1779 + RPC_X_NULL_REF_POINTER syscall.Errno = 1780 + RPC_X_ENUM_VALUE_OUT_OF_RANGE syscall.Errno = 1781 + RPC_X_BYTE_COUNT_TOO_SMALL syscall.Errno = 1782 + RPC_X_BAD_STUB_DATA syscall.Errno = 1783 + ERROR_INVALID_USER_BUFFER syscall.Errno = 1784 + ERROR_UNRECOGNIZED_MEDIA syscall.Errno = 1785 + ERROR_NO_TRUST_LSA_SECRET syscall.Errno = 1786 + ERROR_NO_TRUST_SAM_ACCOUNT syscall.Errno = 1787 + ERROR_TRUSTED_DOMAIN_FAILURE syscall.Errno = 1788 + ERROR_TRUSTED_RELATIONSHIP_FAILURE syscall.Errno = 1789 + ERROR_TRUST_FAILURE syscall.Errno = 1790 + RPC_S_CALL_IN_PROGRESS syscall.Errno = 1791 + ERROR_NETLOGON_NOT_STARTED syscall.Errno = 1792 + ERROR_ACCOUNT_EXPIRED syscall.Errno = 1793 + ERROR_REDIRECTOR_HAS_OPEN_HANDLES syscall.Errno = 1794 + ERROR_PRINTER_DRIVER_ALREADY_INSTALLED syscall.Errno = 1795 + ERROR_UNKNOWN_PORT syscall.Errno = 1796 + ERROR_UNKNOWN_PRINTER_DRIVER syscall.Errno = 1797 + ERROR_UNKNOWN_PRINTPROCESSOR syscall.Errno = 1798 + ERROR_INVALID_SEPARATOR_FILE syscall.Errno = 1799 + ERROR_INVALID_PRIORITY syscall.Errno = 1800 + ERROR_INVALID_PRINTER_NAME syscall.Errno = 1801 + ERROR_PRINTER_ALREADY_EXISTS syscall.Errno = 1802 + ERROR_INVALID_PRINTER_COMMAND syscall.Errno = 1803 + ERROR_INVALID_DATATYPE syscall.Errno = 1804 + ERROR_INVALID_ENVIRONMENT syscall.Errno = 1805 + RPC_S_NO_MORE_BINDINGS syscall.Errno = 1806 + ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT syscall.Errno = 1807 + ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT syscall.Errno = 1808 + ERROR_NOLOGON_SERVER_TRUST_ACCOUNT syscall.Errno = 1809 + ERROR_DOMAIN_TRUST_INCONSISTENT syscall.Errno = 1810 + ERROR_SERVER_HAS_OPEN_HANDLES syscall.Errno = 1811 + ERROR_RESOURCE_DATA_NOT_FOUND syscall.Errno = 1812 + ERROR_RESOURCE_TYPE_NOT_FOUND syscall.Errno = 1813 + ERROR_RESOURCE_NAME_NOT_FOUND syscall.Errno = 1814 + ERROR_RESOURCE_LANG_NOT_FOUND syscall.Errno = 1815 + ERROR_NOT_ENOUGH_QUOTA syscall.Errno = 1816 + RPC_S_NO_INTERFACES syscall.Errno = 1817 + RPC_S_CALL_CANCELLED syscall.Errno = 1818 + RPC_S_BINDING_INCOMPLETE syscall.Errno = 1819 + RPC_S_COMM_FAILURE syscall.Errno = 1820 + RPC_S_UNSUPPORTED_AUTHN_LEVEL syscall.Errno = 1821 + RPC_S_NO_PRINC_NAME syscall.Errno = 1822 + RPC_S_NOT_RPC_ERROR syscall.Errno = 1823 + RPC_S_UUID_LOCAL_ONLY syscall.Errno = 1824 + RPC_S_SEC_PKG_ERROR syscall.Errno = 1825 + RPC_S_NOT_CANCELLED syscall.Errno = 1826 + RPC_X_INVALID_ES_ACTION syscall.Errno = 1827 + RPC_X_WRONG_ES_VERSION syscall.Errno = 1828 + RPC_X_WRONG_STUB_VERSION syscall.Errno = 1829 + RPC_X_INVALID_PIPE_OBJECT syscall.Errno = 1830 + RPC_X_WRONG_PIPE_ORDER syscall.Errno = 1831 + RPC_X_WRONG_PIPE_VERSION syscall.Errno = 1832 + RPC_S_COOKIE_AUTH_FAILED syscall.Errno = 1833 + RPC_S_DO_NOT_DISTURB syscall.Errno = 1834 + RPC_S_SYSTEM_HANDLE_COUNT_EXCEEDED syscall.Errno = 1835 + RPC_S_SYSTEM_HANDLE_TYPE_MISMATCH syscall.Errno = 1836 + RPC_S_GROUP_MEMBER_NOT_FOUND syscall.Errno = 1898 + EPT_S_CANT_CREATE syscall.Errno = 1899 + RPC_S_INVALID_OBJECT syscall.Errno = 1900 + ERROR_INVALID_TIME syscall.Errno = 1901 + ERROR_INVALID_FORM_NAME syscall.Errno = 1902 + ERROR_INVALID_FORM_SIZE syscall.Errno = 1903 + ERROR_ALREADY_WAITING syscall.Errno = 1904 + ERROR_PRINTER_DELETED syscall.Errno = 1905 + ERROR_INVALID_PRINTER_STATE syscall.Errno = 1906 + ERROR_PASSWORD_MUST_CHANGE syscall.Errno = 1907 + ERROR_DOMAIN_CONTROLLER_NOT_FOUND syscall.Errno = 1908 + ERROR_ACCOUNT_LOCKED_OUT syscall.Errno = 1909 + OR_INVALID_OXID syscall.Errno = 1910 + OR_INVALID_OID syscall.Errno = 1911 + OR_INVALID_SET syscall.Errno = 1912 + RPC_S_SEND_INCOMPLETE syscall.Errno = 1913 + RPC_S_INVALID_ASYNC_HANDLE syscall.Errno = 1914 + RPC_S_INVALID_ASYNC_CALL syscall.Errno = 1915 + RPC_X_PIPE_CLOSED syscall.Errno = 1916 + RPC_X_PIPE_DISCIPLINE_ERROR syscall.Errno = 1917 + RPC_X_PIPE_EMPTY syscall.Errno = 1918 + ERROR_NO_SITENAME syscall.Errno = 1919 + ERROR_CANT_ACCESS_FILE syscall.Errno = 1920 + ERROR_CANT_RESOLVE_FILENAME syscall.Errno = 1921 + RPC_S_ENTRY_TYPE_MISMATCH syscall.Errno = 1922 + RPC_S_NOT_ALL_OBJS_EXPORTED syscall.Errno = 1923 + RPC_S_INTERFACE_NOT_EXPORTED syscall.Errno = 1924 + RPC_S_PROFILE_NOT_ADDED syscall.Errno = 1925 + RPC_S_PRF_ELT_NOT_ADDED syscall.Errno = 1926 + RPC_S_PRF_ELT_NOT_REMOVED syscall.Errno = 1927 + RPC_S_GRP_ELT_NOT_ADDED syscall.Errno = 1928 + RPC_S_GRP_ELT_NOT_REMOVED syscall.Errno = 1929 + ERROR_KM_DRIVER_BLOCKED syscall.Errno = 1930 + ERROR_CONTEXT_EXPIRED syscall.Errno = 1931 + ERROR_PER_USER_TRUST_QUOTA_EXCEEDED syscall.Errno = 1932 + ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED syscall.Errno = 1933 + ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED syscall.Errno = 1934 + ERROR_AUTHENTICATION_FIREWALL_FAILED syscall.Errno = 1935 + ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED syscall.Errno = 1936 + ERROR_NTLM_BLOCKED syscall.Errno = 1937 + ERROR_PASSWORD_CHANGE_REQUIRED syscall.Errno = 1938 + ERROR_LOST_MODE_LOGON_RESTRICTION syscall.Errno = 1939 + ERROR_INVALID_PIXEL_FORMAT syscall.Errno = 2000 + ERROR_BAD_DRIVER syscall.Errno = 2001 + ERROR_INVALID_WINDOW_STYLE syscall.Errno = 2002 + ERROR_METAFILE_NOT_SUPPORTED syscall.Errno = 2003 + ERROR_TRANSFORM_NOT_SUPPORTED syscall.Errno = 2004 + ERROR_CLIPPING_NOT_SUPPORTED syscall.Errno = 2005 + ERROR_INVALID_CMM syscall.Errno = 2010 + ERROR_INVALID_PROFILE syscall.Errno = 2011 + ERROR_TAG_NOT_FOUND syscall.Errno = 2012 + ERROR_TAG_NOT_PRESENT syscall.Errno = 2013 + ERROR_DUPLICATE_TAG syscall.Errno = 2014 + ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE syscall.Errno = 2015 + ERROR_PROFILE_NOT_FOUND syscall.Errno = 2016 + ERROR_INVALID_COLORSPACE syscall.Errno = 2017 + ERROR_ICM_NOT_ENABLED syscall.Errno = 2018 + ERROR_DELETING_ICM_XFORM syscall.Errno = 2019 + ERROR_INVALID_TRANSFORM syscall.Errno = 2020 + ERROR_COLORSPACE_MISMATCH syscall.Errno = 2021 + ERROR_INVALID_COLORINDEX syscall.Errno = 2022 + ERROR_PROFILE_DOES_NOT_MATCH_DEVICE syscall.Errno = 2023 + ERROR_CONNECTED_OTHER_PASSWORD syscall.Errno = 2108 + ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT syscall.Errno = 2109 + ERROR_BAD_USERNAME syscall.Errno = 2202 + ERROR_NOT_CONNECTED syscall.Errno = 2250 + ERROR_OPEN_FILES syscall.Errno = 2401 + ERROR_ACTIVE_CONNECTIONS syscall.Errno = 2402 + ERROR_DEVICE_IN_USE syscall.Errno = 2404 + ERROR_UNKNOWN_PRINT_MONITOR syscall.Errno = 3000 + ERROR_PRINTER_DRIVER_IN_USE syscall.Errno = 3001 + ERROR_SPOOL_FILE_NOT_FOUND syscall.Errno = 3002 + ERROR_SPL_NO_STARTDOC syscall.Errno = 3003 + ERROR_SPL_NO_ADDJOB syscall.Errno = 3004 + ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED syscall.Errno = 3005 + ERROR_PRINT_MONITOR_ALREADY_INSTALLED syscall.Errno = 3006 + ERROR_INVALID_PRINT_MONITOR syscall.Errno = 3007 + ERROR_PRINT_MONITOR_IN_USE syscall.Errno = 3008 + ERROR_PRINTER_HAS_JOBS_QUEUED syscall.Errno = 3009 + ERROR_SUCCESS_REBOOT_REQUIRED syscall.Errno = 3010 + ERROR_SUCCESS_RESTART_REQUIRED syscall.Errno = 3011 + ERROR_PRINTER_NOT_FOUND syscall.Errno = 3012 + ERROR_PRINTER_DRIVER_WARNED syscall.Errno = 3013 + ERROR_PRINTER_DRIVER_BLOCKED syscall.Errno = 3014 + ERROR_PRINTER_DRIVER_PACKAGE_IN_USE syscall.Errno = 3015 + ERROR_CORE_DRIVER_PACKAGE_NOT_FOUND syscall.Errno = 3016 + ERROR_FAIL_REBOOT_REQUIRED syscall.Errno = 3017 + ERROR_FAIL_REBOOT_INITIATED syscall.Errno = 3018 + ERROR_PRINTER_DRIVER_DOWNLOAD_NEEDED syscall.Errno = 3019 + ERROR_PRINT_JOB_RESTART_REQUIRED syscall.Errno = 3020 + ERROR_INVALID_PRINTER_DRIVER_MANIFEST syscall.Errno = 3021 + ERROR_PRINTER_NOT_SHAREABLE syscall.Errno = 3022 + ERROR_REQUEST_PAUSED syscall.Errno = 3050 + ERROR_APPEXEC_CONDITION_NOT_SATISFIED syscall.Errno = 3060 + ERROR_APPEXEC_HANDLE_INVALIDATED syscall.Errno = 3061 + ERROR_APPEXEC_INVALID_HOST_GENERATION syscall.Errno = 3062 + ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION syscall.Errno = 3063 + ERROR_APPEXEC_INVALID_HOST_STATE syscall.Errno = 3064 + ERROR_APPEXEC_NO_DONOR syscall.Errno = 3065 + ERROR_APPEXEC_HOST_ID_MISMATCH syscall.Errno = 3066 + ERROR_APPEXEC_UNKNOWN_USER syscall.Errno = 3067 + ERROR_IO_REISSUE_AS_CACHED syscall.Errno = 3950 + ERROR_WINS_INTERNAL syscall.Errno = 4000 + ERROR_CAN_NOT_DEL_LOCAL_WINS syscall.Errno = 4001 + ERROR_STATIC_INIT syscall.Errno = 4002 + ERROR_INC_BACKUP syscall.Errno = 4003 + ERROR_FULL_BACKUP syscall.Errno = 4004 + ERROR_REC_NON_EXISTENT syscall.Errno = 4005 + ERROR_RPL_NOT_ALLOWED syscall.Errno = 4006 + PEERDIST_ERROR_CONTENTINFO_VERSION_UNSUPPORTED syscall.Errno = 4050 + PEERDIST_ERROR_CANNOT_PARSE_CONTENTINFO syscall.Errno = 4051 + PEERDIST_ERROR_MISSING_DATA syscall.Errno = 4052 + PEERDIST_ERROR_NO_MORE syscall.Errno = 4053 + PEERDIST_ERROR_NOT_INITIALIZED syscall.Errno = 4054 + PEERDIST_ERROR_ALREADY_INITIALIZED syscall.Errno = 4055 + PEERDIST_ERROR_SHUTDOWN_IN_PROGRESS syscall.Errno = 4056 + PEERDIST_ERROR_INVALIDATED syscall.Errno = 4057 + PEERDIST_ERROR_ALREADY_EXISTS syscall.Errno = 4058 + PEERDIST_ERROR_OPERATION_NOTFOUND syscall.Errno = 4059 + PEERDIST_ERROR_ALREADY_COMPLETED syscall.Errno = 4060 + PEERDIST_ERROR_OUT_OF_BOUNDS syscall.Errno = 4061 + PEERDIST_ERROR_VERSION_UNSUPPORTED syscall.Errno = 4062 + PEERDIST_ERROR_INVALID_CONFIGURATION syscall.Errno = 4063 + PEERDIST_ERROR_NOT_LICENSED syscall.Errno = 4064 + PEERDIST_ERROR_SERVICE_UNAVAILABLE syscall.Errno = 4065 + PEERDIST_ERROR_TRUST_FAILURE syscall.Errno = 4066 + ERROR_DHCP_ADDRESS_CONFLICT syscall.Errno = 4100 + ERROR_WMI_GUID_NOT_FOUND syscall.Errno = 4200 + ERROR_WMI_INSTANCE_NOT_FOUND syscall.Errno = 4201 + ERROR_WMI_ITEMID_NOT_FOUND syscall.Errno = 4202 + ERROR_WMI_TRY_AGAIN syscall.Errno = 4203 + ERROR_WMI_DP_NOT_FOUND syscall.Errno = 4204 + ERROR_WMI_UNRESOLVED_INSTANCE_REF syscall.Errno = 4205 + ERROR_WMI_ALREADY_ENABLED syscall.Errno = 4206 + ERROR_WMI_GUID_DISCONNECTED syscall.Errno = 4207 + ERROR_WMI_SERVER_UNAVAILABLE syscall.Errno = 4208 + ERROR_WMI_DP_FAILED syscall.Errno = 4209 + ERROR_WMI_INVALID_MOF syscall.Errno = 4210 + ERROR_WMI_INVALID_REGINFO syscall.Errno = 4211 + ERROR_WMI_ALREADY_DISABLED syscall.Errno = 4212 + ERROR_WMI_READ_ONLY syscall.Errno = 4213 + ERROR_WMI_SET_FAILURE syscall.Errno = 4214 + ERROR_NOT_APPCONTAINER syscall.Errno = 4250 + ERROR_APPCONTAINER_REQUIRED syscall.Errno = 4251 + ERROR_NOT_SUPPORTED_IN_APPCONTAINER syscall.Errno = 4252 + ERROR_INVALID_PACKAGE_SID_LENGTH syscall.Errno = 4253 + ERROR_INVALID_MEDIA syscall.Errno = 4300 + ERROR_INVALID_LIBRARY syscall.Errno = 4301 + ERROR_INVALID_MEDIA_POOL syscall.Errno = 4302 + ERROR_DRIVE_MEDIA_MISMATCH syscall.Errno = 4303 + ERROR_MEDIA_OFFLINE syscall.Errno = 4304 + ERROR_LIBRARY_OFFLINE syscall.Errno = 4305 + ERROR_EMPTY syscall.Errno = 4306 + ERROR_NOT_EMPTY syscall.Errno = 4307 + ERROR_MEDIA_UNAVAILABLE syscall.Errno = 4308 + ERROR_RESOURCE_DISABLED syscall.Errno = 4309 + ERROR_INVALID_CLEANER syscall.Errno = 4310 + ERROR_UNABLE_TO_CLEAN syscall.Errno = 4311 + ERROR_OBJECT_NOT_FOUND syscall.Errno = 4312 + ERROR_DATABASE_FAILURE syscall.Errno = 4313 + ERROR_DATABASE_FULL syscall.Errno = 4314 + ERROR_MEDIA_INCOMPATIBLE syscall.Errno = 4315 + ERROR_RESOURCE_NOT_PRESENT syscall.Errno = 4316 + ERROR_INVALID_OPERATION syscall.Errno = 4317 + ERROR_MEDIA_NOT_AVAILABLE syscall.Errno = 4318 + ERROR_DEVICE_NOT_AVAILABLE syscall.Errno = 4319 + ERROR_REQUEST_REFUSED syscall.Errno = 4320 + ERROR_INVALID_DRIVE_OBJECT syscall.Errno = 4321 + ERROR_LIBRARY_FULL syscall.Errno = 4322 + ERROR_MEDIUM_NOT_ACCESSIBLE syscall.Errno = 4323 + ERROR_UNABLE_TO_LOAD_MEDIUM syscall.Errno = 4324 + ERROR_UNABLE_TO_INVENTORY_DRIVE syscall.Errno = 4325 + ERROR_UNABLE_TO_INVENTORY_SLOT syscall.Errno = 4326 + ERROR_UNABLE_TO_INVENTORY_TRANSPORT syscall.Errno = 4327 + ERROR_TRANSPORT_FULL syscall.Errno = 4328 + ERROR_CONTROLLING_IEPORT syscall.Errno = 4329 + ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA syscall.Errno = 4330 + ERROR_CLEANER_SLOT_SET syscall.Errno = 4331 + ERROR_CLEANER_SLOT_NOT_SET syscall.Errno = 4332 + ERROR_CLEANER_CARTRIDGE_SPENT syscall.Errno = 4333 + ERROR_UNEXPECTED_OMID syscall.Errno = 4334 + ERROR_CANT_DELETE_LAST_ITEM syscall.Errno = 4335 + ERROR_MESSAGE_EXCEEDS_MAX_SIZE syscall.Errno = 4336 + ERROR_VOLUME_CONTAINS_SYS_FILES syscall.Errno = 4337 + ERROR_INDIGENOUS_TYPE syscall.Errno = 4338 + ERROR_NO_SUPPORTING_DRIVES syscall.Errno = 4339 + ERROR_CLEANER_CARTRIDGE_INSTALLED syscall.Errno = 4340 + ERROR_IEPORT_FULL syscall.Errno = 4341 + ERROR_FILE_OFFLINE syscall.Errno = 4350 + ERROR_REMOTE_STORAGE_NOT_ACTIVE syscall.Errno = 4351 + ERROR_REMOTE_STORAGE_MEDIA_ERROR syscall.Errno = 4352 + ERROR_NOT_A_REPARSE_POINT syscall.Errno = 4390 + ERROR_REPARSE_ATTRIBUTE_CONFLICT syscall.Errno = 4391 + ERROR_INVALID_REPARSE_DATA syscall.Errno = 4392 + ERROR_REPARSE_TAG_INVALID syscall.Errno = 4393 + ERROR_REPARSE_TAG_MISMATCH syscall.Errno = 4394 + ERROR_REPARSE_POINT_ENCOUNTERED syscall.Errno = 4395 + ERROR_APP_DATA_NOT_FOUND syscall.Errno = 4400 + ERROR_APP_DATA_EXPIRED syscall.Errno = 4401 + ERROR_APP_DATA_CORRUPT syscall.Errno = 4402 + ERROR_APP_DATA_LIMIT_EXCEEDED syscall.Errno = 4403 + ERROR_APP_DATA_REBOOT_REQUIRED syscall.Errno = 4404 + ERROR_SECUREBOOT_ROLLBACK_DETECTED syscall.Errno = 4420 + ERROR_SECUREBOOT_POLICY_VIOLATION syscall.Errno = 4421 + ERROR_SECUREBOOT_INVALID_POLICY syscall.Errno = 4422 + ERROR_SECUREBOOT_POLICY_PUBLISHER_NOT_FOUND syscall.Errno = 4423 + ERROR_SECUREBOOT_POLICY_NOT_SIGNED syscall.Errno = 4424 + ERROR_SECUREBOOT_NOT_ENABLED syscall.Errno = 4425 + ERROR_SECUREBOOT_FILE_REPLACED syscall.Errno = 4426 + ERROR_SECUREBOOT_POLICY_NOT_AUTHORIZED syscall.Errno = 4427 + ERROR_SECUREBOOT_POLICY_UNKNOWN syscall.Errno = 4428 + ERROR_SECUREBOOT_POLICY_MISSING_ANTIROLLBACKVERSION syscall.Errno = 4429 + ERROR_SECUREBOOT_PLATFORM_ID_MISMATCH syscall.Errno = 4430 + ERROR_SECUREBOOT_POLICY_ROLLBACK_DETECTED syscall.Errno = 4431 + ERROR_SECUREBOOT_POLICY_UPGRADE_MISMATCH syscall.Errno = 4432 + ERROR_SECUREBOOT_REQUIRED_POLICY_FILE_MISSING syscall.Errno = 4433 + ERROR_SECUREBOOT_NOT_BASE_POLICY syscall.Errno = 4434 + ERROR_SECUREBOOT_NOT_SUPPLEMENTAL_POLICY syscall.Errno = 4435 + ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED syscall.Errno = 4440 + ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED syscall.Errno = 4441 + ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED syscall.Errno = 4442 + ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED syscall.Errno = 4443 + ERROR_ALREADY_HAS_STREAM_ID syscall.Errno = 4444 + ERROR_SMR_GARBAGE_COLLECTION_REQUIRED syscall.Errno = 4445 + ERROR_WOF_WIM_HEADER_CORRUPT syscall.Errno = 4446 + ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT syscall.Errno = 4447 + ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT syscall.Errno = 4448 + ERROR_VOLUME_NOT_SIS_ENABLED syscall.Errno = 4500 + ERROR_SYSTEM_INTEGRITY_ROLLBACK_DETECTED syscall.Errno = 4550 + ERROR_SYSTEM_INTEGRITY_POLICY_VIOLATION syscall.Errno = 4551 + ERROR_SYSTEM_INTEGRITY_INVALID_POLICY syscall.Errno = 4552 + ERROR_SYSTEM_INTEGRITY_POLICY_NOT_SIGNED syscall.Errno = 4553 + ERROR_VSM_NOT_INITIALIZED syscall.Errno = 4560 + ERROR_VSM_DMA_PROTECTION_NOT_IN_USE syscall.Errno = 4561 + ERROR_PLATFORM_MANIFEST_NOT_AUTHORIZED syscall.Errno = 4570 + ERROR_PLATFORM_MANIFEST_INVALID syscall.Errno = 4571 + ERROR_PLATFORM_MANIFEST_FILE_NOT_AUTHORIZED syscall.Errno = 4572 + ERROR_PLATFORM_MANIFEST_CATALOG_NOT_AUTHORIZED syscall.Errno = 4573 + ERROR_PLATFORM_MANIFEST_BINARY_ID_NOT_FOUND syscall.Errno = 4574 + ERROR_PLATFORM_MANIFEST_NOT_ACTIVE syscall.Errno = 4575 + ERROR_PLATFORM_MANIFEST_NOT_SIGNED syscall.Errno = 4576 + ERROR_DEPENDENT_RESOURCE_EXISTS syscall.Errno = 5001 + ERROR_DEPENDENCY_NOT_FOUND syscall.Errno = 5002 + ERROR_DEPENDENCY_ALREADY_EXISTS syscall.Errno = 5003 + ERROR_RESOURCE_NOT_ONLINE syscall.Errno = 5004 + ERROR_HOST_NODE_NOT_AVAILABLE syscall.Errno = 5005 + ERROR_RESOURCE_NOT_AVAILABLE syscall.Errno = 5006 + ERROR_RESOURCE_NOT_FOUND syscall.Errno = 5007 + ERROR_SHUTDOWN_CLUSTER syscall.Errno = 5008 + ERROR_CANT_EVICT_ACTIVE_NODE syscall.Errno = 5009 + ERROR_OBJECT_ALREADY_EXISTS syscall.Errno = 5010 + ERROR_OBJECT_IN_LIST syscall.Errno = 5011 + ERROR_GROUP_NOT_AVAILABLE syscall.Errno = 5012 + ERROR_GROUP_NOT_FOUND syscall.Errno = 5013 + ERROR_GROUP_NOT_ONLINE syscall.Errno = 5014 + ERROR_HOST_NODE_NOT_RESOURCE_OWNER syscall.Errno = 5015 + ERROR_HOST_NODE_NOT_GROUP_OWNER syscall.Errno = 5016 + ERROR_RESMON_CREATE_FAILED syscall.Errno = 5017 + ERROR_RESMON_ONLINE_FAILED syscall.Errno = 5018 + ERROR_RESOURCE_ONLINE syscall.Errno = 5019 + ERROR_QUORUM_RESOURCE syscall.Errno = 5020 + ERROR_NOT_QUORUM_CAPABLE syscall.Errno = 5021 + ERROR_CLUSTER_SHUTTING_DOWN syscall.Errno = 5022 + ERROR_INVALID_STATE syscall.Errno = 5023 + ERROR_RESOURCE_PROPERTIES_STORED syscall.Errno = 5024 + ERROR_NOT_QUORUM_CLASS syscall.Errno = 5025 + ERROR_CORE_RESOURCE syscall.Errno = 5026 + ERROR_QUORUM_RESOURCE_ONLINE_FAILED syscall.Errno = 5027 + ERROR_QUORUMLOG_OPEN_FAILED syscall.Errno = 5028 + ERROR_CLUSTERLOG_CORRUPT syscall.Errno = 5029 + ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE syscall.Errno = 5030 + ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE syscall.Errno = 5031 + ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND syscall.Errno = 5032 + ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE syscall.Errno = 5033 + ERROR_QUORUM_OWNER_ALIVE syscall.Errno = 5034 + ERROR_NETWORK_NOT_AVAILABLE syscall.Errno = 5035 + ERROR_NODE_NOT_AVAILABLE syscall.Errno = 5036 + ERROR_ALL_NODES_NOT_AVAILABLE syscall.Errno = 5037 + ERROR_RESOURCE_FAILED syscall.Errno = 5038 + ERROR_CLUSTER_INVALID_NODE syscall.Errno = 5039 + ERROR_CLUSTER_NODE_EXISTS syscall.Errno = 5040 + ERROR_CLUSTER_JOIN_IN_PROGRESS syscall.Errno = 5041 + ERROR_CLUSTER_NODE_NOT_FOUND syscall.Errno = 5042 + ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND syscall.Errno = 5043 + ERROR_CLUSTER_NETWORK_EXISTS syscall.Errno = 5044 + ERROR_CLUSTER_NETWORK_NOT_FOUND syscall.Errno = 5045 + ERROR_CLUSTER_NETINTERFACE_EXISTS syscall.Errno = 5046 + ERROR_CLUSTER_NETINTERFACE_NOT_FOUND syscall.Errno = 5047 + ERROR_CLUSTER_INVALID_REQUEST syscall.Errno = 5048 + ERROR_CLUSTER_INVALID_NETWORK_PROVIDER syscall.Errno = 5049 + ERROR_CLUSTER_NODE_DOWN syscall.Errno = 5050 + ERROR_CLUSTER_NODE_UNREACHABLE syscall.Errno = 5051 + ERROR_CLUSTER_NODE_NOT_MEMBER syscall.Errno = 5052 + ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS syscall.Errno = 5053 + ERROR_CLUSTER_INVALID_NETWORK syscall.Errno = 5054 + ERROR_CLUSTER_NODE_UP syscall.Errno = 5056 + ERROR_CLUSTER_IPADDR_IN_USE syscall.Errno = 5057 + ERROR_CLUSTER_NODE_NOT_PAUSED syscall.Errno = 5058 + ERROR_CLUSTER_NO_SECURITY_CONTEXT syscall.Errno = 5059 + ERROR_CLUSTER_NETWORK_NOT_INTERNAL syscall.Errno = 5060 + ERROR_CLUSTER_NODE_ALREADY_UP syscall.Errno = 5061 + ERROR_CLUSTER_NODE_ALREADY_DOWN syscall.Errno = 5062 + ERROR_CLUSTER_NETWORK_ALREADY_ONLINE syscall.Errno = 5063 + ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE syscall.Errno = 5064 + ERROR_CLUSTER_NODE_ALREADY_MEMBER syscall.Errno = 5065 + ERROR_CLUSTER_LAST_INTERNAL_NETWORK syscall.Errno = 5066 + ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS syscall.Errno = 5067 + ERROR_INVALID_OPERATION_ON_QUORUM syscall.Errno = 5068 + ERROR_DEPENDENCY_NOT_ALLOWED syscall.Errno = 5069 + ERROR_CLUSTER_NODE_PAUSED syscall.Errno = 5070 + ERROR_NODE_CANT_HOST_RESOURCE syscall.Errno = 5071 + ERROR_CLUSTER_NODE_NOT_READY syscall.Errno = 5072 + ERROR_CLUSTER_NODE_SHUTTING_DOWN syscall.Errno = 5073 + ERROR_CLUSTER_JOIN_ABORTED syscall.Errno = 5074 + ERROR_CLUSTER_INCOMPATIBLE_VERSIONS syscall.Errno = 5075 + ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED syscall.Errno = 5076 + ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED syscall.Errno = 5077 + ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND syscall.Errno = 5078 + ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED syscall.Errno = 5079 + ERROR_CLUSTER_RESNAME_NOT_FOUND syscall.Errno = 5080 + ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED syscall.Errno = 5081 + ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST syscall.Errno = 5082 + ERROR_CLUSTER_DATABASE_SEQMISMATCH syscall.Errno = 5083 + ERROR_RESMON_INVALID_STATE syscall.Errno = 5084 + ERROR_CLUSTER_GUM_NOT_LOCKER syscall.Errno = 5085 + ERROR_QUORUM_DISK_NOT_FOUND syscall.Errno = 5086 + ERROR_DATABASE_BACKUP_CORRUPT syscall.Errno = 5087 + ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT syscall.Errno = 5088 + ERROR_RESOURCE_PROPERTY_UNCHANGEABLE syscall.Errno = 5089 + ERROR_NO_ADMIN_ACCESS_POINT syscall.Errno = 5090 + ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE syscall.Errno = 5890 + ERROR_CLUSTER_QUORUMLOG_NOT_FOUND syscall.Errno = 5891 + ERROR_CLUSTER_MEMBERSHIP_HALT syscall.Errno = 5892 + ERROR_CLUSTER_INSTANCE_ID_MISMATCH syscall.Errno = 5893 + ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP syscall.Errno = 5894 + ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH syscall.Errno = 5895 + ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP syscall.Errno = 5896 + ERROR_CLUSTER_PARAMETER_MISMATCH syscall.Errno = 5897 + ERROR_NODE_CANNOT_BE_CLUSTERED syscall.Errno = 5898 + ERROR_CLUSTER_WRONG_OS_VERSION syscall.Errno = 5899 + ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME syscall.Errno = 5900 + ERROR_CLUSCFG_ALREADY_COMMITTED syscall.Errno = 5901 + ERROR_CLUSCFG_ROLLBACK_FAILED syscall.Errno = 5902 + ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT syscall.Errno = 5903 + ERROR_CLUSTER_OLD_VERSION syscall.Errno = 5904 + ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME syscall.Errno = 5905 + ERROR_CLUSTER_NO_NET_ADAPTERS syscall.Errno = 5906 + ERROR_CLUSTER_POISONED syscall.Errno = 5907 + ERROR_CLUSTER_GROUP_MOVING syscall.Errno = 5908 + ERROR_CLUSTER_RESOURCE_TYPE_BUSY syscall.Errno = 5909 + ERROR_RESOURCE_CALL_TIMED_OUT syscall.Errno = 5910 + ERROR_INVALID_CLUSTER_IPV6_ADDRESS syscall.Errno = 5911 + ERROR_CLUSTER_INTERNAL_INVALID_FUNCTION syscall.Errno = 5912 + ERROR_CLUSTER_PARAMETER_OUT_OF_BOUNDS syscall.Errno = 5913 + ERROR_CLUSTER_PARTIAL_SEND syscall.Errno = 5914 + ERROR_CLUSTER_REGISTRY_INVALID_FUNCTION syscall.Errno = 5915 + ERROR_CLUSTER_INVALID_STRING_TERMINATION syscall.Errno = 5916 + ERROR_CLUSTER_INVALID_STRING_FORMAT syscall.Errno = 5917 + ERROR_CLUSTER_DATABASE_TRANSACTION_IN_PROGRESS syscall.Errno = 5918 + ERROR_CLUSTER_DATABASE_TRANSACTION_NOT_IN_PROGRESS syscall.Errno = 5919 + ERROR_CLUSTER_NULL_DATA syscall.Errno = 5920 + ERROR_CLUSTER_PARTIAL_READ syscall.Errno = 5921 + ERROR_CLUSTER_PARTIAL_WRITE syscall.Errno = 5922 + ERROR_CLUSTER_CANT_DESERIALIZE_DATA syscall.Errno = 5923 + ERROR_DEPENDENT_RESOURCE_PROPERTY_CONFLICT syscall.Errno = 5924 + ERROR_CLUSTER_NO_QUORUM syscall.Errno = 5925 + ERROR_CLUSTER_INVALID_IPV6_NETWORK syscall.Errno = 5926 + ERROR_CLUSTER_INVALID_IPV6_TUNNEL_NETWORK syscall.Errno = 5927 + ERROR_QUORUM_NOT_ALLOWED_IN_THIS_GROUP syscall.Errno = 5928 + ERROR_DEPENDENCY_TREE_TOO_COMPLEX syscall.Errno = 5929 + ERROR_EXCEPTION_IN_RESOURCE_CALL syscall.Errno = 5930 + ERROR_CLUSTER_RHS_FAILED_INITIALIZATION syscall.Errno = 5931 + ERROR_CLUSTER_NOT_INSTALLED syscall.Errno = 5932 + ERROR_CLUSTER_RESOURCES_MUST_BE_ONLINE_ON_THE_SAME_NODE syscall.Errno = 5933 + ERROR_CLUSTER_MAX_NODES_IN_CLUSTER syscall.Errno = 5934 + ERROR_CLUSTER_TOO_MANY_NODES syscall.Errno = 5935 + ERROR_CLUSTER_OBJECT_ALREADY_USED syscall.Errno = 5936 + ERROR_NONCORE_GROUPS_FOUND syscall.Errno = 5937 + ERROR_FILE_SHARE_RESOURCE_CONFLICT syscall.Errno = 5938 + ERROR_CLUSTER_EVICT_INVALID_REQUEST syscall.Errno = 5939 + ERROR_CLUSTER_SINGLETON_RESOURCE syscall.Errno = 5940 + ERROR_CLUSTER_GROUP_SINGLETON_RESOURCE syscall.Errno = 5941 + ERROR_CLUSTER_RESOURCE_PROVIDER_FAILED syscall.Errno = 5942 + ERROR_CLUSTER_RESOURCE_CONFIGURATION_ERROR syscall.Errno = 5943 + ERROR_CLUSTER_GROUP_BUSY syscall.Errno = 5944 + ERROR_CLUSTER_NOT_SHARED_VOLUME syscall.Errno = 5945 + ERROR_CLUSTER_INVALID_SECURITY_DESCRIPTOR syscall.Errno = 5946 + ERROR_CLUSTER_SHARED_VOLUMES_IN_USE syscall.Errno = 5947 + ERROR_CLUSTER_USE_SHARED_VOLUMES_API syscall.Errno = 5948 + ERROR_CLUSTER_BACKUP_IN_PROGRESS syscall.Errno = 5949 + ERROR_NON_CSV_PATH syscall.Errno = 5950 + ERROR_CSV_VOLUME_NOT_LOCAL syscall.Errno = 5951 + ERROR_CLUSTER_WATCHDOG_TERMINATING syscall.Errno = 5952 + ERROR_CLUSTER_RESOURCE_VETOED_MOVE_INCOMPATIBLE_NODES syscall.Errno = 5953 + ERROR_CLUSTER_INVALID_NODE_WEIGHT syscall.Errno = 5954 + ERROR_CLUSTER_RESOURCE_VETOED_CALL syscall.Errno = 5955 + ERROR_RESMON_SYSTEM_RESOURCES_LACKING syscall.Errno = 5956 + ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_DESTINATION syscall.Errno = 5957 + ERROR_CLUSTER_RESOURCE_VETOED_MOVE_NOT_ENOUGH_RESOURCES_ON_SOURCE syscall.Errno = 5958 + ERROR_CLUSTER_GROUP_QUEUED syscall.Errno = 5959 + ERROR_CLUSTER_RESOURCE_LOCKED_STATUS syscall.Errno = 5960 + ERROR_CLUSTER_SHARED_VOLUME_FAILOVER_NOT_ALLOWED syscall.Errno = 5961 + ERROR_CLUSTER_NODE_DRAIN_IN_PROGRESS syscall.Errno = 5962 + ERROR_CLUSTER_DISK_NOT_CONNECTED syscall.Errno = 5963 + ERROR_DISK_NOT_CSV_CAPABLE syscall.Errno = 5964 + ERROR_RESOURCE_NOT_IN_AVAILABLE_STORAGE syscall.Errno = 5965 + ERROR_CLUSTER_SHARED_VOLUME_REDIRECTED syscall.Errno = 5966 + ERROR_CLUSTER_SHARED_VOLUME_NOT_REDIRECTED syscall.Errno = 5967 + ERROR_CLUSTER_CANNOT_RETURN_PROPERTIES syscall.Errno = 5968 + ERROR_CLUSTER_RESOURCE_CONTAINS_UNSUPPORTED_DIFF_AREA_FOR_SHARED_VOLUMES syscall.Errno = 5969 + ERROR_CLUSTER_RESOURCE_IS_IN_MAINTENANCE_MODE syscall.Errno = 5970 + ERROR_CLUSTER_AFFINITY_CONFLICT syscall.Errno = 5971 + ERROR_CLUSTER_RESOURCE_IS_REPLICA_VIRTUAL_MACHINE syscall.Errno = 5972 + ERROR_CLUSTER_UPGRADE_INCOMPATIBLE_VERSIONS syscall.Errno = 5973 + ERROR_CLUSTER_UPGRADE_FIX_QUORUM_NOT_SUPPORTED syscall.Errno = 5974 + ERROR_CLUSTER_UPGRADE_RESTART_REQUIRED syscall.Errno = 5975 + ERROR_CLUSTER_UPGRADE_IN_PROGRESS syscall.Errno = 5976 + ERROR_CLUSTER_UPGRADE_INCOMPLETE syscall.Errno = 5977 + ERROR_CLUSTER_NODE_IN_GRACE_PERIOD syscall.Errno = 5978 + ERROR_CLUSTER_CSV_IO_PAUSE_TIMEOUT syscall.Errno = 5979 + ERROR_NODE_NOT_ACTIVE_CLUSTER_MEMBER syscall.Errno = 5980 + ERROR_CLUSTER_RESOURCE_NOT_MONITORED syscall.Errno = 5981 + ERROR_CLUSTER_RESOURCE_DOES_NOT_SUPPORT_UNMONITORED syscall.Errno = 5982 + ERROR_CLUSTER_RESOURCE_IS_REPLICATED syscall.Errno = 5983 + ERROR_CLUSTER_NODE_ISOLATED syscall.Errno = 5984 + ERROR_CLUSTER_NODE_QUARANTINED syscall.Errno = 5985 + ERROR_CLUSTER_DATABASE_UPDATE_CONDITION_FAILED syscall.Errno = 5986 + ERROR_CLUSTER_SPACE_DEGRADED syscall.Errno = 5987 + ERROR_CLUSTER_TOKEN_DELEGATION_NOT_SUPPORTED syscall.Errno = 5988 + ERROR_CLUSTER_CSV_INVALID_HANDLE syscall.Errno = 5989 + ERROR_CLUSTER_CSV_SUPPORTED_ONLY_ON_COORDINATOR syscall.Errno = 5990 + ERROR_GROUPSET_NOT_AVAILABLE syscall.Errno = 5991 + ERROR_GROUPSET_NOT_FOUND syscall.Errno = 5992 + ERROR_GROUPSET_CANT_PROVIDE syscall.Errno = 5993 + ERROR_CLUSTER_FAULT_DOMAIN_PARENT_NOT_FOUND syscall.Errno = 5994 + ERROR_CLUSTER_FAULT_DOMAIN_INVALID_HIERARCHY syscall.Errno = 5995 + ERROR_CLUSTER_FAULT_DOMAIN_FAILED_S2D_VALIDATION syscall.Errno = 5996 + ERROR_CLUSTER_FAULT_DOMAIN_S2D_CONNECTIVITY_LOSS syscall.Errno = 5997 + ERROR_CLUSTER_INVALID_INFRASTRUCTURE_FILESERVER_NAME syscall.Errno = 5998 + ERROR_CLUSTERSET_MANAGEMENT_CLUSTER_UNREACHABLE syscall.Errno = 5999 + ERROR_ENCRYPTION_FAILED syscall.Errno = 6000 + ERROR_DECRYPTION_FAILED syscall.Errno = 6001 + ERROR_FILE_ENCRYPTED syscall.Errno = 6002 + ERROR_NO_RECOVERY_POLICY syscall.Errno = 6003 + ERROR_NO_EFS syscall.Errno = 6004 + ERROR_WRONG_EFS syscall.Errno = 6005 + ERROR_NO_USER_KEYS syscall.Errno = 6006 + ERROR_FILE_NOT_ENCRYPTED syscall.Errno = 6007 + ERROR_NOT_EXPORT_FORMAT syscall.Errno = 6008 + ERROR_FILE_READ_ONLY syscall.Errno = 6009 + ERROR_DIR_EFS_DISALLOWED syscall.Errno = 6010 + ERROR_EFS_SERVER_NOT_TRUSTED syscall.Errno = 6011 + ERROR_BAD_RECOVERY_POLICY syscall.Errno = 6012 + ERROR_EFS_ALG_BLOB_TOO_BIG syscall.Errno = 6013 + ERROR_VOLUME_NOT_SUPPORT_EFS syscall.Errno = 6014 + ERROR_EFS_DISABLED syscall.Errno = 6015 + ERROR_EFS_VERSION_NOT_SUPPORT syscall.Errno = 6016 + ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE syscall.Errno = 6017 + ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER syscall.Errno = 6018 + ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE syscall.Errno = 6019 + ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE syscall.Errno = 6020 + ERROR_CS_ENCRYPTION_FILE_NOT_CSE syscall.Errno = 6021 + ERROR_ENCRYPTION_POLICY_DENIES_OPERATION syscall.Errno = 6022 + ERROR_NO_BROWSER_SERVERS_FOUND syscall.Errno = 6118 + SCHED_E_SERVICE_NOT_LOCALSYSTEM syscall.Errno = 6200 + ERROR_LOG_SECTOR_INVALID syscall.Errno = 6600 + ERROR_LOG_SECTOR_PARITY_INVALID syscall.Errno = 6601 + ERROR_LOG_SECTOR_REMAPPED syscall.Errno = 6602 + ERROR_LOG_BLOCK_INCOMPLETE syscall.Errno = 6603 + ERROR_LOG_INVALID_RANGE syscall.Errno = 6604 + ERROR_LOG_BLOCKS_EXHAUSTED syscall.Errno = 6605 + ERROR_LOG_READ_CONTEXT_INVALID syscall.Errno = 6606 + ERROR_LOG_RESTART_INVALID syscall.Errno = 6607 + ERROR_LOG_BLOCK_VERSION syscall.Errno = 6608 + ERROR_LOG_BLOCK_INVALID syscall.Errno = 6609 + ERROR_LOG_READ_MODE_INVALID syscall.Errno = 6610 + ERROR_LOG_NO_RESTART syscall.Errno = 6611 + ERROR_LOG_METADATA_CORRUPT syscall.Errno = 6612 + ERROR_LOG_METADATA_INVALID syscall.Errno = 6613 + ERROR_LOG_METADATA_INCONSISTENT syscall.Errno = 6614 + ERROR_LOG_RESERVATION_INVALID syscall.Errno = 6615 + ERROR_LOG_CANT_DELETE syscall.Errno = 6616 + ERROR_LOG_CONTAINER_LIMIT_EXCEEDED syscall.Errno = 6617 + ERROR_LOG_START_OF_LOG syscall.Errno = 6618 + ERROR_LOG_POLICY_ALREADY_INSTALLED syscall.Errno = 6619 + ERROR_LOG_POLICY_NOT_INSTALLED syscall.Errno = 6620 + ERROR_LOG_POLICY_INVALID syscall.Errno = 6621 + ERROR_LOG_POLICY_CONFLICT syscall.Errno = 6622 + ERROR_LOG_PINNED_ARCHIVE_TAIL syscall.Errno = 6623 + ERROR_LOG_RECORD_NONEXISTENT syscall.Errno = 6624 + ERROR_LOG_RECORDS_RESERVED_INVALID syscall.Errno = 6625 + ERROR_LOG_SPACE_RESERVED_INVALID syscall.Errno = 6626 + ERROR_LOG_TAIL_INVALID syscall.Errno = 6627 + ERROR_LOG_FULL syscall.Errno = 6628 + ERROR_COULD_NOT_RESIZE_LOG syscall.Errno = 6629 + ERROR_LOG_MULTIPLEXED syscall.Errno = 6630 + ERROR_LOG_DEDICATED syscall.Errno = 6631 + ERROR_LOG_ARCHIVE_NOT_IN_PROGRESS syscall.Errno = 6632 + ERROR_LOG_ARCHIVE_IN_PROGRESS syscall.Errno = 6633 + ERROR_LOG_EPHEMERAL syscall.Errno = 6634 + ERROR_LOG_NOT_ENOUGH_CONTAINERS syscall.Errno = 6635 + ERROR_LOG_CLIENT_ALREADY_REGISTERED syscall.Errno = 6636 + ERROR_LOG_CLIENT_NOT_REGISTERED syscall.Errno = 6637 + ERROR_LOG_FULL_HANDLER_IN_PROGRESS syscall.Errno = 6638 + ERROR_LOG_CONTAINER_READ_FAILED syscall.Errno = 6639 + ERROR_LOG_CONTAINER_WRITE_FAILED syscall.Errno = 6640 + ERROR_LOG_CONTAINER_OPEN_FAILED syscall.Errno = 6641 + ERROR_LOG_CONTAINER_STATE_INVALID syscall.Errno = 6642 + ERROR_LOG_STATE_INVALID syscall.Errno = 6643 + ERROR_LOG_PINNED syscall.Errno = 6644 + ERROR_LOG_METADATA_FLUSH_FAILED syscall.Errno = 6645 + ERROR_LOG_INCONSISTENT_SECURITY syscall.Errno = 6646 + ERROR_LOG_APPENDED_FLUSH_FAILED syscall.Errno = 6647 + ERROR_LOG_PINNED_RESERVATION syscall.Errno = 6648 + ERROR_INVALID_TRANSACTION syscall.Errno = 6700 + ERROR_TRANSACTION_NOT_ACTIVE syscall.Errno = 6701 + ERROR_TRANSACTION_REQUEST_NOT_VALID syscall.Errno = 6702 + ERROR_TRANSACTION_NOT_REQUESTED syscall.Errno = 6703 + ERROR_TRANSACTION_ALREADY_ABORTED syscall.Errno = 6704 + ERROR_TRANSACTION_ALREADY_COMMITTED syscall.Errno = 6705 + ERROR_TM_INITIALIZATION_FAILED syscall.Errno = 6706 + ERROR_RESOURCEMANAGER_READ_ONLY syscall.Errno = 6707 + ERROR_TRANSACTION_NOT_JOINED syscall.Errno = 6708 + ERROR_TRANSACTION_SUPERIOR_EXISTS syscall.Errno = 6709 + ERROR_CRM_PROTOCOL_ALREADY_EXISTS syscall.Errno = 6710 + ERROR_TRANSACTION_PROPAGATION_FAILED syscall.Errno = 6711 + ERROR_CRM_PROTOCOL_NOT_FOUND syscall.Errno = 6712 + ERROR_TRANSACTION_INVALID_MARSHALL_BUFFER syscall.Errno = 6713 + ERROR_CURRENT_TRANSACTION_NOT_VALID syscall.Errno = 6714 + ERROR_TRANSACTION_NOT_FOUND syscall.Errno = 6715 + ERROR_RESOURCEMANAGER_NOT_FOUND syscall.Errno = 6716 + ERROR_ENLISTMENT_NOT_FOUND syscall.Errno = 6717 + ERROR_TRANSACTIONMANAGER_NOT_FOUND syscall.Errno = 6718 + ERROR_TRANSACTIONMANAGER_NOT_ONLINE syscall.Errno = 6719 + ERROR_TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION syscall.Errno = 6720 + ERROR_TRANSACTION_NOT_ROOT syscall.Errno = 6721 + ERROR_TRANSACTION_OBJECT_EXPIRED syscall.Errno = 6722 + ERROR_TRANSACTION_RESPONSE_NOT_ENLISTED syscall.Errno = 6723 + ERROR_TRANSACTION_RECORD_TOO_LONG syscall.Errno = 6724 + ERROR_IMPLICIT_TRANSACTION_NOT_SUPPORTED syscall.Errno = 6725 + ERROR_TRANSACTION_INTEGRITY_VIOLATED syscall.Errno = 6726 + ERROR_TRANSACTIONMANAGER_IDENTITY_MISMATCH syscall.Errno = 6727 + ERROR_RM_CANNOT_BE_FROZEN_FOR_SNAPSHOT syscall.Errno = 6728 + ERROR_TRANSACTION_MUST_WRITETHROUGH syscall.Errno = 6729 + ERROR_TRANSACTION_NO_SUPERIOR syscall.Errno = 6730 + ERROR_HEURISTIC_DAMAGE_POSSIBLE syscall.Errno = 6731 + ERROR_TRANSACTIONAL_CONFLICT syscall.Errno = 6800 + ERROR_RM_NOT_ACTIVE syscall.Errno = 6801 + ERROR_RM_METADATA_CORRUPT syscall.Errno = 6802 + ERROR_DIRECTORY_NOT_RM syscall.Errno = 6803 + ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE syscall.Errno = 6805 + ERROR_LOG_RESIZE_INVALID_SIZE syscall.Errno = 6806 + ERROR_OBJECT_NO_LONGER_EXISTS syscall.Errno = 6807 + ERROR_STREAM_MINIVERSION_NOT_FOUND syscall.Errno = 6808 + ERROR_STREAM_MINIVERSION_NOT_VALID syscall.Errno = 6809 + ERROR_MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION syscall.Errno = 6810 + ERROR_CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT syscall.Errno = 6811 + ERROR_CANT_CREATE_MORE_STREAM_MINIVERSIONS syscall.Errno = 6812 + ERROR_REMOTE_FILE_VERSION_MISMATCH syscall.Errno = 6814 + ERROR_HANDLE_NO_LONGER_VALID syscall.Errno = 6815 + ERROR_NO_TXF_METADATA syscall.Errno = 6816 + ERROR_LOG_CORRUPTION_DETECTED syscall.Errno = 6817 + ERROR_CANT_RECOVER_WITH_HANDLE_OPEN syscall.Errno = 6818 + ERROR_RM_DISCONNECTED syscall.Errno = 6819 + ERROR_ENLISTMENT_NOT_SUPERIOR syscall.Errno = 6820 + ERROR_RECOVERY_NOT_NEEDED syscall.Errno = 6821 + ERROR_RM_ALREADY_STARTED syscall.Errno = 6822 + ERROR_FILE_IDENTITY_NOT_PERSISTENT syscall.Errno = 6823 + ERROR_CANT_BREAK_TRANSACTIONAL_DEPENDENCY syscall.Errno = 6824 + ERROR_CANT_CROSS_RM_BOUNDARY syscall.Errno = 6825 + ERROR_TXF_DIR_NOT_EMPTY syscall.Errno = 6826 + ERROR_INDOUBT_TRANSACTIONS_EXIST syscall.Errno = 6827 + ERROR_TM_VOLATILE syscall.Errno = 6828 + ERROR_ROLLBACK_TIMER_EXPIRED syscall.Errno = 6829 + ERROR_TXF_ATTRIBUTE_CORRUPT syscall.Errno = 6830 + ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6831 + ERROR_TRANSACTIONAL_OPEN_NOT_ALLOWED syscall.Errno = 6832 + ERROR_LOG_GROWTH_FAILED syscall.Errno = 6833 + ERROR_TRANSACTED_MAPPING_UNSUPPORTED_REMOTE syscall.Errno = 6834 + ERROR_TXF_METADATA_ALREADY_PRESENT syscall.Errno = 6835 + ERROR_TRANSACTION_SCOPE_CALLBACKS_NOT_SET syscall.Errno = 6836 + ERROR_TRANSACTION_REQUIRED_PROMOTION syscall.Errno = 6837 + ERROR_CANNOT_EXECUTE_FILE_IN_TRANSACTION syscall.Errno = 6838 + ERROR_TRANSACTIONS_NOT_FROZEN syscall.Errno = 6839 + ERROR_TRANSACTION_FREEZE_IN_PROGRESS syscall.Errno = 6840 + ERROR_NOT_SNAPSHOT_VOLUME syscall.Errno = 6841 + ERROR_NO_SAVEPOINT_WITH_OPEN_FILES syscall.Errno = 6842 + ERROR_DATA_LOST_REPAIR syscall.Errno = 6843 + ERROR_SPARSE_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6844 + ERROR_TM_IDENTITY_MISMATCH syscall.Errno = 6845 + ERROR_FLOATED_SECTION syscall.Errno = 6846 + ERROR_CANNOT_ACCEPT_TRANSACTED_WORK syscall.Errno = 6847 + ERROR_CANNOT_ABORT_TRANSACTIONS syscall.Errno = 6848 + ERROR_BAD_CLUSTERS syscall.Errno = 6849 + ERROR_COMPRESSION_NOT_ALLOWED_IN_TRANSACTION syscall.Errno = 6850 + ERROR_VOLUME_DIRTY syscall.Errno = 6851 + ERROR_NO_LINK_TRACKING_IN_TRANSACTION syscall.Errno = 6852 + ERROR_OPERATION_NOT_SUPPORTED_IN_TRANSACTION syscall.Errno = 6853 + ERROR_EXPIRED_HANDLE syscall.Errno = 6854 + ERROR_TRANSACTION_NOT_ENLISTED syscall.Errno = 6855 + ERROR_CTX_WINSTATION_NAME_INVALID syscall.Errno = 7001 + ERROR_CTX_INVALID_PD syscall.Errno = 7002 + ERROR_CTX_PD_NOT_FOUND syscall.Errno = 7003 + ERROR_CTX_WD_NOT_FOUND syscall.Errno = 7004 + ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY syscall.Errno = 7005 + ERROR_CTX_SERVICE_NAME_COLLISION syscall.Errno = 7006 + ERROR_CTX_CLOSE_PENDING syscall.Errno = 7007 + ERROR_CTX_NO_OUTBUF syscall.Errno = 7008 + ERROR_CTX_MODEM_INF_NOT_FOUND syscall.Errno = 7009 + ERROR_CTX_INVALID_MODEMNAME syscall.Errno = 7010 + ERROR_CTX_MODEM_RESPONSE_ERROR syscall.Errno = 7011 + ERROR_CTX_MODEM_RESPONSE_TIMEOUT syscall.Errno = 7012 + ERROR_CTX_MODEM_RESPONSE_NO_CARRIER syscall.Errno = 7013 + ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE syscall.Errno = 7014 + ERROR_CTX_MODEM_RESPONSE_BUSY syscall.Errno = 7015 + ERROR_CTX_MODEM_RESPONSE_VOICE syscall.Errno = 7016 + ERROR_CTX_TD_ERROR syscall.Errno = 7017 + ERROR_CTX_WINSTATION_NOT_FOUND syscall.Errno = 7022 + ERROR_CTX_WINSTATION_ALREADY_EXISTS syscall.Errno = 7023 + ERROR_CTX_WINSTATION_BUSY syscall.Errno = 7024 + ERROR_CTX_BAD_VIDEO_MODE syscall.Errno = 7025 + ERROR_CTX_GRAPHICS_INVALID syscall.Errno = 7035 + ERROR_CTX_LOGON_DISABLED syscall.Errno = 7037 + ERROR_CTX_NOT_CONSOLE syscall.Errno = 7038 + ERROR_CTX_CLIENT_QUERY_TIMEOUT syscall.Errno = 7040 + ERROR_CTX_CONSOLE_DISCONNECT syscall.Errno = 7041 + ERROR_CTX_CONSOLE_CONNECT syscall.Errno = 7042 + ERROR_CTX_SHADOW_DENIED syscall.Errno = 7044 + ERROR_CTX_WINSTATION_ACCESS_DENIED syscall.Errno = 7045 + ERROR_CTX_INVALID_WD syscall.Errno = 7049 + ERROR_CTX_SHADOW_INVALID syscall.Errno = 7050 + ERROR_CTX_SHADOW_DISABLED syscall.Errno = 7051 + ERROR_CTX_CLIENT_LICENSE_IN_USE syscall.Errno = 7052 + ERROR_CTX_CLIENT_LICENSE_NOT_SET syscall.Errno = 7053 + ERROR_CTX_LICENSE_NOT_AVAILABLE syscall.Errno = 7054 + ERROR_CTX_LICENSE_CLIENT_INVALID syscall.Errno = 7055 + ERROR_CTX_LICENSE_EXPIRED syscall.Errno = 7056 + ERROR_CTX_SHADOW_NOT_RUNNING syscall.Errno = 7057 + ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE syscall.Errno = 7058 + ERROR_ACTIVATION_COUNT_EXCEEDED syscall.Errno = 7059 + ERROR_CTX_WINSTATIONS_DISABLED syscall.Errno = 7060 + ERROR_CTX_ENCRYPTION_LEVEL_REQUIRED syscall.Errno = 7061 + ERROR_CTX_SESSION_IN_USE syscall.Errno = 7062 + ERROR_CTX_NO_FORCE_LOGOFF syscall.Errno = 7063 + ERROR_CTX_ACCOUNT_RESTRICTION syscall.Errno = 7064 + ERROR_RDP_PROTOCOL_ERROR syscall.Errno = 7065 + ERROR_CTX_CDM_CONNECT syscall.Errno = 7066 + ERROR_CTX_CDM_DISCONNECT syscall.Errno = 7067 + ERROR_CTX_SECURITY_LAYER_ERROR syscall.Errno = 7068 + ERROR_TS_INCOMPATIBLE_SESSIONS syscall.Errno = 7069 + ERROR_TS_VIDEO_SUBSYSTEM_ERROR syscall.Errno = 7070 + FRS_ERR_INVALID_API_SEQUENCE syscall.Errno = 8001 + FRS_ERR_STARTING_SERVICE syscall.Errno = 8002 + FRS_ERR_STOPPING_SERVICE syscall.Errno = 8003 + FRS_ERR_INTERNAL_API syscall.Errno = 8004 + FRS_ERR_INTERNAL syscall.Errno = 8005 + FRS_ERR_SERVICE_COMM syscall.Errno = 8006 + FRS_ERR_INSUFFICIENT_PRIV syscall.Errno = 8007 + FRS_ERR_AUTHENTICATION syscall.Errno = 8008 + FRS_ERR_PARENT_INSUFFICIENT_PRIV syscall.Errno = 8009 + FRS_ERR_PARENT_AUTHENTICATION syscall.Errno = 8010 + FRS_ERR_CHILD_TO_PARENT_COMM syscall.Errno = 8011 + FRS_ERR_PARENT_TO_CHILD_COMM syscall.Errno = 8012 + FRS_ERR_SYSVOL_POPULATE syscall.Errno = 8013 + FRS_ERR_SYSVOL_POPULATE_TIMEOUT syscall.Errno = 8014 + FRS_ERR_SYSVOL_IS_BUSY syscall.Errno = 8015 + FRS_ERR_SYSVOL_DEMOTE syscall.Errno = 8016 + FRS_ERR_INVALID_SERVICE_PARAMETER syscall.Errno = 8017 + DS_S_SUCCESS = ERROR_SUCCESS + ERROR_DS_NOT_INSTALLED syscall.Errno = 8200 + ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY syscall.Errno = 8201 + ERROR_DS_NO_ATTRIBUTE_OR_VALUE syscall.Errno = 8202 + ERROR_DS_INVALID_ATTRIBUTE_SYNTAX syscall.Errno = 8203 + ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED syscall.Errno = 8204 + ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS syscall.Errno = 8205 + ERROR_DS_BUSY syscall.Errno = 8206 + ERROR_DS_UNAVAILABLE syscall.Errno = 8207 + ERROR_DS_NO_RIDS_ALLOCATED syscall.Errno = 8208 + ERROR_DS_NO_MORE_RIDS syscall.Errno = 8209 + ERROR_DS_INCORRECT_ROLE_OWNER syscall.Errno = 8210 + ERROR_DS_RIDMGR_INIT_ERROR syscall.Errno = 8211 + ERROR_DS_OBJ_CLASS_VIOLATION syscall.Errno = 8212 + ERROR_DS_CANT_ON_NON_LEAF syscall.Errno = 8213 + ERROR_DS_CANT_ON_RDN syscall.Errno = 8214 + ERROR_DS_CANT_MOD_OBJ_CLASS syscall.Errno = 8215 + ERROR_DS_CROSS_DOM_MOVE_ERROR syscall.Errno = 8216 + ERROR_DS_GC_NOT_AVAILABLE syscall.Errno = 8217 + ERROR_SHARED_POLICY syscall.Errno = 8218 + ERROR_POLICY_OBJECT_NOT_FOUND syscall.Errno = 8219 + ERROR_POLICY_ONLY_IN_DS syscall.Errno = 8220 + ERROR_PROMOTION_ACTIVE syscall.Errno = 8221 + ERROR_NO_PROMOTION_ACTIVE syscall.Errno = 8222 + ERROR_DS_OPERATIONS_ERROR syscall.Errno = 8224 + ERROR_DS_PROTOCOL_ERROR syscall.Errno = 8225 + ERROR_DS_TIMELIMIT_EXCEEDED syscall.Errno = 8226 + ERROR_DS_SIZELIMIT_EXCEEDED syscall.Errno = 8227 + ERROR_DS_ADMIN_LIMIT_EXCEEDED syscall.Errno = 8228 + ERROR_DS_COMPARE_FALSE syscall.Errno = 8229 + ERROR_DS_COMPARE_TRUE syscall.Errno = 8230 + ERROR_DS_AUTH_METHOD_NOT_SUPPORTED syscall.Errno = 8231 + ERROR_DS_STRONG_AUTH_REQUIRED syscall.Errno = 8232 + ERROR_DS_INAPPROPRIATE_AUTH syscall.Errno = 8233 + ERROR_DS_AUTH_UNKNOWN syscall.Errno = 8234 + ERROR_DS_REFERRAL syscall.Errno = 8235 + ERROR_DS_UNAVAILABLE_CRIT_EXTENSION syscall.Errno = 8236 + ERROR_DS_CONFIDENTIALITY_REQUIRED syscall.Errno = 8237 + ERROR_DS_INAPPROPRIATE_MATCHING syscall.Errno = 8238 + ERROR_DS_CONSTRAINT_VIOLATION syscall.Errno = 8239 + ERROR_DS_NO_SUCH_OBJECT syscall.Errno = 8240 + ERROR_DS_ALIAS_PROBLEM syscall.Errno = 8241 + ERROR_DS_INVALID_DN_SYNTAX syscall.Errno = 8242 + ERROR_DS_IS_LEAF syscall.Errno = 8243 + ERROR_DS_ALIAS_DEREF_PROBLEM syscall.Errno = 8244 + ERROR_DS_UNWILLING_TO_PERFORM syscall.Errno = 8245 + ERROR_DS_LOOP_DETECT syscall.Errno = 8246 + ERROR_DS_NAMING_VIOLATION syscall.Errno = 8247 + ERROR_DS_OBJECT_RESULTS_TOO_LARGE syscall.Errno = 8248 + ERROR_DS_AFFECTS_MULTIPLE_DSAS syscall.Errno = 8249 + ERROR_DS_SERVER_DOWN syscall.Errno = 8250 + ERROR_DS_LOCAL_ERROR syscall.Errno = 8251 + ERROR_DS_ENCODING_ERROR syscall.Errno = 8252 + ERROR_DS_DECODING_ERROR syscall.Errno = 8253 + ERROR_DS_FILTER_UNKNOWN syscall.Errno = 8254 + ERROR_DS_PARAM_ERROR syscall.Errno = 8255 + ERROR_DS_NOT_SUPPORTED syscall.Errno = 8256 + ERROR_DS_NO_RESULTS_RETURNED syscall.Errno = 8257 + ERROR_DS_CONTROL_NOT_FOUND syscall.Errno = 8258 + ERROR_DS_CLIENT_LOOP syscall.Errno = 8259 + ERROR_DS_REFERRAL_LIMIT_EXCEEDED syscall.Errno = 8260 + ERROR_DS_SORT_CONTROL_MISSING syscall.Errno = 8261 + ERROR_DS_OFFSET_RANGE_ERROR syscall.Errno = 8262 + ERROR_DS_RIDMGR_DISABLED syscall.Errno = 8263 + ERROR_DS_ROOT_MUST_BE_NC syscall.Errno = 8301 + ERROR_DS_ADD_REPLICA_INHIBITED syscall.Errno = 8302 + ERROR_DS_ATT_NOT_DEF_IN_SCHEMA syscall.Errno = 8303 + ERROR_DS_MAX_OBJ_SIZE_EXCEEDED syscall.Errno = 8304 + ERROR_DS_OBJ_STRING_NAME_EXISTS syscall.Errno = 8305 + ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA syscall.Errno = 8306 + ERROR_DS_RDN_DOESNT_MATCH_SCHEMA syscall.Errno = 8307 + ERROR_DS_NO_REQUESTED_ATTS_FOUND syscall.Errno = 8308 + ERROR_DS_USER_BUFFER_TO_SMALL syscall.Errno = 8309 + ERROR_DS_ATT_IS_NOT_ON_OBJ syscall.Errno = 8310 + ERROR_DS_ILLEGAL_MOD_OPERATION syscall.Errno = 8311 + ERROR_DS_OBJ_TOO_LARGE syscall.Errno = 8312 + ERROR_DS_BAD_INSTANCE_TYPE syscall.Errno = 8313 + ERROR_DS_MASTERDSA_REQUIRED syscall.Errno = 8314 + ERROR_DS_OBJECT_CLASS_REQUIRED syscall.Errno = 8315 + ERROR_DS_MISSING_REQUIRED_ATT syscall.Errno = 8316 + ERROR_DS_ATT_NOT_DEF_FOR_CLASS syscall.Errno = 8317 + ERROR_DS_ATT_ALREADY_EXISTS syscall.Errno = 8318 + ERROR_DS_CANT_ADD_ATT_VALUES syscall.Errno = 8320 + ERROR_DS_SINGLE_VALUE_CONSTRAINT syscall.Errno = 8321 + ERROR_DS_RANGE_CONSTRAINT syscall.Errno = 8322 + ERROR_DS_ATT_VAL_ALREADY_EXISTS syscall.Errno = 8323 + ERROR_DS_CANT_REM_MISSING_ATT syscall.Errno = 8324 + ERROR_DS_CANT_REM_MISSING_ATT_VAL syscall.Errno = 8325 + ERROR_DS_ROOT_CANT_BE_SUBREF syscall.Errno = 8326 + ERROR_DS_NO_CHAINING syscall.Errno = 8327 + ERROR_DS_NO_CHAINED_EVAL syscall.Errno = 8328 + ERROR_DS_NO_PARENT_OBJECT syscall.Errno = 8329 + ERROR_DS_PARENT_IS_AN_ALIAS syscall.Errno = 8330 + ERROR_DS_CANT_MIX_MASTER_AND_REPS syscall.Errno = 8331 + ERROR_DS_CHILDREN_EXIST syscall.Errno = 8332 + ERROR_DS_OBJ_NOT_FOUND syscall.Errno = 8333 + ERROR_DS_ALIASED_OBJ_MISSING syscall.Errno = 8334 + ERROR_DS_BAD_NAME_SYNTAX syscall.Errno = 8335 + ERROR_DS_ALIAS_POINTS_TO_ALIAS syscall.Errno = 8336 + ERROR_DS_CANT_DEREF_ALIAS syscall.Errno = 8337 + ERROR_DS_OUT_OF_SCOPE syscall.Errno = 8338 + ERROR_DS_OBJECT_BEING_REMOVED syscall.Errno = 8339 + ERROR_DS_CANT_DELETE_DSA_OBJ syscall.Errno = 8340 + ERROR_DS_GENERIC_ERROR syscall.Errno = 8341 + ERROR_DS_DSA_MUST_BE_INT_MASTER syscall.Errno = 8342 + ERROR_DS_CLASS_NOT_DSA syscall.Errno = 8343 + ERROR_DS_INSUFF_ACCESS_RIGHTS syscall.Errno = 8344 + ERROR_DS_ILLEGAL_SUPERIOR syscall.Errno = 8345 + ERROR_DS_ATTRIBUTE_OWNED_BY_SAM syscall.Errno = 8346 + ERROR_DS_NAME_TOO_MANY_PARTS syscall.Errno = 8347 + ERROR_DS_NAME_TOO_LONG syscall.Errno = 8348 + ERROR_DS_NAME_VALUE_TOO_LONG syscall.Errno = 8349 + ERROR_DS_NAME_UNPARSEABLE syscall.Errno = 8350 + ERROR_DS_NAME_TYPE_UNKNOWN syscall.Errno = 8351 + ERROR_DS_NOT_AN_OBJECT syscall.Errno = 8352 + ERROR_DS_SEC_DESC_TOO_SHORT syscall.Errno = 8353 + ERROR_DS_SEC_DESC_INVALID syscall.Errno = 8354 + ERROR_DS_NO_DELETED_NAME syscall.Errno = 8355 + ERROR_DS_SUBREF_MUST_HAVE_PARENT syscall.Errno = 8356 + ERROR_DS_NCNAME_MUST_BE_NC syscall.Errno = 8357 + ERROR_DS_CANT_ADD_SYSTEM_ONLY syscall.Errno = 8358 + ERROR_DS_CLASS_MUST_BE_CONCRETE syscall.Errno = 8359 + ERROR_DS_INVALID_DMD syscall.Errno = 8360 + ERROR_DS_OBJ_GUID_EXISTS syscall.Errno = 8361 + ERROR_DS_NOT_ON_BACKLINK syscall.Errno = 8362 + ERROR_DS_NO_CROSSREF_FOR_NC syscall.Errno = 8363 + ERROR_DS_SHUTTING_DOWN syscall.Errno = 8364 + ERROR_DS_UNKNOWN_OPERATION syscall.Errno = 8365 + ERROR_DS_INVALID_ROLE_OWNER syscall.Errno = 8366 + ERROR_DS_COULDNT_CONTACT_FSMO syscall.Errno = 8367 + ERROR_DS_CROSS_NC_DN_RENAME syscall.Errno = 8368 + ERROR_DS_CANT_MOD_SYSTEM_ONLY syscall.Errno = 8369 + ERROR_DS_REPLICATOR_ONLY syscall.Errno = 8370 + ERROR_DS_OBJ_CLASS_NOT_DEFINED syscall.Errno = 8371 + ERROR_DS_OBJ_CLASS_NOT_SUBCLASS syscall.Errno = 8372 + ERROR_DS_NAME_REFERENCE_INVALID syscall.Errno = 8373 + ERROR_DS_CROSS_REF_EXISTS syscall.Errno = 8374 + ERROR_DS_CANT_DEL_MASTER_CROSSREF syscall.Errno = 8375 + ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD syscall.Errno = 8376 + ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX syscall.Errno = 8377 + ERROR_DS_DUP_RDN syscall.Errno = 8378 + ERROR_DS_DUP_OID syscall.Errno = 8379 + ERROR_DS_DUP_MAPI_ID syscall.Errno = 8380 + ERROR_DS_DUP_SCHEMA_ID_GUID syscall.Errno = 8381 + ERROR_DS_DUP_LDAP_DISPLAY_NAME syscall.Errno = 8382 + ERROR_DS_SEMANTIC_ATT_TEST syscall.Errno = 8383 + ERROR_DS_SYNTAX_MISMATCH syscall.Errno = 8384 + ERROR_DS_EXISTS_IN_MUST_HAVE syscall.Errno = 8385 + ERROR_DS_EXISTS_IN_MAY_HAVE syscall.Errno = 8386 + ERROR_DS_NONEXISTENT_MAY_HAVE syscall.Errno = 8387 + ERROR_DS_NONEXISTENT_MUST_HAVE syscall.Errno = 8388 + ERROR_DS_AUX_CLS_TEST_FAIL syscall.Errno = 8389 + ERROR_DS_NONEXISTENT_POSS_SUP syscall.Errno = 8390 + ERROR_DS_SUB_CLS_TEST_FAIL syscall.Errno = 8391 + ERROR_DS_BAD_RDN_ATT_ID_SYNTAX syscall.Errno = 8392 + ERROR_DS_EXISTS_IN_AUX_CLS syscall.Errno = 8393 + ERROR_DS_EXISTS_IN_SUB_CLS syscall.Errno = 8394 + ERROR_DS_EXISTS_IN_POSS_SUP syscall.Errno = 8395 + ERROR_DS_RECALCSCHEMA_FAILED syscall.Errno = 8396 + ERROR_DS_TREE_DELETE_NOT_FINISHED syscall.Errno = 8397 + ERROR_DS_CANT_DELETE syscall.Errno = 8398 + ERROR_DS_ATT_SCHEMA_REQ_ID syscall.Errno = 8399 + ERROR_DS_BAD_ATT_SCHEMA_SYNTAX syscall.Errno = 8400 + ERROR_DS_CANT_CACHE_ATT syscall.Errno = 8401 + ERROR_DS_CANT_CACHE_CLASS syscall.Errno = 8402 + ERROR_DS_CANT_REMOVE_ATT_CACHE syscall.Errno = 8403 + ERROR_DS_CANT_REMOVE_CLASS_CACHE syscall.Errno = 8404 + ERROR_DS_CANT_RETRIEVE_DN syscall.Errno = 8405 + ERROR_DS_MISSING_SUPREF syscall.Errno = 8406 + ERROR_DS_CANT_RETRIEVE_INSTANCE syscall.Errno = 8407 + ERROR_DS_CODE_INCONSISTENCY syscall.Errno = 8408 + ERROR_DS_DATABASE_ERROR syscall.Errno = 8409 + ERROR_DS_GOVERNSID_MISSING syscall.Errno = 8410 + ERROR_DS_MISSING_EXPECTED_ATT syscall.Errno = 8411 + ERROR_DS_NCNAME_MISSING_CR_REF syscall.Errno = 8412 + ERROR_DS_SECURITY_CHECKING_ERROR syscall.Errno = 8413 + ERROR_DS_SCHEMA_NOT_LOADED syscall.Errno = 8414 + ERROR_DS_SCHEMA_ALLOC_FAILED syscall.Errno = 8415 + ERROR_DS_ATT_SCHEMA_REQ_SYNTAX syscall.Errno = 8416 + ERROR_DS_GCVERIFY_ERROR syscall.Errno = 8417 + ERROR_DS_DRA_SCHEMA_MISMATCH syscall.Errno = 8418 + ERROR_DS_CANT_FIND_DSA_OBJ syscall.Errno = 8419 + ERROR_DS_CANT_FIND_EXPECTED_NC syscall.Errno = 8420 + ERROR_DS_CANT_FIND_NC_IN_CACHE syscall.Errno = 8421 + ERROR_DS_CANT_RETRIEVE_CHILD syscall.Errno = 8422 + ERROR_DS_SECURITY_ILLEGAL_MODIFY syscall.Errno = 8423 + ERROR_DS_CANT_REPLACE_HIDDEN_REC syscall.Errno = 8424 + ERROR_DS_BAD_HIERARCHY_FILE syscall.Errno = 8425 + ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED syscall.Errno = 8426 + ERROR_DS_CONFIG_PARAM_MISSING syscall.Errno = 8427 + ERROR_DS_COUNTING_AB_INDICES_FAILED syscall.Errno = 8428 + ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED syscall.Errno = 8429 + ERROR_DS_INTERNAL_FAILURE syscall.Errno = 8430 + ERROR_DS_UNKNOWN_ERROR syscall.Errno = 8431 + ERROR_DS_ROOT_REQUIRES_CLASS_TOP syscall.Errno = 8432 + ERROR_DS_REFUSING_FSMO_ROLES syscall.Errno = 8433 + ERROR_DS_MISSING_FSMO_SETTINGS syscall.Errno = 8434 + ERROR_DS_UNABLE_TO_SURRENDER_ROLES syscall.Errno = 8435 + ERROR_DS_DRA_GENERIC syscall.Errno = 8436 + ERROR_DS_DRA_INVALID_PARAMETER syscall.Errno = 8437 + ERROR_DS_DRA_BUSY syscall.Errno = 8438 + ERROR_DS_DRA_BAD_DN syscall.Errno = 8439 + ERROR_DS_DRA_BAD_NC syscall.Errno = 8440 + ERROR_DS_DRA_DN_EXISTS syscall.Errno = 8441 + ERROR_DS_DRA_INTERNAL_ERROR syscall.Errno = 8442 + ERROR_DS_DRA_INCONSISTENT_DIT syscall.Errno = 8443 + ERROR_DS_DRA_CONNECTION_FAILED syscall.Errno = 8444 + ERROR_DS_DRA_BAD_INSTANCE_TYPE syscall.Errno = 8445 + ERROR_DS_DRA_OUT_OF_MEM syscall.Errno = 8446 + ERROR_DS_DRA_MAIL_PROBLEM syscall.Errno = 8447 + ERROR_DS_DRA_REF_ALREADY_EXISTS syscall.Errno = 8448 + ERROR_DS_DRA_REF_NOT_FOUND syscall.Errno = 8449 + ERROR_DS_DRA_OBJ_IS_REP_SOURCE syscall.Errno = 8450 + ERROR_DS_DRA_DB_ERROR syscall.Errno = 8451 + ERROR_DS_DRA_NO_REPLICA syscall.Errno = 8452 + ERROR_DS_DRA_ACCESS_DENIED syscall.Errno = 8453 + ERROR_DS_DRA_NOT_SUPPORTED syscall.Errno = 8454 + ERROR_DS_DRA_RPC_CANCELLED syscall.Errno = 8455 + ERROR_DS_DRA_SOURCE_DISABLED syscall.Errno = 8456 + ERROR_DS_DRA_SINK_DISABLED syscall.Errno = 8457 + ERROR_DS_DRA_NAME_COLLISION syscall.Errno = 8458 + ERROR_DS_DRA_SOURCE_REINSTALLED syscall.Errno = 8459 + ERROR_DS_DRA_MISSING_PARENT syscall.Errno = 8460 + ERROR_DS_DRA_PREEMPTED syscall.Errno = 8461 + ERROR_DS_DRA_ABANDON_SYNC syscall.Errno = 8462 + ERROR_DS_DRA_SHUTDOWN syscall.Errno = 8463 + ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET syscall.Errno = 8464 + ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA syscall.Errno = 8465 + ERROR_DS_DRA_EXTN_CONNECTION_FAILED syscall.Errno = 8466 + ERROR_DS_INSTALL_SCHEMA_MISMATCH syscall.Errno = 8467 + ERROR_DS_DUP_LINK_ID syscall.Errno = 8468 + ERROR_DS_NAME_ERROR_RESOLVING syscall.Errno = 8469 + ERROR_DS_NAME_ERROR_NOT_FOUND syscall.Errno = 8470 + ERROR_DS_NAME_ERROR_NOT_UNIQUE syscall.Errno = 8471 + ERROR_DS_NAME_ERROR_NO_MAPPING syscall.Errno = 8472 + ERROR_DS_NAME_ERROR_DOMAIN_ONLY syscall.Errno = 8473 + ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING syscall.Errno = 8474 + ERROR_DS_CONSTRUCTED_ATT_MOD syscall.Errno = 8475 + ERROR_DS_WRONG_OM_OBJ_CLASS syscall.Errno = 8476 + ERROR_DS_DRA_REPL_PENDING syscall.Errno = 8477 + ERROR_DS_DS_REQUIRED syscall.Errno = 8478 + ERROR_DS_INVALID_LDAP_DISPLAY_NAME syscall.Errno = 8479 + ERROR_DS_NON_BASE_SEARCH syscall.Errno = 8480 + ERROR_DS_CANT_RETRIEVE_ATTS syscall.Errno = 8481 + ERROR_DS_BACKLINK_WITHOUT_LINK syscall.Errno = 8482 + ERROR_DS_EPOCH_MISMATCH syscall.Errno = 8483 + ERROR_DS_SRC_NAME_MISMATCH syscall.Errno = 8484 + ERROR_DS_SRC_AND_DST_NC_IDENTICAL syscall.Errno = 8485 + ERROR_DS_DST_NC_MISMATCH syscall.Errno = 8486 + ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC syscall.Errno = 8487 + ERROR_DS_SRC_GUID_MISMATCH syscall.Errno = 8488 + ERROR_DS_CANT_MOVE_DELETED_OBJECT syscall.Errno = 8489 + ERROR_DS_PDC_OPERATION_IN_PROGRESS syscall.Errno = 8490 + ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD syscall.Errno = 8491 + ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION syscall.Errno = 8492 + ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS syscall.Errno = 8493 + ERROR_DS_NC_MUST_HAVE_NC_PARENT syscall.Errno = 8494 + ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE syscall.Errno = 8495 + ERROR_DS_DST_DOMAIN_NOT_NATIVE syscall.Errno = 8496 + ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER syscall.Errno = 8497 + ERROR_DS_CANT_MOVE_ACCOUNT_GROUP syscall.Errno = 8498 + ERROR_DS_CANT_MOVE_RESOURCE_GROUP syscall.Errno = 8499 + ERROR_DS_INVALID_SEARCH_FLAG syscall.Errno = 8500 + ERROR_DS_NO_TREE_DELETE_ABOVE_NC syscall.Errno = 8501 + ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE syscall.Errno = 8502 + ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE syscall.Errno = 8503 + ERROR_DS_SAM_INIT_FAILURE syscall.Errno = 8504 + ERROR_DS_SENSITIVE_GROUP_VIOLATION syscall.Errno = 8505 + ERROR_DS_CANT_MOD_PRIMARYGROUPID syscall.Errno = 8506 + ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD syscall.Errno = 8507 + ERROR_DS_NONSAFE_SCHEMA_CHANGE syscall.Errno = 8508 + ERROR_DS_SCHEMA_UPDATE_DISALLOWED syscall.Errno = 8509 + ERROR_DS_CANT_CREATE_UNDER_SCHEMA syscall.Errno = 8510 + ERROR_DS_INSTALL_NO_SRC_SCH_VERSION syscall.Errno = 8511 + ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE syscall.Errno = 8512 + ERROR_DS_INVALID_GROUP_TYPE syscall.Errno = 8513 + ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN syscall.Errno = 8514 + ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN syscall.Errno = 8515 + ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER syscall.Errno = 8516 + ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER syscall.Errno = 8517 + ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER syscall.Errno = 8518 + ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER syscall.Errno = 8519 + ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER syscall.Errno = 8520 + ERROR_DS_HAVE_PRIMARY_MEMBERS syscall.Errno = 8521 + ERROR_DS_STRING_SD_CONVERSION_FAILED syscall.Errno = 8522 + ERROR_DS_NAMING_MASTER_GC syscall.Errno = 8523 + ERROR_DS_DNS_LOOKUP_FAILURE syscall.Errno = 8524 + ERROR_DS_COULDNT_UPDATE_SPNS syscall.Errno = 8525 + ERROR_DS_CANT_RETRIEVE_SD syscall.Errno = 8526 + ERROR_DS_KEY_NOT_UNIQUE syscall.Errno = 8527 + ERROR_DS_WRONG_LINKED_ATT_SYNTAX syscall.Errno = 8528 + ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD syscall.Errno = 8529 + ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY syscall.Errno = 8530 + ERROR_DS_CANT_START syscall.Errno = 8531 + ERROR_DS_INIT_FAILURE syscall.Errno = 8532 + ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION syscall.Errno = 8533 + ERROR_DS_SOURCE_DOMAIN_IN_FOREST syscall.Errno = 8534 + ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST syscall.Errno = 8535 + ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED syscall.Errno = 8536 + ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN syscall.Errno = 8537 + ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER syscall.Errno = 8538 + ERROR_DS_SRC_SID_EXISTS_IN_FOREST syscall.Errno = 8539 + ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH syscall.Errno = 8540 + ERROR_SAM_INIT_FAILURE syscall.Errno = 8541 + ERROR_DS_DRA_SCHEMA_INFO_SHIP syscall.Errno = 8542 + ERROR_DS_DRA_SCHEMA_CONFLICT syscall.Errno = 8543 + ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT syscall.Errno = 8544 + ERROR_DS_DRA_OBJ_NC_MISMATCH syscall.Errno = 8545 + ERROR_DS_NC_STILL_HAS_DSAS syscall.Errno = 8546 + ERROR_DS_GC_REQUIRED syscall.Errno = 8547 + ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY syscall.Errno = 8548 + ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS syscall.Errno = 8549 + ERROR_DS_CANT_ADD_TO_GC syscall.Errno = 8550 + ERROR_DS_NO_CHECKPOINT_WITH_PDC syscall.Errno = 8551 + ERROR_DS_SOURCE_AUDITING_NOT_ENABLED syscall.Errno = 8552 + ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC syscall.Errno = 8553 + ERROR_DS_INVALID_NAME_FOR_SPN syscall.Errno = 8554 + ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS syscall.Errno = 8555 + ERROR_DS_UNICODEPWD_NOT_IN_QUOTES syscall.Errno = 8556 + ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED syscall.Errno = 8557 + ERROR_DS_MUST_BE_RUN_ON_DST_DC syscall.Errno = 8558 + ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER syscall.Errno = 8559 + ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ syscall.Errno = 8560 + ERROR_DS_INIT_FAILURE_CONSOLE syscall.Errno = 8561 + ERROR_DS_SAM_INIT_FAILURE_CONSOLE syscall.Errno = 8562 + ERROR_DS_FOREST_VERSION_TOO_HIGH syscall.Errno = 8563 + ERROR_DS_DOMAIN_VERSION_TOO_HIGH syscall.Errno = 8564 + ERROR_DS_FOREST_VERSION_TOO_LOW syscall.Errno = 8565 + ERROR_DS_DOMAIN_VERSION_TOO_LOW syscall.Errno = 8566 + ERROR_DS_INCOMPATIBLE_VERSION syscall.Errno = 8567 + ERROR_DS_LOW_DSA_VERSION syscall.Errno = 8568 + ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN syscall.Errno = 8569 + ERROR_DS_NOT_SUPPORTED_SORT_ORDER syscall.Errno = 8570 + ERROR_DS_NAME_NOT_UNIQUE syscall.Errno = 8571 + ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4 syscall.Errno = 8572 + ERROR_DS_OUT_OF_VERSION_STORE syscall.Errno = 8573 + ERROR_DS_INCOMPATIBLE_CONTROLS_USED syscall.Errno = 8574 + ERROR_DS_NO_REF_DOMAIN syscall.Errno = 8575 + ERROR_DS_RESERVED_LINK_ID syscall.Errno = 8576 + ERROR_DS_LINK_ID_NOT_AVAILABLE syscall.Errno = 8577 + ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER syscall.Errno = 8578 + ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE syscall.Errno = 8579 + ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC syscall.Errno = 8580 + ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG syscall.Errno = 8581 + ERROR_DS_MODIFYDN_WRONG_GRANDPARENT syscall.Errno = 8582 + ERROR_DS_NAME_ERROR_TRUST_REFERRAL syscall.Errno = 8583 + ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER syscall.Errno = 8584 + ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD syscall.Errno = 8585 + ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 syscall.Errno = 8586 + ERROR_DS_THREAD_LIMIT_EXCEEDED syscall.Errno = 8587 + ERROR_DS_NOT_CLOSEST syscall.Errno = 8588 + ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF syscall.Errno = 8589 + ERROR_DS_SINGLE_USER_MODE_FAILED syscall.Errno = 8590 + ERROR_DS_NTDSCRIPT_SYNTAX_ERROR syscall.Errno = 8591 + ERROR_DS_NTDSCRIPT_PROCESS_ERROR syscall.Errno = 8592 + ERROR_DS_DIFFERENT_REPL_EPOCHS syscall.Errno = 8593 + ERROR_DS_DRS_EXTENSIONS_CHANGED syscall.Errno = 8594 + ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR syscall.Errno = 8595 + ERROR_DS_NO_MSDS_INTID syscall.Errno = 8596 + ERROR_DS_DUP_MSDS_INTID syscall.Errno = 8597 + ERROR_DS_EXISTS_IN_RDNATTID syscall.Errno = 8598 + ERROR_DS_AUTHORIZATION_FAILED syscall.Errno = 8599 + ERROR_DS_INVALID_SCRIPT syscall.Errno = 8600 + ERROR_DS_REMOTE_CROSSREF_OP_FAILED syscall.Errno = 8601 + ERROR_DS_CROSS_REF_BUSY syscall.Errno = 8602 + ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN syscall.Errno = 8603 + ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC syscall.Errno = 8604 + ERROR_DS_DUPLICATE_ID_FOUND syscall.Errno = 8605 + ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT syscall.Errno = 8606 + ERROR_DS_GROUP_CONVERSION_ERROR syscall.Errno = 8607 + ERROR_DS_CANT_MOVE_APP_BASIC_GROUP syscall.Errno = 8608 + ERROR_DS_CANT_MOVE_APP_QUERY_GROUP syscall.Errno = 8609 + ERROR_DS_ROLE_NOT_VERIFIED syscall.Errno = 8610 + ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL syscall.Errno = 8611 + ERROR_DS_DOMAIN_RENAME_IN_PROGRESS syscall.Errno = 8612 + ERROR_DS_EXISTING_AD_CHILD_NC syscall.Errno = 8613 + ERROR_DS_REPL_LIFETIME_EXCEEDED syscall.Errno = 8614 + ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER syscall.Errno = 8615 + ERROR_DS_LDAP_SEND_QUEUE_FULL syscall.Errno = 8616 + ERROR_DS_DRA_OUT_SCHEDULE_WINDOW syscall.Errno = 8617 + ERROR_DS_POLICY_NOT_KNOWN syscall.Errno = 8618 + ERROR_NO_SITE_SETTINGS_OBJECT syscall.Errno = 8619 + ERROR_NO_SECRETS syscall.Errno = 8620 + ERROR_NO_WRITABLE_DC_FOUND syscall.Errno = 8621 + ERROR_DS_NO_SERVER_OBJECT syscall.Errno = 8622 + ERROR_DS_NO_NTDSA_OBJECT syscall.Errno = 8623 + ERROR_DS_NON_ASQ_SEARCH syscall.Errno = 8624 + ERROR_DS_AUDIT_FAILURE syscall.Errno = 8625 + ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE syscall.Errno = 8626 + ERROR_DS_INVALID_SEARCH_FLAG_TUPLE syscall.Errno = 8627 + ERROR_DS_HIERARCHY_TABLE_TOO_DEEP syscall.Errno = 8628 + ERROR_DS_DRA_CORRUPT_UTD_VECTOR syscall.Errno = 8629 + ERROR_DS_DRA_SECRETS_DENIED syscall.Errno = 8630 + ERROR_DS_RESERVED_MAPI_ID syscall.Errno = 8631 + ERROR_DS_MAPI_ID_NOT_AVAILABLE syscall.Errno = 8632 + ERROR_DS_DRA_MISSING_KRBTGT_SECRET syscall.Errno = 8633 + ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST syscall.Errno = 8634 + ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST syscall.Errno = 8635 + ERROR_INVALID_USER_PRINCIPAL_NAME syscall.Errno = 8636 + ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS syscall.Errno = 8637 + ERROR_DS_OID_NOT_FOUND syscall.Errno = 8638 + ERROR_DS_DRA_RECYCLED_TARGET syscall.Errno = 8639 + ERROR_DS_DISALLOWED_NC_REDIRECT syscall.Errno = 8640 + ERROR_DS_HIGH_ADLDS_FFL syscall.Errno = 8641 + ERROR_DS_HIGH_DSA_VERSION syscall.Errno = 8642 + ERROR_DS_LOW_ADLDS_FFL syscall.Errno = 8643 + ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION syscall.Errno = 8644 + ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED syscall.Errno = 8645 + ERROR_INCORRECT_ACCOUNT_TYPE syscall.Errno = 8646 + ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST syscall.Errno = 8647 + ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST syscall.Errno = 8648 + ERROR_DS_MISSING_FOREST_TRUST syscall.Errno = 8649 + ERROR_DS_VALUE_KEY_NOT_UNIQUE syscall.Errno = 8650 + DNS_ERROR_RESPONSE_CODES_BASE syscall.Errno = 9000 + DNS_ERROR_RCODE_NO_ERROR = ERROR_SUCCESS + DNS_ERROR_MASK syscall.Errno = 0x00002328 + DNS_ERROR_RCODE_FORMAT_ERROR syscall.Errno = 9001 + DNS_ERROR_RCODE_SERVER_FAILURE syscall.Errno = 9002 + DNS_ERROR_RCODE_NAME_ERROR syscall.Errno = 9003 + DNS_ERROR_RCODE_NOT_IMPLEMENTED syscall.Errno = 9004 + DNS_ERROR_RCODE_REFUSED syscall.Errno = 9005 + DNS_ERROR_RCODE_YXDOMAIN syscall.Errno = 9006 + DNS_ERROR_RCODE_YXRRSET syscall.Errno = 9007 + DNS_ERROR_RCODE_NXRRSET syscall.Errno = 9008 + DNS_ERROR_RCODE_NOTAUTH syscall.Errno = 9009 + DNS_ERROR_RCODE_NOTZONE syscall.Errno = 9010 + DNS_ERROR_RCODE_BADSIG syscall.Errno = 9016 + DNS_ERROR_RCODE_BADKEY syscall.Errno = 9017 + DNS_ERROR_RCODE_BADTIME syscall.Errno = 9018 + DNS_ERROR_RCODE_LAST = DNS_ERROR_RCODE_BADTIME + DNS_ERROR_DNSSEC_BASE syscall.Errno = 9100 + DNS_ERROR_KEYMASTER_REQUIRED syscall.Errno = 9101 + DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE syscall.Errno = 9102 + DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 syscall.Errno = 9103 + DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS syscall.Errno = 9104 + DNS_ERROR_UNSUPPORTED_ALGORITHM syscall.Errno = 9105 + DNS_ERROR_INVALID_KEY_SIZE syscall.Errno = 9106 + DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE syscall.Errno = 9107 + DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION syscall.Errno = 9108 + DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR syscall.Errno = 9109 + DNS_ERROR_UNEXPECTED_CNG_ERROR syscall.Errno = 9110 + DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION syscall.Errno = 9111 + DNS_ERROR_KSP_NOT_ACCESSIBLE syscall.Errno = 9112 + DNS_ERROR_TOO_MANY_SKDS syscall.Errno = 9113 + DNS_ERROR_INVALID_ROLLOVER_PERIOD syscall.Errno = 9114 + DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET syscall.Errno = 9115 + DNS_ERROR_ROLLOVER_IN_PROGRESS syscall.Errno = 9116 + DNS_ERROR_STANDBY_KEY_NOT_PRESENT syscall.Errno = 9117 + DNS_ERROR_NOT_ALLOWED_ON_ZSK syscall.Errno = 9118 + DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD syscall.Errno = 9119 + DNS_ERROR_ROLLOVER_ALREADY_QUEUED syscall.Errno = 9120 + DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE syscall.Errno = 9121 + DNS_ERROR_BAD_KEYMASTER syscall.Errno = 9122 + DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD syscall.Errno = 9123 + DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT syscall.Errno = 9124 + DNS_ERROR_DNSSEC_IS_DISABLED syscall.Errno = 9125 + DNS_ERROR_INVALID_XML syscall.Errno = 9126 + DNS_ERROR_NO_VALID_TRUST_ANCHORS syscall.Errno = 9127 + DNS_ERROR_ROLLOVER_NOT_POKEABLE syscall.Errno = 9128 + DNS_ERROR_NSEC3_NAME_COLLISION syscall.Errno = 9129 + DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 syscall.Errno = 9130 + DNS_ERROR_PACKET_FMT_BASE syscall.Errno = 9500 + DNS_INFO_NO_RECORDS syscall.Errno = 9501 + DNS_ERROR_BAD_PACKET syscall.Errno = 9502 + DNS_ERROR_NO_PACKET syscall.Errno = 9503 + DNS_ERROR_RCODE syscall.Errno = 9504 + DNS_ERROR_UNSECURE_PACKET syscall.Errno = 9505 + DNS_STATUS_PACKET_UNSECURE = DNS_ERROR_UNSECURE_PACKET + DNS_REQUEST_PENDING syscall.Errno = 9506 + DNS_ERROR_NO_MEMORY = ERROR_OUTOFMEMORY + DNS_ERROR_INVALID_NAME = ERROR_INVALID_NAME + DNS_ERROR_INVALID_DATA = ERROR_INVALID_DATA + DNS_ERROR_GENERAL_API_BASE syscall.Errno = 9550 + DNS_ERROR_INVALID_TYPE syscall.Errno = 9551 + DNS_ERROR_INVALID_IP_ADDRESS syscall.Errno = 9552 + DNS_ERROR_INVALID_PROPERTY syscall.Errno = 9553 + DNS_ERROR_TRY_AGAIN_LATER syscall.Errno = 9554 + DNS_ERROR_NOT_UNIQUE syscall.Errno = 9555 + DNS_ERROR_NON_RFC_NAME syscall.Errno = 9556 + DNS_STATUS_FQDN syscall.Errno = 9557 + DNS_STATUS_DOTTED_NAME syscall.Errno = 9558 + DNS_STATUS_SINGLE_PART_NAME syscall.Errno = 9559 + DNS_ERROR_INVALID_NAME_CHAR syscall.Errno = 9560 + DNS_ERROR_NUMERIC_NAME syscall.Errno = 9561 + DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER syscall.Errno = 9562 + DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION syscall.Errno = 9563 + DNS_ERROR_CANNOT_FIND_ROOT_HINTS syscall.Errno = 9564 + DNS_ERROR_INCONSISTENT_ROOT_HINTS syscall.Errno = 9565 + DNS_ERROR_DWORD_VALUE_TOO_SMALL syscall.Errno = 9566 + DNS_ERROR_DWORD_VALUE_TOO_LARGE syscall.Errno = 9567 + DNS_ERROR_BACKGROUND_LOADING syscall.Errno = 9568 + DNS_ERROR_NOT_ALLOWED_ON_RODC syscall.Errno = 9569 + DNS_ERROR_NOT_ALLOWED_UNDER_DNAME syscall.Errno = 9570 + DNS_ERROR_DELEGATION_REQUIRED syscall.Errno = 9571 + DNS_ERROR_INVALID_POLICY_TABLE syscall.Errno = 9572 + DNS_ERROR_ADDRESS_REQUIRED syscall.Errno = 9573 + DNS_ERROR_ZONE_BASE syscall.Errno = 9600 + DNS_ERROR_ZONE_DOES_NOT_EXIST syscall.Errno = 9601 + DNS_ERROR_NO_ZONE_INFO syscall.Errno = 9602 + DNS_ERROR_INVALID_ZONE_OPERATION syscall.Errno = 9603 + DNS_ERROR_ZONE_CONFIGURATION_ERROR syscall.Errno = 9604 + DNS_ERROR_ZONE_HAS_NO_SOA_RECORD syscall.Errno = 9605 + DNS_ERROR_ZONE_HAS_NO_NS_RECORDS syscall.Errno = 9606 + DNS_ERROR_ZONE_LOCKED syscall.Errno = 9607 + DNS_ERROR_ZONE_CREATION_FAILED syscall.Errno = 9608 + DNS_ERROR_ZONE_ALREADY_EXISTS syscall.Errno = 9609 + DNS_ERROR_AUTOZONE_ALREADY_EXISTS syscall.Errno = 9610 + DNS_ERROR_INVALID_ZONE_TYPE syscall.Errno = 9611 + DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP syscall.Errno = 9612 + DNS_ERROR_ZONE_NOT_SECONDARY syscall.Errno = 9613 + DNS_ERROR_NEED_SECONDARY_ADDRESSES syscall.Errno = 9614 + DNS_ERROR_WINS_INIT_FAILED syscall.Errno = 9615 + DNS_ERROR_NEED_WINS_SERVERS syscall.Errno = 9616 + DNS_ERROR_NBSTAT_INIT_FAILED syscall.Errno = 9617 + DNS_ERROR_SOA_DELETE_INVALID syscall.Errno = 9618 + DNS_ERROR_FORWARDER_ALREADY_EXISTS syscall.Errno = 9619 + DNS_ERROR_ZONE_REQUIRES_MASTER_IP syscall.Errno = 9620 + DNS_ERROR_ZONE_IS_SHUTDOWN syscall.Errno = 9621 + DNS_ERROR_ZONE_LOCKED_FOR_SIGNING syscall.Errno = 9622 + DNS_ERROR_DATAFILE_BASE syscall.Errno = 9650 + DNS_ERROR_PRIMARY_REQUIRES_DATAFILE syscall.Errno = 9651 + DNS_ERROR_INVALID_DATAFILE_NAME syscall.Errno = 9652 + DNS_ERROR_DATAFILE_OPEN_FAILURE syscall.Errno = 9653 + DNS_ERROR_FILE_WRITEBACK_FAILED syscall.Errno = 9654 + DNS_ERROR_DATAFILE_PARSING syscall.Errno = 9655 + DNS_ERROR_DATABASE_BASE syscall.Errno = 9700 + DNS_ERROR_RECORD_DOES_NOT_EXIST syscall.Errno = 9701 + DNS_ERROR_RECORD_FORMAT syscall.Errno = 9702 + DNS_ERROR_NODE_CREATION_FAILED syscall.Errno = 9703 + DNS_ERROR_UNKNOWN_RECORD_TYPE syscall.Errno = 9704 + DNS_ERROR_RECORD_TIMED_OUT syscall.Errno = 9705 + DNS_ERROR_NAME_NOT_IN_ZONE syscall.Errno = 9706 + DNS_ERROR_CNAME_LOOP syscall.Errno = 9707 + DNS_ERROR_NODE_IS_CNAME syscall.Errno = 9708 + DNS_ERROR_CNAME_COLLISION syscall.Errno = 9709 + DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT syscall.Errno = 9710 + DNS_ERROR_RECORD_ALREADY_EXISTS syscall.Errno = 9711 + DNS_ERROR_SECONDARY_DATA syscall.Errno = 9712 + DNS_ERROR_NO_CREATE_CACHE_DATA syscall.Errno = 9713 + DNS_ERROR_NAME_DOES_NOT_EXIST syscall.Errno = 9714 + DNS_WARNING_PTR_CREATE_FAILED syscall.Errno = 9715 + DNS_WARNING_DOMAIN_UNDELETED syscall.Errno = 9716 + DNS_ERROR_DS_UNAVAILABLE syscall.Errno = 9717 + DNS_ERROR_DS_ZONE_ALREADY_EXISTS syscall.Errno = 9718 + DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE syscall.Errno = 9719 + DNS_ERROR_NODE_IS_DNAME syscall.Errno = 9720 + DNS_ERROR_DNAME_COLLISION syscall.Errno = 9721 + DNS_ERROR_ALIAS_LOOP syscall.Errno = 9722 + DNS_ERROR_OPERATION_BASE syscall.Errno = 9750 + DNS_INFO_AXFR_COMPLETE syscall.Errno = 9751 + DNS_ERROR_AXFR syscall.Errno = 9752 + DNS_INFO_ADDED_LOCAL_WINS syscall.Errno = 9753 + DNS_ERROR_SECURE_BASE syscall.Errno = 9800 + DNS_STATUS_CONTINUE_NEEDED syscall.Errno = 9801 + DNS_ERROR_SETUP_BASE syscall.Errno = 9850 + DNS_ERROR_NO_TCPIP syscall.Errno = 9851 + DNS_ERROR_NO_DNS_SERVERS syscall.Errno = 9852 + DNS_ERROR_DP_BASE syscall.Errno = 9900 + DNS_ERROR_DP_DOES_NOT_EXIST syscall.Errno = 9901 + DNS_ERROR_DP_ALREADY_EXISTS syscall.Errno = 9902 + DNS_ERROR_DP_NOT_ENLISTED syscall.Errno = 9903 + DNS_ERROR_DP_ALREADY_ENLISTED syscall.Errno = 9904 + DNS_ERROR_DP_NOT_AVAILABLE syscall.Errno = 9905 + DNS_ERROR_DP_FSMO_ERROR syscall.Errno = 9906 + DNS_ERROR_RRL_NOT_ENABLED syscall.Errno = 9911 + DNS_ERROR_RRL_INVALID_WINDOW_SIZE syscall.Errno = 9912 + DNS_ERROR_RRL_INVALID_IPV4_PREFIX syscall.Errno = 9913 + DNS_ERROR_RRL_INVALID_IPV6_PREFIX syscall.Errno = 9914 + DNS_ERROR_RRL_INVALID_TC_RATE syscall.Errno = 9915 + DNS_ERROR_RRL_INVALID_LEAK_RATE syscall.Errno = 9916 + DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE syscall.Errno = 9917 + DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS syscall.Errno = 9921 + DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST syscall.Errno = 9922 + DNS_ERROR_VIRTUALIZATION_TREE_LOCKED syscall.Errno = 9923 + DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME syscall.Errno = 9924 + DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE syscall.Errno = 9925 + DNS_ERROR_ZONESCOPE_ALREADY_EXISTS syscall.Errno = 9951 + DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST syscall.Errno = 9952 + DNS_ERROR_DEFAULT_ZONESCOPE syscall.Errno = 9953 + DNS_ERROR_INVALID_ZONESCOPE_NAME syscall.Errno = 9954 + DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES syscall.Errno = 9955 + DNS_ERROR_LOAD_ZONESCOPE_FAILED syscall.Errno = 9956 + DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED syscall.Errno = 9957 + DNS_ERROR_INVALID_SCOPE_NAME syscall.Errno = 9958 + DNS_ERROR_SCOPE_DOES_NOT_EXIST syscall.Errno = 9959 + DNS_ERROR_DEFAULT_SCOPE syscall.Errno = 9960 + DNS_ERROR_INVALID_SCOPE_OPERATION syscall.Errno = 9961 + DNS_ERROR_SCOPE_LOCKED syscall.Errno = 9962 + DNS_ERROR_SCOPE_ALREADY_EXISTS syscall.Errno = 9963 + DNS_ERROR_POLICY_ALREADY_EXISTS syscall.Errno = 9971 + DNS_ERROR_POLICY_DOES_NOT_EXIST syscall.Errno = 9972 + DNS_ERROR_POLICY_INVALID_CRITERIA syscall.Errno = 9973 + DNS_ERROR_POLICY_INVALID_SETTINGS syscall.Errno = 9974 + DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED syscall.Errno = 9975 + DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST syscall.Errno = 9976 + DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS syscall.Errno = 9977 + DNS_ERROR_SUBNET_DOES_NOT_EXIST syscall.Errno = 9978 + DNS_ERROR_SUBNET_ALREADY_EXISTS syscall.Errno = 9979 + DNS_ERROR_POLICY_LOCKED syscall.Errno = 9980 + DNS_ERROR_POLICY_INVALID_WEIGHT syscall.Errno = 9981 + DNS_ERROR_POLICY_INVALID_NAME syscall.Errno = 9982 + DNS_ERROR_POLICY_MISSING_CRITERIA syscall.Errno = 9983 + DNS_ERROR_INVALID_CLIENT_SUBNET_NAME syscall.Errno = 9984 + DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID syscall.Errno = 9985 + DNS_ERROR_POLICY_SCOPE_MISSING syscall.Errno = 9986 + DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED syscall.Errno = 9987 + DNS_ERROR_SERVERSCOPE_IS_REFERENCED syscall.Errno = 9988 + DNS_ERROR_ZONESCOPE_IS_REFERENCED syscall.Errno = 9989 + DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET syscall.Errno = 9990 + DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL syscall.Errno = 9991 + DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL syscall.Errno = 9992 + DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE syscall.Errno = 9993 + DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN syscall.Errno = 9994 + DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE syscall.Errno = 9995 + DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY syscall.Errno = 9996 + WSABASEERR syscall.Errno = 10000 + WSAEINTR syscall.Errno = 10004 + WSAEBADF syscall.Errno = 10009 + WSAEACCES syscall.Errno = 10013 + WSAEFAULT syscall.Errno = 10014 + WSAEINVAL syscall.Errno = 10022 + WSAEMFILE syscall.Errno = 10024 + WSAEWOULDBLOCK syscall.Errno = 10035 + WSAEINPROGRESS syscall.Errno = 10036 + WSAEALREADY syscall.Errno = 10037 + WSAENOTSOCK syscall.Errno = 10038 + WSAEDESTADDRREQ syscall.Errno = 10039 + WSAEMSGSIZE syscall.Errno = 10040 + WSAEPROTOTYPE syscall.Errno = 10041 + WSAENOPROTOOPT syscall.Errno = 10042 + WSAEPROTONOSUPPORT syscall.Errno = 10043 + WSAESOCKTNOSUPPORT syscall.Errno = 10044 + WSAEOPNOTSUPP syscall.Errno = 10045 + WSAEPFNOSUPPORT syscall.Errno = 10046 + WSAEAFNOSUPPORT syscall.Errno = 10047 + WSAEADDRINUSE syscall.Errno = 10048 + WSAEADDRNOTAVAIL syscall.Errno = 10049 + WSAENETDOWN syscall.Errno = 10050 + WSAENETUNREACH syscall.Errno = 10051 + WSAENETRESET syscall.Errno = 10052 + WSAECONNABORTED syscall.Errno = 10053 + WSAECONNRESET syscall.Errno = 10054 + WSAENOBUFS syscall.Errno = 10055 + WSAEISCONN syscall.Errno = 10056 + WSAENOTCONN syscall.Errno = 10057 + WSAESHUTDOWN syscall.Errno = 10058 + WSAETOOMANYREFS syscall.Errno = 10059 + WSAETIMEDOUT syscall.Errno = 10060 + WSAECONNREFUSED syscall.Errno = 10061 + WSAELOOP syscall.Errno = 10062 + WSAENAMETOOLONG syscall.Errno = 10063 + WSAEHOSTDOWN syscall.Errno = 10064 + WSAEHOSTUNREACH syscall.Errno = 10065 + WSAENOTEMPTY syscall.Errno = 10066 + WSAEPROCLIM syscall.Errno = 10067 + WSAEUSERS syscall.Errno = 10068 + WSAEDQUOT syscall.Errno = 10069 + WSAESTALE syscall.Errno = 10070 + WSAEREMOTE syscall.Errno = 10071 + WSASYSNOTREADY syscall.Errno = 10091 + WSAVERNOTSUPPORTED syscall.Errno = 10092 + WSANOTINITIALISED syscall.Errno = 10093 + WSAEDISCON syscall.Errno = 10101 + WSAENOMORE syscall.Errno = 10102 + WSAECANCELLED syscall.Errno = 10103 + WSAEINVALIDPROCTABLE syscall.Errno = 10104 + WSAEINVALIDPROVIDER syscall.Errno = 10105 + WSAEPROVIDERFAILEDINIT syscall.Errno = 10106 + WSASYSCALLFAILURE syscall.Errno = 10107 + WSASERVICE_NOT_FOUND syscall.Errno = 10108 + WSATYPE_NOT_FOUND syscall.Errno = 10109 + WSA_E_NO_MORE syscall.Errno = 10110 + WSA_E_CANCELLED syscall.Errno = 10111 + WSAEREFUSED syscall.Errno = 10112 + WSAHOST_NOT_FOUND syscall.Errno = 11001 + WSATRY_AGAIN syscall.Errno = 11002 + WSANO_RECOVERY syscall.Errno = 11003 + WSANO_DATA syscall.Errno = 11004 + WSA_QOS_RECEIVERS syscall.Errno = 11005 + WSA_QOS_SENDERS syscall.Errno = 11006 + WSA_QOS_NO_SENDERS syscall.Errno = 11007 + WSA_QOS_NO_RECEIVERS syscall.Errno = 11008 + WSA_QOS_REQUEST_CONFIRMED syscall.Errno = 11009 + WSA_QOS_ADMISSION_FAILURE syscall.Errno = 11010 + WSA_QOS_POLICY_FAILURE syscall.Errno = 11011 + WSA_QOS_BAD_STYLE syscall.Errno = 11012 + WSA_QOS_BAD_OBJECT syscall.Errno = 11013 + WSA_QOS_TRAFFIC_CTRL_ERROR syscall.Errno = 11014 + WSA_QOS_GENERIC_ERROR syscall.Errno = 11015 + WSA_QOS_ESERVICETYPE syscall.Errno = 11016 + WSA_QOS_EFLOWSPEC syscall.Errno = 11017 + WSA_QOS_EPROVSPECBUF syscall.Errno = 11018 + WSA_QOS_EFILTERSTYLE syscall.Errno = 11019 + WSA_QOS_EFILTERTYPE syscall.Errno = 11020 + WSA_QOS_EFILTERCOUNT syscall.Errno = 11021 + WSA_QOS_EOBJLENGTH syscall.Errno = 11022 + WSA_QOS_EFLOWCOUNT syscall.Errno = 11023 + WSA_QOS_EUNKOWNPSOBJ syscall.Errno = 11024 + WSA_QOS_EPOLICYOBJ syscall.Errno = 11025 + WSA_QOS_EFLOWDESC syscall.Errno = 11026 + WSA_QOS_EPSFLOWSPEC syscall.Errno = 11027 + WSA_QOS_EPSFILTERSPEC syscall.Errno = 11028 + WSA_QOS_ESDMODEOBJ syscall.Errno = 11029 + WSA_QOS_ESHAPERATEOBJ syscall.Errno = 11030 + WSA_QOS_RESERVED_PETYPE syscall.Errno = 11031 + WSA_SECURE_HOST_NOT_FOUND syscall.Errno = 11032 + WSA_IPSEC_NAME_POLICY_ERROR syscall.Errno = 11033 + ERROR_IPSEC_QM_POLICY_EXISTS syscall.Errno = 13000 + ERROR_IPSEC_QM_POLICY_NOT_FOUND syscall.Errno = 13001 + ERROR_IPSEC_QM_POLICY_IN_USE syscall.Errno = 13002 + ERROR_IPSEC_MM_POLICY_EXISTS syscall.Errno = 13003 + ERROR_IPSEC_MM_POLICY_NOT_FOUND syscall.Errno = 13004 + ERROR_IPSEC_MM_POLICY_IN_USE syscall.Errno = 13005 + ERROR_IPSEC_MM_FILTER_EXISTS syscall.Errno = 13006 + ERROR_IPSEC_MM_FILTER_NOT_FOUND syscall.Errno = 13007 + ERROR_IPSEC_TRANSPORT_FILTER_EXISTS syscall.Errno = 13008 + ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND syscall.Errno = 13009 + ERROR_IPSEC_MM_AUTH_EXISTS syscall.Errno = 13010 + ERROR_IPSEC_MM_AUTH_NOT_FOUND syscall.Errno = 13011 + ERROR_IPSEC_MM_AUTH_IN_USE syscall.Errno = 13012 + ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND syscall.Errno = 13013 + ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND syscall.Errno = 13014 + ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND syscall.Errno = 13015 + ERROR_IPSEC_TUNNEL_FILTER_EXISTS syscall.Errno = 13016 + ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND syscall.Errno = 13017 + ERROR_IPSEC_MM_FILTER_PENDING_DELETION syscall.Errno = 13018 + ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION syscall.Errno = 13019 + ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION syscall.Errno = 13020 + ERROR_IPSEC_MM_POLICY_PENDING_DELETION syscall.Errno = 13021 + ERROR_IPSEC_MM_AUTH_PENDING_DELETION syscall.Errno = 13022 + ERROR_IPSEC_QM_POLICY_PENDING_DELETION syscall.Errno = 13023 + WARNING_IPSEC_MM_POLICY_PRUNED syscall.Errno = 13024 + WARNING_IPSEC_QM_POLICY_PRUNED syscall.Errno = 13025 + ERROR_IPSEC_IKE_NEG_STATUS_BEGIN syscall.Errno = 13800 + ERROR_IPSEC_IKE_AUTH_FAIL syscall.Errno = 13801 + ERROR_IPSEC_IKE_ATTRIB_FAIL syscall.Errno = 13802 + ERROR_IPSEC_IKE_NEGOTIATION_PENDING syscall.Errno = 13803 + ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR syscall.Errno = 13804 + ERROR_IPSEC_IKE_TIMED_OUT syscall.Errno = 13805 + ERROR_IPSEC_IKE_NO_CERT syscall.Errno = 13806 + ERROR_IPSEC_IKE_SA_DELETED syscall.Errno = 13807 + ERROR_IPSEC_IKE_SA_REAPED syscall.Errno = 13808 + ERROR_IPSEC_IKE_MM_ACQUIRE_DROP syscall.Errno = 13809 + ERROR_IPSEC_IKE_QM_ACQUIRE_DROP syscall.Errno = 13810 + ERROR_IPSEC_IKE_QUEUE_DROP_MM syscall.Errno = 13811 + ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM syscall.Errno = 13812 + ERROR_IPSEC_IKE_DROP_NO_RESPONSE syscall.Errno = 13813 + ERROR_IPSEC_IKE_MM_DELAY_DROP syscall.Errno = 13814 + ERROR_IPSEC_IKE_QM_DELAY_DROP syscall.Errno = 13815 + ERROR_IPSEC_IKE_ERROR syscall.Errno = 13816 + ERROR_IPSEC_IKE_CRL_FAILED syscall.Errno = 13817 + ERROR_IPSEC_IKE_INVALID_KEY_USAGE syscall.Errno = 13818 + ERROR_IPSEC_IKE_INVALID_CERT_TYPE syscall.Errno = 13819 + ERROR_IPSEC_IKE_NO_PRIVATE_KEY syscall.Errno = 13820 + ERROR_IPSEC_IKE_SIMULTANEOUS_REKEY syscall.Errno = 13821 + ERROR_IPSEC_IKE_DH_FAIL syscall.Errno = 13822 + ERROR_IPSEC_IKE_CRITICAL_PAYLOAD_NOT_RECOGNIZED syscall.Errno = 13823 + ERROR_IPSEC_IKE_INVALID_HEADER syscall.Errno = 13824 + ERROR_IPSEC_IKE_NO_POLICY syscall.Errno = 13825 + ERROR_IPSEC_IKE_INVALID_SIGNATURE syscall.Errno = 13826 + ERROR_IPSEC_IKE_KERBEROS_ERROR syscall.Errno = 13827 + ERROR_IPSEC_IKE_NO_PUBLIC_KEY syscall.Errno = 13828 + ERROR_IPSEC_IKE_PROCESS_ERR syscall.Errno = 13829 + ERROR_IPSEC_IKE_PROCESS_ERR_SA syscall.Errno = 13830 + ERROR_IPSEC_IKE_PROCESS_ERR_PROP syscall.Errno = 13831 + ERROR_IPSEC_IKE_PROCESS_ERR_TRANS syscall.Errno = 13832 + ERROR_IPSEC_IKE_PROCESS_ERR_KE syscall.Errno = 13833 + ERROR_IPSEC_IKE_PROCESS_ERR_ID syscall.Errno = 13834 + ERROR_IPSEC_IKE_PROCESS_ERR_CERT syscall.Errno = 13835 + ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ syscall.Errno = 13836 + ERROR_IPSEC_IKE_PROCESS_ERR_HASH syscall.Errno = 13837 + ERROR_IPSEC_IKE_PROCESS_ERR_SIG syscall.Errno = 13838 + ERROR_IPSEC_IKE_PROCESS_ERR_NONCE syscall.Errno = 13839 + ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY syscall.Errno = 13840 + ERROR_IPSEC_IKE_PROCESS_ERR_DELETE syscall.Errno = 13841 + ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR syscall.Errno = 13842 + ERROR_IPSEC_IKE_INVALID_PAYLOAD syscall.Errno = 13843 + ERROR_IPSEC_IKE_LOAD_SOFT_SA syscall.Errno = 13844 + ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN syscall.Errno = 13845 + ERROR_IPSEC_IKE_INVALID_COOKIE syscall.Errno = 13846 + ERROR_IPSEC_IKE_NO_PEER_CERT syscall.Errno = 13847 + ERROR_IPSEC_IKE_PEER_CRL_FAILED syscall.Errno = 13848 + ERROR_IPSEC_IKE_POLICY_CHANGE syscall.Errno = 13849 + ERROR_IPSEC_IKE_NO_MM_POLICY syscall.Errno = 13850 + ERROR_IPSEC_IKE_NOTCBPRIV syscall.Errno = 13851 + ERROR_IPSEC_IKE_SECLOADFAIL syscall.Errno = 13852 + ERROR_IPSEC_IKE_FAILSSPINIT syscall.Errno = 13853 + ERROR_IPSEC_IKE_FAILQUERYSSP syscall.Errno = 13854 + ERROR_IPSEC_IKE_SRVACQFAIL syscall.Errno = 13855 + ERROR_IPSEC_IKE_SRVQUERYCRED syscall.Errno = 13856 + ERROR_IPSEC_IKE_GETSPIFAIL syscall.Errno = 13857 + ERROR_IPSEC_IKE_INVALID_FILTER syscall.Errno = 13858 + ERROR_IPSEC_IKE_OUT_OF_MEMORY syscall.Errno = 13859 + ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED syscall.Errno = 13860 + ERROR_IPSEC_IKE_INVALID_POLICY syscall.Errno = 13861 + ERROR_IPSEC_IKE_UNKNOWN_DOI syscall.Errno = 13862 + ERROR_IPSEC_IKE_INVALID_SITUATION syscall.Errno = 13863 + ERROR_IPSEC_IKE_DH_FAILURE syscall.Errno = 13864 + ERROR_IPSEC_IKE_INVALID_GROUP syscall.Errno = 13865 + ERROR_IPSEC_IKE_ENCRYPT syscall.Errno = 13866 + ERROR_IPSEC_IKE_DECRYPT syscall.Errno = 13867 + ERROR_IPSEC_IKE_POLICY_MATCH syscall.Errno = 13868 + ERROR_IPSEC_IKE_UNSUPPORTED_ID syscall.Errno = 13869 + ERROR_IPSEC_IKE_INVALID_HASH syscall.Errno = 13870 + ERROR_IPSEC_IKE_INVALID_HASH_ALG syscall.Errno = 13871 + ERROR_IPSEC_IKE_INVALID_HASH_SIZE syscall.Errno = 13872 + ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG syscall.Errno = 13873 + ERROR_IPSEC_IKE_INVALID_AUTH_ALG syscall.Errno = 13874 + ERROR_IPSEC_IKE_INVALID_SIG syscall.Errno = 13875 + ERROR_IPSEC_IKE_LOAD_FAILED syscall.Errno = 13876 + ERROR_IPSEC_IKE_RPC_DELETE syscall.Errno = 13877 + ERROR_IPSEC_IKE_BENIGN_REINIT syscall.Errno = 13878 + ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY syscall.Errno = 13879 + ERROR_IPSEC_IKE_INVALID_MAJOR_VERSION syscall.Errno = 13880 + ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN syscall.Errno = 13881 + ERROR_IPSEC_IKE_MM_LIMIT syscall.Errno = 13882 + ERROR_IPSEC_IKE_NEGOTIATION_DISABLED syscall.Errno = 13883 + ERROR_IPSEC_IKE_QM_LIMIT syscall.Errno = 13884 + ERROR_IPSEC_IKE_MM_EXPIRED syscall.Errno = 13885 + ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID syscall.Errno = 13886 + ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH syscall.Errno = 13887 + ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID syscall.Errno = 13888 + ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD syscall.Errno = 13889 + ERROR_IPSEC_IKE_DOS_COOKIE_SENT syscall.Errno = 13890 + ERROR_IPSEC_IKE_SHUTTING_DOWN syscall.Errno = 13891 + ERROR_IPSEC_IKE_CGA_AUTH_FAILED syscall.Errno = 13892 + ERROR_IPSEC_IKE_PROCESS_ERR_NATOA syscall.Errno = 13893 + ERROR_IPSEC_IKE_INVALID_MM_FOR_QM syscall.Errno = 13894 + ERROR_IPSEC_IKE_QM_EXPIRED syscall.Errno = 13895 + ERROR_IPSEC_IKE_TOO_MANY_FILTERS syscall.Errno = 13896 + ERROR_IPSEC_IKE_NEG_STATUS_END syscall.Errno = 13897 + ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL syscall.Errno = 13898 + ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE syscall.Errno = 13899 + ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING syscall.Errno = 13900 + ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING syscall.Errno = 13901 + ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS syscall.Errno = 13902 + ERROR_IPSEC_IKE_RATELIMIT_DROP syscall.Errno = 13903 + ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE syscall.Errno = 13904 + ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE syscall.Errno = 13905 + ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE syscall.Errno = 13906 + ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY syscall.Errno = 13907 + ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE syscall.Errno = 13908 + ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END syscall.Errno = 13909 + ERROR_IPSEC_BAD_SPI syscall.Errno = 13910 + ERROR_IPSEC_SA_LIFETIME_EXPIRED syscall.Errno = 13911 + ERROR_IPSEC_WRONG_SA syscall.Errno = 13912 + ERROR_IPSEC_REPLAY_CHECK_FAILED syscall.Errno = 13913 + ERROR_IPSEC_INVALID_PACKET syscall.Errno = 13914 + ERROR_IPSEC_INTEGRITY_CHECK_FAILED syscall.Errno = 13915 + ERROR_IPSEC_CLEAR_TEXT_DROP syscall.Errno = 13916 + ERROR_IPSEC_AUTH_FIREWALL_DROP syscall.Errno = 13917 + ERROR_IPSEC_THROTTLE_DROP syscall.Errno = 13918 + ERROR_IPSEC_DOSP_BLOCK syscall.Errno = 13925 + ERROR_IPSEC_DOSP_RECEIVED_MULTICAST syscall.Errno = 13926 + ERROR_IPSEC_DOSP_INVALID_PACKET syscall.Errno = 13927 + ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED syscall.Errno = 13928 + ERROR_IPSEC_DOSP_MAX_ENTRIES syscall.Errno = 13929 + ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED syscall.Errno = 13930 + ERROR_IPSEC_DOSP_NOT_INSTALLED syscall.Errno = 13931 + ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES syscall.Errno = 13932 + ERROR_SXS_SECTION_NOT_FOUND syscall.Errno = 14000 + ERROR_SXS_CANT_GEN_ACTCTX syscall.Errno = 14001 + ERROR_SXS_INVALID_ACTCTXDATA_FORMAT syscall.Errno = 14002 + ERROR_SXS_ASSEMBLY_NOT_FOUND syscall.Errno = 14003 + ERROR_SXS_MANIFEST_FORMAT_ERROR syscall.Errno = 14004 + ERROR_SXS_MANIFEST_PARSE_ERROR syscall.Errno = 14005 + ERROR_SXS_ACTIVATION_CONTEXT_DISABLED syscall.Errno = 14006 + ERROR_SXS_KEY_NOT_FOUND syscall.Errno = 14007 + ERROR_SXS_VERSION_CONFLICT syscall.Errno = 14008 + ERROR_SXS_WRONG_SECTION_TYPE syscall.Errno = 14009 + ERROR_SXS_THREAD_QUERIES_DISABLED syscall.Errno = 14010 + ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET syscall.Errno = 14011 + ERROR_SXS_UNKNOWN_ENCODING_GROUP syscall.Errno = 14012 + ERROR_SXS_UNKNOWN_ENCODING syscall.Errno = 14013 + ERROR_SXS_INVALID_XML_NAMESPACE_URI syscall.Errno = 14014 + ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED syscall.Errno = 14015 + ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED syscall.Errno = 14016 + ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE syscall.Errno = 14017 + ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE syscall.Errno = 14018 + ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE syscall.Errno = 14019 + ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT syscall.Errno = 14020 + ERROR_SXS_DUPLICATE_DLL_NAME syscall.Errno = 14021 + ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME syscall.Errno = 14022 + ERROR_SXS_DUPLICATE_CLSID syscall.Errno = 14023 + ERROR_SXS_DUPLICATE_IID syscall.Errno = 14024 + ERROR_SXS_DUPLICATE_TLBID syscall.Errno = 14025 + ERROR_SXS_DUPLICATE_PROGID syscall.Errno = 14026 + ERROR_SXS_DUPLICATE_ASSEMBLY_NAME syscall.Errno = 14027 + ERROR_SXS_FILE_HASH_MISMATCH syscall.Errno = 14028 + ERROR_SXS_POLICY_PARSE_ERROR syscall.Errno = 14029 + ERROR_SXS_XML_E_MISSINGQUOTE syscall.Errno = 14030 + ERROR_SXS_XML_E_COMMENTSYNTAX syscall.Errno = 14031 + ERROR_SXS_XML_E_BADSTARTNAMECHAR syscall.Errno = 14032 + ERROR_SXS_XML_E_BADNAMECHAR syscall.Errno = 14033 + ERROR_SXS_XML_E_BADCHARINSTRING syscall.Errno = 14034 + ERROR_SXS_XML_E_XMLDECLSYNTAX syscall.Errno = 14035 + ERROR_SXS_XML_E_BADCHARDATA syscall.Errno = 14036 + ERROR_SXS_XML_E_MISSINGWHITESPACE syscall.Errno = 14037 + ERROR_SXS_XML_E_EXPECTINGTAGEND syscall.Errno = 14038 + ERROR_SXS_XML_E_MISSINGSEMICOLON syscall.Errno = 14039 + ERROR_SXS_XML_E_UNBALANCEDPAREN syscall.Errno = 14040 + ERROR_SXS_XML_E_INTERNALERROR syscall.Errno = 14041 + ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE syscall.Errno = 14042 + ERROR_SXS_XML_E_INCOMPLETE_ENCODING syscall.Errno = 14043 + ERROR_SXS_XML_E_MISSING_PAREN syscall.Errno = 14044 + ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE syscall.Errno = 14045 + ERROR_SXS_XML_E_MULTIPLE_COLONS syscall.Errno = 14046 + ERROR_SXS_XML_E_INVALID_DECIMAL syscall.Errno = 14047 + ERROR_SXS_XML_E_INVALID_HEXIDECIMAL syscall.Errno = 14048 + ERROR_SXS_XML_E_INVALID_UNICODE syscall.Errno = 14049 + ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK syscall.Errno = 14050 + ERROR_SXS_XML_E_UNEXPECTEDENDTAG syscall.Errno = 14051 + ERROR_SXS_XML_E_UNCLOSEDTAG syscall.Errno = 14052 + ERROR_SXS_XML_E_DUPLICATEATTRIBUTE syscall.Errno = 14053 + ERROR_SXS_XML_E_MULTIPLEROOTS syscall.Errno = 14054 + ERROR_SXS_XML_E_INVALIDATROOTLEVEL syscall.Errno = 14055 + ERROR_SXS_XML_E_BADXMLDECL syscall.Errno = 14056 + ERROR_SXS_XML_E_MISSINGROOT syscall.Errno = 14057 + ERROR_SXS_XML_E_UNEXPECTEDEOF syscall.Errno = 14058 + ERROR_SXS_XML_E_BADPEREFINSUBSET syscall.Errno = 14059 + ERROR_SXS_XML_E_UNCLOSEDSTARTTAG syscall.Errno = 14060 + ERROR_SXS_XML_E_UNCLOSEDENDTAG syscall.Errno = 14061 + ERROR_SXS_XML_E_UNCLOSEDSTRING syscall.Errno = 14062 + ERROR_SXS_XML_E_UNCLOSEDCOMMENT syscall.Errno = 14063 + ERROR_SXS_XML_E_UNCLOSEDDECL syscall.Errno = 14064 + ERROR_SXS_XML_E_UNCLOSEDCDATA syscall.Errno = 14065 + ERROR_SXS_XML_E_RESERVEDNAMESPACE syscall.Errno = 14066 + ERROR_SXS_XML_E_INVALIDENCODING syscall.Errno = 14067 + ERROR_SXS_XML_E_INVALIDSWITCH syscall.Errno = 14068 + ERROR_SXS_XML_E_BADXMLCASE syscall.Errno = 14069 + ERROR_SXS_XML_E_INVALID_STANDALONE syscall.Errno = 14070 + ERROR_SXS_XML_E_UNEXPECTED_STANDALONE syscall.Errno = 14071 + ERROR_SXS_XML_E_INVALID_VERSION syscall.Errno = 14072 + ERROR_SXS_XML_E_MISSINGEQUALS syscall.Errno = 14073 + ERROR_SXS_PROTECTION_RECOVERY_FAILED syscall.Errno = 14074 + ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT syscall.Errno = 14075 + ERROR_SXS_PROTECTION_CATALOG_NOT_VALID syscall.Errno = 14076 + ERROR_SXS_UNTRANSLATABLE_HRESULT syscall.Errno = 14077 + ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING syscall.Errno = 14078 + ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE syscall.Errno = 14079 + ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME syscall.Errno = 14080 + ERROR_SXS_ASSEMBLY_MISSING syscall.Errno = 14081 + ERROR_SXS_CORRUPT_ACTIVATION_STACK syscall.Errno = 14082 + ERROR_SXS_CORRUPTION syscall.Errno = 14083 + ERROR_SXS_EARLY_DEACTIVATION syscall.Errno = 14084 + ERROR_SXS_INVALID_DEACTIVATION syscall.Errno = 14085 + ERROR_SXS_MULTIPLE_DEACTIVATION syscall.Errno = 14086 + ERROR_SXS_PROCESS_TERMINATION_REQUESTED syscall.Errno = 14087 + ERROR_SXS_RELEASE_ACTIVATION_CONTEXT syscall.Errno = 14088 + ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY syscall.Errno = 14089 + ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE syscall.Errno = 14090 + ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME syscall.Errno = 14091 + ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE syscall.Errno = 14092 + ERROR_SXS_IDENTITY_PARSE_ERROR syscall.Errno = 14093 + ERROR_MALFORMED_SUBSTITUTION_STRING syscall.Errno = 14094 + ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN syscall.Errno = 14095 + ERROR_UNMAPPED_SUBSTITUTION_STRING syscall.Errno = 14096 + ERROR_SXS_ASSEMBLY_NOT_LOCKED syscall.Errno = 14097 + ERROR_SXS_COMPONENT_STORE_CORRUPT syscall.Errno = 14098 + ERROR_ADVANCED_INSTALLER_FAILED syscall.Errno = 14099 + ERROR_XML_ENCODING_MISMATCH syscall.Errno = 14100 + ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT syscall.Errno = 14101 + ERROR_SXS_IDENTITIES_DIFFERENT syscall.Errno = 14102 + ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT syscall.Errno = 14103 + ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY syscall.Errno = 14104 + ERROR_SXS_MANIFEST_TOO_BIG syscall.Errno = 14105 + ERROR_SXS_SETTING_NOT_REGISTERED syscall.Errno = 14106 + ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE syscall.Errno = 14107 + ERROR_SMI_PRIMITIVE_INSTALLER_FAILED syscall.Errno = 14108 + ERROR_GENERIC_COMMAND_FAILED syscall.Errno = 14109 + ERROR_SXS_FILE_HASH_MISSING syscall.Errno = 14110 + ERROR_EVT_INVALID_CHANNEL_PATH syscall.Errno = 15000 + ERROR_EVT_INVALID_QUERY syscall.Errno = 15001 + ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND syscall.Errno = 15002 + ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND syscall.Errno = 15003 + ERROR_EVT_INVALID_PUBLISHER_NAME syscall.Errno = 15004 + ERROR_EVT_INVALID_EVENT_DATA syscall.Errno = 15005 + ERROR_EVT_CHANNEL_NOT_FOUND syscall.Errno = 15007 + ERROR_EVT_MALFORMED_XML_TEXT syscall.Errno = 15008 + ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL syscall.Errno = 15009 + ERROR_EVT_CONFIGURATION_ERROR syscall.Errno = 15010 + ERROR_EVT_QUERY_RESULT_STALE syscall.Errno = 15011 + ERROR_EVT_QUERY_RESULT_INVALID_POSITION syscall.Errno = 15012 + ERROR_EVT_NON_VALIDATING_MSXML syscall.Errno = 15013 + ERROR_EVT_FILTER_ALREADYSCOPED syscall.Errno = 15014 + ERROR_EVT_FILTER_NOTELTSET syscall.Errno = 15015 + ERROR_EVT_FILTER_INVARG syscall.Errno = 15016 + ERROR_EVT_FILTER_INVTEST syscall.Errno = 15017 + ERROR_EVT_FILTER_INVTYPE syscall.Errno = 15018 + ERROR_EVT_FILTER_PARSEERR syscall.Errno = 15019 + ERROR_EVT_FILTER_UNSUPPORTEDOP syscall.Errno = 15020 + ERROR_EVT_FILTER_UNEXPECTEDTOKEN syscall.Errno = 15021 + ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL syscall.Errno = 15022 + ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE syscall.Errno = 15023 + ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE syscall.Errno = 15024 + ERROR_EVT_CHANNEL_CANNOT_ACTIVATE syscall.Errno = 15025 + ERROR_EVT_FILTER_TOO_COMPLEX syscall.Errno = 15026 + ERROR_EVT_MESSAGE_NOT_FOUND syscall.Errno = 15027 + ERROR_EVT_MESSAGE_ID_NOT_FOUND syscall.Errno = 15028 + ERROR_EVT_UNRESOLVED_VALUE_INSERT syscall.Errno = 15029 + ERROR_EVT_UNRESOLVED_PARAMETER_INSERT syscall.Errno = 15030 + ERROR_EVT_MAX_INSERTS_REACHED syscall.Errno = 15031 + ERROR_EVT_EVENT_DEFINITION_NOT_FOUND syscall.Errno = 15032 + ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND syscall.Errno = 15033 + ERROR_EVT_VERSION_TOO_OLD syscall.Errno = 15034 + ERROR_EVT_VERSION_TOO_NEW syscall.Errno = 15035 + ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY syscall.Errno = 15036 + ERROR_EVT_PUBLISHER_DISABLED syscall.Errno = 15037 + ERROR_EVT_FILTER_OUT_OF_RANGE syscall.Errno = 15038 + ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE syscall.Errno = 15080 + ERROR_EC_LOG_DISABLED syscall.Errno = 15081 + ERROR_EC_CIRCULAR_FORWARDING syscall.Errno = 15082 + ERROR_EC_CREDSTORE_FULL syscall.Errno = 15083 + ERROR_EC_CRED_NOT_FOUND syscall.Errno = 15084 + ERROR_EC_NO_ACTIVE_CHANNEL syscall.Errno = 15085 + ERROR_MUI_FILE_NOT_FOUND syscall.Errno = 15100 + ERROR_MUI_INVALID_FILE syscall.Errno = 15101 + ERROR_MUI_INVALID_RC_CONFIG syscall.Errno = 15102 + ERROR_MUI_INVALID_LOCALE_NAME syscall.Errno = 15103 + ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME syscall.Errno = 15104 + ERROR_MUI_FILE_NOT_LOADED syscall.Errno = 15105 + ERROR_RESOURCE_ENUM_USER_STOP syscall.Errno = 15106 + ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED syscall.Errno = 15107 + ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME syscall.Errno = 15108 + ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE syscall.Errno = 15110 + ERROR_MRM_INVALID_PRICONFIG syscall.Errno = 15111 + ERROR_MRM_INVALID_FILE_TYPE syscall.Errno = 15112 + ERROR_MRM_UNKNOWN_QUALIFIER syscall.Errno = 15113 + ERROR_MRM_INVALID_QUALIFIER_VALUE syscall.Errno = 15114 + ERROR_MRM_NO_CANDIDATE syscall.Errno = 15115 + ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE syscall.Errno = 15116 + ERROR_MRM_RESOURCE_TYPE_MISMATCH syscall.Errno = 15117 + ERROR_MRM_DUPLICATE_MAP_NAME syscall.Errno = 15118 + ERROR_MRM_DUPLICATE_ENTRY syscall.Errno = 15119 + ERROR_MRM_INVALID_RESOURCE_IDENTIFIER syscall.Errno = 15120 + ERROR_MRM_FILEPATH_TOO_LONG syscall.Errno = 15121 + ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE syscall.Errno = 15122 + ERROR_MRM_INVALID_PRI_FILE syscall.Errno = 15126 + ERROR_MRM_NAMED_RESOURCE_NOT_FOUND syscall.Errno = 15127 + ERROR_MRM_MAP_NOT_FOUND syscall.Errno = 15135 + ERROR_MRM_UNSUPPORTED_PROFILE_TYPE syscall.Errno = 15136 + ERROR_MRM_INVALID_QUALIFIER_OPERATOR syscall.Errno = 15137 + ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE syscall.Errno = 15138 + ERROR_MRM_AUTOMERGE_ENABLED syscall.Errno = 15139 + ERROR_MRM_TOO_MANY_RESOURCES syscall.Errno = 15140 + ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_MERGE syscall.Errno = 15141 + ERROR_MRM_UNSUPPORTED_FILE_TYPE_FOR_LOAD_UNLOAD_PRI_FILE syscall.Errno = 15142 + ERROR_MRM_NO_CURRENT_VIEW_ON_THREAD syscall.Errno = 15143 + ERROR_DIFFERENT_PROFILE_RESOURCE_MANAGER_EXIST syscall.Errno = 15144 + ERROR_OPERATION_NOT_ALLOWED_FROM_SYSTEM_COMPONENT syscall.Errno = 15145 + ERROR_MRM_DIRECT_REF_TO_NON_DEFAULT_RESOURCE syscall.Errno = 15146 + ERROR_MRM_GENERATION_COUNT_MISMATCH syscall.Errno = 15147 + ERROR_PRI_MERGE_VERSION_MISMATCH syscall.Errno = 15148 + ERROR_PRI_MERGE_MISSING_SCHEMA syscall.Errno = 15149 + ERROR_PRI_MERGE_LOAD_FILE_FAILED syscall.Errno = 15150 + ERROR_PRI_MERGE_ADD_FILE_FAILED syscall.Errno = 15151 + ERROR_PRI_MERGE_WRITE_FILE_FAILED syscall.Errno = 15152 + ERROR_PRI_MERGE_MULTIPLE_PACKAGE_FAMILIES_NOT_ALLOWED syscall.Errno = 15153 + ERROR_PRI_MERGE_MULTIPLE_MAIN_PACKAGES_NOT_ALLOWED syscall.Errno = 15154 + ERROR_PRI_MERGE_BUNDLE_PACKAGES_NOT_ALLOWED syscall.Errno = 15155 + ERROR_PRI_MERGE_MAIN_PACKAGE_REQUIRED syscall.Errno = 15156 + ERROR_PRI_MERGE_RESOURCE_PACKAGE_REQUIRED syscall.Errno = 15157 + ERROR_PRI_MERGE_INVALID_FILE_NAME syscall.Errno = 15158 + ERROR_MRM_PACKAGE_NOT_FOUND syscall.Errno = 15159 + ERROR_MCA_INVALID_CAPABILITIES_STRING syscall.Errno = 15200 + ERROR_MCA_INVALID_VCP_VERSION syscall.Errno = 15201 + ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION syscall.Errno = 15202 + ERROR_MCA_MCCS_VERSION_MISMATCH syscall.Errno = 15203 + ERROR_MCA_UNSUPPORTED_MCCS_VERSION syscall.Errno = 15204 + ERROR_MCA_INTERNAL_ERROR syscall.Errno = 15205 + ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED syscall.Errno = 15206 + ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE syscall.Errno = 15207 + ERROR_AMBIGUOUS_SYSTEM_DEVICE syscall.Errno = 15250 + ERROR_SYSTEM_DEVICE_NOT_FOUND syscall.Errno = 15299 + ERROR_HASH_NOT_SUPPORTED syscall.Errno = 15300 + ERROR_HASH_NOT_PRESENT syscall.Errno = 15301 + ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED syscall.Errno = 15321 + ERROR_GPIO_CLIENT_INFORMATION_INVALID syscall.Errno = 15322 + ERROR_GPIO_VERSION_NOT_SUPPORTED syscall.Errno = 15323 + ERROR_GPIO_INVALID_REGISTRATION_PACKET syscall.Errno = 15324 + ERROR_GPIO_OPERATION_DENIED syscall.Errno = 15325 + ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE syscall.Errno = 15326 + ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED syscall.Errno = 15327 + ERROR_CANNOT_SWITCH_RUNLEVEL syscall.Errno = 15400 + ERROR_INVALID_RUNLEVEL_SETTING syscall.Errno = 15401 + ERROR_RUNLEVEL_SWITCH_TIMEOUT syscall.Errno = 15402 + ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT syscall.Errno = 15403 + ERROR_RUNLEVEL_SWITCH_IN_PROGRESS syscall.Errno = 15404 + ERROR_SERVICES_FAILED_AUTOSTART syscall.Errno = 15405 + ERROR_COM_TASK_STOP_PENDING syscall.Errno = 15501 + ERROR_INSTALL_OPEN_PACKAGE_FAILED syscall.Errno = 15600 + ERROR_INSTALL_PACKAGE_NOT_FOUND syscall.Errno = 15601 + ERROR_INSTALL_INVALID_PACKAGE syscall.Errno = 15602 + ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED syscall.Errno = 15603 + ERROR_INSTALL_OUT_OF_DISK_SPACE syscall.Errno = 15604 + ERROR_INSTALL_NETWORK_FAILURE syscall.Errno = 15605 + ERROR_INSTALL_REGISTRATION_FAILURE syscall.Errno = 15606 + ERROR_INSTALL_DEREGISTRATION_FAILURE syscall.Errno = 15607 + ERROR_INSTALL_CANCEL syscall.Errno = 15608 + ERROR_INSTALL_FAILED syscall.Errno = 15609 + ERROR_REMOVE_FAILED syscall.Errno = 15610 + ERROR_PACKAGE_ALREADY_EXISTS syscall.Errno = 15611 + ERROR_NEEDS_REMEDIATION syscall.Errno = 15612 + ERROR_INSTALL_PREREQUISITE_FAILED syscall.Errno = 15613 + ERROR_PACKAGE_REPOSITORY_CORRUPTED syscall.Errno = 15614 + ERROR_INSTALL_POLICY_FAILURE syscall.Errno = 15615 + ERROR_PACKAGE_UPDATING syscall.Errno = 15616 + ERROR_DEPLOYMENT_BLOCKED_BY_POLICY syscall.Errno = 15617 + ERROR_PACKAGES_IN_USE syscall.Errno = 15618 + ERROR_RECOVERY_FILE_CORRUPT syscall.Errno = 15619 + ERROR_INVALID_STAGED_SIGNATURE syscall.Errno = 15620 + ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED syscall.Errno = 15621 + ERROR_INSTALL_PACKAGE_DOWNGRADE syscall.Errno = 15622 + ERROR_SYSTEM_NEEDS_REMEDIATION syscall.Errno = 15623 + ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN syscall.Errno = 15624 + ERROR_RESILIENCY_FILE_CORRUPT syscall.Errno = 15625 + ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING syscall.Errno = 15626 + ERROR_PACKAGE_MOVE_FAILED syscall.Errno = 15627 + ERROR_INSTALL_VOLUME_NOT_EMPTY syscall.Errno = 15628 + ERROR_INSTALL_VOLUME_OFFLINE syscall.Errno = 15629 + ERROR_INSTALL_VOLUME_CORRUPT syscall.Errno = 15630 + ERROR_NEEDS_REGISTRATION syscall.Errno = 15631 + ERROR_INSTALL_WRONG_PROCESSOR_ARCHITECTURE syscall.Errno = 15632 + ERROR_DEV_SIDELOAD_LIMIT_EXCEEDED syscall.Errno = 15633 + ERROR_INSTALL_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE syscall.Errno = 15634 + ERROR_PACKAGE_NOT_SUPPORTED_ON_FILESYSTEM syscall.Errno = 15635 + ERROR_PACKAGE_MOVE_BLOCKED_BY_STREAMING syscall.Errno = 15636 + ERROR_INSTALL_OPTIONAL_PACKAGE_APPLICATIONID_NOT_UNIQUE syscall.Errno = 15637 + ERROR_PACKAGE_STAGING_ONHOLD syscall.Errno = 15638 + ERROR_INSTALL_INVALID_RELATED_SET_UPDATE syscall.Errno = 15639 + ERROR_INSTALL_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE_FULLTRUST_CAPABILITY syscall.Errno = 15640 + ERROR_DEPLOYMENT_BLOCKED_BY_USER_LOG_OFF syscall.Errno = 15641 + ERROR_PROVISION_OPTIONAL_PACKAGE_REQUIRES_MAIN_PACKAGE_PROVISIONED syscall.Errno = 15642 + ERROR_PACKAGES_REPUTATION_CHECK_FAILED syscall.Errno = 15643 + ERROR_PACKAGES_REPUTATION_CHECK_TIMEDOUT syscall.Errno = 15644 + ERROR_DEPLOYMENT_OPTION_NOT_SUPPORTED syscall.Errno = 15645 + ERROR_APPINSTALLER_ACTIVATION_BLOCKED syscall.Errno = 15646 + ERROR_REGISTRATION_FROM_REMOTE_DRIVE_NOT_SUPPORTED syscall.Errno = 15647 + APPMODEL_ERROR_NO_PACKAGE syscall.Errno = 15700 + APPMODEL_ERROR_PACKAGE_RUNTIME_CORRUPT syscall.Errno = 15701 + APPMODEL_ERROR_PACKAGE_IDENTITY_CORRUPT syscall.Errno = 15702 + APPMODEL_ERROR_NO_APPLICATION syscall.Errno = 15703 + APPMODEL_ERROR_DYNAMIC_PROPERTY_READ_FAILED syscall.Errno = 15704 + APPMODEL_ERROR_DYNAMIC_PROPERTY_INVALID syscall.Errno = 15705 + APPMODEL_ERROR_PACKAGE_NOT_AVAILABLE syscall.Errno = 15706 + ERROR_STATE_LOAD_STORE_FAILED syscall.Errno = 15800 + ERROR_STATE_GET_VERSION_FAILED syscall.Errno = 15801 + ERROR_STATE_SET_VERSION_FAILED syscall.Errno = 15802 + ERROR_STATE_STRUCTURED_RESET_FAILED syscall.Errno = 15803 + ERROR_STATE_OPEN_CONTAINER_FAILED syscall.Errno = 15804 + ERROR_STATE_CREATE_CONTAINER_FAILED syscall.Errno = 15805 + ERROR_STATE_DELETE_CONTAINER_FAILED syscall.Errno = 15806 + ERROR_STATE_READ_SETTING_FAILED syscall.Errno = 15807 + ERROR_STATE_WRITE_SETTING_FAILED syscall.Errno = 15808 + ERROR_STATE_DELETE_SETTING_FAILED syscall.Errno = 15809 + ERROR_STATE_QUERY_SETTING_FAILED syscall.Errno = 15810 + ERROR_STATE_READ_COMPOSITE_SETTING_FAILED syscall.Errno = 15811 + ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED syscall.Errno = 15812 + ERROR_STATE_ENUMERATE_CONTAINER_FAILED syscall.Errno = 15813 + ERROR_STATE_ENUMERATE_SETTINGS_FAILED syscall.Errno = 15814 + ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED syscall.Errno = 15815 + ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED syscall.Errno = 15816 + ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED syscall.Errno = 15817 + ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED syscall.Errno = 15818 + ERROR_API_UNAVAILABLE syscall.Errno = 15841 + STORE_ERROR_UNLICENSED syscall.Errno = 15861 + STORE_ERROR_UNLICENSED_USER syscall.Errno = 15862 + STORE_ERROR_PENDING_COM_TRANSACTION syscall.Errno = 15863 + STORE_ERROR_LICENSE_REVOKED syscall.Errno = 15864 + SEVERITY_SUCCESS syscall.Errno = 0 + SEVERITY_ERROR syscall.Errno = 1 + FACILITY_NT_BIT = 0x10000000 + E_NOT_SET = ERROR_NOT_FOUND + E_NOT_VALID_STATE = ERROR_INVALID_STATE + E_NOT_SUFFICIENT_BUFFER = ERROR_INSUFFICIENT_BUFFER + E_TIME_CRITICAL_THREAD = ERROR_TIME_CRITICAL_THREAD + NOERROR syscall.Errno = 0 + E_UNEXPECTED Handle = 0x8000FFFF + E_NOTIMPL Handle = 0x80004001 + E_OUTOFMEMORY Handle = 0x8007000E + E_INVALIDARG Handle = 0x80070057 + E_NOINTERFACE Handle = 0x80004002 + E_POINTER Handle = 0x80004003 + E_HANDLE Handle = 0x80070006 + E_ABORT Handle = 0x80004004 + E_FAIL Handle = 0x80004005 + E_ACCESSDENIED Handle = 0x80070005 + E_PENDING Handle = 0x8000000A + E_BOUNDS Handle = 0x8000000B + E_CHANGED_STATE Handle = 0x8000000C + E_ILLEGAL_STATE_CHANGE Handle = 0x8000000D + E_ILLEGAL_METHOD_CALL Handle = 0x8000000E + RO_E_METADATA_NAME_NOT_FOUND Handle = 0x8000000F + RO_E_METADATA_NAME_IS_NAMESPACE Handle = 0x80000010 + RO_E_METADATA_INVALID_TYPE_FORMAT Handle = 0x80000011 + RO_E_INVALID_METADATA_FILE Handle = 0x80000012 + RO_E_CLOSED Handle = 0x80000013 + RO_E_EXCLUSIVE_WRITE Handle = 0x80000014 + RO_E_CHANGE_NOTIFICATION_IN_PROGRESS Handle = 0x80000015 + RO_E_ERROR_STRING_NOT_FOUND Handle = 0x80000016 + E_STRING_NOT_NULL_TERMINATED Handle = 0x80000017 + E_ILLEGAL_DELEGATE_ASSIGNMENT Handle = 0x80000018 + E_ASYNC_OPERATION_NOT_STARTED Handle = 0x80000019 + E_APPLICATION_EXITING Handle = 0x8000001A + E_APPLICATION_VIEW_EXITING Handle = 0x8000001B + RO_E_MUST_BE_AGILE Handle = 0x8000001C + RO_E_UNSUPPORTED_FROM_MTA Handle = 0x8000001D + RO_E_COMMITTED Handle = 0x8000001E + RO_E_BLOCKED_CROSS_ASTA_CALL Handle = 0x8000001F + RO_E_CANNOT_ACTIVATE_FULL_TRUST_SERVER Handle = 0x80000020 + RO_E_CANNOT_ACTIVATE_UNIVERSAL_APPLICATION_SERVER Handle = 0x80000021 + CO_E_INIT_TLS Handle = 0x80004006 + CO_E_INIT_SHARED_ALLOCATOR Handle = 0x80004007 + CO_E_INIT_MEMORY_ALLOCATOR Handle = 0x80004008 + CO_E_INIT_CLASS_CACHE Handle = 0x80004009 + CO_E_INIT_RPC_CHANNEL Handle = 0x8000400A + CO_E_INIT_TLS_SET_CHANNEL_CONTROL Handle = 0x8000400B + CO_E_INIT_TLS_CHANNEL_CONTROL Handle = 0x8000400C + CO_E_INIT_UNACCEPTED_USER_ALLOCATOR Handle = 0x8000400D + CO_E_INIT_SCM_MUTEX_EXISTS Handle = 0x8000400E + CO_E_INIT_SCM_FILE_MAPPING_EXISTS Handle = 0x8000400F + CO_E_INIT_SCM_MAP_VIEW_OF_FILE Handle = 0x80004010 + CO_E_INIT_SCM_EXEC_FAILURE Handle = 0x80004011 + CO_E_INIT_ONLY_SINGLE_THREADED Handle = 0x80004012 + CO_E_CANT_REMOTE Handle = 0x80004013 + CO_E_BAD_SERVER_NAME Handle = 0x80004014 + CO_E_WRONG_SERVER_IDENTITY Handle = 0x80004015 + CO_E_OLE1DDE_DISABLED Handle = 0x80004016 + CO_E_RUNAS_SYNTAX Handle = 0x80004017 + CO_E_CREATEPROCESS_FAILURE Handle = 0x80004018 + CO_E_RUNAS_CREATEPROCESS_FAILURE Handle = 0x80004019 + CO_E_RUNAS_LOGON_FAILURE Handle = 0x8000401A + CO_E_LAUNCH_PERMSSION_DENIED Handle = 0x8000401B + CO_E_START_SERVICE_FAILURE Handle = 0x8000401C + CO_E_REMOTE_COMMUNICATION_FAILURE Handle = 0x8000401D + CO_E_SERVER_START_TIMEOUT Handle = 0x8000401E + CO_E_CLSREG_INCONSISTENT Handle = 0x8000401F + CO_E_IIDREG_INCONSISTENT Handle = 0x80004020 + CO_E_NOT_SUPPORTED Handle = 0x80004021 + CO_E_RELOAD_DLL Handle = 0x80004022 + CO_E_MSI_ERROR Handle = 0x80004023 + CO_E_ATTEMPT_TO_CREATE_OUTSIDE_CLIENT_CONTEXT Handle = 0x80004024 + CO_E_SERVER_PAUSED Handle = 0x80004025 + CO_E_SERVER_NOT_PAUSED Handle = 0x80004026 + CO_E_CLASS_DISABLED Handle = 0x80004027 + CO_E_CLRNOTAVAILABLE Handle = 0x80004028 + CO_E_ASYNC_WORK_REJECTED Handle = 0x80004029 + CO_E_SERVER_INIT_TIMEOUT Handle = 0x8000402A + CO_E_NO_SECCTX_IN_ACTIVATE Handle = 0x8000402B + CO_E_TRACKER_CONFIG Handle = 0x80004030 + CO_E_THREADPOOL_CONFIG Handle = 0x80004031 + CO_E_SXS_CONFIG Handle = 0x80004032 + CO_E_MALFORMED_SPN Handle = 0x80004033 + CO_E_UNREVOKED_REGISTRATION_ON_APARTMENT_SHUTDOWN Handle = 0x80004034 + CO_E_PREMATURE_STUB_RUNDOWN Handle = 0x80004035 + S_OK Handle = 0 + S_FALSE Handle = 1 + OLE_E_FIRST Handle = 0x80040000 + OLE_E_LAST Handle = 0x800400FF + OLE_S_FIRST Handle = 0x00040000 + OLE_S_LAST Handle = 0x000400FF + OLE_E_OLEVERB Handle = 0x80040000 + OLE_E_ADVF Handle = 0x80040001 + OLE_E_ENUM_NOMORE Handle = 0x80040002 + OLE_E_ADVISENOTSUPPORTED Handle = 0x80040003 + OLE_E_NOCONNECTION Handle = 0x80040004 + OLE_E_NOTRUNNING Handle = 0x80040005 + OLE_E_NOCACHE Handle = 0x80040006 + OLE_E_BLANK Handle = 0x80040007 + OLE_E_CLASSDIFF Handle = 0x80040008 + OLE_E_CANT_GETMONIKER Handle = 0x80040009 + OLE_E_CANT_BINDTOSOURCE Handle = 0x8004000A + OLE_E_STATIC Handle = 0x8004000B + OLE_E_PROMPTSAVECANCELLED Handle = 0x8004000C + OLE_E_INVALIDRECT Handle = 0x8004000D + OLE_E_WRONGCOMPOBJ Handle = 0x8004000E + OLE_E_INVALIDHWND Handle = 0x8004000F + OLE_E_NOT_INPLACEACTIVE Handle = 0x80040010 + OLE_E_CANTCONVERT Handle = 0x80040011 + OLE_E_NOSTORAGE Handle = 0x80040012 + DV_E_FORMATETC Handle = 0x80040064 + DV_E_DVTARGETDEVICE Handle = 0x80040065 + DV_E_STGMEDIUM Handle = 0x80040066 + DV_E_STATDATA Handle = 0x80040067 + DV_E_LINDEX Handle = 0x80040068 + DV_E_TYMED Handle = 0x80040069 + DV_E_CLIPFORMAT Handle = 0x8004006A + DV_E_DVASPECT Handle = 0x8004006B + DV_E_DVTARGETDEVICE_SIZE Handle = 0x8004006C + DV_E_NOIVIEWOBJECT Handle = 0x8004006D + DRAGDROP_E_FIRST syscall.Errno = 0x80040100 + DRAGDROP_E_LAST syscall.Errno = 0x8004010F + DRAGDROP_S_FIRST syscall.Errno = 0x00040100 + DRAGDROP_S_LAST syscall.Errno = 0x0004010F + DRAGDROP_E_NOTREGISTERED Handle = 0x80040100 + DRAGDROP_E_ALREADYREGISTERED Handle = 0x80040101 + DRAGDROP_E_INVALIDHWND Handle = 0x80040102 + DRAGDROP_E_CONCURRENT_DRAG_ATTEMPTED Handle = 0x80040103 + CLASSFACTORY_E_FIRST syscall.Errno = 0x80040110 + CLASSFACTORY_E_LAST syscall.Errno = 0x8004011F + CLASSFACTORY_S_FIRST syscall.Errno = 0x00040110 + CLASSFACTORY_S_LAST syscall.Errno = 0x0004011F + CLASS_E_NOAGGREGATION Handle = 0x80040110 + CLASS_E_CLASSNOTAVAILABLE Handle = 0x80040111 + CLASS_E_NOTLICENSED Handle = 0x80040112 + MARSHAL_E_FIRST syscall.Errno = 0x80040120 + MARSHAL_E_LAST syscall.Errno = 0x8004012F + MARSHAL_S_FIRST syscall.Errno = 0x00040120 + MARSHAL_S_LAST syscall.Errno = 0x0004012F + DATA_E_FIRST syscall.Errno = 0x80040130 + DATA_E_LAST syscall.Errno = 0x8004013F + DATA_S_FIRST syscall.Errno = 0x00040130 + DATA_S_LAST syscall.Errno = 0x0004013F + VIEW_E_FIRST syscall.Errno = 0x80040140 + VIEW_E_LAST syscall.Errno = 0x8004014F + VIEW_S_FIRST syscall.Errno = 0x00040140 + VIEW_S_LAST syscall.Errno = 0x0004014F + VIEW_E_DRAW Handle = 0x80040140 + REGDB_E_FIRST syscall.Errno = 0x80040150 + REGDB_E_LAST syscall.Errno = 0x8004015F + REGDB_S_FIRST syscall.Errno = 0x00040150 + REGDB_S_LAST syscall.Errno = 0x0004015F + REGDB_E_READREGDB Handle = 0x80040150 + REGDB_E_WRITEREGDB Handle = 0x80040151 + REGDB_E_KEYMISSING Handle = 0x80040152 + REGDB_E_INVALIDVALUE Handle = 0x80040153 + REGDB_E_CLASSNOTREG Handle = 0x80040154 + REGDB_E_IIDNOTREG Handle = 0x80040155 + REGDB_E_BADTHREADINGMODEL Handle = 0x80040156 + REGDB_E_PACKAGEPOLICYVIOLATION Handle = 0x80040157 + CAT_E_FIRST syscall.Errno = 0x80040160 + CAT_E_LAST syscall.Errno = 0x80040161 + CAT_E_CATIDNOEXIST Handle = 0x80040160 + CAT_E_NODESCRIPTION Handle = 0x80040161 + CS_E_FIRST syscall.Errno = 0x80040164 + CS_E_LAST syscall.Errno = 0x8004016F + CS_E_PACKAGE_NOTFOUND Handle = 0x80040164 + CS_E_NOT_DELETABLE Handle = 0x80040165 + CS_E_CLASS_NOTFOUND Handle = 0x80040166 + CS_E_INVALID_VERSION Handle = 0x80040167 + CS_E_NO_CLASSSTORE Handle = 0x80040168 + CS_E_OBJECT_NOTFOUND Handle = 0x80040169 + CS_E_OBJECT_ALREADY_EXISTS Handle = 0x8004016A + CS_E_INVALID_PATH Handle = 0x8004016B + CS_E_NETWORK_ERROR Handle = 0x8004016C + CS_E_ADMIN_LIMIT_EXCEEDED Handle = 0x8004016D + CS_E_SCHEMA_MISMATCH Handle = 0x8004016E + CS_E_INTERNAL_ERROR Handle = 0x8004016F + CACHE_E_FIRST syscall.Errno = 0x80040170 + CACHE_E_LAST syscall.Errno = 0x8004017F + CACHE_S_FIRST syscall.Errno = 0x00040170 + CACHE_S_LAST syscall.Errno = 0x0004017F + CACHE_E_NOCACHE_UPDATED Handle = 0x80040170 + OLEOBJ_E_FIRST syscall.Errno = 0x80040180 + OLEOBJ_E_LAST syscall.Errno = 0x8004018F + OLEOBJ_S_FIRST syscall.Errno = 0x00040180 + OLEOBJ_S_LAST syscall.Errno = 0x0004018F + OLEOBJ_E_NOVERBS Handle = 0x80040180 + OLEOBJ_E_INVALIDVERB Handle = 0x80040181 + CLIENTSITE_E_FIRST syscall.Errno = 0x80040190 + CLIENTSITE_E_LAST syscall.Errno = 0x8004019F + CLIENTSITE_S_FIRST syscall.Errno = 0x00040190 + CLIENTSITE_S_LAST syscall.Errno = 0x0004019F + INPLACE_E_NOTUNDOABLE Handle = 0x800401A0 + INPLACE_E_NOTOOLSPACE Handle = 0x800401A1 + INPLACE_E_FIRST syscall.Errno = 0x800401A0 + INPLACE_E_LAST syscall.Errno = 0x800401AF + INPLACE_S_FIRST syscall.Errno = 0x000401A0 + INPLACE_S_LAST syscall.Errno = 0x000401AF + ENUM_E_FIRST syscall.Errno = 0x800401B0 + ENUM_E_LAST syscall.Errno = 0x800401BF + ENUM_S_FIRST syscall.Errno = 0x000401B0 + ENUM_S_LAST syscall.Errno = 0x000401BF + CONVERT10_E_FIRST syscall.Errno = 0x800401C0 + CONVERT10_E_LAST syscall.Errno = 0x800401CF + CONVERT10_S_FIRST syscall.Errno = 0x000401C0 + CONVERT10_S_LAST syscall.Errno = 0x000401CF + CONVERT10_E_OLESTREAM_GET Handle = 0x800401C0 + CONVERT10_E_OLESTREAM_PUT Handle = 0x800401C1 + CONVERT10_E_OLESTREAM_FMT Handle = 0x800401C2 + CONVERT10_E_OLESTREAM_BITMAP_TO_DIB Handle = 0x800401C3 + CONVERT10_E_STG_FMT Handle = 0x800401C4 + CONVERT10_E_STG_NO_STD_STREAM Handle = 0x800401C5 + CONVERT10_E_STG_DIB_TO_BITMAP Handle = 0x800401C6 + CLIPBRD_E_FIRST syscall.Errno = 0x800401D0 + CLIPBRD_E_LAST syscall.Errno = 0x800401DF + CLIPBRD_S_FIRST syscall.Errno = 0x000401D0 + CLIPBRD_S_LAST syscall.Errno = 0x000401DF + CLIPBRD_E_CANT_OPEN Handle = 0x800401D0 + CLIPBRD_E_CANT_EMPTY Handle = 0x800401D1 + CLIPBRD_E_CANT_SET Handle = 0x800401D2 + CLIPBRD_E_BAD_DATA Handle = 0x800401D3 + CLIPBRD_E_CANT_CLOSE Handle = 0x800401D4 + MK_E_FIRST syscall.Errno = 0x800401E0 + MK_E_LAST syscall.Errno = 0x800401EF + MK_S_FIRST syscall.Errno = 0x000401E0 + MK_S_LAST syscall.Errno = 0x000401EF + MK_E_CONNECTMANUALLY Handle = 0x800401E0 + MK_E_EXCEEDEDDEADLINE Handle = 0x800401E1 + MK_E_NEEDGENERIC Handle = 0x800401E2 + MK_E_UNAVAILABLE Handle = 0x800401E3 + MK_E_SYNTAX Handle = 0x800401E4 + MK_E_NOOBJECT Handle = 0x800401E5 + MK_E_INVALIDEXTENSION Handle = 0x800401E6 + MK_E_INTERMEDIATEINTERFACENOTSUPPORTED Handle = 0x800401E7 + MK_E_NOTBINDABLE Handle = 0x800401E8 + MK_E_NOTBOUND Handle = 0x800401E9 + MK_E_CANTOPENFILE Handle = 0x800401EA + MK_E_MUSTBOTHERUSER Handle = 0x800401EB + MK_E_NOINVERSE Handle = 0x800401EC + MK_E_NOSTORAGE Handle = 0x800401ED + MK_E_NOPREFIX Handle = 0x800401EE + MK_E_ENUMERATION_FAILED Handle = 0x800401EF + CO_E_FIRST syscall.Errno = 0x800401F0 + CO_E_LAST syscall.Errno = 0x800401FF + CO_S_FIRST syscall.Errno = 0x000401F0 + CO_S_LAST syscall.Errno = 0x000401FF + CO_E_NOTINITIALIZED Handle = 0x800401F0 + CO_E_ALREADYINITIALIZED Handle = 0x800401F1 + CO_E_CANTDETERMINECLASS Handle = 0x800401F2 + CO_E_CLASSSTRING Handle = 0x800401F3 + CO_E_IIDSTRING Handle = 0x800401F4 + CO_E_APPNOTFOUND Handle = 0x800401F5 + CO_E_APPSINGLEUSE Handle = 0x800401F6 + CO_E_ERRORINAPP Handle = 0x800401F7 + CO_E_DLLNOTFOUND Handle = 0x800401F8 + CO_E_ERRORINDLL Handle = 0x800401F9 + CO_E_WRONGOSFORAPP Handle = 0x800401FA + CO_E_OBJNOTREG Handle = 0x800401FB + CO_E_OBJISREG Handle = 0x800401FC + CO_E_OBJNOTCONNECTED Handle = 0x800401FD + CO_E_APPDIDNTREG Handle = 0x800401FE + CO_E_RELEASED Handle = 0x800401FF + EVENT_E_FIRST syscall.Errno = 0x80040200 + EVENT_E_LAST syscall.Errno = 0x8004021F + EVENT_S_FIRST syscall.Errno = 0x00040200 + EVENT_S_LAST syscall.Errno = 0x0004021F + EVENT_S_SOME_SUBSCRIBERS_FAILED Handle = 0x00040200 + EVENT_E_ALL_SUBSCRIBERS_FAILED Handle = 0x80040201 + EVENT_S_NOSUBSCRIBERS Handle = 0x00040202 + EVENT_E_QUERYSYNTAX Handle = 0x80040203 + EVENT_E_QUERYFIELD Handle = 0x80040204 + EVENT_E_INTERNALEXCEPTION Handle = 0x80040205 + EVENT_E_INTERNALERROR Handle = 0x80040206 + EVENT_E_INVALID_PER_USER_SID Handle = 0x80040207 + EVENT_E_USER_EXCEPTION Handle = 0x80040208 + EVENT_E_TOO_MANY_METHODS Handle = 0x80040209 + EVENT_E_MISSING_EVENTCLASS Handle = 0x8004020A + EVENT_E_NOT_ALL_REMOVED Handle = 0x8004020B + EVENT_E_COMPLUS_NOT_INSTALLED Handle = 0x8004020C + EVENT_E_CANT_MODIFY_OR_DELETE_UNCONFIGURED_OBJECT Handle = 0x8004020D + EVENT_E_CANT_MODIFY_OR_DELETE_CONFIGURED_OBJECT Handle = 0x8004020E + EVENT_E_INVALID_EVENT_CLASS_PARTITION Handle = 0x8004020F + EVENT_E_PER_USER_SID_NOT_LOGGED_ON Handle = 0x80040210 + TPC_E_INVALID_PROPERTY Handle = 0x80040241 + TPC_E_NO_DEFAULT_TABLET Handle = 0x80040212 + TPC_E_UNKNOWN_PROPERTY Handle = 0x8004021B + TPC_E_INVALID_INPUT_RECT Handle = 0x80040219 + TPC_E_INVALID_STROKE Handle = 0x80040222 + TPC_E_INITIALIZE_FAIL Handle = 0x80040223 + TPC_E_NOT_RELEVANT Handle = 0x80040232 + TPC_E_INVALID_PACKET_DESCRIPTION Handle = 0x80040233 + TPC_E_RECOGNIZER_NOT_REGISTERED Handle = 0x80040235 + TPC_E_INVALID_RIGHTS Handle = 0x80040236 + TPC_E_OUT_OF_ORDER_CALL Handle = 0x80040237 + TPC_E_QUEUE_FULL Handle = 0x80040238 + TPC_E_INVALID_CONFIGURATION Handle = 0x80040239 + TPC_E_INVALID_DATA_FROM_RECOGNIZER Handle = 0x8004023A + TPC_S_TRUNCATED Handle = 0x00040252 + TPC_S_INTERRUPTED Handle = 0x00040253 + TPC_S_NO_DATA_TO_PROCESS Handle = 0x00040254 + XACT_E_FIRST syscall.Errno = 0x8004D000 + XACT_E_LAST syscall.Errno = 0x8004D02B + XACT_S_FIRST syscall.Errno = 0x0004D000 + XACT_S_LAST syscall.Errno = 0x0004D010 + XACT_E_ALREADYOTHERSINGLEPHASE Handle = 0x8004D000 + XACT_E_CANTRETAIN Handle = 0x8004D001 + XACT_E_COMMITFAILED Handle = 0x8004D002 + XACT_E_COMMITPREVENTED Handle = 0x8004D003 + XACT_E_HEURISTICABORT Handle = 0x8004D004 + XACT_E_HEURISTICCOMMIT Handle = 0x8004D005 + XACT_E_HEURISTICDAMAGE Handle = 0x8004D006 + XACT_E_HEURISTICDANGER Handle = 0x8004D007 + XACT_E_ISOLATIONLEVEL Handle = 0x8004D008 + XACT_E_NOASYNC Handle = 0x8004D009 + XACT_E_NOENLIST Handle = 0x8004D00A + XACT_E_NOISORETAIN Handle = 0x8004D00B + XACT_E_NORESOURCE Handle = 0x8004D00C + XACT_E_NOTCURRENT Handle = 0x8004D00D + XACT_E_NOTRANSACTION Handle = 0x8004D00E + XACT_E_NOTSUPPORTED Handle = 0x8004D00F + XACT_E_UNKNOWNRMGRID Handle = 0x8004D010 + XACT_E_WRONGSTATE Handle = 0x8004D011 + XACT_E_WRONGUOW Handle = 0x8004D012 + XACT_E_XTIONEXISTS Handle = 0x8004D013 + XACT_E_NOIMPORTOBJECT Handle = 0x8004D014 + XACT_E_INVALIDCOOKIE Handle = 0x8004D015 + XACT_E_INDOUBT Handle = 0x8004D016 + XACT_E_NOTIMEOUT Handle = 0x8004D017 + XACT_E_ALREADYINPROGRESS Handle = 0x8004D018 + XACT_E_ABORTED Handle = 0x8004D019 + XACT_E_LOGFULL Handle = 0x8004D01A + XACT_E_TMNOTAVAILABLE Handle = 0x8004D01B + XACT_E_CONNECTION_DOWN Handle = 0x8004D01C + XACT_E_CONNECTION_DENIED Handle = 0x8004D01D + XACT_E_REENLISTTIMEOUT Handle = 0x8004D01E + XACT_E_TIP_CONNECT_FAILED Handle = 0x8004D01F + XACT_E_TIP_PROTOCOL_ERROR Handle = 0x8004D020 + XACT_E_TIP_PULL_FAILED Handle = 0x8004D021 + XACT_E_DEST_TMNOTAVAILABLE Handle = 0x8004D022 + XACT_E_TIP_DISABLED Handle = 0x8004D023 + XACT_E_NETWORK_TX_DISABLED Handle = 0x8004D024 + XACT_E_PARTNER_NETWORK_TX_DISABLED Handle = 0x8004D025 + XACT_E_XA_TX_DISABLED Handle = 0x8004D026 + XACT_E_UNABLE_TO_READ_DTC_CONFIG Handle = 0x8004D027 + XACT_E_UNABLE_TO_LOAD_DTC_PROXY Handle = 0x8004D028 + XACT_E_ABORTING Handle = 0x8004D029 + XACT_E_PUSH_COMM_FAILURE Handle = 0x8004D02A + XACT_E_PULL_COMM_FAILURE Handle = 0x8004D02B + XACT_E_LU_TX_DISABLED Handle = 0x8004D02C + XACT_E_CLERKNOTFOUND Handle = 0x8004D080 + XACT_E_CLERKEXISTS Handle = 0x8004D081 + XACT_E_RECOVERYINPROGRESS Handle = 0x8004D082 + XACT_E_TRANSACTIONCLOSED Handle = 0x8004D083 + XACT_E_INVALIDLSN Handle = 0x8004D084 + XACT_E_REPLAYREQUEST Handle = 0x8004D085 + XACT_S_ASYNC Handle = 0x0004D000 + XACT_S_DEFECT Handle = 0x0004D001 + XACT_S_READONLY Handle = 0x0004D002 + XACT_S_SOMENORETAIN Handle = 0x0004D003 + XACT_S_OKINFORM Handle = 0x0004D004 + XACT_S_MADECHANGESCONTENT Handle = 0x0004D005 + XACT_S_MADECHANGESINFORM Handle = 0x0004D006 + XACT_S_ALLNORETAIN Handle = 0x0004D007 + XACT_S_ABORTING Handle = 0x0004D008 + XACT_S_SINGLEPHASE Handle = 0x0004D009 + XACT_S_LOCALLY_OK Handle = 0x0004D00A + XACT_S_LASTRESOURCEMANAGER Handle = 0x0004D010 + CONTEXT_E_FIRST syscall.Errno = 0x8004E000 + CONTEXT_E_LAST syscall.Errno = 0x8004E02F + CONTEXT_S_FIRST syscall.Errno = 0x0004E000 + CONTEXT_S_LAST syscall.Errno = 0x0004E02F + CONTEXT_E_ABORTED Handle = 0x8004E002 + CONTEXT_E_ABORTING Handle = 0x8004E003 + CONTEXT_E_NOCONTEXT Handle = 0x8004E004 + CONTEXT_E_WOULD_DEADLOCK Handle = 0x8004E005 + CONTEXT_E_SYNCH_TIMEOUT Handle = 0x8004E006 + CONTEXT_E_OLDREF Handle = 0x8004E007 + CONTEXT_E_ROLENOTFOUND Handle = 0x8004E00C + CONTEXT_E_TMNOTAVAILABLE Handle = 0x8004E00F + CO_E_ACTIVATIONFAILED Handle = 0x8004E021 + CO_E_ACTIVATIONFAILED_EVENTLOGGED Handle = 0x8004E022 + CO_E_ACTIVATIONFAILED_CATALOGERROR Handle = 0x8004E023 + CO_E_ACTIVATIONFAILED_TIMEOUT Handle = 0x8004E024 + CO_E_INITIALIZATIONFAILED Handle = 0x8004E025 + CONTEXT_E_NOJIT Handle = 0x8004E026 + CONTEXT_E_NOTRANSACTION Handle = 0x8004E027 + CO_E_THREADINGMODEL_CHANGED Handle = 0x8004E028 + CO_E_NOIISINTRINSICS Handle = 0x8004E029 + CO_E_NOCOOKIES Handle = 0x8004E02A + CO_E_DBERROR Handle = 0x8004E02B + CO_E_NOTPOOLED Handle = 0x8004E02C + CO_E_NOTCONSTRUCTED Handle = 0x8004E02D + CO_E_NOSYNCHRONIZATION Handle = 0x8004E02E + CO_E_ISOLEVELMISMATCH Handle = 0x8004E02F + CO_E_CALL_OUT_OF_TX_SCOPE_NOT_ALLOWED Handle = 0x8004E030 + CO_E_EXIT_TRANSACTION_SCOPE_NOT_CALLED Handle = 0x8004E031 + OLE_S_USEREG Handle = 0x00040000 + OLE_S_STATIC Handle = 0x00040001 + OLE_S_MAC_CLIPFORMAT Handle = 0x00040002 + DRAGDROP_S_DROP Handle = 0x00040100 + DRAGDROP_S_CANCEL Handle = 0x00040101 + DRAGDROP_S_USEDEFAULTCURSORS Handle = 0x00040102 + DATA_S_SAMEFORMATETC Handle = 0x00040130 + VIEW_S_ALREADY_FROZEN Handle = 0x00040140 + CACHE_S_FORMATETC_NOTSUPPORTED Handle = 0x00040170 + CACHE_S_SAMECACHE Handle = 0x00040171 + CACHE_S_SOMECACHES_NOTUPDATED Handle = 0x00040172 + OLEOBJ_S_INVALIDVERB Handle = 0x00040180 + OLEOBJ_S_CANNOT_DOVERB_NOW Handle = 0x00040181 + OLEOBJ_S_INVALIDHWND Handle = 0x00040182 + INPLACE_S_TRUNCATED Handle = 0x000401A0 + CONVERT10_S_NO_PRESENTATION Handle = 0x000401C0 + MK_S_REDUCED_TO_SELF Handle = 0x000401E2 + MK_S_ME Handle = 0x000401E4 + MK_S_HIM Handle = 0x000401E5 + MK_S_US Handle = 0x000401E6 + MK_S_MONIKERALREADYREGISTERED Handle = 0x000401E7 + SCHED_S_TASK_READY Handle = 0x00041300 + SCHED_S_TASK_RUNNING Handle = 0x00041301 + SCHED_S_TASK_DISABLED Handle = 0x00041302 + SCHED_S_TASK_HAS_NOT_RUN Handle = 0x00041303 + SCHED_S_TASK_NO_MORE_RUNS Handle = 0x00041304 + SCHED_S_TASK_NOT_SCHEDULED Handle = 0x00041305 + SCHED_S_TASK_TERMINATED Handle = 0x00041306 + SCHED_S_TASK_NO_VALID_TRIGGERS Handle = 0x00041307 + SCHED_S_EVENT_TRIGGER Handle = 0x00041308 + SCHED_E_TRIGGER_NOT_FOUND Handle = 0x80041309 + SCHED_E_TASK_NOT_READY Handle = 0x8004130A + SCHED_E_TASK_NOT_RUNNING Handle = 0x8004130B + SCHED_E_SERVICE_NOT_INSTALLED Handle = 0x8004130C + SCHED_E_CANNOT_OPEN_TASK Handle = 0x8004130D + SCHED_E_INVALID_TASK Handle = 0x8004130E + SCHED_E_ACCOUNT_INFORMATION_NOT_SET Handle = 0x8004130F + SCHED_E_ACCOUNT_NAME_NOT_FOUND Handle = 0x80041310 + SCHED_E_ACCOUNT_DBASE_CORRUPT Handle = 0x80041311 + SCHED_E_NO_SECURITY_SERVICES Handle = 0x80041312 + SCHED_E_UNKNOWN_OBJECT_VERSION Handle = 0x80041313 + SCHED_E_UNSUPPORTED_ACCOUNT_OPTION Handle = 0x80041314 + SCHED_E_SERVICE_NOT_RUNNING Handle = 0x80041315 + SCHED_E_UNEXPECTEDNODE Handle = 0x80041316 + SCHED_E_NAMESPACE Handle = 0x80041317 + SCHED_E_INVALIDVALUE Handle = 0x80041318 + SCHED_E_MISSINGNODE Handle = 0x80041319 + SCHED_E_MALFORMEDXML Handle = 0x8004131A + SCHED_S_SOME_TRIGGERS_FAILED Handle = 0x0004131B + SCHED_S_BATCH_LOGON_PROBLEM Handle = 0x0004131C + SCHED_E_TOO_MANY_NODES Handle = 0x8004131D + SCHED_E_PAST_END_BOUNDARY Handle = 0x8004131E + SCHED_E_ALREADY_RUNNING Handle = 0x8004131F + SCHED_E_USER_NOT_LOGGED_ON Handle = 0x80041320 + SCHED_E_INVALID_TASK_HASH Handle = 0x80041321 + SCHED_E_SERVICE_NOT_AVAILABLE Handle = 0x80041322 + SCHED_E_SERVICE_TOO_BUSY Handle = 0x80041323 + SCHED_E_TASK_ATTEMPTED Handle = 0x80041324 + SCHED_S_TASK_QUEUED Handle = 0x00041325 + SCHED_E_TASK_DISABLED Handle = 0x80041326 + SCHED_E_TASK_NOT_V1_COMPAT Handle = 0x80041327 + SCHED_E_START_ON_DEMAND Handle = 0x80041328 + SCHED_E_TASK_NOT_UBPM_COMPAT Handle = 0x80041329 + SCHED_E_DEPRECATED_FEATURE_USED Handle = 0x80041330 + CO_E_CLASS_CREATE_FAILED Handle = 0x80080001 + CO_E_SCM_ERROR Handle = 0x80080002 + CO_E_SCM_RPC_FAILURE Handle = 0x80080003 + CO_E_BAD_PATH Handle = 0x80080004 + CO_E_SERVER_EXEC_FAILURE Handle = 0x80080005 + CO_E_OBJSRV_RPC_FAILURE Handle = 0x80080006 + MK_E_NO_NORMALIZED Handle = 0x80080007 + CO_E_SERVER_STOPPING Handle = 0x80080008 + MEM_E_INVALID_ROOT Handle = 0x80080009 + MEM_E_INVALID_LINK Handle = 0x80080010 + MEM_E_INVALID_SIZE Handle = 0x80080011 + CO_S_NOTALLINTERFACES Handle = 0x00080012 + CO_S_MACHINENAMENOTFOUND Handle = 0x00080013 + CO_E_MISSING_DISPLAYNAME Handle = 0x80080015 + CO_E_RUNAS_VALUE_MUST_BE_AAA Handle = 0x80080016 + CO_E_ELEVATION_DISABLED Handle = 0x80080017 + APPX_E_PACKAGING_INTERNAL Handle = 0x80080200 + APPX_E_INTERLEAVING_NOT_ALLOWED Handle = 0x80080201 + APPX_E_RELATIONSHIPS_NOT_ALLOWED Handle = 0x80080202 + APPX_E_MISSING_REQUIRED_FILE Handle = 0x80080203 + APPX_E_INVALID_MANIFEST Handle = 0x80080204 + APPX_E_INVALID_BLOCKMAP Handle = 0x80080205 + APPX_E_CORRUPT_CONTENT Handle = 0x80080206 + APPX_E_BLOCK_HASH_INVALID Handle = 0x80080207 + APPX_E_REQUESTED_RANGE_TOO_LARGE Handle = 0x80080208 + APPX_E_INVALID_SIP_CLIENT_DATA Handle = 0x80080209 + APPX_E_INVALID_KEY_INFO Handle = 0x8008020A + APPX_E_INVALID_CONTENTGROUPMAP Handle = 0x8008020B + APPX_E_INVALID_APPINSTALLER Handle = 0x8008020C + APPX_E_DELTA_BASELINE_VERSION_MISMATCH Handle = 0x8008020D + APPX_E_DELTA_PACKAGE_MISSING_FILE Handle = 0x8008020E + APPX_E_INVALID_DELTA_PACKAGE Handle = 0x8008020F + APPX_E_DELTA_APPENDED_PACKAGE_NOT_ALLOWED Handle = 0x80080210 + APPX_E_INVALID_PACKAGING_LAYOUT Handle = 0x80080211 + APPX_E_INVALID_PACKAGESIGNCONFIG Handle = 0x80080212 + APPX_E_RESOURCESPRI_NOT_ALLOWED Handle = 0x80080213 + APPX_E_FILE_COMPRESSION_MISMATCH Handle = 0x80080214 + APPX_E_INVALID_PAYLOAD_PACKAGE_EXTENSION Handle = 0x80080215 + APPX_E_INVALID_ENCRYPTION_EXCLUSION_FILE_LIST Handle = 0x80080216 + BT_E_SPURIOUS_ACTIVATION Handle = 0x80080300 + DISP_E_UNKNOWNINTERFACE Handle = 0x80020001 + DISP_E_MEMBERNOTFOUND Handle = 0x80020003 + DISP_E_PARAMNOTFOUND Handle = 0x80020004 + DISP_E_TYPEMISMATCH Handle = 0x80020005 + DISP_E_UNKNOWNNAME Handle = 0x80020006 + DISP_E_NONAMEDARGS Handle = 0x80020007 + DISP_E_BADVARTYPE Handle = 0x80020008 + DISP_E_EXCEPTION Handle = 0x80020009 + DISP_E_OVERFLOW Handle = 0x8002000A + DISP_E_BADINDEX Handle = 0x8002000B + DISP_E_UNKNOWNLCID Handle = 0x8002000C + DISP_E_ARRAYISLOCKED Handle = 0x8002000D + DISP_E_BADPARAMCOUNT Handle = 0x8002000E + DISP_E_PARAMNOTOPTIONAL Handle = 0x8002000F + DISP_E_BADCALLEE Handle = 0x80020010 + DISP_E_NOTACOLLECTION Handle = 0x80020011 + DISP_E_DIVBYZERO Handle = 0x80020012 + DISP_E_BUFFERTOOSMALL Handle = 0x80020013 + TYPE_E_BUFFERTOOSMALL Handle = 0x80028016 + TYPE_E_FIELDNOTFOUND Handle = 0x80028017 + TYPE_E_INVDATAREAD Handle = 0x80028018 + TYPE_E_UNSUPFORMAT Handle = 0x80028019 + TYPE_E_REGISTRYACCESS Handle = 0x8002801C + TYPE_E_LIBNOTREGISTERED Handle = 0x8002801D + TYPE_E_UNDEFINEDTYPE Handle = 0x80028027 + TYPE_E_QUALIFIEDNAMEDISALLOWED Handle = 0x80028028 + TYPE_E_INVALIDSTATE Handle = 0x80028029 + TYPE_E_WRONGTYPEKIND Handle = 0x8002802A + TYPE_E_ELEMENTNOTFOUND Handle = 0x8002802B + TYPE_E_AMBIGUOUSNAME Handle = 0x8002802C + TYPE_E_NAMECONFLICT Handle = 0x8002802D + TYPE_E_UNKNOWNLCID Handle = 0x8002802E + TYPE_E_DLLFUNCTIONNOTFOUND Handle = 0x8002802F + TYPE_E_BADMODULEKIND Handle = 0x800288BD + TYPE_E_SIZETOOBIG Handle = 0x800288C5 + TYPE_E_DUPLICATEID Handle = 0x800288C6 + TYPE_E_INVALIDID Handle = 0x800288CF + TYPE_E_TYPEMISMATCH Handle = 0x80028CA0 + TYPE_E_OUTOFBOUNDS Handle = 0x80028CA1 + TYPE_E_IOERROR Handle = 0x80028CA2 + TYPE_E_CANTCREATETMPFILE Handle = 0x80028CA3 + TYPE_E_CANTLOADLIBRARY Handle = 0x80029C4A + TYPE_E_INCONSISTENTPROPFUNCS Handle = 0x80029C83 + TYPE_E_CIRCULARTYPE Handle = 0x80029C84 + STG_E_INVALIDFUNCTION Handle = 0x80030001 + STG_E_FILENOTFOUND Handle = 0x80030002 + STG_E_PATHNOTFOUND Handle = 0x80030003 + STG_E_TOOMANYOPENFILES Handle = 0x80030004 + STG_E_ACCESSDENIED Handle = 0x80030005 + STG_E_INVALIDHANDLE Handle = 0x80030006 + STG_E_INSUFFICIENTMEMORY Handle = 0x80030008 + STG_E_INVALIDPOINTER Handle = 0x80030009 + STG_E_NOMOREFILES Handle = 0x80030012 + STG_E_DISKISWRITEPROTECTED Handle = 0x80030013 + STG_E_SEEKERROR Handle = 0x80030019 + STG_E_WRITEFAULT Handle = 0x8003001D + STG_E_READFAULT Handle = 0x8003001E + STG_E_SHAREVIOLATION Handle = 0x80030020 + STG_E_LOCKVIOLATION Handle = 0x80030021 + STG_E_FILEALREADYEXISTS Handle = 0x80030050 + STG_E_INVALIDPARAMETER Handle = 0x80030057 + STG_E_MEDIUMFULL Handle = 0x80030070 + STG_E_PROPSETMISMATCHED Handle = 0x800300F0 + STG_E_ABNORMALAPIEXIT Handle = 0x800300FA + STG_E_INVALIDHEADER Handle = 0x800300FB + STG_E_INVALIDNAME Handle = 0x800300FC + STG_E_UNKNOWN Handle = 0x800300FD + STG_E_UNIMPLEMENTEDFUNCTION Handle = 0x800300FE + STG_E_INVALIDFLAG Handle = 0x800300FF + STG_E_INUSE Handle = 0x80030100 + STG_E_NOTCURRENT Handle = 0x80030101 + STG_E_REVERTED Handle = 0x80030102 + STG_E_CANTSAVE Handle = 0x80030103 + STG_E_OLDFORMAT Handle = 0x80030104 + STG_E_OLDDLL Handle = 0x80030105 + STG_E_SHAREREQUIRED Handle = 0x80030106 + STG_E_NOTFILEBASEDSTORAGE Handle = 0x80030107 + STG_E_EXTANTMARSHALLINGS Handle = 0x80030108 + STG_E_DOCFILECORRUPT Handle = 0x80030109 + STG_E_BADBASEADDRESS Handle = 0x80030110 + STG_E_DOCFILETOOLARGE Handle = 0x80030111 + STG_E_NOTSIMPLEFORMAT Handle = 0x80030112 + STG_E_INCOMPLETE Handle = 0x80030201 + STG_E_TERMINATED Handle = 0x80030202 + STG_S_CONVERTED Handle = 0x00030200 + STG_S_BLOCK Handle = 0x00030201 + STG_S_RETRYNOW Handle = 0x00030202 + STG_S_MONITORING Handle = 0x00030203 + STG_S_MULTIPLEOPENS Handle = 0x00030204 + STG_S_CONSOLIDATIONFAILED Handle = 0x00030205 + STG_S_CANNOTCONSOLIDATE Handle = 0x00030206 + STG_S_POWER_CYCLE_REQUIRED Handle = 0x00030207 + STG_E_FIRMWARE_SLOT_INVALID Handle = 0x80030208 + STG_E_FIRMWARE_IMAGE_INVALID Handle = 0x80030209 + STG_E_DEVICE_UNRESPONSIVE Handle = 0x8003020A + STG_E_STATUS_COPY_PROTECTION_FAILURE Handle = 0x80030305 + STG_E_CSS_AUTHENTICATION_FAILURE Handle = 0x80030306 + STG_E_CSS_KEY_NOT_PRESENT Handle = 0x80030307 + STG_E_CSS_KEY_NOT_ESTABLISHED Handle = 0x80030308 + STG_E_CSS_SCRAMBLED_SECTOR Handle = 0x80030309 + STG_E_CSS_REGION_MISMATCH Handle = 0x8003030A + STG_E_RESETS_EXHAUSTED Handle = 0x8003030B + RPC_E_CALL_REJECTED Handle = 0x80010001 + RPC_E_CALL_CANCELED Handle = 0x80010002 + RPC_E_CANTPOST_INSENDCALL Handle = 0x80010003 + RPC_E_CANTCALLOUT_INASYNCCALL Handle = 0x80010004 + RPC_E_CANTCALLOUT_INEXTERNALCALL Handle = 0x80010005 + RPC_E_CONNECTION_TERMINATED Handle = 0x80010006 + RPC_E_SERVER_DIED Handle = 0x80010007 + RPC_E_CLIENT_DIED Handle = 0x80010008 + RPC_E_INVALID_DATAPACKET Handle = 0x80010009 + RPC_E_CANTTRANSMIT_CALL Handle = 0x8001000A + RPC_E_CLIENT_CANTMARSHAL_DATA Handle = 0x8001000B + RPC_E_CLIENT_CANTUNMARSHAL_DATA Handle = 0x8001000C + RPC_E_SERVER_CANTMARSHAL_DATA Handle = 0x8001000D + RPC_E_SERVER_CANTUNMARSHAL_DATA Handle = 0x8001000E + RPC_E_INVALID_DATA Handle = 0x8001000F + RPC_E_INVALID_PARAMETER Handle = 0x80010010 + RPC_E_CANTCALLOUT_AGAIN Handle = 0x80010011 + RPC_E_SERVER_DIED_DNE Handle = 0x80010012 + RPC_E_SYS_CALL_FAILED Handle = 0x80010100 + RPC_E_OUT_OF_RESOURCES Handle = 0x80010101 + RPC_E_ATTEMPTED_MULTITHREAD Handle = 0x80010102 + RPC_E_NOT_REGISTERED Handle = 0x80010103 + RPC_E_FAULT Handle = 0x80010104 + RPC_E_SERVERFAULT Handle = 0x80010105 + RPC_E_CHANGED_MODE Handle = 0x80010106 + RPC_E_INVALIDMETHOD Handle = 0x80010107 + RPC_E_DISCONNECTED Handle = 0x80010108 + RPC_E_RETRY Handle = 0x80010109 + RPC_E_SERVERCALL_RETRYLATER Handle = 0x8001010A + RPC_E_SERVERCALL_REJECTED Handle = 0x8001010B + RPC_E_INVALID_CALLDATA Handle = 0x8001010C + RPC_E_CANTCALLOUT_ININPUTSYNCCALL Handle = 0x8001010D + RPC_E_WRONG_THREAD Handle = 0x8001010E + RPC_E_THREAD_NOT_INIT Handle = 0x8001010F + RPC_E_VERSION_MISMATCH Handle = 0x80010110 + RPC_E_INVALID_HEADER Handle = 0x80010111 + RPC_E_INVALID_EXTENSION Handle = 0x80010112 + RPC_E_INVALID_IPID Handle = 0x80010113 + RPC_E_INVALID_OBJECT Handle = 0x80010114 + RPC_S_CALLPENDING Handle = 0x80010115 + RPC_S_WAITONTIMER Handle = 0x80010116 + RPC_E_CALL_COMPLETE Handle = 0x80010117 + RPC_E_UNSECURE_CALL Handle = 0x80010118 + RPC_E_TOO_LATE Handle = 0x80010119 + RPC_E_NO_GOOD_SECURITY_PACKAGES Handle = 0x8001011A + RPC_E_ACCESS_DENIED Handle = 0x8001011B + RPC_E_REMOTE_DISABLED Handle = 0x8001011C + RPC_E_INVALID_OBJREF Handle = 0x8001011D + RPC_E_NO_CONTEXT Handle = 0x8001011E + RPC_E_TIMEOUT Handle = 0x8001011F + RPC_E_NO_SYNC Handle = 0x80010120 + RPC_E_FULLSIC_REQUIRED Handle = 0x80010121 + RPC_E_INVALID_STD_NAME Handle = 0x80010122 + CO_E_FAILEDTOIMPERSONATE Handle = 0x80010123 + CO_E_FAILEDTOGETSECCTX Handle = 0x80010124 + CO_E_FAILEDTOOPENTHREADTOKEN Handle = 0x80010125 + CO_E_FAILEDTOGETTOKENINFO Handle = 0x80010126 + CO_E_TRUSTEEDOESNTMATCHCLIENT Handle = 0x80010127 + CO_E_FAILEDTOQUERYCLIENTBLANKET Handle = 0x80010128 + CO_E_FAILEDTOSETDACL Handle = 0x80010129 + CO_E_ACCESSCHECKFAILED Handle = 0x8001012A + CO_E_NETACCESSAPIFAILED Handle = 0x8001012B + CO_E_WRONGTRUSTEENAMESYNTAX Handle = 0x8001012C + CO_E_INVALIDSID Handle = 0x8001012D + CO_E_CONVERSIONFAILED Handle = 0x8001012E + CO_E_NOMATCHINGSIDFOUND Handle = 0x8001012F + CO_E_LOOKUPACCSIDFAILED Handle = 0x80010130 + CO_E_NOMATCHINGNAMEFOUND Handle = 0x80010131 + CO_E_LOOKUPACCNAMEFAILED Handle = 0x80010132 + CO_E_SETSERLHNDLFAILED Handle = 0x80010133 + CO_E_FAILEDTOGETWINDIR Handle = 0x80010134 + CO_E_PATHTOOLONG Handle = 0x80010135 + CO_E_FAILEDTOGENUUID Handle = 0x80010136 + CO_E_FAILEDTOCREATEFILE Handle = 0x80010137 + CO_E_FAILEDTOCLOSEHANDLE Handle = 0x80010138 + CO_E_EXCEEDSYSACLLIMIT Handle = 0x80010139 + CO_E_ACESINWRONGORDER Handle = 0x8001013A + CO_E_INCOMPATIBLESTREAMVERSION Handle = 0x8001013B + CO_E_FAILEDTOOPENPROCESSTOKEN Handle = 0x8001013C + CO_E_DECODEFAILED Handle = 0x8001013D + CO_E_ACNOTINITIALIZED Handle = 0x8001013F + CO_E_CANCEL_DISABLED Handle = 0x80010140 + RPC_E_UNEXPECTED Handle = 0x8001FFFF + ERROR_AUDITING_DISABLED Handle = 0xC0090001 + ERROR_ALL_SIDS_FILTERED Handle = 0xC0090002 + ERROR_BIZRULES_NOT_ENABLED Handle = 0xC0090003 + NTE_BAD_UID Handle = 0x80090001 + NTE_BAD_HASH Handle = 0x80090002 + NTE_BAD_KEY Handle = 0x80090003 + NTE_BAD_LEN Handle = 0x80090004 + NTE_BAD_DATA Handle = 0x80090005 + NTE_BAD_SIGNATURE Handle = 0x80090006 + NTE_BAD_VER Handle = 0x80090007 + NTE_BAD_ALGID Handle = 0x80090008 + NTE_BAD_FLAGS Handle = 0x80090009 + NTE_BAD_TYPE Handle = 0x8009000A + NTE_BAD_KEY_STATE Handle = 0x8009000B + NTE_BAD_HASH_STATE Handle = 0x8009000C + NTE_NO_KEY Handle = 0x8009000D + NTE_NO_MEMORY Handle = 0x8009000E + NTE_EXISTS Handle = 0x8009000F + NTE_PERM Handle = 0x80090010 + NTE_NOT_FOUND Handle = 0x80090011 + NTE_DOUBLE_ENCRYPT Handle = 0x80090012 + NTE_BAD_PROVIDER Handle = 0x80090013 + NTE_BAD_PROV_TYPE Handle = 0x80090014 + NTE_BAD_PUBLIC_KEY Handle = 0x80090015 + NTE_BAD_KEYSET Handle = 0x80090016 + NTE_PROV_TYPE_NOT_DEF Handle = 0x80090017 + NTE_PROV_TYPE_ENTRY_BAD Handle = 0x80090018 + NTE_KEYSET_NOT_DEF Handle = 0x80090019 + NTE_KEYSET_ENTRY_BAD Handle = 0x8009001A + NTE_PROV_TYPE_NO_MATCH Handle = 0x8009001B + NTE_SIGNATURE_FILE_BAD Handle = 0x8009001C + NTE_PROVIDER_DLL_FAIL Handle = 0x8009001D + NTE_PROV_DLL_NOT_FOUND Handle = 0x8009001E + NTE_BAD_KEYSET_PARAM Handle = 0x8009001F + NTE_FAIL Handle = 0x80090020 + NTE_SYS_ERR Handle = 0x80090021 + NTE_SILENT_CONTEXT Handle = 0x80090022 + NTE_TOKEN_KEYSET_STORAGE_FULL Handle = 0x80090023 + NTE_TEMPORARY_PROFILE Handle = 0x80090024 + NTE_FIXEDPARAMETER Handle = 0x80090025 + NTE_INVALID_HANDLE Handle = 0x80090026 + NTE_INVALID_PARAMETER Handle = 0x80090027 + NTE_BUFFER_TOO_SMALL Handle = 0x80090028 + NTE_NOT_SUPPORTED Handle = 0x80090029 + NTE_NO_MORE_ITEMS Handle = 0x8009002A + NTE_BUFFERS_OVERLAP Handle = 0x8009002B + NTE_DECRYPTION_FAILURE Handle = 0x8009002C + NTE_INTERNAL_ERROR Handle = 0x8009002D + NTE_UI_REQUIRED Handle = 0x8009002E + NTE_HMAC_NOT_SUPPORTED Handle = 0x8009002F + NTE_DEVICE_NOT_READY Handle = 0x80090030 + NTE_AUTHENTICATION_IGNORED Handle = 0x80090031 + NTE_VALIDATION_FAILED Handle = 0x80090032 + NTE_INCORRECT_PASSWORD Handle = 0x80090033 + NTE_ENCRYPTION_FAILURE Handle = 0x80090034 + NTE_DEVICE_NOT_FOUND Handle = 0x80090035 + NTE_USER_CANCELLED Handle = 0x80090036 + NTE_PASSWORD_CHANGE_REQUIRED Handle = 0x80090037 + NTE_NOT_ACTIVE_CONSOLE Handle = 0x80090038 + SEC_E_INSUFFICIENT_MEMORY Handle = 0x80090300 + SEC_E_INVALID_HANDLE Handle = 0x80090301 + SEC_E_UNSUPPORTED_FUNCTION Handle = 0x80090302 + SEC_E_TARGET_UNKNOWN Handle = 0x80090303 + SEC_E_INTERNAL_ERROR Handle = 0x80090304 + SEC_E_SECPKG_NOT_FOUND Handle = 0x80090305 + SEC_E_NOT_OWNER Handle = 0x80090306 + SEC_E_CANNOT_INSTALL Handle = 0x80090307 + SEC_E_INVALID_TOKEN Handle = 0x80090308 + SEC_E_CANNOT_PACK Handle = 0x80090309 + SEC_E_QOP_NOT_SUPPORTED Handle = 0x8009030A + SEC_E_NO_IMPERSONATION Handle = 0x8009030B + SEC_E_LOGON_DENIED Handle = 0x8009030C + SEC_E_UNKNOWN_CREDENTIALS Handle = 0x8009030D + SEC_E_NO_CREDENTIALS Handle = 0x8009030E + SEC_E_MESSAGE_ALTERED Handle = 0x8009030F + SEC_E_OUT_OF_SEQUENCE Handle = 0x80090310 + SEC_E_NO_AUTHENTICATING_AUTHORITY Handle = 0x80090311 + SEC_I_CONTINUE_NEEDED Handle = 0x00090312 + SEC_I_COMPLETE_NEEDED Handle = 0x00090313 + SEC_I_COMPLETE_AND_CONTINUE Handle = 0x00090314 + SEC_I_LOCAL_LOGON Handle = 0x00090315 + SEC_E_BAD_PKGID Handle = 0x80090316 + SEC_E_CONTEXT_EXPIRED Handle = 0x80090317 + SEC_I_CONTEXT_EXPIRED Handle = 0x00090317 + SEC_E_INCOMPLETE_MESSAGE Handle = 0x80090318 + SEC_E_INCOMPLETE_CREDENTIALS Handle = 0x80090320 + SEC_E_BUFFER_TOO_SMALL Handle = 0x80090321 + SEC_I_INCOMPLETE_CREDENTIALS Handle = 0x00090320 + SEC_I_RENEGOTIATE Handle = 0x00090321 + SEC_E_WRONG_PRINCIPAL Handle = 0x80090322 + SEC_I_NO_LSA_CONTEXT Handle = 0x00090323 + SEC_E_TIME_SKEW Handle = 0x80090324 + SEC_E_UNTRUSTED_ROOT Handle = 0x80090325 + SEC_E_ILLEGAL_MESSAGE Handle = 0x80090326 + SEC_E_CERT_UNKNOWN Handle = 0x80090327 + SEC_E_CERT_EXPIRED Handle = 0x80090328 + SEC_E_ENCRYPT_FAILURE Handle = 0x80090329 + SEC_E_DECRYPT_FAILURE Handle = 0x80090330 + SEC_E_ALGORITHM_MISMATCH Handle = 0x80090331 + SEC_E_SECURITY_QOS_FAILED Handle = 0x80090332 + SEC_E_UNFINISHED_CONTEXT_DELETED Handle = 0x80090333 + SEC_E_NO_TGT_REPLY Handle = 0x80090334 + SEC_E_NO_IP_ADDRESSES Handle = 0x80090335 + SEC_E_WRONG_CREDENTIAL_HANDLE Handle = 0x80090336 + SEC_E_CRYPTO_SYSTEM_INVALID Handle = 0x80090337 + SEC_E_MAX_REFERRALS_EXCEEDED Handle = 0x80090338 + SEC_E_MUST_BE_KDC Handle = 0x80090339 + SEC_E_STRONG_CRYPTO_NOT_SUPPORTED Handle = 0x8009033A + SEC_E_TOO_MANY_PRINCIPALS Handle = 0x8009033B + SEC_E_NO_PA_DATA Handle = 0x8009033C + SEC_E_PKINIT_NAME_MISMATCH Handle = 0x8009033D + SEC_E_SMARTCARD_LOGON_REQUIRED Handle = 0x8009033E + SEC_E_SHUTDOWN_IN_PROGRESS Handle = 0x8009033F + SEC_E_KDC_INVALID_REQUEST Handle = 0x80090340 + SEC_E_KDC_UNABLE_TO_REFER Handle = 0x80090341 + SEC_E_KDC_UNKNOWN_ETYPE Handle = 0x80090342 + SEC_E_UNSUPPORTED_PREAUTH Handle = 0x80090343 + SEC_E_DELEGATION_REQUIRED Handle = 0x80090345 + SEC_E_BAD_BINDINGS Handle = 0x80090346 + SEC_E_MULTIPLE_ACCOUNTS Handle = 0x80090347 + SEC_E_NO_KERB_KEY Handle = 0x80090348 + SEC_E_CERT_WRONG_USAGE Handle = 0x80090349 + SEC_E_DOWNGRADE_DETECTED Handle = 0x80090350 + SEC_E_SMARTCARD_CERT_REVOKED Handle = 0x80090351 + SEC_E_ISSUING_CA_UNTRUSTED Handle = 0x80090352 + SEC_E_REVOCATION_OFFLINE_C Handle = 0x80090353 + SEC_E_PKINIT_CLIENT_FAILURE Handle = 0x80090354 + SEC_E_SMARTCARD_CERT_EXPIRED Handle = 0x80090355 + SEC_E_NO_S4U_PROT_SUPPORT Handle = 0x80090356 + SEC_E_CROSSREALM_DELEGATION_FAILURE Handle = 0x80090357 + SEC_E_REVOCATION_OFFLINE_KDC Handle = 0x80090358 + SEC_E_ISSUING_CA_UNTRUSTED_KDC Handle = 0x80090359 + SEC_E_KDC_CERT_EXPIRED Handle = 0x8009035A + SEC_E_KDC_CERT_REVOKED Handle = 0x8009035B + SEC_I_SIGNATURE_NEEDED Handle = 0x0009035C + SEC_E_INVALID_PARAMETER Handle = 0x8009035D + SEC_E_DELEGATION_POLICY Handle = 0x8009035E + SEC_E_POLICY_NLTM_ONLY Handle = 0x8009035F + SEC_I_NO_RENEGOTIATION Handle = 0x00090360 + SEC_E_NO_CONTEXT Handle = 0x80090361 + SEC_E_PKU2U_CERT_FAILURE Handle = 0x80090362 + SEC_E_MUTUAL_AUTH_FAILED Handle = 0x80090363 + SEC_I_MESSAGE_FRAGMENT Handle = 0x00090364 + SEC_E_ONLY_HTTPS_ALLOWED Handle = 0x80090365 + SEC_I_CONTINUE_NEEDED_MESSAGE_OK Handle = 0x00090366 + SEC_E_APPLICATION_PROTOCOL_MISMATCH Handle = 0x80090367 + SEC_I_ASYNC_CALL_PENDING Handle = 0x00090368 + SEC_E_INVALID_UPN_NAME Handle = 0x80090369 + SEC_E_NO_SPM = SEC_E_INTERNAL_ERROR + SEC_E_NOT_SUPPORTED = SEC_E_UNSUPPORTED_FUNCTION + CRYPT_E_MSG_ERROR Handle = 0x80091001 + CRYPT_E_UNKNOWN_ALGO Handle = 0x80091002 + CRYPT_E_OID_FORMAT Handle = 0x80091003 + CRYPT_E_INVALID_MSG_TYPE Handle = 0x80091004 + CRYPT_E_UNEXPECTED_ENCODING Handle = 0x80091005 + CRYPT_E_AUTH_ATTR_MISSING Handle = 0x80091006 + CRYPT_E_HASH_VALUE Handle = 0x80091007 + CRYPT_E_INVALID_INDEX Handle = 0x80091008 + CRYPT_E_ALREADY_DECRYPTED Handle = 0x80091009 + CRYPT_E_NOT_DECRYPTED Handle = 0x8009100A + CRYPT_E_RECIPIENT_NOT_FOUND Handle = 0x8009100B + CRYPT_E_CONTROL_TYPE Handle = 0x8009100C + CRYPT_E_ISSUER_SERIALNUMBER Handle = 0x8009100D + CRYPT_E_SIGNER_NOT_FOUND Handle = 0x8009100E + CRYPT_E_ATTRIBUTES_MISSING Handle = 0x8009100F + CRYPT_E_STREAM_MSG_NOT_READY Handle = 0x80091010 + CRYPT_E_STREAM_INSUFFICIENT_DATA Handle = 0x80091011 + CRYPT_I_NEW_PROTECTION_REQUIRED Handle = 0x00091012 + CRYPT_E_BAD_LEN Handle = 0x80092001 + CRYPT_E_BAD_ENCODE Handle = 0x80092002 + CRYPT_E_FILE_ERROR Handle = 0x80092003 + CRYPT_E_NOT_FOUND Handle = 0x80092004 + CRYPT_E_EXISTS Handle = 0x80092005 + CRYPT_E_NO_PROVIDER Handle = 0x80092006 + CRYPT_E_SELF_SIGNED Handle = 0x80092007 + CRYPT_E_DELETED_PREV Handle = 0x80092008 + CRYPT_E_NO_MATCH Handle = 0x80092009 + CRYPT_E_UNEXPECTED_MSG_TYPE Handle = 0x8009200A + CRYPT_E_NO_KEY_PROPERTY Handle = 0x8009200B + CRYPT_E_NO_DECRYPT_CERT Handle = 0x8009200C + CRYPT_E_BAD_MSG Handle = 0x8009200D + CRYPT_E_NO_SIGNER Handle = 0x8009200E + CRYPT_E_PENDING_CLOSE Handle = 0x8009200F + CRYPT_E_REVOKED Handle = 0x80092010 + CRYPT_E_NO_REVOCATION_DLL Handle = 0x80092011 + CRYPT_E_NO_REVOCATION_CHECK Handle = 0x80092012 + CRYPT_E_REVOCATION_OFFLINE Handle = 0x80092013 + CRYPT_E_NOT_IN_REVOCATION_DATABASE Handle = 0x80092014 + CRYPT_E_INVALID_NUMERIC_STRING Handle = 0x80092020 + CRYPT_E_INVALID_PRINTABLE_STRING Handle = 0x80092021 + CRYPT_E_INVALID_IA5_STRING Handle = 0x80092022 + CRYPT_E_INVALID_X500_STRING Handle = 0x80092023 + CRYPT_E_NOT_CHAR_STRING Handle = 0x80092024 + CRYPT_E_FILERESIZED Handle = 0x80092025 + CRYPT_E_SECURITY_SETTINGS Handle = 0x80092026 + CRYPT_E_NO_VERIFY_USAGE_DLL Handle = 0x80092027 + CRYPT_E_NO_VERIFY_USAGE_CHECK Handle = 0x80092028 + CRYPT_E_VERIFY_USAGE_OFFLINE Handle = 0x80092029 + CRYPT_E_NOT_IN_CTL Handle = 0x8009202A + CRYPT_E_NO_TRUSTED_SIGNER Handle = 0x8009202B + CRYPT_E_MISSING_PUBKEY_PARA Handle = 0x8009202C + CRYPT_E_OBJECT_LOCATOR_OBJECT_NOT_FOUND Handle = 0x8009202D + CRYPT_E_OSS_ERROR Handle = 0x80093000 + OSS_MORE_BUF Handle = 0x80093001 + OSS_NEGATIVE_UINTEGER Handle = 0x80093002 + OSS_PDU_RANGE Handle = 0x80093003 + OSS_MORE_INPUT Handle = 0x80093004 + OSS_DATA_ERROR Handle = 0x80093005 + OSS_BAD_ARG Handle = 0x80093006 + OSS_BAD_VERSION Handle = 0x80093007 + OSS_OUT_MEMORY Handle = 0x80093008 + OSS_PDU_MISMATCH Handle = 0x80093009 + OSS_LIMITED Handle = 0x8009300A + OSS_BAD_PTR Handle = 0x8009300B + OSS_BAD_TIME Handle = 0x8009300C + OSS_INDEFINITE_NOT_SUPPORTED Handle = 0x8009300D + OSS_MEM_ERROR Handle = 0x8009300E + OSS_BAD_TABLE Handle = 0x8009300F + OSS_TOO_LONG Handle = 0x80093010 + OSS_CONSTRAINT_VIOLATED Handle = 0x80093011 + OSS_FATAL_ERROR Handle = 0x80093012 + OSS_ACCESS_SERIALIZATION_ERROR Handle = 0x80093013 + OSS_NULL_TBL Handle = 0x80093014 + OSS_NULL_FCN Handle = 0x80093015 + OSS_BAD_ENCRULES Handle = 0x80093016 + OSS_UNAVAIL_ENCRULES Handle = 0x80093017 + OSS_CANT_OPEN_TRACE_WINDOW Handle = 0x80093018 + OSS_UNIMPLEMENTED Handle = 0x80093019 + OSS_OID_DLL_NOT_LINKED Handle = 0x8009301A + OSS_CANT_OPEN_TRACE_FILE Handle = 0x8009301B + OSS_TRACE_FILE_ALREADY_OPEN Handle = 0x8009301C + OSS_TABLE_MISMATCH Handle = 0x8009301D + OSS_TYPE_NOT_SUPPORTED Handle = 0x8009301E + OSS_REAL_DLL_NOT_LINKED Handle = 0x8009301F + OSS_REAL_CODE_NOT_LINKED Handle = 0x80093020 + OSS_OUT_OF_RANGE Handle = 0x80093021 + OSS_COPIER_DLL_NOT_LINKED Handle = 0x80093022 + OSS_CONSTRAINT_DLL_NOT_LINKED Handle = 0x80093023 + OSS_COMPARATOR_DLL_NOT_LINKED Handle = 0x80093024 + OSS_COMPARATOR_CODE_NOT_LINKED Handle = 0x80093025 + OSS_MEM_MGR_DLL_NOT_LINKED Handle = 0x80093026 + OSS_PDV_DLL_NOT_LINKED Handle = 0x80093027 + OSS_PDV_CODE_NOT_LINKED Handle = 0x80093028 + OSS_API_DLL_NOT_LINKED Handle = 0x80093029 + OSS_BERDER_DLL_NOT_LINKED Handle = 0x8009302A + OSS_PER_DLL_NOT_LINKED Handle = 0x8009302B + OSS_OPEN_TYPE_ERROR Handle = 0x8009302C + OSS_MUTEX_NOT_CREATED Handle = 0x8009302D + OSS_CANT_CLOSE_TRACE_FILE Handle = 0x8009302E + CRYPT_E_ASN1_ERROR Handle = 0x80093100 + CRYPT_E_ASN1_INTERNAL Handle = 0x80093101 + CRYPT_E_ASN1_EOD Handle = 0x80093102 + CRYPT_E_ASN1_CORRUPT Handle = 0x80093103 + CRYPT_E_ASN1_LARGE Handle = 0x80093104 + CRYPT_E_ASN1_CONSTRAINT Handle = 0x80093105 + CRYPT_E_ASN1_MEMORY Handle = 0x80093106 + CRYPT_E_ASN1_OVERFLOW Handle = 0x80093107 + CRYPT_E_ASN1_BADPDU Handle = 0x80093108 + CRYPT_E_ASN1_BADARGS Handle = 0x80093109 + CRYPT_E_ASN1_BADREAL Handle = 0x8009310A + CRYPT_E_ASN1_BADTAG Handle = 0x8009310B + CRYPT_E_ASN1_CHOICE Handle = 0x8009310C + CRYPT_E_ASN1_RULE Handle = 0x8009310D + CRYPT_E_ASN1_UTF8 Handle = 0x8009310E + CRYPT_E_ASN1_PDU_TYPE Handle = 0x80093133 + CRYPT_E_ASN1_NYI Handle = 0x80093134 + CRYPT_E_ASN1_EXTENDED Handle = 0x80093201 + CRYPT_E_ASN1_NOEOD Handle = 0x80093202 + CERTSRV_E_BAD_REQUESTSUBJECT Handle = 0x80094001 + CERTSRV_E_NO_REQUEST Handle = 0x80094002 + CERTSRV_E_BAD_REQUESTSTATUS Handle = 0x80094003 + CERTSRV_E_PROPERTY_EMPTY Handle = 0x80094004 + CERTSRV_E_INVALID_CA_CERTIFICATE Handle = 0x80094005 + CERTSRV_E_SERVER_SUSPENDED Handle = 0x80094006 + CERTSRV_E_ENCODING_LENGTH Handle = 0x80094007 + CERTSRV_E_ROLECONFLICT Handle = 0x80094008 + CERTSRV_E_RESTRICTEDOFFICER Handle = 0x80094009 + CERTSRV_E_KEY_ARCHIVAL_NOT_CONFIGURED Handle = 0x8009400A + CERTSRV_E_NO_VALID_KRA Handle = 0x8009400B + CERTSRV_E_BAD_REQUEST_KEY_ARCHIVAL Handle = 0x8009400C + CERTSRV_E_NO_CAADMIN_DEFINED Handle = 0x8009400D + CERTSRV_E_BAD_RENEWAL_CERT_ATTRIBUTE Handle = 0x8009400E + CERTSRV_E_NO_DB_SESSIONS Handle = 0x8009400F + CERTSRV_E_ALIGNMENT_FAULT Handle = 0x80094010 + CERTSRV_E_ENROLL_DENIED Handle = 0x80094011 + CERTSRV_E_TEMPLATE_DENIED Handle = 0x80094012 + CERTSRV_E_DOWNLEVEL_DC_SSL_OR_UPGRADE Handle = 0x80094013 + CERTSRV_E_ADMIN_DENIED_REQUEST Handle = 0x80094014 + CERTSRV_E_NO_POLICY_SERVER Handle = 0x80094015 + CERTSRV_E_WEAK_SIGNATURE_OR_KEY Handle = 0x80094016 + CERTSRV_E_KEY_ATTESTATION_NOT_SUPPORTED Handle = 0x80094017 + CERTSRV_E_ENCRYPTION_CERT_REQUIRED Handle = 0x80094018 + CERTSRV_E_UNSUPPORTED_CERT_TYPE Handle = 0x80094800 + CERTSRV_E_NO_CERT_TYPE Handle = 0x80094801 + CERTSRV_E_TEMPLATE_CONFLICT Handle = 0x80094802 + CERTSRV_E_SUBJECT_ALT_NAME_REQUIRED Handle = 0x80094803 + CERTSRV_E_ARCHIVED_KEY_REQUIRED Handle = 0x80094804 + CERTSRV_E_SMIME_REQUIRED Handle = 0x80094805 + CERTSRV_E_BAD_RENEWAL_SUBJECT Handle = 0x80094806 + CERTSRV_E_BAD_TEMPLATE_VERSION Handle = 0x80094807 + CERTSRV_E_TEMPLATE_POLICY_REQUIRED Handle = 0x80094808 + CERTSRV_E_SIGNATURE_POLICY_REQUIRED Handle = 0x80094809 + CERTSRV_E_SIGNATURE_COUNT Handle = 0x8009480A + CERTSRV_E_SIGNATURE_REJECTED Handle = 0x8009480B + CERTSRV_E_ISSUANCE_POLICY_REQUIRED Handle = 0x8009480C + CERTSRV_E_SUBJECT_UPN_REQUIRED Handle = 0x8009480D + CERTSRV_E_SUBJECT_DIRECTORY_GUID_REQUIRED Handle = 0x8009480E + CERTSRV_E_SUBJECT_DNS_REQUIRED Handle = 0x8009480F + CERTSRV_E_ARCHIVED_KEY_UNEXPECTED Handle = 0x80094810 + CERTSRV_E_KEY_LENGTH Handle = 0x80094811 + CERTSRV_E_SUBJECT_EMAIL_REQUIRED Handle = 0x80094812 + CERTSRV_E_UNKNOWN_CERT_TYPE Handle = 0x80094813 + CERTSRV_E_CERT_TYPE_OVERLAP Handle = 0x80094814 + CERTSRV_E_TOO_MANY_SIGNATURES Handle = 0x80094815 + CERTSRV_E_RENEWAL_BAD_PUBLIC_KEY Handle = 0x80094816 + CERTSRV_E_INVALID_EK Handle = 0x80094817 + CERTSRV_E_INVALID_IDBINDING Handle = 0x80094818 + CERTSRV_E_INVALID_ATTESTATION Handle = 0x80094819 + CERTSRV_E_KEY_ATTESTATION Handle = 0x8009481A + CERTSRV_E_CORRUPT_KEY_ATTESTATION Handle = 0x8009481B + CERTSRV_E_EXPIRED_CHALLENGE Handle = 0x8009481C + CERTSRV_E_INVALID_RESPONSE Handle = 0x8009481D + CERTSRV_E_INVALID_REQUESTID Handle = 0x8009481E + CERTSRV_E_REQUEST_PRECERTIFICATE_MISMATCH Handle = 0x8009481F + CERTSRV_E_PENDING_CLIENT_RESPONSE Handle = 0x80094820 + XENROLL_E_KEY_NOT_EXPORTABLE Handle = 0x80095000 + XENROLL_E_CANNOT_ADD_ROOT_CERT Handle = 0x80095001 + XENROLL_E_RESPONSE_KA_HASH_NOT_FOUND Handle = 0x80095002 + XENROLL_E_RESPONSE_UNEXPECTED_KA_HASH Handle = 0x80095003 + XENROLL_E_RESPONSE_KA_HASH_MISMATCH Handle = 0x80095004 + XENROLL_E_KEYSPEC_SMIME_MISMATCH Handle = 0x80095005 + TRUST_E_SYSTEM_ERROR Handle = 0x80096001 + TRUST_E_NO_SIGNER_CERT Handle = 0x80096002 + TRUST_E_COUNTER_SIGNER Handle = 0x80096003 + TRUST_E_CERT_SIGNATURE Handle = 0x80096004 + TRUST_E_TIME_STAMP Handle = 0x80096005 + TRUST_E_BAD_DIGEST Handle = 0x80096010 + TRUST_E_MALFORMED_SIGNATURE Handle = 0x80096011 + TRUST_E_BASIC_CONSTRAINTS Handle = 0x80096019 + TRUST_E_FINANCIAL_CRITERIA Handle = 0x8009601E + MSSIPOTF_E_OUTOFMEMRANGE Handle = 0x80097001 + MSSIPOTF_E_CANTGETOBJECT Handle = 0x80097002 + MSSIPOTF_E_NOHEADTABLE Handle = 0x80097003 + MSSIPOTF_E_BAD_MAGICNUMBER Handle = 0x80097004 + MSSIPOTF_E_BAD_OFFSET_TABLE Handle = 0x80097005 + MSSIPOTF_E_TABLE_TAGORDER Handle = 0x80097006 + MSSIPOTF_E_TABLE_LONGWORD Handle = 0x80097007 + MSSIPOTF_E_BAD_FIRST_TABLE_PLACEMENT Handle = 0x80097008 + MSSIPOTF_E_TABLES_OVERLAP Handle = 0x80097009 + MSSIPOTF_E_TABLE_PADBYTES Handle = 0x8009700A + MSSIPOTF_E_FILETOOSMALL Handle = 0x8009700B + MSSIPOTF_E_TABLE_CHECKSUM Handle = 0x8009700C + MSSIPOTF_E_FILE_CHECKSUM Handle = 0x8009700D + MSSIPOTF_E_FAILED_POLICY Handle = 0x80097010 + MSSIPOTF_E_FAILED_HINTS_CHECK Handle = 0x80097011 + MSSIPOTF_E_NOT_OPENTYPE Handle = 0x80097012 + MSSIPOTF_E_FILE Handle = 0x80097013 + MSSIPOTF_E_CRYPT Handle = 0x80097014 + MSSIPOTF_E_BADVERSION Handle = 0x80097015 + MSSIPOTF_E_DSIG_STRUCTURE Handle = 0x80097016 + MSSIPOTF_E_PCONST_CHECK Handle = 0x80097017 + MSSIPOTF_E_STRUCTURE Handle = 0x80097018 + ERROR_CRED_REQUIRES_CONFIRMATION Handle = 0x80097019 + NTE_OP_OK syscall.Errno = 0 + TRUST_E_PROVIDER_UNKNOWN Handle = 0x800B0001 + TRUST_E_ACTION_UNKNOWN Handle = 0x800B0002 + TRUST_E_SUBJECT_FORM_UNKNOWN Handle = 0x800B0003 + TRUST_E_SUBJECT_NOT_TRUSTED Handle = 0x800B0004 + DIGSIG_E_ENCODE Handle = 0x800B0005 + DIGSIG_E_DECODE Handle = 0x800B0006 + DIGSIG_E_EXTENSIBILITY Handle = 0x800B0007 + DIGSIG_E_CRYPTO Handle = 0x800B0008 + PERSIST_E_SIZEDEFINITE Handle = 0x800B0009 + PERSIST_E_SIZEINDEFINITE Handle = 0x800B000A + PERSIST_E_NOTSELFSIZING Handle = 0x800B000B + TRUST_E_NOSIGNATURE Handle = 0x800B0100 + CERT_E_EXPIRED Handle = 0x800B0101 + CERT_E_VALIDITYPERIODNESTING Handle = 0x800B0102 + CERT_E_ROLE Handle = 0x800B0103 + CERT_E_PATHLENCONST Handle = 0x800B0104 + CERT_E_CRITICAL Handle = 0x800B0105 + CERT_E_PURPOSE Handle = 0x800B0106 + CERT_E_ISSUERCHAINING Handle = 0x800B0107 + CERT_E_MALFORMED Handle = 0x800B0108 + CERT_E_UNTRUSTEDROOT Handle = 0x800B0109 + CERT_E_CHAINING Handle = 0x800B010A + TRUST_E_FAIL Handle = 0x800B010B + CERT_E_REVOKED Handle = 0x800B010C + CERT_E_UNTRUSTEDTESTROOT Handle = 0x800B010D + CERT_E_REVOCATION_FAILURE Handle = 0x800B010E + CERT_E_CN_NO_MATCH Handle = 0x800B010F + CERT_E_WRONG_USAGE Handle = 0x800B0110 + TRUST_E_EXPLICIT_DISTRUST Handle = 0x800B0111 + CERT_E_UNTRUSTEDCA Handle = 0x800B0112 + CERT_E_INVALID_POLICY Handle = 0x800B0113 + CERT_E_INVALID_NAME Handle = 0x800B0114 + SPAPI_E_EXPECTED_SECTION_NAME Handle = 0x800F0000 + SPAPI_E_BAD_SECTION_NAME_LINE Handle = 0x800F0001 + SPAPI_E_SECTION_NAME_TOO_LONG Handle = 0x800F0002 + SPAPI_E_GENERAL_SYNTAX Handle = 0x800F0003 + SPAPI_E_WRONG_INF_STYLE Handle = 0x800F0100 + SPAPI_E_SECTION_NOT_FOUND Handle = 0x800F0101 + SPAPI_E_LINE_NOT_FOUND Handle = 0x800F0102 + SPAPI_E_NO_BACKUP Handle = 0x800F0103 + SPAPI_E_NO_ASSOCIATED_CLASS Handle = 0x800F0200 + SPAPI_E_CLASS_MISMATCH Handle = 0x800F0201 + SPAPI_E_DUPLICATE_FOUND Handle = 0x800F0202 + SPAPI_E_NO_DRIVER_SELECTED Handle = 0x800F0203 + SPAPI_E_KEY_DOES_NOT_EXIST Handle = 0x800F0204 + SPAPI_E_INVALID_DEVINST_NAME Handle = 0x800F0205 + SPAPI_E_INVALID_CLASS Handle = 0x800F0206 + SPAPI_E_DEVINST_ALREADY_EXISTS Handle = 0x800F0207 + SPAPI_E_DEVINFO_NOT_REGISTERED Handle = 0x800F0208 + SPAPI_E_INVALID_REG_PROPERTY Handle = 0x800F0209 + SPAPI_E_NO_INF Handle = 0x800F020A + SPAPI_E_NO_SUCH_DEVINST Handle = 0x800F020B + SPAPI_E_CANT_LOAD_CLASS_ICON Handle = 0x800F020C + SPAPI_E_INVALID_CLASS_INSTALLER Handle = 0x800F020D + SPAPI_E_DI_DO_DEFAULT Handle = 0x800F020E + SPAPI_E_DI_NOFILECOPY Handle = 0x800F020F + SPAPI_E_INVALID_HWPROFILE Handle = 0x800F0210 + SPAPI_E_NO_DEVICE_SELECTED Handle = 0x800F0211 + SPAPI_E_DEVINFO_LIST_LOCKED Handle = 0x800F0212 + SPAPI_E_DEVINFO_DATA_LOCKED Handle = 0x800F0213 + SPAPI_E_DI_BAD_PATH Handle = 0x800F0214 + SPAPI_E_NO_CLASSINSTALL_PARAMS Handle = 0x800F0215 + SPAPI_E_FILEQUEUE_LOCKED Handle = 0x800F0216 + SPAPI_E_BAD_SERVICE_INSTALLSECT Handle = 0x800F0217 + SPAPI_E_NO_CLASS_DRIVER_LIST Handle = 0x800F0218 + SPAPI_E_NO_ASSOCIATED_SERVICE Handle = 0x800F0219 + SPAPI_E_NO_DEFAULT_DEVICE_INTERFACE Handle = 0x800F021A + SPAPI_E_DEVICE_INTERFACE_ACTIVE Handle = 0x800F021B + SPAPI_E_DEVICE_INTERFACE_REMOVED Handle = 0x800F021C + SPAPI_E_BAD_INTERFACE_INSTALLSECT Handle = 0x800F021D + SPAPI_E_NO_SUCH_INTERFACE_CLASS Handle = 0x800F021E + SPAPI_E_INVALID_REFERENCE_STRING Handle = 0x800F021F + SPAPI_E_INVALID_MACHINENAME Handle = 0x800F0220 + SPAPI_E_REMOTE_COMM_FAILURE Handle = 0x800F0221 + SPAPI_E_MACHINE_UNAVAILABLE Handle = 0x800F0222 + SPAPI_E_NO_CONFIGMGR_SERVICES Handle = 0x800F0223 + SPAPI_E_INVALID_PROPPAGE_PROVIDER Handle = 0x800F0224 + SPAPI_E_NO_SUCH_DEVICE_INTERFACE Handle = 0x800F0225 + SPAPI_E_DI_POSTPROCESSING_REQUIRED Handle = 0x800F0226 + SPAPI_E_INVALID_COINSTALLER Handle = 0x800F0227 + SPAPI_E_NO_COMPAT_DRIVERS Handle = 0x800F0228 + SPAPI_E_NO_DEVICE_ICON Handle = 0x800F0229 + SPAPI_E_INVALID_INF_LOGCONFIG Handle = 0x800F022A + SPAPI_E_DI_DONT_INSTALL Handle = 0x800F022B + SPAPI_E_INVALID_FILTER_DRIVER Handle = 0x800F022C + SPAPI_E_NON_WINDOWS_NT_DRIVER Handle = 0x800F022D + SPAPI_E_NON_WINDOWS_DRIVER Handle = 0x800F022E + SPAPI_E_NO_CATALOG_FOR_OEM_INF Handle = 0x800F022F + SPAPI_E_DEVINSTALL_QUEUE_NONNATIVE Handle = 0x800F0230 + SPAPI_E_NOT_DISABLEABLE Handle = 0x800F0231 + SPAPI_E_CANT_REMOVE_DEVINST Handle = 0x800F0232 + SPAPI_E_INVALID_TARGET Handle = 0x800F0233 + SPAPI_E_DRIVER_NONNATIVE Handle = 0x800F0234 + SPAPI_E_IN_WOW64 Handle = 0x800F0235 + SPAPI_E_SET_SYSTEM_RESTORE_POINT Handle = 0x800F0236 + SPAPI_E_INCORRECTLY_COPIED_INF Handle = 0x800F0237 + SPAPI_E_SCE_DISABLED Handle = 0x800F0238 + SPAPI_E_UNKNOWN_EXCEPTION Handle = 0x800F0239 + SPAPI_E_PNP_REGISTRY_ERROR Handle = 0x800F023A + SPAPI_E_REMOTE_REQUEST_UNSUPPORTED Handle = 0x800F023B + SPAPI_E_NOT_AN_INSTALLED_OEM_INF Handle = 0x800F023C + SPAPI_E_INF_IN_USE_BY_DEVICES Handle = 0x800F023D + SPAPI_E_DI_FUNCTION_OBSOLETE Handle = 0x800F023E + SPAPI_E_NO_AUTHENTICODE_CATALOG Handle = 0x800F023F + SPAPI_E_AUTHENTICODE_DISALLOWED Handle = 0x800F0240 + SPAPI_E_AUTHENTICODE_TRUSTED_PUBLISHER Handle = 0x800F0241 + SPAPI_E_AUTHENTICODE_TRUST_NOT_ESTABLISHED Handle = 0x800F0242 + SPAPI_E_AUTHENTICODE_PUBLISHER_NOT_TRUSTED Handle = 0x800F0243 + SPAPI_E_SIGNATURE_OSATTRIBUTE_MISMATCH Handle = 0x800F0244 + SPAPI_E_ONLY_VALIDATE_VIA_AUTHENTICODE Handle = 0x800F0245 + SPAPI_E_DEVICE_INSTALLER_NOT_READY Handle = 0x800F0246 + SPAPI_E_DRIVER_STORE_ADD_FAILED Handle = 0x800F0247 + SPAPI_E_DEVICE_INSTALL_BLOCKED Handle = 0x800F0248 + SPAPI_E_DRIVER_INSTALL_BLOCKED Handle = 0x800F0249 + SPAPI_E_WRONG_INF_TYPE Handle = 0x800F024A + SPAPI_E_FILE_HASH_NOT_IN_CATALOG Handle = 0x800F024B + SPAPI_E_DRIVER_STORE_DELETE_FAILED Handle = 0x800F024C + SPAPI_E_UNRECOVERABLE_STACK_OVERFLOW Handle = 0x800F0300 + SPAPI_E_ERROR_NOT_INSTALLED Handle = 0x800F1000 + SCARD_S_SUCCESS = S_OK + SCARD_F_INTERNAL_ERROR Handle = 0x80100001 + SCARD_E_CANCELLED Handle = 0x80100002 + SCARD_E_INVALID_HANDLE Handle = 0x80100003 + SCARD_E_INVALID_PARAMETER Handle = 0x80100004 + SCARD_E_INVALID_TARGET Handle = 0x80100005 + SCARD_E_NO_MEMORY Handle = 0x80100006 + SCARD_F_WAITED_TOO_LONG Handle = 0x80100007 + SCARD_E_INSUFFICIENT_BUFFER Handle = 0x80100008 + SCARD_E_UNKNOWN_READER Handle = 0x80100009 + SCARD_E_TIMEOUT Handle = 0x8010000A + SCARD_E_SHARING_VIOLATION Handle = 0x8010000B + SCARD_E_NO_SMARTCARD Handle = 0x8010000C + SCARD_E_UNKNOWN_CARD Handle = 0x8010000D + SCARD_E_CANT_DISPOSE Handle = 0x8010000E + SCARD_E_PROTO_MISMATCH Handle = 0x8010000F + SCARD_E_NOT_READY Handle = 0x80100010 + SCARD_E_INVALID_VALUE Handle = 0x80100011 + SCARD_E_SYSTEM_CANCELLED Handle = 0x80100012 + SCARD_F_COMM_ERROR Handle = 0x80100013 + SCARD_F_UNKNOWN_ERROR Handle = 0x80100014 + SCARD_E_INVALID_ATR Handle = 0x80100015 + SCARD_E_NOT_TRANSACTED Handle = 0x80100016 + SCARD_E_READER_UNAVAILABLE Handle = 0x80100017 + SCARD_P_SHUTDOWN Handle = 0x80100018 + SCARD_E_PCI_TOO_SMALL Handle = 0x80100019 + SCARD_E_READER_UNSUPPORTED Handle = 0x8010001A + SCARD_E_DUPLICATE_READER Handle = 0x8010001B + SCARD_E_CARD_UNSUPPORTED Handle = 0x8010001C + SCARD_E_NO_SERVICE Handle = 0x8010001D + SCARD_E_SERVICE_STOPPED Handle = 0x8010001E + SCARD_E_UNEXPECTED Handle = 0x8010001F + SCARD_E_ICC_INSTALLATION Handle = 0x80100020 + SCARD_E_ICC_CREATEORDER Handle = 0x80100021 + SCARD_E_UNSUPPORTED_FEATURE Handle = 0x80100022 + SCARD_E_DIR_NOT_FOUND Handle = 0x80100023 + SCARD_E_FILE_NOT_FOUND Handle = 0x80100024 + SCARD_E_NO_DIR Handle = 0x80100025 + SCARD_E_NO_FILE Handle = 0x80100026 + SCARD_E_NO_ACCESS Handle = 0x80100027 + SCARD_E_WRITE_TOO_MANY Handle = 0x80100028 + SCARD_E_BAD_SEEK Handle = 0x80100029 + SCARD_E_INVALID_CHV Handle = 0x8010002A + SCARD_E_UNKNOWN_RES_MNG Handle = 0x8010002B + SCARD_E_NO_SUCH_CERTIFICATE Handle = 0x8010002C + SCARD_E_CERTIFICATE_UNAVAILABLE Handle = 0x8010002D + SCARD_E_NO_READERS_AVAILABLE Handle = 0x8010002E + SCARD_E_COMM_DATA_LOST Handle = 0x8010002F + SCARD_E_NO_KEY_CONTAINER Handle = 0x80100030 + SCARD_E_SERVER_TOO_BUSY Handle = 0x80100031 + SCARD_E_PIN_CACHE_EXPIRED Handle = 0x80100032 + SCARD_E_NO_PIN_CACHE Handle = 0x80100033 + SCARD_E_READ_ONLY_CARD Handle = 0x80100034 + SCARD_W_UNSUPPORTED_CARD Handle = 0x80100065 + SCARD_W_UNRESPONSIVE_CARD Handle = 0x80100066 + SCARD_W_UNPOWERED_CARD Handle = 0x80100067 + SCARD_W_RESET_CARD Handle = 0x80100068 + SCARD_W_REMOVED_CARD Handle = 0x80100069 + SCARD_W_SECURITY_VIOLATION Handle = 0x8010006A + SCARD_W_WRONG_CHV Handle = 0x8010006B + SCARD_W_CHV_BLOCKED Handle = 0x8010006C + SCARD_W_EOF Handle = 0x8010006D + SCARD_W_CANCELLED_BY_USER Handle = 0x8010006E + SCARD_W_CARD_NOT_AUTHENTICATED Handle = 0x8010006F + SCARD_W_CACHE_ITEM_NOT_FOUND Handle = 0x80100070 + SCARD_W_CACHE_ITEM_STALE Handle = 0x80100071 + SCARD_W_CACHE_ITEM_TOO_BIG Handle = 0x80100072 + COMADMIN_E_OBJECTERRORS Handle = 0x80110401 + COMADMIN_E_OBJECTINVALID Handle = 0x80110402 + COMADMIN_E_KEYMISSING Handle = 0x80110403 + COMADMIN_E_ALREADYINSTALLED Handle = 0x80110404 + COMADMIN_E_APP_FILE_WRITEFAIL Handle = 0x80110407 + COMADMIN_E_APP_FILE_READFAIL Handle = 0x80110408 + COMADMIN_E_APP_FILE_VERSION Handle = 0x80110409 + COMADMIN_E_BADPATH Handle = 0x8011040A + COMADMIN_E_APPLICATIONEXISTS Handle = 0x8011040B + COMADMIN_E_ROLEEXISTS Handle = 0x8011040C + COMADMIN_E_CANTCOPYFILE Handle = 0x8011040D + COMADMIN_E_NOUSER Handle = 0x8011040F + COMADMIN_E_INVALIDUSERIDS Handle = 0x80110410 + COMADMIN_E_NOREGISTRYCLSID Handle = 0x80110411 + COMADMIN_E_BADREGISTRYPROGID Handle = 0x80110412 + COMADMIN_E_AUTHENTICATIONLEVEL Handle = 0x80110413 + COMADMIN_E_USERPASSWDNOTVALID Handle = 0x80110414 + COMADMIN_E_CLSIDORIIDMISMATCH Handle = 0x80110418 + COMADMIN_E_REMOTEINTERFACE Handle = 0x80110419 + COMADMIN_E_DLLREGISTERSERVER Handle = 0x8011041A + COMADMIN_E_NOSERVERSHARE Handle = 0x8011041B + COMADMIN_E_DLLLOADFAILED Handle = 0x8011041D + COMADMIN_E_BADREGISTRYLIBID Handle = 0x8011041E + COMADMIN_E_APPDIRNOTFOUND Handle = 0x8011041F + COMADMIN_E_REGISTRARFAILED Handle = 0x80110423 + COMADMIN_E_COMPFILE_DOESNOTEXIST Handle = 0x80110424 + COMADMIN_E_COMPFILE_LOADDLLFAIL Handle = 0x80110425 + COMADMIN_E_COMPFILE_GETCLASSOBJ Handle = 0x80110426 + COMADMIN_E_COMPFILE_CLASSNOTAVAIL Handle = 0x80110427 + COMADMIN_E_COMPFILE_BADTLB Handle = 0x80110428 + COMADMIN_E_COMPFILE_NOTINSTALLABLE Handle = 0x80110429 + COMADMIN_E_NOTCHANGEABLE Handle = 0x8011042A + COMADMIN_E_NOTDELETEABLE Handle = 0x8011042B + COMADMIN_E_SESSION Handle = 0x8011042C + COMADMIN_E_COMP_MOVE_LOCKED Handle = 0x8011042D + COMADMIN_E_COMP_MOVE_BAD_DEST Handle = 0x8011042E + COMADMIN_E_REGISTERTLB Handle = 0x80110430 + COMADMIN_E_SYSTEMAPP Handle = 0x80110433 + COMADMIN_E_COMPFILE_NOREGISTRAR Handle = 0x80110434 + COMADMIN_E_COREQCOMPINSTALLED Handle = 0x80110435 + COMADMIN_E_SERVICENOTINSTALLED Handle = 0x80110436 + COMADMIN_E_PROPERTYSAVEFAILED Handle = 0x80110437 + COMADMIN_E_OBJECTEXISTS Handle = 0x80110438 + COMADMIN_E_COMPONENTEXISTS Handle = 0x80110439 + COMADMIN_E_REGFILE_CORRUPT Handle = 0x8011043B + COMADMIN_E_PROPERTY_OVERFLOW Handle = 0x8011043C + COMADMIN_E_NOTINREGISTRY Handle = 0x8011043E + COMADMIN_E_OBJECTNOTPOOLABLE Handle = 0x8011043F + COMADMIN_E_APPLID_MATCHES_CLSID Handle = 0x80110446 + COMADMIN_E_ROLE_DOES_NOT_EXIST Handle = 0x80110447 + COMADMIN_E_START_APP_NEEDS_COMPONENTS Handle = 0x80110448 + COMADMIN_E_REQUIRES_DIFFERENT_PLATFORM Handle = 0x80110449 + COMADMIN_E_CAN_NOT_EXPORT_APP_PROXY Handle = 0x8011044A + COMADMIN_E_CAN_NOT_START_APP Handle = 0x8011044B + COMADMIN_E_CAN_NOT_EXPORT_SYS_APP Handle = 0x8011044C + COMADMIN_E_CANT_SUBSCRIBE_TO_COMPONENT Handle = 0x8011044D + COMADMIN_E_EVENTCLASS_CANT_BE_SUBSCRIBER Handle = 0x8011044E + COMADMIN_E_LIB_APP_PROXY_INCOMPATIBLE Handle = 0x8011044F + COMADMIN_E_BASE_PARTITION_ONLY Handle = 0x80110450 + COMADMIN_E_START_APP_DISABLED Handle = 0x80110451 + COMADMIN_E_CAT_DUPLICATE_PARTITION_NAME Handle = 0x80110457 + COMADMIN_E_CAT_INVALID_PARTITION_NAME Handle = 0x80110458 + COMADMIN_E_CAT_PARTITION_IN_USE Handle = 0x80110459 + COMADMIN_E_FILE_PARTITION_DUPLICATE_FILES Handle = 0x8011045A + COMADMIN_E_CAT_IMPORTED_COMPONENTS_NOT_ALLOWED Handle = 0x8011045B + COMADMIN_E_AMBIGUOUS_APPLICATION_NAME Handle = 0x8011045C + COMADMIN_E_AMBIGUOUS_PARTITION_NAME Handle = 0x8011045D + COMADMIN_E_REGDB_NOTINITIALIZED Handle = 0x80110472 + COMADMIN_E_REGDB_NOTOPEN Handle = 0x80110473 + COMADMIN_E_REGDB_SYSTEMERR Handle = 0x80110474 + COMADMIN_E_REGDB_ALREADYRUNNING Handle = 0x80110475 + COMADMIN_E_MIG_VERSIONNOTSUPPORTED Handle = 0x80110480 + COMADMIN_E_MIG_SCHEMANOTFOUND Handle = 0x80110481 + COMADMIN_E_CAT_BITNESSMISMATCH Handle = 0x80110482 + COMADMIN_E_CAT_UNACCEPTABLEBITNESS Handle = 0x80110483 + COMADMIN_E_CAT_WRONGAPPBITNESS Handle = 0x80110484 + COMADMIN_E_CAT_PAUSE_RESUME_NOT_SUPPORTED Handle = 0x80110485 + COMADMIN_E_CAT_SERVERFAULT Handle = 0x80110486 + COMQC_E_APPLICATION_NOT_QUEUED Handle = 0x80110600 + COMQC_E_NO_QUEUEABLE_INTERFACES Handle = 0x80110601 + COMQC_E_QUEUING_SERVICE_NOT_AVAILABLE Handle = 0x80110602 + COMQC_E_NO_IPERSISTSTREAM Handle = 0x80110603 + COMQC_E_BAD_MESSAGE Handle = 0x80110604 + COMQC_E_UNAUTHENTICATED Handle = 0x80110605 + COMQC_E_UNTRUSTED_ENQUEUER Handle = 0x80110606 + MSDTC_E_DUPLICATE_RESOURCE Handle = 0x80110701 + COMADMIN_E_OBJECT_PARENT_MISSING Handle = 0x80110808 + COMADMIN_E_OBJECT_DOES_NOT_EXIST Handle = 0x80110809 + COMADMIN_E_APP_NOT_RUNNING Handle = 0x8011080A + COMADMIN_E_INVALID_PARTITION Handle = 0x8011080B + COMADMIN_E_SVCAPP_NOT_POOLABLE_OR_RECYCLABLE Handle = 0x8011080D + COMADMIN_E_USER_IN_SET Handle = 0x8011080E + COMADMIN_E_CANTRECYCLELIBRARYAPPS Handle = 0x8011080F + COMADMIN_E_CANTRECYCLESERVICEAPPS Handle = 0x80110811 + COMADMIN_E_PROCESSALREADYRECYCLED Handle = 0x80110812 + COMADMIN_E_PAUSEDPROCESSMAYNOTBERECYCLED Handle = 0x80110813 + COMADMIN_E_CANTMAKEINPROCSERVICE Handle = 0x80110814 + COMADMIN_E_PROGIDINUSEBYCLSID Handle = 0x80110815 + COMADMIN_E_DEFAULT_PARTITION_NOT_IN_SET Handle = 0x80110816 + COMADMIN_E_RECYCLEDPROCESSMAYNOTBEPAUSED Handle = 0x80110817 + COMADMIN_E_PARTITION_ACCESSDENIED Handle = 0x80110818 + COMADMIN_E_PARTITION_MSI_ONLY Handle = 0x80110819 + COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_1_0_FORMAT Handle = 0x8011081A + COMADMIN_E_LEGACYCOMPS_NOT_ALLOWED_IN_NONBASE_PARTITIONS Handle = 0x8011081B + COMADMIN_E_COMP_MOVE_SOURCE Handle = 0x8011081C + COMADMIN_E_COMP_MOVE_DEST Handle = 0x8011081D + COMADMIN_E_COMP_MOVE_PRIVATE Handle = 0x8011081E + COMADMIN_E_BASEPARTITION_REQUIRED_IN_SET Handle = 0x8011081F + COMADMIN_E_CANNOT_ALIAS_EVENTCLASS Handle = 0x80110820 + COMADMIN_E_PRIVATE_ACCESSDENIED Handle = 0x80110821 + COMADMIN_E_SAFERINVALID Handle = 0x80110822 + COMADMIN_E_REGISTRY_ACCESSDENIED Handle = 0x80110823 + COMADMIN_E_PARTITIONS_DISABLED Handle = 0x80110824 + WER_S_REPORT_DEBUG Handle = 0x001B0000 + WER_S_REPORT_UPLOADED Handle = 0x001B0001 + WER_S_REPORT_QUEUED Handle = 0x001B0002 + WER_S_DISABLED Handle = 0x001B0003 + WER_S_SUSPENDED_UPLOAD Handle = 0x001B0004 + WER_S_DISABLED_QUEUE Handle = 0x001B0005 + WER_S_DISABLED_ARCHIVE Handle = 0x001B0006 + WER_S_REPORT_ASYNC Handle = 0x001B0007 + WER_S_IGNORE_ASSERT_INSTANCE Handle = 0x001B0008 + WER_S_IGNORE_ALL_ASSERTS Handle = 0x001B0009 + WER_S_ASSERT_CONTINUE Handle = 0x001B000A + WER_S_THROTTLED Handle = 0x001B000B + WER_S_REPORT_UPLOADED_CAB Handle = 0x001B000C + WER_E_CRASH_FAILURE Handle = 0x801B8000 + WER_E_CANCELED Handle = 0x801B8001 + WER_E_NETWORK_FAILURE Handle = 0x801B8002 + WER_E_NOT_INITIALIZED Handle = 0x801B8003 + WER_E_ALREADY_REPORTING Handle = 0x801B8004 + WER_E_DUMP_THROTTLED Handle = 0x801B8005 + WER_E_INSUFFICIENT_CONSENT Handle = 0x801B8006 + WER_E_TOO_HEAVY Handle = 0x801B8007 + ERROR_FLT_IO_COMPLETE Handle = 0x001F0001 + ERROR_FLT_NO_HANDLER_DEFINED Handle = 0x801F0001 + ERROR_FLT_CONTEXT_ALREADY_DEFINED Handle = 0x801F0002 + ERROR_FLT_INVALID_ASYNCHRONOUS_REQUEST Handle = 0x801F0003 + ERROR_FLT_DISALLOW_FAST_IO Handle = 0x801F0004 + ERROR_FLT_INVALID_NAME_REQUEST Handle = 0x801F0005 + ERROR_FLT_NOT_SAFE_TO_POST_OPERATION Handle = 0x801F0006 + ERROR_FLT_NOT_INITIALIZED Handle = 0x801F0007 + ERROR_FLT_FILTER_NOT_READY Handle = 0x801F0008 + ERROR_FLT_POST_OPERATION_CLEANUP Handle = 0x801F0009 + ERROR_FLT_INTERNAL_ERROR Handle = 0x801F000A + ERROR_FLT_DELETING_OBJECT Handle = 0x801F000B + ERROR_FLT_MUST_BE_NONPAGED_POOL Handle = 0x801F000C + ERROR_FLT_DUPLICATE_ENTRY Handle = 0x801F000D + ERROR_FLT_CBDQ_DISABLED Handle = 0x801F000E + ERROR_FLT_DO_NOT_ATTACH Handle = 0x801F000F + ERROR_FLT_DO_NOT_DETACH Handle = 0x801F0010 + ERROR_FLT_INSTANCE_ALTITUDE_COLLISION Handle = 0x801F0011 + ERROR_FLT_INSTANCE_NAME_COLLISION Handle = 0x801F0012 + ERROR_FLT_FILTER_NOT_FOUND Handle = 0x801F0013 + ERROR_FLT_VOLUME_NOT_FOUND Handle = 0x801F0014 + ERROR_FLT_INSTANCE_NOT_FOUND Handle = 0x801F0015 + ERROR_FLT_CONTEXT_ALLOCATION_NOT_FOUND Handle = 0x801F0016 + ERROR_FLT_INVALID_CONTEXT_REGISTRATION Handle = 0x801F0017 + ERROR_FLT_NAME_CACHE_MISS Handle = 0x801F0018 + ERROR_FLT_NO_DEVICE_OBJECT Handle = 0x801F0019 + ERROR_FLT_VOLUME_ALREADY_MOUNTED Handle = 0x801F001A + ERROR_FLT_ALREADY_ENLISTED Handle = 0x801F001B + ERROR_FLT_CONTEXT_ALREADY_LINKED Handle = 0x801F001C + ERROR_FLT_NO_WAITER_FOR_REPLY Handle = 0x801F0020 + ERROR_FLT_REGISTRATION_BUSY Handle = 0x801F0023 + ERROR_HUNG_DISPLAY_DRIVER_THREAD Handle = 0x80260001 + DWM_E_COMPOSITIONDISABLED Handle = 0x80263001 + DWM_E_REMOTING_NOT_SUPPORTED Handle = 0x80263002 + DWM_E_NO_REDIRECTION_SURFACE_AVAILABLE Handle = 0x80263003 + DWM_E_NOT_QUEUING_PRESENTS Handle = 0x80263004 + DWM_E_ADAPTER_NOT_FOUND Handle = 0x80263005 + DWM_S_GDI_REDIRECTION_SURFACE Handle = 0x00263005 + DWM_E_TEXTURE_TOO_LARGE Handle = 0x80263007 + DWM_S_GDI_REDIRECTION_SURFACE_BLT_VIA_GDI Handle = 0x00263008 + ERROR_MONITOR_NO_DESCRIPTOR Handle = 0x00261001 + ERROR_MONITOR_UNKNOWN_DESCRIPTOR_FORMAT Handle = 0x00261002 + ERROR_MONITOR_INVALID_DESCRIPTOR_CHECKSUM Handle = 0xC0261003 + ERROR_MONITOR_INVALID_STANDARD_TIMING_BLOCK Handle = 0xC0261004 + ERROR_MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED Handle = 0xC0261005 + ERROR_MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK Handle = 0xC0261006 + ERROR_MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK Handle = 0xC0261007 + ERROR_MONITOR_NO_MORE_DESCRIPTOR_DATA Handle = 0xC0261008 + ERROR_MONITOR_INVALID_DETAILED_TIMING_BLOCK Handle = 0xC0261009 + ERROR_MONITOR_INVALID_MANUFACTURE_DATE Handle = 0xC026100A + ERROR_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER Handle = 0xC0262000 + ERROR_GRAPHICS_INSUFFICIENT_DMA_BUFFER Handle = 0xC0262001 + ERROR_GRAPHICS_INVALID_DISPLAY_ADAPTER Handle = 0xC0262002 + ERROR_GRAPHICS_ADAPTER_WAS_RESET Handle = 0xC0262003 + ERROR_GRAPHICS_INVALID_DRIVER_MODEL Handle = 0xC0262004 + ERROR_GRAPHICS_PRESENT_MODE_CHANGED Handle = 0xC0262005 + ERROR_GRAPHICS_PRESENT_OCCLUDED Handle = 0xC0262006 + ERROR_GRAPHICS_PRESENT_DENIED Handle = 0xC0262007 + ERROR_GRAPHICS_CANNOTCOLORCONVERT Handle = 0xC0262008 + ERROR_GRAPHICS_DRIVER_MISMATCH Handle = 0xC0262009 + ERROR_GRAPHICS_PARTIAL_DATA_POPULATED Handle = 0x4026200A + ERROR_GRAPHICS_PRESENT_REDIRECTION_DISABLED Handle = 0xC026200B + ERROR_GRAPHICS_PRESENT_UNOCCLUDED Handle = 0xC026200C + ERROR_GRAPHICS_WINDOWDC_NOT_AVAILABLE Handle = 0xC026200D + ERROR_GRAPHICS_WINDOWLESS_PRESENT_DISABLED Handle = 0xC026200E + ERROR_GRAPHICS_PRESENT_INVALID_WINDOW Handle = 0xC026200F + ERROR_GRAPHICS_PRESENT_BUFFER_NOT_BOUND Handle = 0xC0262010 + ERROR_GRAPHICS_VAIL_STATE_CHANGED Handle = 0xC0262011 + ERROR_GRAPHICS_NO_VIDEO_MEMORY Handle = 0xC0262100 + ERROR_GRAPHICS_CANT_LOCK_MEMORY Handle = 0xC0262101 + ERROR_GRAPHICS_ALLOCATION_BUSY Handle = 0xC0262102 + ERROR_GRAPHICS_TOO_MANY_REFERENCES Handle = 0xC0262103 + ERROR_GRAPHICS_TRY_AGAIN_LATER Handle = 0xC0262104 + ERROR_GRAPHICS_TRY_AGAIN_NOW Handle = 0xC0262105 + ERROR_GRAPHICS_ALLOCATION_INVALID Handle = 0xC0262106 + ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE Handle = 0xC0262107 + ERROR_GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED Handle = 0xC0262108 + ERROR_GRAPHICS_CANT_EVICT_PINNED_ALLOCATION Handle = 0xC0262109 + ERROR_GRAPHICS_INVALID_ALLOCATION_USAGE Handle = 0xC0262110 + ERROR_GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION Handle = 0xC0262111 + ERROR_GRAPHICS_ALLOCATION_CLOSED Handle = 0xC0262112 + ERROR_GRAPHICS_INVALID_ALLOCATION_INSTANCE Handle = 0xC0262113 + ERROR_GRAPHICS_INVALID_ALLOCATION_HANDLE Handle = 0xC0262114 + ERROR_GRAPHICS_WRONG_ALLOCATION_DEVICE Handle = 0xC0262115 + ERROR_GRAPHICS_ALLOCATION_CONTENT_LOST Handle = 0xC0262116 + ERROR_GRAPHICS_GPU_EXCEPTION_ON_DEVICE Handle = 0xC0262200 + ERROR_GRAPHICS_SKIP_ALLOCATION_PREPARATION Handle = 0x40262201 + ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY Handle = 0xC0262300 + ERROR_GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED Handle = 0xC0262301 + ERROR_GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED Handle = 0xC0262302 + ERROR_GRAPHICS_INVALID_VIDPN Handle = 0xC0262303 + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE Handle = 0xC0262304 + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET Handle = 0xC0262305 + ERROR_GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED Handle = 0xC0262306 + ERROR_GRAPHICS_MODE_NOT_PINNED Handle = 0x00262307 + ERROR_GRAPHICS_INVALID_VIDPN_SOURCEMODESET Handle = 0xC0262308 + ERROR_GRAPHICS_INVALID_VIDPN_TARGETMODESET Handle = 0xC0262309 + ERROR_GRAPHICS_INVALID_FREQUENCY Handle = 0xC026230A + ERROR_GRAPHICS_INVALID_ACTIVE_REGION Handle = 0xC026230B + ERROR_GRAPHICS_INVALID_TOTAL_REGION Handle = 0xC026230C + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE Handle = 0xC0262310 + ERROR_GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE Handle = 0xC0262311 + ERROR_GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET Handle = 0xC0262312 + ERROR_GRAPHICS_PATH_ALREADY_IN_TOPOLOGY Handle = 0xC0262313 + ERROR_GRAPHICS_MODE_ALREADY_IN_MODESET Handle = 0xC0262314 + ERROR_GRAPHICS_INVALID_VIDEOPRESENTSOURCESET Handle = 0xC0262315 + ERROR_GRAPHICS_INVALID_VIDEOPRESENTTARGETSET Handle = 0xC0262316 + ERROR_GRAPHICS_SOURCE_ALREADY_IN_SET Handle = 0xC0262317 + ERROR_GRAPHICS_TARGET_ALREADY_IN_SET Handle = 0xC0262318 + ERROR_GRAPHICS_INVALID_VIDPN_PRESENT_PATH Handle = 0xC0262319 + ERROR_GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY Handle = 0xC026231A + ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET Handle = 0xC026231B + ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE Handle = 0xC026231C + ERROR_GRAPHICS_FREQUENCYRANGE_NOT_IN_SET Handle = 0xC026231D + ERROR_GRAPHICS_NO_PREFERRED_MODE Handle = 0x0026231E + ERROR_GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET Handle = 0xC026231F + ERROR_GRAPHICS_STALE_MODESET Handle = 0xC0262320 + ERROR_GRAPHICS_INVALID_MONITOR_SOURCEMODESET Handle = 0xC0262321 + ERROR_GRAPHICS_INVALID_MONITOR_SOURCE_MODE Handle = 0xC0262322 + ERROR_GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN Handle = 0xC0262323 + ERROR_GRAPHICS_MODE_ID_MUST_BE_UNIQUE Handle = 0xC0262324 + ERROR_GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION Handle = 0xC0262325 + ERROR_GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES Handle = 0xC0262326 + ERROR_GRAPHICS_PATH_NOT_IN_TOPOLOGY Handle = 0xC0262327 + ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE Handle = 0xC0262328 + ERROR_GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET Handle = 0xC0262329 + ERROR_GRAPHICS_INVALID_MONITORDESCRIPTORSET Handle = 0xC026232A + ERROR_GRAPHICS_INVALID_MONITORDESCRIPTOR Handle = 0xC026232B + ERROR_GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET Handle = 0xC026232C + ERROR_GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET Handle = 0xC026232D + ERROR_GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE Handle = 0xC026232E + ERROR_GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE Handle = 0xC026232F + ERROR_GRAPHICS_RESOURCES_NOT_RELATED Handle = 0xC0262330 + ERROR_GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE Handle = 0xC0262331 + ERROR_GRAPHICS_TARGET_ID_MUST_BE_UNIQUE Handle = 0xC0262332 + ERROR_GRAPHICS_NO_AVAILABLE_VIDPN_TARGET Handle = 0xC0262333 + ERROR_GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER Handle = 0xC0262334 + ERROR_GRAPHICS_NO_VIDPNMGR Handle = 0xC0262335 + ERROR_GRAPHICS_NO_ACTIVE_VIDPN Handle = 0xC0262336 + ERROR_GRAPHICS_STALE_VIDPN_TOPOLOGY Handle = 0xC0262337 + ERROR_GRAPHICS_MONITOR_NOT_CONNECTED Handle = 0xC0262338 + ERROR_GRAPHICS_SOURCE_NOT_IN_TOPOLOGY Handle = 0xC0262339 + ERROR_GRAPHICS_INVALID_PRIMARYSURFACE_SIZE Handle = 0xC026233A + ERROR_GRAPHICS_INVALID_VISIBLEREGION_SIZE Handle = 0xC026233B + ERROR_GRAPHICS_INVALID_STRIDE Handle = 0xC026233C + ERROR_GRAPHICS_INVALID_PIXELFORMAT Handle = 0xC026233D + ERROR_GRAPHICS_INVALID_COLORBASIS Handle = 0xC026233E + ERROR_GRAPHICS_INVALID_PIXELVALUEACCESSMODE Handle = 0xC026233F + ERROR_GRAPHICS_TARGET_NOT_IN_TOPOLOGY Handle = 0xC0262340 + ERROR_GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT Handle = 0xC0262341 + ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0xC0262342 + ERROR_GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN Handle = 0xC0262343 + ERROR_GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL Handle = 0xC0262344 + ERROR_GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION Handle = 0xC0262345 + ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED Handle = 0xC0262346 + ERROR_GRAPHICS_INVALID_GAMMA_RAMP Handle = 0xC0262347 + ERROR_GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED Handle = 0xC0262348 + ERROR_GRAPHICS_MULTISAMPLING_NOT_SUPPORTED Handle = 0xC0262349 + ERROR_GRAPHICS_MODE_NOT_IN_MODESET Handle = 0xC026234A + ERROR_GRAPHICS_DATASET_IS_EMPTY Handle = 0x0026234B + ERROR_GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET Handle = 0x0026234C + ERROR_GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON Handle = 0xC026234D + ERROR_GRAPHICS_INVALID_PATH_CONTENT_TYPE Handle = 0xC026234E + ERROR_GRAPHICS_INVALID_COPYPROTECTION_TYPE Handle = 0xC026234F + ERROR_GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS Handle = 0xC0262350 + ERROR_GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED Handle = 0x00262351 + ERROR_GRAPHICS_INVALID_SCANLINE_ORDERING Handle = 0xC0262352 + ERROR_GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED Handle = 0xC0262353 + ERROR_GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS Handle = 0xC0262354 + ERROR_GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT Handle = 0xC0262355 + ERROR_GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM Handle = 0xC0262356 + ERROR_GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN Handle = 0xC0262357 + ERROR_GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT Handle = 0xC0262358 + ERROR_GRAPHICS_MAX_NUM_PATHS_REACHED Handle = 0xC0262359 + ERROR_GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION Handle = 0xC026235A + ERROR_GRAPHICS_INVALID_CLIENT_TYPE Handle = 0xC026235B + ERROR_GRAPHICS_CLIENTVIDPN_NOT_SET Handle = 0xC026235C + ERROR_GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED Handle = 0xC0262400 + ERROR_GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED Handle = 0xC0262401 + ERROR_GRAPHICS_UNKNOWN_CHILD_STATUS Handle = 0x4026242F + ERROR_GRAPHICS_NOT_A_LINKED_ADAPTER Handle = 0xC0262430 + ERROR_GRAPHICS_LEADLINK_NOT_ENUMERATED Handle = 0xC0262431 + ERROR_GRAPHICS_CHAINLINKS_NOT_ENUMERATED Handle = 0xC0262432 + ERROR_GRAPHICS_ADAPTER_CHAIN_NOT_READY Handle = 0xC0262433 + ERROR_GRAPHICS_CHAINLINKS_NOT_STARTED Handle = 0xC0262434 + ERROR_GRAPHICS_CHAINLINKS_NOT_POWERED_ON Handle = 0xC0262435 + ERROR_GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE Handle = 0xC0262436 + ERROR_GRAPHICS_LEADLINK_START_DEFERRED Handle = 0x40262437 + ERROR_GRAPHICS_NOT_POST_DEVICE_DRIVER Handle = 0xC0262438 + ERROR_GRAPHICS_POLLING_TOO_FREQUENTLY Handle = 0x40262439 + ERROR_GRAPHICS_START_DEFERRED Handle = 0x4026243A + ERROR_GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED Handle = 0xC026243B + ERROR_GRAPHICS_DEPENDABLE_CHILD_STATUS Handle = 0x4026243C + ERROR_GRAPHICS_OPM_NOT_SUPPORTED Handle = 0xC0262500 + ERROR_GRAPHICS_COPP_NOT_SUPPORTED Handle = 0xC0262501 + ERROR_GRAPHICS_UAB_NOT_SUPPORTED Handle = 0xC0262502 + ERROR_GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS Handle = 0xC0262503 + ERROR_GRAPHICS_OPM_NO_VIDEO_OUTPUTS_EXIST Handle = 0xC0262505 + ERROR_GRAPHICS_OPM_INTERNAL_ERROR Handle = 0xC026250B + ERROR_GRAPHICS_OPM_INVALID_HANDLE Handle = 0xC026250C + ERROR_GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH Handle = 0xC026250E + ERROR_GRAPHICS_OPM_SPANNING_MODE_ENABLED Handle = 0xC026250F + ERROR_GRAPHICS_OPM_THEATER_MODE_ENABLED Handle = 0xC0262510 + ERROR_GRAPHICS_PVP_HFS_FAILED Handle = 0xC0262511 + ERROR_GRAPHICS_OPM_INVALID_SRM Handle = 0xC0262512 + ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP Handle = 0xC0262513 + ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP Handle = 0xC0262514 + ERROR_GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA Handle = 0xC0262515 + ERROR_GRAPHICS_OPM_HDCP_SRM_NEVER_SET Handle = 0xC0262516 + ERROR_GRAPHICS_OPM_RESOLUTION_TOO_HIGH Handle = 0xC0262517 + ERROR_GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE Handle = 0xC0262518 + ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_NO_LONGER_EXISTS Handle = 0xC026251A + ERROR_GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS Handle = 0xC026251B + ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS Handle = 0xC026251C + ERROR_GRAPHICS_OPM_INVALID_INFORMATION_REQUEST Handle = 0xC026251D + ERROR_GRAPHICS_OPM_DRIVER_INTERNAL_ERROR Handle = 0xC026251E + ERROR_GRAPHICS_OPM_VIDEO_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS Handle = 0xC026251F + ERROR_GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED Handle = 0xC0262520 + ERROR_GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST Handle = 0xC0262521 + ERROR_GRAPHICS_I2C_NOT_SUPPORTED Handle = 0xC0262580 + ERROR_GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST Handle = 0xC0262581 + ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA Handle = 0xC0262582 + ERROR_GRAPHICS_I2C_ERROR_RECEIVING_DATA Handle = 0xC0262583 + ERROR_GRAPHICS_DDCCI_VCP_NOT_SUPPORTED Handle = 0xC0262584 + ERROR_GRAPHICS_DDCCI_INVALID_DATA Handle = 0xC0262585 + ERROR_GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE Handle = 0xC0262586 + ERROR_GRAPHICS_MCA_INVALID_CAPABILITIES_STRING Handle = 0xC0262587 + ERROR_GRAPHICS_MCA_INTERNAL_ERROR Handle = 0xC0262588 + ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND Handle = 0xC0262589 + ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH Handle = 0xC026258A + ERROR_GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM Handle = 0xC026258B + ERROR_GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE Handle = 0xC026258C + ERROR_GRAPHICS_MONITOR_NO_LONGER_EXISTS Handle = 0xC026258D + ERROR_GRAPHICS_DDCCI_CURRENT_CURRENT_VALUE_GREATER_THAN_MAXIMUM_VALUE Handle = 0xC02625D8 + ERROR_GRAPHICS_MCA_INVALID_VCP_VERSION Handle = 0xC02625D9 + ERROR_GRAPHICS_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION Handle = 0xC02625DA + ERROR_GRAPHICS_MCA_MCCS_VERSION_MISMATCH Handle = 0xC02625DB + ERROR_GRAPHICS_MCA_UNSUPPORTED_MCCS_VERSION Handle = 0xC02625DC + ERROR_GRAPHICS_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED Handle = 0xC02625DE + ERROR_GRAPHICS_MCA_UNSUPPORTED_COLOR_TEMPERATURE Handle = 0xC02625DF + ERROR_GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED Handle = 0xC02625E0 + ERROR_GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME Handle = 0xC02625E1 + ERROR_GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP Handle = 0xC02625E2 + ERROR_GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED Handle = 0xC02625E3 + ERROR_GRAPHICS_INVALID_POINTER Handle = 0xC02625E4 + ERROR_GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE Handle = 0xC02625E5 + ERROR_GRAPHICS_PARAMETER_ARRAY_TOO_SMALL Handle = 0xC02625E6 + ERROR_GRAPHICS_INTERNAL_ERROR Handle = 0xC02625E7 + ERROR_GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS Handle = 0xC02605E8 + NAP_E_INVALID_PACKET Handle = 0x80270001 + NAP_E_MISSING_SOH Handle = 0x80270002 + NAP_E_CONFLICTING_ID Handle = 0x80270003 + NAP_E_NO_CACHED_SOH Handle = 0x80270004 + NAP_E_STILL_BOUND Handle = 0x80270005 + NAP_E_NOT_REGISTERED Handle = 0x80270006 + NAP_E_NOT_INITIALIZED Handle = 0x80270007 + NAP_E_MISMATCHED_ID Handle = 0x80270008 + NAP_E_NOT_PENDING Handle = 0x80270009 + NAP_E_ID_NOT_FOUND Handle = 0x8027000A + NAP_E_MAXSIZE_TOO_SMALL Handle = 0x8027000B + NAP_E_SERVICE_NOT_RUNNING Handle = 0x8027000C + NAP_S_CERT_ALREADY_PRESENT Handle = 0x0027000D + NAP_E_ENTITY_DISABLED Handle = 0x8027000E + NAP_E_NETSH_GROUPPOLICY_ERROR Handle = 0x8027000F + NAP_E_TOO_MANY_CALLS Handle = 0x80270010 + NAP_E_SHV_CONFIG_EXISTED Handle = 0x80270011 + NAP_E_SHV_CONFIG_NOT_FOUND Handle = 0x80270012 + NAP_E_SHV_TIMEOUT Handle = 0x80270013 + TPM_E_ERROR_MASK Handle = 0x80280000 + TPM_E_AUTHFAIL Handle = 0x80280001 + TPM_E_BADINDEX Handle = 0x80280002 + TPM_E_BAD_PARAMETER Handle = 0x80280003 + TPM_E_AUDITFAILURE Handle = 0x80280004 + TPM_E_CLEAR_DISABLED Handle = 0x80280005 + TPM_E_DEACTIVATED Handle = 0x80280006 + TPM_E_DISABLED Handle = 0x80280007 + TPM_E_DISABLED_CMD Handle = 0x80280008 + TPM_E_FAIL Handle = 0x80280009 + TPM_E_BAD_ORDINAL Handle = 0x8028000A + TPM_E_INSTALL_DISABLED Handle = 0x8028000B + TPM_E_INVALID_KEYHANDLE Handle = 0x8028000C + TPM_E_KEYNOTFOUND Handle = 0x8028000D + TPM_E_INAPPROPRIATE_ENC Handle = 0x8028000E + TPM_E_MIGRATEFAIL Handle = 0x8028000F + TPM_E_INVALID_PCR_INFO Handle = 0x80280010 + TPM_E_NOSPACE Handle = 0x80280011 + TPM_E_NOSRK Handle = 0x80280012 + TPM_E_NOTSEALED_BLOB Handle = 0x80280013 + TPM_E_OWNER_SET Handle = 0x80280014 + TPM_E_RESOURCES Handle = 0x80280015 + TPM_E_SHORTRANDOM Handle = 0x80280016 + TPM_E_SIZE Handle = 0x80280017 + TPM_E_WRONGPCRVAL Handle = 0x80280018 + TPM_E_BAD_PARAM_SIZE Handle = 0x80280019 + TPM_E_SHA_THREAD Handle = 0x8028001A + TPM_E_SHA_ERROR Handle = 0x8028001B + TPM_E_FAILEDSELFTEST Handle = 0x8028001C + TPM_E_AUTH2FAIL Handle = 0x8028001D + TPM_E_BADTAG Handle = 0x8028001E + TPM_E_IOERROR Handle = 0x8028001F + TPM_E_ENCRYPT_ERROR Handle = 0x80280020 + TPM_E_DECRYPT_ERROR Handle = 0x80280021 + TPM_E_INVALID_AUTHHANDLE Handle = 0x80280022 + TPM_E_NO_ENDORSEMENT Handle = 0x80280023 + TPM_E_INVALID_KEYUSAGE Handle = 0x80280024 + TPM_E_WRONG_ENTITYTYPE Handle = 0x80280025 + TPM_E_INVALID_POSTINIT Handle = 0x80280026 + TPM_E_INAPPROPRIATE_SIG Handle = 0x80280027 + TPM_E_BAD_KEY_PROPERTY Handle = 0x80280028 + TPM_E_BAD_MIGRATION Handle = 0x80280029 + TPM_E_BAD_SCHEME Handle = 0x8028002A + TPM_E_BAD_DATASIZE Handle = 0x8028002B + TPM_E_BAD_MODE Handle = 0x8028002C + TPM_E_BAD_PRESENCE Handle = 0x8028002D + TPM_E_BAD_VERSION Handle = 0x8028002E + TPM_E_NO_WRAP_TRANSPORT Handle = 0x8028002F + TPM_E_AUDITFAIL_UNSUCCESSFUL Handle = 0x80280030 + TPM_E_AUDITFAIL_SUCCESSFUL Handle = 0x80280031 + TPM_E_NOTRESETABLE Handle = 0x80280032 + TPM_E_NOTLOCAL Handle = 0x80280033 + TPM_E_BAD_TYPE Handle = 0x80280034 + TPM_E_INVALID_RESOURCE Handle = 0x80280035 + TPM_E_NOTFIPS Handle = 0x80280036 + TPM_E_INVALID_FAMILY Handle = 0x80280037 + TPM_E_NO_NV_PERMISSION Handle = 0x80280038 + TPM_E_REQUIRES_SIGN Handle = 0x80280039 + TPM_E_KEY_NOTSUPPORTED Handle = 0x8028003A + TPM_E_AUTH_CONFLICT Handle = 0x8028003B + TPM_E_AREA_LOCKED Handle = 0x8028003C + TPM_E_BAD_LOCALITY Handle = 0x8028003D + TPM_E_READ_ONLY Handle = 0x8028003E + TPM_E_PER_NOWRITE Handle = 0x8028003F + TPM_E_FAMILYCOUNT Handle = 0x80280040 + TPM_E_WRITE_LOCKED Handle = 0x80280041 + TPM_E_BAD_ATTRIBUTES Handle = 0x80280042 + TPM_E_INVALID_STRUCTURE Handle = 0x80280043 + TPM_E_KEY_OWNER_CONTROL Handle = 0x80280044 + TPM_E_BAD_COUNTER Handle = 0x80280045 + TPM_E_NOT_FULLWRITE Handle = 0x80280046 + TPM_E_CONTEXT_GAP Handle = 0x80280047 + TPM_E_MAXNVWRITES Handle = 0x80280048 + TPM_E_NOOPERATOR Handle = 0x80280049 + TPM_E_RESOURCEMISSING Handle = 0x8028004A + TPM_E_DELEGATE_LOCK Handle = 0x8028004B + TPM_E_DELEGATE_FAMILY Handle = 0x8028004C + TPM_E_DELEGATE_ADMIN Handle = 0x8028004D + TPM_E_TRANSPORT_NOTEXCLUSIVE Handle = 0x8028004E + TPM_E_OWNER_CONTROL Handle = 0x8028004F + TPM_E_DAA_RESOURCES Handle = 0x80280050 + TPM_E_DAA_INPUT_DATA0 Handle = 0x80280051 + TPM_E_DAA_INPUT_DATA1 Handle = 0x80280052 + TPM_E_DAA_ISSUER_SETTINGS Handle = 0x80280053 + TPM_E_DAA_TPM_SETTINGS Handle = 0x80280054 + TPM_E_DAA_STAGE Handle = 0x80280055 + TPM_E_DAA_ISSUER_VALIDITY Handle = 0x80280056 + TPM_E_DAA_WRONG_W Handle = 0x80280057 + TPM_E_BAD_HANDLE Handle = 0x80280058 + TPM_E_BAD_DELEGATE Handle = 0x80280059 + TPM_E_BADCONTEXT Handle = 0x8028005A + TPM_E_TOOMANYCONTEXTS Handle = 0x8028005B + TPM_E_MA_TICKET_SIGNATURE Handle = 0x8028005C + TPM_E_MA_DESTINATION Handle = 0x8028005D + TPM_E_MA_SOURCE Handle = 0x8028005E + TPM_E_MA_AUTHORITY Handle = 0x8028005F + TPM_E_PERMANENTEK Handle = 0x80280061 + TPM_E_BAD_SIGNATURE Handle = 0x80280062 + TPM_E_NOCONTEXTSPACE Handle = 0x80280063 + TPM_20_E_ASYMMETRIC Handle = 0x80280081 + TPM_20_E_ATTRIBUTES Handle = 0x80280082 + TPM_20_E_HASH Handle = 0x80280083 + TPM_20_E_VALUE Handle = 0x80280084 + TPM_20_E_HIERARCHY Handle = 0x80280085 + TPM_20_E_KEY_SIZE Handle = 0x80280087 + TPM_20_E_MGF Handle = 0x80280088 + TPM_20_E_MODE Handle = 0x80280089 + TPM_20_E_TYPE Handle = 0x8028008A + TPM_20_E_HANDLE Handle = 0x8028008B + TPM_20_E_KDF Handle = 0x8028008C + TPM_20_E_RANGE Handle = 0x8028008D + TPM_20_E_AUTH_FAIL Handle = 0x8028008E + TPM_20_E_NONCE Handle = 0x8028008F + TPM_20_E_PP Handle = 0x80280090 + TPM_20_E_SCHEME Handle = 0x80280092 + TPM_20_E_SIZE Handle = 0x80280095 + TPM_20_E_SYMMETRIC Handle = 0x80280096 + TPM_20_E_TAG Handle = 0x80280097 + TPM_20_E_SELECTOR Handle = 0x80280098 + TPM_20_E_INSUFFICIENT Handle = 0x8028009A + TPM_20_E_SIGNATURE Handle = 0x8028009B + TPM_20_E_KEY Handle = 0x8028009C + TPM_20_E_POLICY_FAIL Handle = 0x8028009D + TPM_20_E_INTEGRITY Handle = 0x8028009F + TPM_20_E_TICKET Handle = 0x802800A0 + TPM_20_E_RESERVED_BITS Handle = 0x802800A1 + TPM_20_E_BAD_AUTH Handle = 0x802800A2 + TPM_20_E_EXPIRED Handle = 0x802800A3 + TPM_20_E_POLICY_CC Handle = 0x802800A4 + TPM_20_E_BINDING Handle = 0x802800A5 + TPM_20_E_CURVE Handle = 0x802800A6 + TPM_20_E_ECC_POINT Handle = 0x802800A7 + TPM_20_E_INITIALIZE Handle = 0x80280100 + TPM_20_E_FAILURE Handle = 0x80280101 + TPM_20_E_SEQUENCE Handle = 0x80280103 + TPM_20_E_PRIVATE Handle = 0x8028010B + TPM_20_E_HMAC Handle = 0x80280119 + TPM_20_E_DISABLED Handle = 0x80280120 + TPM_20_E_EXCLUSIVE Handle = 0x80280121 + TPM_20_E_ECC_CURVE Handle = 0x80280123 + TPM_20_E_AUTH_TYPE Handle = 0x80280124 + TPM_20_E_AUTH_MISSING Handle = 0x80280125 + TPM_20_E_POLICY Handle = 0x80280126 + TPM_20_E_PCR Handle = 0x80280127 + TPM_20_E_PCR_CHANGED Handle = 0x80280128 + TPM_20_E_UPGRADE Handle = 0x8028012D + TPM_20_E_TOO_MANY_CONTEXTS Handle = 0x8028012E + TPM_20_E_AUTH_UNAVAILABLE Handle = 0x8028012F + TPM_20_E_REBOOT Handle = 0x80280130 + TPM_20_E_UNBALANCED Handle = 0x80280131 + TPM_20_E_COMMAND_SIZE Handle = 0x80280142 + TPM_20_E_COMMAND_CODE Handle = 0x80280143 + TPM_20_E_AUTHSIZE Handle = 0x80280144 + TPM_20_E_AUTH_CONTEXT Handle = 0x80280145 + TPM_20_E_NV_RANGE Handle = 0x80280146 + TPM_20_E_NV_SIZE Handle = 0x80280147 + TPM_20_E_NV_LOCKED Handle = 0x80280148 + TPM_20_E_NV_AUTHORIZATION Handle = 0x80280149 + TPM_20_E_NV_UNINITIALIZED Handle = 0x8028014A + TPM_20_E_NV_SPACE Handle = 0x8028014B + TPM_20_E_NV_DEFINED Handle = 0x8028014C + TPM_20_E_BAD_CONTEXT Handle = 0x80280150 + TPM_20_E_CPHASH Handle = 0x80280151 + TPM_20_E_PARENT Handle = 0x80280152 + TPM_20_E_NEEDS_TEST Handle = 0x80280153 + TPM_20_E_NO_RESULT Handle = 0x80280154 + TPM_20_E_SENSITIVE Handle = 0x80280155 + TPM_E_COMMAND_BLOCKED Handle = 0x80280400 + TPM_E_INVALID_HANDLE Handle = 0x80280401 + TPM_E_DUPLICATE_VHANDLE Handle = 0x80280402 + TPM_E_EMBEDDED_COMMAND_BLOCKED Handle = 0x80280403 + TPM_E_EMBEDDED_COMMAND_UNSUPPORTED Handle = 0x80280404 + TPM_E_RETRY Handle = 0x80280800 + TPM_E_NEEDS_SELFTEST Handle = 0x80280801 + TPM_E_DOING_SELFTEST Handle = 0x80280802 + TPM_E_DEFEND_LOCK_RUNNING Handle = 0x80280803 + TPM_20_E_CONTEXT_GAP Handle = 0x80280901 + TPM_20_E_OBJECT_MEMORY Handle = 0x80280902 + TPM_20_E_SESSION_MEMORY Handle = 0x80280903 + TPM_20_E_MEMORY Handle = 0x80280904 + TPM_20_E_SESSION_HANDLES Handle = 0x80280905 + TPM_20_E_OBJECT_HANDLES Handle = 0x80280906 + TPM_20_E_LOCALITY Handle = 0x80280907 + TPM_20_E_YIELDED Handle = 0x80280908 + TPM_20_E_CANCELED Handle = 0x80280909 + TPM_20_E_TESTING Handle = 0x8028090A + TPM_20_E_NV_RATE Handle = 0x80280920 + TPM_20_E_LOCKOUT Handle = 0x80280921 + TPM_20_E_RETRY Handle = 0x80280922 + TPM_20_E_NV_UNAVAILABLE Handle = 0x80280923 + TBS_E_INTERNAL_ERROR Handle = 0x80284001 + TBS_E_BAD_PARAMETER Handle = 0x80284002 + TBS_E_INVALID_OUTPUT_POINTER Handle = 0x80284003 + TBS_E_INVALID_CONTEXT Handle = 0x80284004 + TBS_E_INSUFFICIENT_BUFFER Handle = 0x80284005 + TBS_E_IOERROR Handle = 0x80284006 + TBS_E_INVALID_CONTEXT_PARAM Handle = 0x80284007 + TBS_E_SERVICE_NOT_RUNNING Handle = 0x80284008 + TBS_E_TOO_MANY_TBS_CONTEXTS Handle = 0x80284009 + TBS_E_TOO_MANY_RESOURCES Handle = 0x8028400A + TBS_E_SERVICE_START_PENDING Handle = 0x8028400B + TBS_E_PPI_NOT_SUPPORTED Handle = 0x8028400C + TBS_E_COMMAND_CANCELED Handle = 0x8028400D + TBS_E_BUFFER_TOO_LARGE Handle = 0x8028400E + TBS_E_TPM_NOT_FOUND Handle = 0x8028400F + TBS_E_SERVICE_DISABLED Handle = 0x80284010 + TBS_E_NO_EVENT_LOG Handle = 0x80284011 + TBS_E_ACCESS_DENIED Handle = 0x80284012 + TBS_E_PROVISIONING_NOT_ALLOWED Handle = 0x80284013 + TBS_E_PPI_FUNCTION_UNSUPPORTED Handle = 0x80284014 + TBS_E_OWNERAUTH_NOT_FOUND Handle = 0x80284015 + TBS_E_PROVISIONING_INCOMPLETE Handle = 0x80284016 + TPMAPI_E_INVALID_STATE Handle = 0x80290100 + TPMAPI_E_NOT_ENOUGH_DATA Handle = 0x80290101 + TPMAPI_E_TOO_MUCH_DATA Handle = 0x80290102 + TPMAPI_E_INVALID_OUTPUT_POINTER Handle = 0x80290103 + TPMAPI_E_INVALID_PARAMETER Handle = 0x80290104 + TPMAPI_E_OUT_OF_MEMORY Handle = 0x80290105 + TPMAPI_E_BUFFER_TOO_SMALL Handle = 0x80290106 + TPMAPI_E_INTERNAL_ERROR Handle = 0x80290107 + TPMAPI_E_ACCESS_DENIED Handle = 0x80290108 + TPMAPI_E_AUTHORIZATION_FAILED Handle = 0x80290109 + TPMAPI_E_INVALID_CONTEXT_HANDLE Handle = 0x8029010A + TPMAPI_E_TBS_COMMUNICATION_ERROR Handle = 0x8029010B + TPMAPI_E_TPM_COMMAND_ERROR Handle = 0x8029010C + TPMAPI_E_MESSAGE_TOO_LARGE Handle = 0x8029010D + TPMAPI_E_INVALID_ENCODING Handle = 0x8029010E + TPMAPI_E_INVALID_KEY_SIZE Handle = 0x8029010F + TPMAPI_E_ENCRYPTION_FAILED Handle = 0x80290110 + TPMAPI_E_INVALID_KEY_PARAMS Handle = 0x80290111 + TPMAPI_E_INVALID_MIGRATION_AUTHORIZATION_BLOB Handle = 0x80290112 + TPMAPI_E_INVALID_PCR_INDEX Handle = 0x80290113 + TPMAPI_E_INVALID_DELEGATE_BLOB Handle = 0x80290114 + TPMAPI_E_INVALID_CONTEXT_PARAMS Handle = 0x80290115 + TPMAPI_E_INVALID_KEY_BLOB Handle = 0x80290116 + TPMAPI_E_INVALID_PCR_DATA Handle = 0x80290117 + TPMAPI_E_INVALID_OWNER_AUTH Handle = 0x80290118 + TPMAPI_E_FIPS_RNG_CHECK_FAILED Handle = 0x80290119 + TPMAPI_E_EMPTY_TCG_LOG Handle = 0x8029011A + TPMAPI_E_INVALID_TCG_LOG_ENTRY Handle = 0x8029011B + TPMAPI_E_TCG_SEPARATOR_ABSENT Handle = 0x8029011C + TPMAPI_E_TCG_INVALID_DIGEST_ENTRY Handle = 0x8029011D + TPMAPI_E_POLICY_DENIES_OPERATION Handle = 0x8029011E + TPMAPI_E_NV_BITS_NOT_DEFINED Handle = 0x8029011F + TPMAPI_E_NV_BITS_NOT_READY Handle = 0x80290120 + TPMAPI_E_SEALING_KEY_NOT_AVAILABLE Handle = 0x80290121 + TPMAPI_E_NO_AUTHORIZATION_CHAIN_FOUND Handle = 0x80290122 + TPMAPI_E_SVN_COUNTER_NOT_AVAILABLE Handle = 0x80290123 + TPMAPI_E_OWNER_AUTH_NOT_NULL Handle = 0x80290124 + TPMAPI_E_ENDORSEMENT_AUTH_NOT_NULL Handle = 0x80290125 + TPMAPI_E_AUTHORIZATION_REVOKED Handle = 0x80290126 + TPMAPI_E_MALFORMED_AUTHORIZATION_KEY Handle = 0x80290127 + TPMAPI_E_AUTHORIZING_KEY_NOT_SUPPORTED Handle = 0x80290128 + TPMAPI_E_INVALID_AUTHORIZATION_SIGNATURE Handle = 0x80290129 + TPMAPI_E_MALFORMED_AUTHORIZATION_POLICY Handle = 0x8029012A + TPMAPI_E_MALFORMED_AUTHORIZATION_OTHER Handle = 0x8029012B + TPMAPI_E_SEALING_KEY_CHANGED Handle = 0x8029012C + TBSIMP_E_BUFFER_TOO_SMALL Handle = 0x80290200 + TBSIMP_E_CLEANUP_FAILED Handle = 0x80290201 + TBSIMP_E_INVALID_CONTEXT_HANDLE Handle = 0x80290202 + TBSIMP_E_INVALID_CONTEXT_PARAM Handle = 0x80290203 + TBSIMP_E_TPM_ERROR Handle = 0x80290204 + TBSIMP_E_HASH_BAD_KEY Handle = 0x80290205 + TBSIMP_E_DUPLICATE_VHANDLE Handle = 0x80290206 + TBSIMP_E_INVALID_OUTPUT_POINTER Handle = 0x80290207 + TBSIMP_E_INVALID_PARAMETER Handle = 0x80290208 + TBSIMP_E_RPC_INIT_FAILED Handle = 0x80290209 + TBSIMP_E_SCHEDULER_NOT_RUNNING Handle = 0x8029020A + TBSIMP_E_COMMAND_CANCELED Handle = 0x8029020B + TBSIMP_E_OUT_OF_MEMORY Handle = 0x8029020C + TBSIMP_E_LIST_NO_MORE_ITEMS Handle = 0x8029020D + TBSIMP_E_LIST_NOT_FOUND Handle = 0x8029020E + TBSIMP_E_NOT_ENOUGH_SPACE Handle = 0x8029020F + TBSIMP_E_NOT_ENOUGH_TPM_CONTEXTS Handle = 0x80290210 + TBSIMP_E_COMMAND_FAILED Handle = 0x80290211 + TBSIMP_E_UNKNOWN_ORDINAL Handle = 0x80290212 + TBSIMP_E_RESOURCE_EXPIRED Handle = 0x80290213 + TBSIMP_E_INVALID_RESOURCE Handle = 0x80290214 + TBSIMP_E_NOTHING_TO_UNLOAD Handle = 0x80290215 + TBSIMP_E_HASH_TABLE_FULL Handle = 0x80290216 + TBSIMP_E_TOO_MANY_TBS_CONTEXTS Handle = 0x80290217 + TBSIMP_E_TOO_MANY_RESOURCES Handle = 0x80290218 + TBSIMP_E_PPI_NOT_SUPPORTED Handle = 0x80290219 + TBSIMP_E_TPM_INCOMPATIBLE Handle = 0x8029021A + TBSIMP_E_NO_EVENT_LOG Handle = 0x8029021B + TPM_E_PPI_ACPI_FAILURE Handle = 0x80290300 + TPM_E_PPI_USER_ABORT Handle = 0x80290301 + TPM_E_PPI_BIOS_FAILURE Handle = 0x80290302 + TPM_E_PPI_NOT_SUPPORTED Handle = 0x80290303 + TPM_E_PPI_BLOCKED_IN_BIOS Handle = 0x80290304 + TPM_E_PCP_ERROR_MASK Handle = 0x80290400 + TPM_E_PCP_DEVICE_NOT_READY Handle = 0x80290401 + TPM_E_PCP_INVALID_HANDLE Handle = 0x80290402 + TPM_E_PCP_INVALID_PARAMETER Handle = 0x80290403 + TPM_E_PCP_FLAG_NOT_SUPPORTED Handle = 0x80290404 + TPM_E_PCP_NOT_SUPPORTED Handle = 0x80290405 + TPM_E_PCP_BUFFER_TOO_SMALL Handle = 0x80290406 + TPM_E_PCP_INTERNAL_ERROR Handle = 0x80290407 + TPM_E_PCP_AUTHENTICATION_FAILED Handle = 0x80290408 + TPM_E_PCP_AUTHENTICATION_IGNORED Handle = 0x80290409 + TPM_E_PCP_POLICY_NOT_FOUND Handle = 0x8029040A + TPM_E_PCP_PROFILE_NOT_FOUND Handle = 0x8029040B + TPM_E_PCP_VALIDATION_FAILED Handle = 0x8029040C + TPM_E_PCP_WRONG_PARENT Handle = 0x8029040E + TPM_E_KEY_NOT_LOADED Handle = 0x8029040F + TPM_E_NO_KEY_CERTIFICATION Handle = 0x80290410 + TPM_E_KEY_NOT_FINALIZED Handle = 0x80290411 + TPM_E_ATTESTATION_CHALLENGE_NOT_SET Handle = 0x80290412 + TPM_E_NOT_PCR_BOUND Handle = 0x80290413 + TPM_E_KEY_ALREADY_FINALIZED Handle = 0x80290414 + TPM_E_KEY_USAGE_POLICY_NOT_SUPPORTED Handle = 0x80290415 + TPM_E_KEY_USAGE_POLICY_INVALID Handle = 0x80290416 + TPM_E_SOFT_KEY_ERROR Handle = 0x80290417 + TPM_E_KEY_NOT_AUTHENTICATED Handle = 0x80290418 + TPM_E_PCP_KEY_NOT_AIK Handle = 0x80290419 + TPM_E_KEY_NOT_SIGNING_KEY Handle = 0x8029041A + TPM_E_LOCKED_OUT Handle = 0x8029041B + TPM_E_CLAIM_TYPE_NOT_SUPPORTED Handle = 0x8029041C + TPM_E_VERSION_NOT_SUPPORTED Handle = 0x8029041D + TPM_E_BUFFER_LENGTH_MISMATCH Handle = 0x8029041E + TPM_E_PCP_IFX_RSA_KEY_CREATION_BLOCKED Handle = 0x8029041F + TPM_E_PCP_TICKET_MISSING Handle = 0x80290420 + TPM_E_PCP_RAW_POLICY_NOT_SUPPORTED Handle = 0x80290421 + TPM_E_PCP_KEY_HANDLE_INVALIDATED Handle = 0x80290422 + TPM_E_PCP_UNSUPPORTED_PSS_SALT Handle = 0x40290423 + TPM_E_ZERO_EXHAUST_ENABLED Handle = 0x80290500 + PLA_E_DCS_NOT_FOUND Handle = 0x80300002 + PLA_E_DCS_IN_USE Handle = 0x803000AA + PLA_E_TOO_MANY_FOLDERS Handle = 0x80300045 + PLA_E_NO_MIN_DISK Handle = 0x80300070 + PLA_E_DCS_ALREADY_EXISTS Handle = 0x803000B7 + PLA_S_PROPERTY_IGNORED Handle = 0x00300100 + PLA_E_PROPERTY_CONFLICT Handle = 0x80300101 + PLA_E_DCS_SINGLETON_REQUIRED Handle = 0x80300102 + PLA_E_CREDENTIALS_REQUIRED Handle = 0x80300103 + PLA_E_DCS_NOT_RUNNING Handle = 0x80300104 + PLA_E_CONFLICT_INCL_EXCL_API Handle = 0x80300105 + PLA_E_NETWORK_EXE_NOT_VALID Handle = 0x80300106 + PLA_E_EXE_ALREADY_CONFIGURED Handle = 0x80300107 + PLA_E_EXE_PATH_NOT_VALID Handle = 0x80300108 + PLA_E_DC_ALREADY_EXISTS Handle = 0x80300109 + PLA_E_DCS_START_WAIT_TIMEOUT Handle = 0x8030010A + PLA_E_DC_START_WAIT_TIMEOUT Handle = 0x8030010B + PLA_E_REPORT_WAIT_TIMEOUT Handle = 0x8030010C + PLA_E_NO_DUPLICATES Handle = 0x8030010D + PLA_E_EXE_FULL_PATH_REQUIRED Handle = 0x8030010E + PLA_E_INVALID_SESSION_NAME Handle = 0x8030010F + PLA_E_PLA_CHANNEL_NOT_ENABLED Handle = 0x80300110 + PLA_E_TASKSCHED_CHANNEL_NOT_ENABLED Handle = 0x80300111 + PLA_E_RULES_MANAGER_FAILED Handle = 0x80300112 + PLA_E_CABAPI_FAILURE Handle = 0x80300113 + FVE_E_LOCKED_VOLUME Handle = 0x80310000 + FVE_E_NOT_ENCRYPTED Handle = 0x80310001 + FVE_E_NO_TPM_BIOS Handle = 0x80310002 + FVE_E_NO_MBR_METRIC Handle = 0x80310003 + FVE_E_NO_BOOTSECTOR_METRIC Handle = 0x80310004 + FVE_E_NO_BOOTMGR_METRIC Handle = 0x80310005 + FVE_E_WRONG_BOOTMGR Handle = 0x80310006 + FVE_E_SECURE_KEY_REQUIRED Handle = 0x80310007 + FVE_E_NOT_ACTIVATED Handle = 0x80310008 + FVE_E_ACTION_NOT_ALLOWED Handle = 0x80310009 + FVE_E_AD_SCHEMA_NOT_INSTALLED Handle = 0x8031000A + FVE_E_AD_INVALID_DATATYPE Handle = 0x8031000B + FVE_E_AD_INVALID_DATASIZE Handle = 0x8031000C + FVE_E_AD_NO_VALUES Handle = 0x8031000D + FVE_E_AD_ATTR_NOT_SET Handle = 0x8031000E + FVE_E_AD_GUID_NOT_FOUND Handle = 0x8031000F + FVE_E_BAD_INFORMATION Handle = 0x80310010 + FVE_E_TOO_SMALL Handle = 0x80310011 + FVE_E_SYSTEM_VOLUME Handle = 0x80310012 + FVE_E_FAILED_WRONG_FS Handle = 0x80310013 + FVE_E_BAD_PARTITION_SIZE Handle = 0x80310014 + FVE_E_NOT_SUPPORTED Handle = 0x80310015 + FVE_E_BAD_DATA Handle = 0x80310016 + FVE_E_VOLUME_NOT_BOUND Handle = 0x80310017 + FVE_E_TPM_NOT_OWNED Handle = 0x80310018 + FVE_E_NOT_DATA_VOLUME Handle = 0x80310019 + FVE_E_AD_INSUFFICIENT_BUFFER Handle = 0x8031001A + FVE_E_CONV_READ Handle = 0x8031001B + FVE_E_CONV_WRITE Handle = 0x8031001C + FVE_E_KEY_REQUIRED Handle = 0x8031001D + FVE_E_CLUSTERING_NOT_SUPPORTED Handle = 0x8031001E + FVE_E_VOLUME_BOUND_ALREADY Handle = 0x8031001F + FVE_E_OS_NOT_PROTECTED Handle = 0x80310020 + FVE_E_PROTECTION_DISABLED Handle = 0x80310021 + FVE_E_RECOVERY_KEY_REQUIRED Handle = 0x80310022 + FVE_E_FOREIGN_VOLUME Handle = 0x80310023 + FVE_E_OVERLAPPED_UPDATE Handle = 0x80310024 + FVE_E_TPM_SRK_AUTH_NOT_ZERO Handle = 0x80310025 + FVE_E_FAILED_SECTOR_SIZE Handle = 0x80310026 + FVE_E_FAILED_AUTHENTICATION Handle = 0x80310027 + FVE_E_NOT_OS_VOLUME Handle = 0x80310028 + FVE_E_AUTOUNLOCK_ENABLED Handle = 0x80310029 + FVE_E_WRONG_BOOTSECTOR Handle = 0x8031002A + FVE_E_WRONG_SYSTEM_FS Handle = 0x8031002B + FVE_E_POLICY_PASSWORD_REQUIRED Handle = 0x8031002C + FVE_E_CANNOT_SET_FVEK_ENCRYPTED Handle = 0x8031002D + FVE_E_CANNOT_ENCRYPT_NO_KEY Handle = 0x8031002E + FVE_E_BOOTABLE_CDDVD Handle = 0x80310030 + FVE_E_PROTECTOR_EXISTS Handle = 0x80310031 + FVE_E_RELATIVE_PATH Handle = 0x80310032 + FVE_E_PROTECTOR_NOT_FOUND Handle = 0x80310033 + FVE_E_INVALID_KEY_FORMAT Handle = 0x80310034 + FVE_E_INVALID_PASSWORD_FORMAT Handle = 0x80310035 + FVE_E_FIPS_RNG_CHECK_FAILED Handle = 0x80310036 + FVE_E_FIPS_PREVENTS_RECOVERY_PASSWORD Handle = 0x80310037 + FVE_E_FIPS_PREVENTS_EXTERNAL_KEY_EXPORT Handle = 0x80310038 + FVE_E_NOT_DECRYPTED Handle = 0x80310039 + FVE_E_INVALID_PROTECTOR_TYPE Handle = 0x8031003A + FVE_E_NO_PROTECTORS_TO_TEST Handle = 0x8031003B + FVE_E_KEYFILE_NOT_FOUND Handle = 0x8031003C + FVE_E_KEYFILE_INVALID Handle = 0x8031003D + FVE_E_KEYFILE_NO_VMK Handle = 0x8031003E + FVE_E_TPM_DISABLED Handle = 0x8031003F + FVE_E_NOT_ALLOWED_IN_SAFE_MODE Handle = 0x80310040 + FVE_E_TPM_INVALID_PCR Handle = 0x80310041 + FVE_E_TPM_NO_VMK Handle = 0x80310042 + FVE_E_PIN_INVALID Handle = 0x80310043 + FVE_E_AUTH_INVALID_APPLICATION Handle = 0x80310044 + FVE_E_AUTH_INVALID_CONFIG Handle = 0x80310045 + FVE_E_FIPS_DISABLE_PROTECTION_NOT_ALLOWED Handle = 0x80310046 + FVE_E_FS_NOT_EXTENDED Handle = 0x80310047 + FVE_E_FIRMWARE_TYPE_NOT_SUPPORTED Handle = 0x80310048 + FVE_E_NO_LICENSE Handle = 0x80310049 + FVE_E_NOT_ON_STACK Handle = 0x8031004A + FVE_E_FS_MOUNTED Handle = 0x8031004B + FVE_E_TOKEN_NOT_IMPERSONATED Handle = 0x8031004C + FVE_E_DRY_RUN_FAILED Handle = 0x8031004D + FVE_E_REBOOT_REQUIRED Handle = 0x8031004E + FVE_E_DEBUGGER_ENABLED Handle = 0x8031004F + FVE_E_RAW_ACCESS Handle = 0x80310050 + FVE_E_RAW_BLOCKED Handle = 0x80310051 + FVE_E_BCD_APPLICATIONS_PATH_INCORRECT Handle = 0x80310052 + FVE_E_NOT_ALLOWED_IN_VERSION Handle = 0x80310053 + FVE_E_NO_AUTOUNLOCK_MASTER_KEY Handle = 0x80310054 + FVE_E_MOR_FAILED Handle = 0x80310055 + FVE_E_HIDDEN_VOLUME Handle = 0x80310056 + FVE_E_TRANSIENT_STATE Handle = 0x80310057 + FVE_E_PUBKEY_NOT_ALLOWED Handle = 0x80310058 + FVE_E_VOLUME_HANDLE_OPEN Handle = 0x80310059 + FVE_E_NO_FEATURE_LICENSE Handle = 0x8031005A + FVE_E_INVALID_STARTUP_OPTIONS Handle = 0x8031005B + FVE_E_POLICY_RECOVERY_PASSWORD_NOT_ALLOWED Handle = 0x8031005C + FVE_E_POLICY_RECOVERY_PASSWORD_REQUIRED Handle = 0x8031005D + FVE_E_POLICY_RECOVERY_KEY_NOT_ALLOWED Handle = 0x8031005E + FVE_E_POLICY_RECOVERY_KEY_REQUIRED Handle = 0x8031005F + FVE_E_POLICY_STARTUP_PIN_NOT_ALLOWED Handle = 0x80310060 + FVE_E_POLICY_STARTUP_PIN_REQUIRED Handle = 0x80310061 + FVE_E_POLICY_STARTUP_KEY_NOT_ALLOWED Handle = 0x80310062 + FVE_E_POLICY_STARTUP_KEY_REQUIRED Handle = 0x80310063 + FVE_E_POLICY_STARTUP_PIN_KEY_NOT_ALLOWED Handle = 0x80310064 + FVE_E_POLICY_STARTUP_PIN_KEY_REQUIRED Handle = 0x80310065 + FVE_E_POLICY_STARTUP_TPM_NOT_ALLOWED Handle = 0x80310066 + FVE_E_POLICY_STARTUP_TPM_REQUIRED Handle = 0x80310067 + FVE_E_POLICY_INVALID_PIN_LENGTH Handle = 0x80310068 + FVE_E_KEY_PROTECTOR_NOT_SUPPORTED Handle = 0x80310069 + FVE_E_POLICY_PASSPHRASE_NOT_ALLOWED Handle = 0x8031006A + FVE_E_POLICY_PASSPHRASE_REQUIRED Handle = 0x8031006B + FVE_E_FIPS_PREVENTS_PASSPHRASE Handle = 0x8031006C + FVE_E_OS_VOLUME_PASSPHRASE_NOT_ALLOWED Handle = 0x8031006D + FVE_E_INVALID_BITLOCKER_OID Handle = 0x8031006E + FVE_E_VOLUME_TOO_SMALL Handle = 0x8031006F + FVE_E_DV_NOT_SUPPORTED_ON_FS Handle = 0x80310070 + FVE_E_DV_NOT_ALLOWED_BY_GP Handle = 0x80310071 + FVE_E_POLICY_USER_CERTIFICATE_NOT_ALLOWED Handle = 0x80310072 + FVE_E_POLICY_USER_CERTIFICATE_REQUIRED Handle = 0x80310073 + FVE_E_POLICY_USER_CERT_MUST_BE_HW Handle = 0x80310074 + FVE_E_POLICY_USER_CONFIGURE_FDV_AUTOUNLOCK_NOT_ALLOWED Handle = 0x80310075 + FVE_E_POLICY_USER_CONFIGURE_RDV_AUTOUNLOCK_NOT_ALLOWED Handle = 0x80310076 + FVE_E_POLICY_USER_CONFIGURE_RDV_NOT_ALLOWED Handle = 0x80310077 + FVE_E_POLICY_USER_ENABLE_RDV_NOT_ALLOWED Handle = 0x80310078 + FVE_E_POLICY_USER_DISABLE_RDV_NOT_ALLOWED Handle = 0x80310079 + FVE_E_POLICY_INVALID_PASSPHRASE_LENGTH Handle = 0x80310080 + FVE_E_POLICY_PASSPHRASE_TOO_SIMPLE Handle = 0x80310081 + FVE_E_RECOVERY_PARTITION Handle = 0x80310082 + FVE_E_POLICY_CONFLICT_FDV_RK_OFF_AUK_ON Handle = 0x80310083 + FVE_E_POLICY_CONFLICT_RDV_RK_OFF_AUK_ON Handle = 0x80310084 + FVE_E_NON_BITLOCKER_OID Handle = 0x80310085 + FVE_E_POLICY_PROHIBITS_SELFSIGNED Handle = 0x80310086 + FVE_E_POLICY_CONFLICT_RO_AND_STARTUP_KEY_REQUIRED Handle = 0x80310087 + FVE_E_CONV_RECOVERY_FAILED Handle = 0x80310088 + FVE_E_VIRTUALIZED_SPACE_TOO_BIG Handle = 0x80310089 + FVE_E_POLICY_CONFLICT_OSV_RP_OFF_ADB_ON Handle = 0x80310090 + FVE_E_POLICY_CONFLICT_FDV_RP_OFF_ADB_ON Handle = 0x80310091 + FVE_E_POLICY_CONFLICT_RDV_RP_OFF_ADB_ON Handle = 0x80310092 + FVE_E_NON_BITLOCKER_KU Handle = 0x80310093 + FVE_E_PRIVATEKEY_AUTH_FAILED Handle = 0x80310094 + FVE_E_REMOVAL_OF_DRA_FAILED Handle = 0x80310095 + FVE_E_OPERATION_NOT_SUPPORTED_ON_VISTA_VOLUME Handle = 0x80310096 + FVE_E_CANT_LOCK_AUTOUNLOCK_ENABLED_VOLUME Handle = 0x80310097 + FVE_E_FIPS_HASH_KDF_NOT_ALLOWED Handle = 0x80310098 + FVE_E_ENH_PIN_INVALID Handle = 0x80310099 + FVE_E_INVALID_PIN_CHARS Handle = 0x8031009A + FVE_E_INVALID_DATUM_TYPE Handle = 0x8031009B + FVE_E_EFI_ONLY Handle = 0x8031009C + FVE_E_MULTIPLE_NKP_CERTS Handle = 0x8031009D + FVE_E_REMOVAL_OF_NKP_FAILED Handle = 0x8031009E + FVE_E_INVALID_NKP_CERT Handle = 0x8031009F + FVE_E_NO_EXISTING_PIN Handle = 0x803100A0 + FVE_E_PROTECTOR_CHANGE_PIN_MISMATCH Handle = 0x803100A1 + FVE_E_PIN_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED Handle = 0x803100A2 + FVE_E_PROTECTOR_CHANGE_MAX_PIN_CHANGE_ATTEMPTS_REACHED Handle = 0x803100A3 + FVE_E_POLICY_PASSPHRASE_REQUIRES_ASCII Handle = 0x803100A4 + FVE_E_FULL_ENCRYPTION_NOT_ALLOWED_ON_TP_STORAGE Handle = 0x803100A5 + FVE_E_WIPE_NOT_ALLOWED_ON_TP_STORAGE Handle = 0x803100A6 + FVE_E_KEY_LENGTH_NOT_SUPPORTED_BY_EDRIVE Handle = 0x803100A7 + FVE_E_NO_EXISTING_PASSPHRASE Handle = 0x803100A8 + FVE_E_PROTECTOR_CHANGE_PASSPHRASE_MISMATCH Handle = 0x803100A9 + FVE_E_PASSPHRASE_TOO_LONG Handle = 0x803100AA + FVE_E_NO_PASSPHRASE_WITH_TPM Handle = 0x803100AB + FVE_E_NO_TPM_WITH_PASSPHRASE Handle = 0x803100AC + FVE_E_NOT_ALLOWED_ON_CSV_STACK Handle = 0x803100AD + FVE_E_NOT_ALLOWED_ON_CLUSTER Handle = 0x803100AE + FVE_E_EDRIVE_NO_FAILOVER_TO_SW Handle = 0x803100AF + FVE_E_EDRIVE_BAND_IN_USE Handle = 0x803100B0 + FVE_E_EDRIVE_DISALLOWED_BY_GP Handle = 0x803100B1 + FVE_E_EDRIVE_INCOMPATIBLE_VOLUME Handle = 0x803100B2 + FVE_E_NOT_ALLOWED_TO_UPGRADE_WHILE_CONVERTING Handle = 0x803100B3 + FVE_E_EDRIVE_DV_NOT_SUPPORTED Handle = 0x803100B4 + FVE_E_NO_PREBOOT_KEYBOARD_DETECTED Handle = 0x803100B5 + FVE_E_NO_PREBOOT_KEYBOARD_OR_WINRE_DETECTED Handle = 0x803100B6 + FVE_E_POLICY_REQUIRES_STARTUP_PIN_ON_TOUCH_DEVICE Handle = 0x803100B7 + FVE_E_POLICY_REQUIRES_RECOVERY_PASSWORD_ON_TOUCH_DEVICE Handle = 0x803100B8 + FVE_E_WIPE_CANCEL_NOT_APPLICABLE Handle = 0x803100B9 + FVE_E_SECUREBOOT_DISABLED Handle = 0x803100BA + FVE_E_SECUREBOOT_CONFIGURATION_INVALID Handle = 0x803100BB + FVE_E_EDRIVE_DRY_RUN_FAILED Handle = 0x803100BC + FVE_E_SHADOW_COPY_PRESENT Handle = 0x803100BD + FVE_E_POLICY_INVALID_ENHANCED_BCD_SETTINGS Handle = 0x803100BE + FVE_E_EDRIVE_INCOMPATIBLE_FIRMWARE Handle = 0x803100BF + FVE_E_PROTECTOR_CHANGE_MAX_PASSPHRASE_CHANGE_ATTEMPTS_REACHED Handle = 0x803100C0 + FVE_E_PASSPHRASE_PROTECTOR_CHANGE_BY_STD_USER_DISALLOWED Handle = 0x803100C1 + FVE_E_LIVEID_ACCOUNT_SUSPENDED Handle = 0x803100C2 + FVE_E_LIVEID_ACCOUNT_BLOCKED Handle = 0x803100C3 + FVE_E_NOT_PROVISIONED_ON_ALL_VOLUMES Handle = 0x803100C4 + FVE_E_DE_FIXED_DATA_NOT_SUPPORTED Handle = 0x803100C5 + FVE_E_DE_HARDWARE_NOT_COMPLIANT Handle = 0x803100C6 + FVE_E_DE_WINRE_NOT_CONFIGURED Handle = 0x803100C7 + FVE_E_DE_PROTECTION_SUSPENDED Handle = 0x803100C8 + FVE_E_DE_OS_VOLUME_NOT_PROTECTED Handle = 0x803100C9 + FVE_E_DE_DEVICE_LOCKEDOUT Handle = 0x803100CA + FVE_E_DE_PROTECTION_NOT_YET_ENABLED Handle = 0x803100CB + FVE_E_INVALID_PIN_CHARS_DETAILED Handle = 0x803100CC + FVE_E_DEVICE_LOCKOUT_COUNTER_UNAVAILABLE Handle = 0x803100CD + FVE_E_DEVICELOCKOUT_COUNTER_MISMATCH Handle = 0x803100CE + FVE_E_BUFFER_TOO_LARGE Handle = 0x803100CF + FVE_E_NO_SUCH_CAPABILITY_ON_TARGET Handle = 0x803100D0 + FVE_E_DE_PREVENTED_FOR_OS Handle = 0x803100D1 + FVE_E_DE_VOLUME_OPTED_OUT Handle = 0x803100D2 + FVE_E_DE_VOLUME_NOT_SUPPORTED Handle = 0x803100D3 + FVE_E_EOW_NOT_SUPPORTED_IN_VERSION Handle = 0x803100D4 + FVE_E_ADBACKUP_NOT_ENABLED Handle = 0x803100D5 + FVE_E_VOLUME_EXTEND_PREVENTS_EOW_DECRYPT Handle = 0x803100D6 + FVE_E_NOT_DE_VOLUME Handle = 0x803100D7 + FVE_E_PROTECTION_CANNOT_BE_DISABLED Handle = 0x803100D8 + FVE_E_OSV_KSR_NOT_ALLOWED Handle = 0x803100D9 + FWP_E_CALLOUT_NOT_FOUND Handle = 0x80320001 + FWP_E_CONDITION_NOT_FOUND Handle = 0x80320002 + FWP_E_FILTER_NOT_FOUND Handle = 0x80320003 + FWP_E_LAYER_NOT_FOUND Handle = 0x80320004 + FWP_E_PROVIDER_NOT_FOUND Handle = 0x80320005 + FWP_E_PROVIDER_CONTEXT_NOT_FOUND Handle = 0x80320006 + FWP_E_SUBLAYER_NOT_FOUND Handle = 0x80320007 + FWP_E_NOT_FOUND Handle = 0x80320008 + FWP_E_ALREADY_EXISTS Handle = 0x80320009 + FWP_E_IN_USE Handle = 0x8032000A + FWP_E_DYNAMIC_SESSION_IN_PROGRESS Handle = 0x8032000B + FWP_E_WRONG_SESSION Handle = 0x8032000C + FWP_E_NO_TXN_IN_PROGRESS Handle = 0x8032000D + FWP_E_TXN_IN_PROGRESS Handle = 0x8032000E + FWP_E_TXN_ABORTED Handle = 0x8032000F + FWP_E_SESSION_ABORTED Handle = 0x80320010 + FWP_E_INCOMPATIBLE_TXN Handle = 0x80320011 + FWP_E_TIMEOUT Handle = 0x80320012 + FWP_E_NET_EVENTS_DISABLED Handle = 0x80320013 + FWP_E_INCOMPATIBLE_LAYER Handle = 0x80320014 + FWP_E_KM_CLIENTS_ONLY Handle = 0x80320015 + FWP_E_LIFETIME_MISMATCH Handle = 0x80320016 + FWP_E_BUILTIN_OBJECT Handle = 0x80320017 + FWP_E_TOO_MANY_CALLOUTS Handle = 0x80320018 + FWP_E_NOTIFICATION_DROPPED Handle = 0x80320019 + FWP_E_TRAFFIC_MISMATCH Handle = 0x8032001A + FWP_E_INCOMPATIBLE_SA_STATE Handle = 0x8032001B + FWP_E_NULL_POINTER Handle = 0x8032001C + FWP_E_INVALID_ENUMERATOR Handle = 0x8032001D + FWP_E_INVALID_FLAGS Handle = 0x8032001E + FWP_E_INVALID_NET_MASK Handle = 0x8032001F + FWP_E_INVALID_RANGE Handle = 0x80320020 + FWP_E_INVALID_INTERVAL Handle = 0x80320021 + FWP_E_ZERO_LENGTH_ARRAY Handle = 0x80320022 + FWP_E_NULL_DISPLAY_NAME Handle = 0x80320023 + FWP_E_INVALID_ACTION_TYPE Handle = 0x80320024 + FWP_E_INVALID_WEIGHT Handle = 0x80320025 + FWP_E_MATCH_TYPE_MISMATCH Handle = 0x80320026 + FWP_E_TYPE_MISMATCH Handle = 0x80320027 + FWP_E_OUT_OF_BOUNDS Handle = 0x80320028 + FWP_E_RESERVED Handle = 0x80320029 + FWP_E_DUPLICATE_CONDITION Handle = 0x8032002A + FWP_E_DUPLICATE_KEYMOD Handle = 0x8032002B + FWP_E_ACTION_INCOMPATIBLE_WITH_LAYER Handle = 0x8032002C + FWP_E_ACTION_INCOMPATIBLE_WITH_SUBLAYER Handle = 0x8032002D + FWP_E_CONTEXT_INCOMPATIBLE_WITH_LAYER Handle = 0x8032002E + FWP_E_CONTEXT_INCOMPATIBLE_WITH_CALLOUT Handle = 0x8032002F + FWP_E_INCOMPATIBLE_AUTH_METHOD Handle = 0x80320030 + FWP_E_INCOMPATIBLE_DH_GROUP Handle = 0x80320031 + FWP_E_EM_NOT_SUPPORTED Handle = 0x80320032 + FWP_E_NEVER_MATCH Handle = 0x80320033 + FWP_E_PROVIDER_CONTEXT_MISMATCH Handle = 0x80320034 + FWP_E_INVALID_PARAMETER Handle = 0x80320035 + FWP_E_TOO_MANY_SUBLAYERS Handle = 0x80320036 + FWP_E_CALLOUT_NOTIFICATION_FAILED Handle = 0x80320037 + FWP_E_INVALID_AUTH_TRANSFORM Handle = 0x80320038 + FWP_E_INVALID_CIPHER_TRANSFORM Handle = 0x80320039 + FWP_E_INCOMPATIBLE_CIPHER_TRANSFORM Handle = 0x8032003A + FWP_E_INVALID_TRANSFORM_COMBINATION Handle = 0x8032003B + FWP_E_DUPLICATE_AUTH_METHOD Handle = 0x8032003C + FWP_E_INVALID_TUNNEL_ENDPOINT Handle = 0x8032003D + FWP_E_L2_DRIVER_NOT_READY Handle = 0x8032003E + FWP_E_KEY_DICTATOR_ALREADY_REGISTERED Handle = 0x8032003F + FWP_E_KEY_DICTATION_INVALID_KEYING_MATERIAL Handle = 0x80320040 + FWP_E_CONNECTIONS_DISABLED Handle = 0x80320041 + FWP_E_INVALID_DNS_NAME Handle = 0x80320042 + FWP_E_STILL_ON Handle = 0x80320043 + FWP_E_IKEEXT_NOT_RUNNING Handle = 0x80320044 + FWP_E_DROP_NOICMP Handle = 0x80320104 + WS_S_ASYNC Handle = 0x003D0000 + WS_S_END Handle = 0x003D0001 + WS_E_INVALID_FORMAT Handle = 0x803D0000 + WS_E_OBJECT_FAULTED Handle = 0x803D0001 + WS_E_NUMERIC_OVERFLOW Handle = 0x803D0002 + WS_E_INVALID_OPERATION Handle = 0x803D0003 + WS_E_OPERATION_ABORTED Handle = 0x803D0004 + WS_E_ENDPOINT_ACCESS_DENIED Handle = 0x803D0005 + WS_E_OPERATION_TIMED_OUT Handle = 0x803D0006 + WS_E_OPERATION_ABANDONED Handle = 0x803D0007 + WS_E_QUOTA_EXCEEDED Handle = 0x803D0008 + WS_E_NO_TRANSLATION_AVAILABLE Handle = 0x803D0009 + WS_E_SECURITY_VERIFICATION_FAILURE Handle = 0x803D000A + WS_E_ADDRESS_IN_USE Handle = 0x803D000B + WS_E_ADDRESS_NOT_AVAILABLE Handle = 0x803D000C + WS_E_ENDPOINT_NOT_FOUND Handle = 0x803D000D + WS_E_ENDPOINT_NOT_AVAILABLE Handle = 0x803D000E + WS_E_ENDPOINT_FAILURE Handle = 0x803D000F + WS_E_ENDPOINT_UNREACHABLE Handle = 0x803D0010 + WS_E_ENDPOINT_ACTION_NOT_SUPPORTED Handle = 0x803D0011 + WS_E_ENDPOINT_TOO_BUSY Handle = 0x803D0012 + WS_E_ENDPOINT_FAULT_RECEIVED Handle = 0x803D0013 + WS_E_ENDPOINT_DISCONNECTED Handle = 0x803D0014 + WS_E_PROXY_FAILURE Handle = 0x803D0015 + WS_E_PROXY_ACCESS_DENIED Handle = 0x803D0016 + WS_E_NOT_SUPPORTED Handle = 0x803D0017 + WS_E_PROXY_REQUIRES_BASIC_AUTH Handle = 0x803D0018 + WS_E_PROXY_REQUIRES_DIGEST_AUTH Handle = 0x803D0019 + WS_E_PROXY_REQUIRES_NTLM_AUTH Handle = 0x803D001A + WS_E_PROXY_REQUIRES_NEGOTIATE_AUTH Handle = 0x803D001B + WS_E_SERVER_REQUIRES_BASIC_AUTH Handle = 0x803D001C + WS_E_SERVER_REQUIRES_DIGEST_AUTH Handle = 0x803D001D + WS_E_SERVER_REQUIRES_NTLM_AUTH Handle = 0x803D001E + WS_E_SERVER_REQUIRES_NEGOTIATE_AUTH Handle = 0x803D001F + WS_E_INVALID_ENDPOINT_URL Handle = 0x803D0020 + WS_E_OTHER Handle = 0x803D0021 + WS_E_SECURITY_TOKEN_EXPIRED Handle = 0x803D0022 + WS_E_SECURITY_SYSTEM_FAILURE Handle = 0x803D0023 + ERROR_NDIS_INTERFACE_CLOSING syscall.Errno = 0x80340002 + ERROR_NDIS_BAD_VERSION syscall.Errno = 0x80340004 + ERROR_NDIS_BAD_CHARACTERISTICS syscall.Errno = 0x80340005 + ERROR_NDIS_ADAPTER_NOT_FOUND syscall.Errno = 0x80340006 + ERROR_NDIS_OPEN_FAILED syscall.Errno = 0x80340007 + ERROR_NDIS_DEVICE_FAILED syscall.Errno = 0x80340008 + ERROR_NDIS_MULTICAST_FULL syscall.Errno = 0x80340009 + ERROR_NDIS_MULTICAST_EXISTS syscall.Errno = 0x8034000A + ERROR_NDIS_MULTICAST_NOT_FOUND syscall.Errno = 0x8034000B + ERROR_NDIS_REQUEST_ABORTED syscall.Errno = 0x8034000C + ERROR_NDIS_RESET_IN_PROGRESS syscall.Errno = 0x8034000D + ERROR_NDIS_NOT_SUPPORTED syscall.Errno = 0x803400BB + ERROR_NDIS_INVALID_PACKET syscall.Errno = 0x8034000F + ERROR_NDIS_ADAPTER_NOT_READY syscall.Errno = 0x80340011 + ERROR_NDIS_INVALID_LENGTH syscall.Errno = 0x80340014 + ERROR_NDIS_INVALID_DATA syscall.Errno = 0x80340015 + ERROR_NDIS_BUFFER_TOO_SHORT syscall.Errno = 0x80340016 + ERROR_NDIS_INVALID_OID syscall.Errno = 0x80340017 + ERROR_NDIS_ADAPTER_REMOVED syscall.Errno = 0x80340018 + ERROR_NDIS_UNSUPPORTED_MEDIA syscall.Errno = 0x80340019 + ERROR_NDIS_GROUP_ADDRESS_IN_USE syscall.Errno = 0x8034001A + ERROR_NDIS_FILE_NOT_FOUND syscall.Errno = 0x8034001B + ERROR_NDIS_ERROR_READING_FILE syscall.Errno = 0x8034001C + ERROR_NDIS_ALREADY_MAPPED syscall.Errno = 0x8034001D + ERROR_NDIS_RESOURCE_CONFLICT syscall.Errno = 0x8034001E + ERROR_NDIS_MEDIA_DISCONNECTED syscall.Errno = 0x8034001F + ERROR_NDIS_INVALID_ADDRESS syscall.Errno = 0x80340022 + ERROR_NDIS_INVALID_DEVICE_REQUEST syscall.Errno = 0x80340010 + ERROR_NDIS_PAUSED syscall.Errno = 0x8034002A + ERROR_NDIS_INTERFACE_NOT_FOUND syscall.Errno = 0x8034002B + ERROR_NDIS_UNSUPPORTED_REVISION syscall.Errno = 0x8034002C + ERROR_NDIS_INVALID_PORT syscall.Errno = 0x8034002D + ERROR_NDIS_INVALID_PORT_STATE syscall.Errno = 0x8034002E + ERROR_NDIS_LOW_POWER_STATE syscall.Errno = 0x8034002F + ERROR_NDIS_REINIT_REQUIRED syscall.Errno = 0x80340030 + ERROR_NDIS_NO_QUEUES syscall.Errno = 0x80340031 + ERROR_NDIS_DOT11_AUTO_CONFIG_ENABLED syscall.Errno = 0x80342000 + ERROR_NDIS_DOT11_MEDIA_IN_USE syscall.Errno = 0x80342001 + ERROR_NDIS_DOT11_POWER_STATE_INVALID syscall.Errno = 0x80342002 + ERROR_NDIS_PM_WOL_PATTERN_LIST_FULL syscall.Errno = 0x80342003 + ERROR_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL syscall.Errno = 0x80342004 + ERROR_NDIS_DOT11_AP_CHANNEL_CURRENTLY_NOT_AVAILABLE syscall.Errno = 0x80342005 + ERROR_NDIS_DOT11_AP_BAND_CURRENTLY_NOT_AVAILABLE syscall.Errno = 0x80342006 + ERROR_NDIS_DOT11_AP_CHANNEL_NOT_ALLOWED syscall.Errno = 0x80342007 + ERROR_NDIS_DOT11_AP_BAND_NOT_ALLOWED syscall.Errno = 0x80342008 + ERROR_NDIS_INDICATION_REQUIRED syscall.Errno = 0x00340001 + ERROR_NDIS_OFFLOAD_POLICY syscall.Errno = 0xC034100F + ERROR_NDIS_OFFLOAD_CONNECTION_REJECTED syscall.Errno = 0xC0341012 + ERROR_NDIS_OFFLOAD_PATH_REJECTED syscall.Errno = 0xC0341013 + ERROR_HV_INVALID_HYPERCALL_CODE syscall.Errno = 0xC0350002 + ERROR_HV_INVALID_HYPERCALL_INPUT syscall.Errno = 0xC0350003 + ERROR_HV_INVALID_ALIGNMENT syscall.Errno = 0xC0350004 + ERROR_HV_INVALID_PARAMETER syscall.Errno = 0xC0350005 + ERROR_HV_ACCESS_DENIED syscall.Errno = 0xC0350006 + ERROR_HV_INVALID_PARTITION_STATE syscall.Errno = 0xC0350007 + ERROR_HV_OPERATION_DENIED syscall.Errno = 0xC0350008 + ERROR_HV_UNKNOWN_PROPERTY syscall.Errno = 0xC0350009 + ERROR_HV_PROPERTY_VALUE_OUT_OF_RANGE syscall.Errno = 0xC035000A + ERROR_HV_INSUFFICIENT_MEMORY syscall.Errno = 0xC035000B + ERROR_HV_PARTITION_TOO_DEEP syscall.Errno = 0xC035000C + ERROR_HV_INVALID_PARTITION_ID syscall.Errno = 0xC035000D + ERROR_HV_INVALID_VP_INDEX syscall.Errno = 0xC035000E + ERROR_HV_INVALID_PORT_ID syscall.Errno = 0xC0350011 + ERROR_HV_INVALID_CONNECTION_ID syscall.Errno = 0xC0350012 + ERROR_HV_INSUFFICIENT_BUFFERS syscall.Errno = 0xC0350013 + ERROR_HV_NOT_ACKNOWLEDGED syscall.Errno = 0xC0350014 + ERROR_HV_INVALID_VP_STATE syscall.Errno = 0xC0350015 + ERROR_HV_ACKNOWLEDGED syscall.Errno = 0xC0350016 + ERROR_HV_INVALID_SAVE_RESTORE_STATE syscall.Errno = 0xC0350017 + ERROR_HV_INVALID_SYNIC_STATE syscall.Errno = 0xC0350018 + ERROR_HV_OBJECT_IN_USE syscall.Errno = 0xC0350019 + ERROR_HV_INVALID_PROXIMITY_DOMAIN_INFO syscall.Errno = 0xC035001A + ERROR_HV_NO_DATA syscall.Errno = 0xC035001B + ERROR_HV_INACTIVE syscall.Errno = 0xC035001C + ERROR_HV_NO_RESOURCES syscall.Errno = 0xC035001D + ERROR_HV_FEATURE_UNAVAILABLE syscall.Errno = 0xC035001E + ERROR_HV_INSUFFICIENT_BUFFER syscall.Errno = 0xC0350033 + ERROR_HV_INSUFFICIENT_DEVICE_DOMAINS syscall.Errno = 0xC0350038 + ERROR_HV_CPUID_FEATURE_VALIDATION syscall.Errno = 0xC035003C + ERROR_HV_CPUID_XSAVE_FEATURE_VALIDATION syscall.Errno = 0xC035003D + ERROR_HV_PROCESSOR_STARTUP_TIMEOUT syscall.Errno = 0xC035003E + ERROR_HV_SMX_ENABLED syscall.Errno = 0xC035003F + ERROR_HV_INVALID_LP_INDEX syscall.Errno = 0xC0350041 + ERROR_HV_INVALID_REGISTER_VALUE syscall.Errno = 0xC0350050 + ERROR_HV_INVALID_VTL_STATE syscall.Errno = 0xC0350051 + ERROR_HV_NX_NOT_DETECTED syscall.Errno = 0xC0350055 + ERROR_HV_INVALID_DEVICE_ID syscall.Errno = 0xC0350057 + ERROR_HV_INVALID_DEVICE_STATE syscall.Errno = 0xC0350058 + ERROR_HV_PENDING_PAGE_REQUESTS syscall.Errno = 0x00350059 + ERROR_HV_PAGE_REQUEST_INVALID syscall.Errno = 0xC0350060 + ERROR_HV_INVALID_CPU_GROUP_ID syscall.Errno = 0xC035006F + ERROR_HV_INVALID_CPU_GROUP_STATE syscall.Errno = 0xC0350070 + ERROR_HV_OPERATION_FAILED syscall.Errno = 0xC0350071 + ERROR_HV_NOT_ALLOWED_WITH_NESTED_VIRT_ACTIVE syscall.Errno = 0xC0350072 + ERROR_HV_INSUFFICIENT_ROOT_MEMORY syscall.Errno = 0xC0350073 + ERROR_HV_NOT_PRESENT syscall.Errno = 0xC0351000 + ERROR_VID_DUPLICATE_HANDLER syscall.Errno = 0xC0370001 + ERROR_VID_TOO_MANY_HANDLERS syscall.Errno = 0xC0370002 + ERROR_VID_QUEUE_FULL syscall.Errno = 0xC0370003 + ERROR_VID_HANDLER_NOT_PRESENT syscall.Errno = 0xC0370004 + ERROR_VID_INVALID_OBJECT_NAME syscall.Errno = 0xC0370005 + ERROR_VID_PARTITION_NAME_TOO_LONG syscall.Errno = 0xC0370006 + ERROR_VID_MESSAGE_QUEUE_NAME_TOO_LONG syscall.Errno = 0xC0370007 + ERROR_VID_PARTITION_ALREADY_EXISTS syscall.Errno = 0xC0370008 + ERROR_VID_PARTITION_DOES_NOT_EXIST syscall.Errno = 0xC0370009 + ERROR_VID_PARTITION_NAME_NOT_FOUND syscall.Errno = 0xC037000A + ERROR_VID_MESSAGE_QUEUE_ALREADY_EXISTS syscall.Errno = 0xC037000B + ERROR_VID_EXCEEDED_MBP_ENTRY_MAP_LIMIT syscall.Errno = 0xC037000C + ERROR_VID_MB_STILL_REFERENCED syscall.Errno = 0xC037000D + ERROR_VID_CHILD_GPA_PAGE_SET_CORRUPTED syscall.Errno = 0xC037000E + ERROR_VID_INVALID_NUMA_SETTINGS syscall.Errno = 0xC037000F + ERROR_VID_INVALID_NUMA_NODE_INDEX syscall.Errno = 0xC0370010 + ERROR_VID_NOTIFICATION_QUEUE_ALREADY_ASSOCIATED syscall.Errno = 0xC0370011 + ERROR_VID_INVALID_MEMORY_BLOCK_HANDLE syscall.Errno = 0xC0370012 + ERROR_VID_PAGE_RANGE_OVERFLOW syscall.Errno = 0xC0370013 + ERROR_VID_INVALID_MESSAGE_QUEUE_HANDLE syscall.Errno = 0xC0370014 + ERROR_VID_INVALID_GPA_RANGE_HANDLE syscall.Errno = 0xC0370015 + ERROR_VID_NO_MEMORY_BLOCK_NOTIFICATION_QUEUE syscall.Errno = 0xC0370016 + ERROR_VID_MEMORY_BLOCK_LOCK_COUNT_EXCEEDED syscall.Errno = 0xC0370017 + ERROR_VID_INVALID_PPM_HANDLE syscall.Errno = 0xC0370018 + ERROR_VID_MBPS_ARE_LOCKED syscall.Errno = 0xC0370019 + ERROR_VID_MESSAGE_QUEUE_CLOSED syscall.Errno = 0xC037001A + ERROR_VID_VIRTUAL_PROCESSOR_LIMIT_EXCEEDED syscall.Errno = 0xC037001B + ERROR_VID_STOP_PENDING syscall.Errno = 0xC037001C + ERROR_VID_INVALID_PROCESSOR_STATE syscall.Errno = 0xC037001D + ERROR_VID_EXCEEDED_KM_CONTEXT_COUNT_LIMIT syscall.Errno = 0xC037001E + ERROR_VID_KM_INTERFACE_ALREADY_INITIALIZED syscall.Errno = 0xC037001F + ERROR_VID_MB_PROPERTY_ALREADY_SET_RESET syscall.Errno = 0xC0370020 + ERROR_VID_MMIO_RANGE_DESTROYED syscall.Errno = 0xC0370021 + ERROR_VID_INVALID_CHILD_GPA_PAGE_SET syscall.Errno = 0xC0370022 + ERROR_VID_RESERVE_PAGE_SET_IS_BEING_USED syscall.Errno = 0xC0370023 + ERROR_VID_RESERVE_PAGE_SET_TOO_SMALL syscall.Errno = 0xC0370024 + ERROR_VID_MBP_ALREADY_LOCKED_USING_RESERVED_PAGE syscall.Errno = 0xC0370025 + ERROR_VID_MBP_COUNT_EXCEEDED_LIMIT syscall.Errno = 0xC0370026 + ERROR_VID_SAVED_STATE_CORRUPT syscall.Errno = 0xC0370027 + ERROR_VID_SAVED_STATE_UNRECOGNIZED_ITEM syscall.Errno = 0xC0370028 + ERROR_VID_SAVED_STATE_INCOMPATIBLE syscall.Errno = 0xC0370029 + ERROR_VID_VTL_ACCESS_DENIED syscall.Errno = 0xC037002A + ERROR_VMCOMPUTE_TERMINATED_DURING_START syscall.Errno = 0xC0370100 + ERROR_VMCOMPUTE_IMAGE_MISMATCH syscall.Errno = 0xC0370101 + ERROR_VMCOMPUTE_HYPERV_NOT_INSTALLED syscall.Errno = 0xC0370102 + ERROR_VMCOMPUTE_OPERATION_PENDING syscall.Errno = 0xC0370103 + ERROR_VMCOMPUTE_TOO_MANY_NOTIFICATIONS syscall.Errno = 0xC0370104 + ERROR_VMCOMPUTE_INVALID_STATE syscall.Errno = 0xC0370105 + ERROR_VMCOMPUTE_UNEXPECTED_EXIT syscall.Errno = 0xC0370106 + ERROR_VMCOMPUTE_TERMINATED syscall.Errno = 0xC0370107 + ERROR_VMCOMPUTE_CONNECT_FAILED syscall.Errno = 0xC0370108 + ERROR_VMCOMPUTE_TIMEOUT syscall.Errno = 0xC0370109 + ERROR_VMCOMPUTE_CONNECTION_CLOSED syscall.Errno = 0xC037010A + ERROR_VMCOMPUTE_UNKNOWN_MESSAGE syscall.Errno = 0xC037010B + ERROR_VMCOMPUTE_UNSUPPORTED_PROTOCOL_VERSION syscall.Errno = 0xC037010C + ERROR_VMCOMPUTE_INVALID_JSON syscall.Errno = 0xC037010D + ERROR_VMCOMPUTE_SYSTEM_NOT_FOUND syscall.Errno = 0xC037010E + ERROR_VMCOMPUTE_SYSTEM_ALREADY_EXISTS syscall.Errno = 0xC037010F + ERROR_VMCOMPUTE_SYSTEM_ALREADY_STOPPED syscall.Errno = 0xC0370110 + ERROR_VMCOMPUTE_PROTOCOL_ERROR syscall.Errno = 0xC0370111 + ERROR_VMCOMPUTE_INVALID_LAYER syscall.Errno = 0xC0370112 + ERROR_VMCOMPUTE_WINDOWS_INSIDER_REQUIRED syscall.Errno = 0xC0370113 + HCS_E_TERMINATED_DURING_START Handle = 0x80370100 + HCS_E_IMAGE_MISMATCH Handle = 0x80370101 + HCS_E_HYPERV_NOT_INSTALLED Handle = 0x80370102 + HCS_E_INVALID_STATE Handle = 0x80370105 + HCS_E_UNEXPECTED_EXIT Handle = 0x80370106 + HCS_E_TERMINATED Handle = 0x80370107 + HCS_E_CONNECT_FAILED Handle = 0x80370108 + HCS_E_CONNECTION_TIMEOUT Handle = 0x80370109 + HCS_E_CONNECTION_CLOSED Handle = 0x8037010A + HCS_E_UNKNOWN_MESSAGE Handle = 0x8037010B + HCS_E_UNSUPPORTED_PROTOCOL_VERSION Handle = 0x8037010C + HCS_E_INVALID_JSON Handle = 0x8037010D + HCS_E_SYSTEM_NOT_FOUND Handle = 0x8037010E + HCS_E_SYSTEM_ALREADY_EXISTS Handle = 0x8037010F + HCS_E_SYSTEM_ALREADY_STOPPED Handle = 0x80370110 + HCS_E_PROTOCOL_ERROR Handle = 0x80370111 + HCS_E_INVALID_LAYER Handle = 0x80370112 + HCS_E_WINDOWS_INSIDER_REQUIRED Handle = 0x80370113 + HCS_E_SERVICE_NOT_AVAILABLE Handle = 0x80370114 + HCS_E_OPERATION_NOT_STARTED Handle = 0x80370115 + HCS_E_OPERATION_ALREADY_STARTED Handle = 0x80370116 + HCS_E_OPERATION_PENDING Handle = 0x80370117 + HCS_E_OPERATION_TIMEOUT Handle = 0x80370118 + HCS_E_OPERATION_SYSTEM_CALLBACK_ALREADY_SET Handle = 0x80370119 + HCS_E_OPERATION_RESULT_ALLOCATION_FAILED Handle = 0x8037011A + HCS_E_ACCESS_DENIED Handle = 0x8037011B + HCS_E_GUEST_CRITICAL_ERROR Handle = 0x8037011C + ERROR_VNET_VIRTUAL_SWITCH_NAME_NOT_FOUND syscall.Errno = 0xC0370200 + ERROR_VID_REMOTE_NODE_PARENT_GPA_PAGES_USED syscall.Errno = 0x80370001 + WHV_E_UNKNOWN_CAPABILITY Handle = 0x80370300 + WHV_E_INSUFFICIENT_BUFFER Handle = 0x80370301 + WHV_E_UNKNOWN_PROPERTY Handle = 0x80370302 + WHV_E_UNSUPPORTED_HYPERVISOR_CONFIG Handle = 0x80370303 + WHV_E_INVALID_PARTITION_CONFIG Handle = 0x80370304 + WHV_E_GPA_RANGE_NOT_FOUND Handle = 0x80370305 + WHV_E_VP_ALREADY_EXISTS Handle = 0x80370306 + WHV_E_VP_DOES_NOT_EXIST Handle = 0x80370307 + WHV_E_INVALID_VP_STATE Handle = 0x80370308 + WHV_E_INVALID_VP_REGISTER_NAME Handle = 0x80370309 + ERROR_VSMB_SAVED_STATE_FILE_NOT_FOUND syscall.Errno = 0xC0370400 + ERROR_VSMB_SAVED_STATE_CORRUPT syscall.Errno = 0xC0370401 + ERROR_VOLMGR_INCOMPLETE_REGENERATION syscall.Errno = 0x80380001 + ERROR_VOLMGR_INCOMPLETE_DISK_MIGRATION syscall.Errno = 0x80380002 + ERROR_VOLMGR_DATABASE_FULL syscall.Errno = 0xC0380001 + ERROR_VOLMGR_DISK_CONFIGURATION_CORRUPTED syscall.Errno = 0xC0380002 + ERROR_VOLMGR_DISK_CONFIGURATION_NOT_IN_SYNC syscall.Errno = 0xC0380003 + ERROR_VOLMGR_PACK_CONFIG_UPDATE_FAILED syscall.Errno = 0xC0380004 + ERROR_VOLMGR_DISK_CONTAINS_NON_SIMPLE_VOLUME syscall.Errno = 0xC0380005 + ERROR_VOLMGR_DISK_DUPLICATE syscall.Errno = 0xC0380006 + ERROR_VOLMGR_DISK_DYNAMIC syscall.Errno = 0xC0380007 + ERROR_VOLMGR_DISK_ID_INVALID syscall.Errno = 0xC0380008 + ERROR_VOLMGR_DISK_INVALID syscall.Errno = 0xC0380009 + ERROR_VOLMGR_DISK_LAST_VOTER syscall.Errno = 0xC038000A + ERROR_VOLMGR_DISK_LAYOUT_INVALID syscall.Errno = 0xC038000B + ERROR_VOLMGR_DISK_LAYOUT_NON_BASIC_BETWEEN_BASIC_PARTITIONS syscall.Errno = 0xC038000C + ERROR_VOLMGR_DISK_LAYOUT_NOT_CYLINDER_ALIGNED syscall.Errno = 0xC038000D + ERROR_VOLMGR_DISK_LAYOUT_PARTITIONS_TOO_SMALL syscall.Errno = 0xC038000E + ERROR_VOLMGR_DISK_LAYOUT_PRIMARY_BETWEEN_LOGICAL_PARTITIONS syscall.Errno = 0xC038000F + ERROR_VOLMGR_DISK_LAYOUT_TOO_MANY_PARTITIONS syscall.Errno = 0xC0380010 + ERROR_VOLMGR_DISK_MISSING syscall.Errno = 0xC0380011 + ERROR_VOLMGR_DISK_NOT_EMPTY syscall.Errno = 0xC0380012 + ERROR_VOLMGR_DISK_NOT_ENOUGH_SPACE syscall.Errno = 0xC0380013 + ERROR_VOLMGR_DISK_REVECTORING_FAILED syscall.Errno = 0xC0380014 + ERROR_VOLMGR_DISK_SECTOR_SIZE_INVALID syscall.Errno = 0xC0380015 + ERROR_VOLMGR_DISK_SET_NOT_CONTAINED syscall.Errno = 0xC0380016 + ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_MEMBERS syscall.Errno = 0xC0380017 + ERROR_VOLMGR_DISK_USED_BY_MULTIPLE_PLEXES syscall.Errno = 0xC0380018 + ERROR_VOLMGR_DYNAMIC_DISK_NOT_SUPPORTED syscall.Errno = 0xC0380019 + ERROR_VOLMGR_EXTENT_ALREADY_USED syscall.Errno = 0xC038001A + ERROR_VOLMGR_EXTENT_NOT_CONTIGUOUS syscall.Errno = 0xC038001B + ERROR_VOLMGR_EXTENT_NOT_IN_PUBLIC_REGION syscall.Errno = 0xC038001C + ERROR_VOLMGR_EXTENT_NOT_SECTOR_ALIGNED syscall.Errno = 0xC038001D + ERROR_VOLMGR_EXTENT_OVERLAPS_EBR_PARTITION syscall.Errno = 0xC038001E + ERROR_VOLMGR_EXTENT_VOLUME_LENGTHS_DO_NOT_MATCH syscall.Errno = 0xC038001F + ERROR_VOLMGR_FAULT_TOLERANT_NOT_SUPPORTED syscall.Errno = 0xC0380020 + ERROR_VOLMGR_INTERLEAVE_LENGTH_INVALID syscall.Errno = 0xC0380021 + ERROR_VOLMGR_MAXIMUM_REGISTERED_USERS syscall.Errno = 0xC0380022 + ERROR_VOLMGR_MEMBER_IN_SYNC syscall.Errno = 0xC0380023 + ERROR_VOLMGR_MEMBER_INDEX_DUPLICATE syscall.Errno = 0xC0380024 + ERROR_VOLMGR_MEMBER_INDEX_INVALID syscall.Errno = 0xC0380025 + ERROR_VOLMGR_MEMBER_MISSING syscall.Errno = 0xC0380026 + ERROR_VOLMGR_MEMBER_NOT_DETACHED syscall.Errno = 0xC0380027 + ERROR_VOLMGR_MEMBER_REGENERATING syscall.Errno = 0xC0380028 + ERROR_VOLMGR_ALL_DISKS_FAILED syscall.Errno = 0xC0380029 + ERROR_VOLMGR_NO_REGISTERED_USERS syscall.Errno = 0xC038002A + ERROR_VOLMGR_NO_SUCH_USER syscall.Errno = 0xC038002B + ERROR_VOLMGR_NOTIFICATION_RESET syscall.Errno = 0xC038002C + ERROR_VOLMGR_NUMBER_OF_MEMBERS_INVALID syscall.Errno = 0xC038002D + ERROR_VOLMGR_NUMBER_OF_PLEXES_INVALID syscall.Errno = 0xC038002E + ERROR_VOLMGR_PACK_DUPLICATE syscall.Errno = 0xC038002F + ERROR_VOLMGR_PACK_ID_INVALID syscall.Errno = 0xC0380030 + ERROR_VOLMGR_PACK_INVALID syscall.Errno = 0xC0380031 + ERROR_VOLMGR_PACK_NAME_INVALID syscall.Errno = 0xC0380032 + ERROR_VOLMGR_PACK_OFFLINE syscall.Errno = 0xC0380033 + ERROR_VOLMGR_PACK_HAS_QUORUM syscall.Errno = 0xC0380034 + ERROR_VOLMGR_PACK_WITHOUT_QUORUM syscall.Errno = 0xC0380035 + ERROR_VOLMGR_PARTITION_STYLE_INVALID syscall.Errno = 0xC0380036 + ERROR_VOLMGR_PARTITION_UPDATE_FAILED syscall.Errno = 0xC0380037 + ERROR_VOLMGR_PLEX_IN_SYNC syscall.Errno = 0xC0380038 + ERROR_VOLMGR_PLEX_INDEX_DUPLICATE syscall.Errno = 0xC0380039 + ERROR_VOLMGR_PLEX_INDEX_INVALID syscall.Errno = 0xC038003A + ERROR_VOLMGR_PLEX_LAST_ACTIVE syscall.Errno = 0xC038003B + ERROR_VOLMGR_PLEX_MISSING syscall.Errno = 0xC038003C + ERROR_VOLMGR_PLEX_REGENERATING syscall.Errno = 0xC038003D + ERROR_VOLMGR_PLEX_TYPE_INVALID syscall.Errno = 0xC038003E + ERROR_VOLMGR_PLEX_NOT_RAID5 syscall.Errno = 0xC038003F + ERROR_VOLMGR_PLEX_NOT_SIMPLE syscall.Errno = 0xC0380040 + ERROR_VOLMGR_STRUCTURE_SIZE_INVALID syscall.Errno = 0xC0380041 + ERROR_VOLMGR_TOO_MANY_NOTIFICATION_REQUESTS syscall.Errno = 0xC0380042 + ERROR_VOLMGR_TRANSACTION_IN_PROGRESS syscall.Errno = 0xC0380043 + ERROR_VOLMGR_UNEXPECTED_DISK_LAYOUT_CHANGE syscall.Errno = 0xC0380044 + ERROR_VOLMGR_VOLUME_CONTAINS_MISSING_DISK syscall.Errno = 0xC0380045 + ERROR_VOLMGR_VOLUME_ID_INVALID syscall.Errno = 0xC0380046 + ERROR_VOLMGR_VOLUME_LENGTH_INVALID syscall.Errno = 0xC0380047 + ERROR_VOLMGR_VOLUME_LENGTH_NOT_SECTOR_SIZE_MULTIPLE syscall.Errno = 0xC0380048 + ERROR_VOLMGR_VOLUME_NOT_MIRRORED syscall.Errno = 0xC0380049 + ERROR_VOLMGR_VOLUME_NOT_RETAINED syscall.Errno = 0xC038004A + ERROR_VOLMGR_VOLUME_OFFLINE syscall.Errno = 0xC038004B + ERROR_VOLMGR_VOLUME_RETAINED syscall.Errno = 0xC038004C + ERROR_VOLMGR_NUMBER_OF_EXTENTS_INVALID syscall.Errno = 0xC038004D + ERROR_VOLMGR_DIFFERENT_SECTOR_SIZE syscall.Errno = 0xC038004E + ERROR_VOLMGR_BAD_BOOT_DISK syscall.Errno = 0xC038004F + ERROR_VOLMGR_PACK_CONFIG_OFFLINE syscall.Errno = 0xC0380050 + ERROR_VOLMGR_PACK_CONFIG_ONLINE syscall.Errno = 0xC0380051 + ERROR_VOLMGR_NOT_PRIMARY_PACK syscall.Errno = 0xC0380052 + ERROR_VOLMGR_PACK_LOG_UPDATE_FAILED syscall.Errno = 0xC0380053 + ERROR_VOLMGR_NUMBER_OF_DISKS_IN_PLEX_INVALID syscall.Errno = 0xC0380054 + ERROR_VOLMGR_NUMBER_OF_DISKS_IN_MEMBER_INVALID syscall.Errno = 0xC0380055 + ERROR_VOLMGR_VOLUME_MIRRORED syscall.Errno = 0xC0380056 + ERROR_VOLMGR_PLEX_NOT_SIMPLE_SPANNED syscall.Errno = 0xC0380057 + ERROR_VOLMGR_NO_VALID_LOG_COPIES syscall.Errno = 0xC0380058 + ERROR_VOLMGR_PRIMARY_PACK_PRESENT syscall.Errno = 0xC0380059 + ERROR_VOLMGR_NUMBER_OF_DISKS_INVALID syscall.Errno = 0xC038005A + ERROR_VOLMGR_MIRROR_NOT_SUPPORTED syscall.Errno = 0xC038005B + ERROR_VOLMGR_RAID5_NOT_SUPPORTED syscall.Errno = 0xC038005C + ERROR_BCD_NOT_ALL_ENTRIES_IMPORTED syscall.Errno = 0x80390001 + ERROR_BCD_TOO_MANY_ELEMENTS syscall.Errno = 0xC0390002 + ERROR_BCD_NOT_ALL_ENTRIES_SYNCHRONIZED syscall.Errno = 0x80390003 + ERROR_VHD_DRIVE_FOOTER_MISSING syscall.Errno = 0xC03A0001 + ERROR_VHD_DRIVE_FOOTER_CHECKSUM_MISMATCH syscall.Errno = 0xC03A0002 + ERROR_VHD_DRIVE_FOOTER_CORRUPT syscall.Errno = 0xC03A0003 + ERROR_VHD_FORMAT_UNKNOWN syscall.Errno = 0xC03A0004 + ERROR_VHD_FORMAT_UNSUPPORTED_VERSION syscall.Errno = 0xC03A0005 + ERROR_VHD_SPARSE_HEADER_CHECKSUM_MISMATCH syscall.Errno = 0xC03A0006 + ERROR_VHD_SPARSE_HEADER_UNSUPPORTED_VERSION syscall.Errno = 0xC03A0007 + ERROR_VHD_SPARSE_HEADER_CORRUPT syscall.Errno = 0xC03A0008 + ERROR_VHD_BLOCK_ALLOCATION_FAILURE syscall.Errno = 0xC03A0009 + ERROR_VHD_BLOCK_ALLOCATION_TABLE_CORRUPT syscall.Errno = 0xC03A000A + ERROR_VHD_INVALID_BLOCK_SIZE syscall.Errno = 0xC03A000B + ERROR_VHD_BITMAP_MISMATCH syscall.Errno = 0xC03A000C + ERROR_VHD_PARENT_VHD_NOT_FOUND syscall.Errno = 0xC03A000D + ERROR_VHD_CHILD_PARENT_ID_MISMATCH syscall.Errno = 0xC03A000E + ERROR_VHD_CHILD_PARENT_TIMESTAMP_MISMATCH syscall.Errno = 0xC03A000F + ERROR_VHD_METADATA_READ_FAILURE syscall.Errno = 0xC03A0010 + ERROR_VHD_METADATA_WRITE_FAILURE syscall.Errno = 0xC03A0011 + ERROR_VHD_INVALID_SIZE syscall.Errno = 0xC03A0012 + ERROR_VHD_INVALID_FILE_SIZE syscall.Errno = 0xC03A0013 + ERROR_VIRTDISK_PROVIDER_NOT_FOUND syscall.Errno = 0xC03A0014 + ERROR_VIRTDISK_NOT_VIRTUAL_DISK syscall.Errno = 0xC03A0015 + ERROR_VHD_PARENT_VHD_ACCESS_DENIED syscall.Errno = 0xC03A0016 + ERROR_VHD_CHILD_PARENT_SIZE_MISMATCH syscall.Errno = 0xC03A0017 + ERROR_VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED syscall.Errno = 0xC03A0018 + ERROR_VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT syscall.Errno = 0xC03A0019 + ERROR_VIRTUAL_DISK_LIMITATION syscall.Errno = 0xC03A001A + ERROR_VHD_INVALID_TYPE syscall.Errno = 0xC03A001B + ERROR_VHD_INVALID_STATE syscall.Errno = 0xC03A001C + ERROR_VIRTDISK_UNSUPPORTED_DISK_SECTOR_SIZE syscall.Errno = 0xC03A001D + ERROR_VIRTDISK_DISK_ALREADY_OWNED syscall.Errno = 0xC03A001E + ERROR_VIRTDISK_DISK_ONLINE_AND_WRITABLE syscall.Errno = 0xC03A001F + ERROR_CTLOG_TRACKING_NOT_INITIALIZED syscall.Errno = 0xC03A0020 + ERROR_CTLOG_LOGFILE_SIZE_EXCEEDED_MAXSIZE syscall.Errno = 0xC03A0021 + ERROR_CTLOG_VHD_CHANGED_OFFLINE syscall.Errno = 0xC03A0022 + ERROR_CTLOG_INVALID_TRACKING_STATE syscall.Errno = 0xC03A0023 + ERROR_CTLOG_INCONSISTENT_TRACKING_FILE syscall.Errno = 0xC03A0024 + ERROR_VHD_RESIZE_WOULD_TRUNCATE_DATA syscall.Errno = 0xC03A0025 + ERROR_VHD_COULD_NOT_COMPUTE_MINIMUM_VIRTUAL_SIZE syscall.Errno = 0xC03A0026 + ERROR_VHD_ALREADY_AT_OR_BELOW_MINIMUM_VIRTUAL_SIZE syscall.Errno = 0xC03A0027 + ERROR_VHD_METADATA_FULL syscall.Errno = 0xC03A0028 + ERROR_VHD_INVALID_CHANGE_TRACKING_ID syscall.Errno = 0xC03A0029 + ERROR_VHD_CHANGE_TRACKING_DISABLED syscall.Errno = 0xC03A002A + ERROR_VHD_MISSING_CHANGE_TRACKING_INFORMATION syscall.Errno = 0xC03A0030 + ERROR_QUERY_STORAGE_ERROR syscall.Errno = 0x803A0001 + HCN_E_NETWORK_NOT_FOUND Handle = 0x803B0001 + HCN_E_ENDPOINT_NOT_FOUND Handle = 0x803B0002 + HCN_E_LAYER_NOT_FOUND Handle = 0x803B0003 + HCN_E_SWITCH_NOT_FOUND Handle = 0x803B0004 + HCN_E_SUBNET_NOT_FOUND Handle = 0x803B0005 + HCN_E_ADAPTER_NOT_FOUND Handle = 0x803B0006 + HCN_E_PORT_NOT_FOUND Handle = 0x803B0007 + HCN_E_POLICY_NOT_FOUND Handle = 0x803B0008 + HCN_E_VFP_PORTSETTING_NOT_FOUND Handle = 0x803B0009 + HCN_E_INVALID_NETWORK Handle = 0x803B000A + HCN_E_INVALID_NETWORK_TYPE Handle = 0x803B000B + HCN_E_INVALID_ENDPOINT Handle = 0x803B000C + HCN_E_INVALID_POLICY Handle = 0x803B000D + HCN_E_INVALID_POLICY_TYPE Handle = 0x803B000E + HCN_E_INVALID_REMOTE_ENDPOINT_OPERATION Handle = 0x803B000F + HCN_E_NETWORK_ALREADY_EXISTS Handle = 0x803B0010 + HCN_E_LAYER_ALREADY_EXISTS Handle = 0x803B0011 + HCN_E_POLICY_ALREADY_EXISTS Handle = 0x803B0012 + HCN_E_PORT_ALREADY_EXISTS Handle = 0x803B0013 + HCN_E_ENDPOINT_ALREADY_ATTACHED Handle = 0x803B0014 + HCN_E_REQUEST_UNSUPPORTED Handle = 0x803B0015 + HCN_E_MAPPING_NOT_SUPPORTED Handle = 0x803B0016 + HCN_E_DEGRADED_OPERATION Handle = 0x803B0017 + HCN_E_SHARED_SWITCH_MODIFICATION Handle = 0x803B0018 + HCN_E_GUID_CONVERSION_FAILURE Handle = 0x803B0019 + HCN_E_REGKEY_FAILURE Handle = 0x803B001A + HCN_E_INVALID_JSON Handle = 0x803B001B + HCN_E_INVALID_JSON_REFERENCE Handle = 0x803B001C + HCN_E_ENDPOINT_SHARING_DISABLED Handle = 0x803B001D + HCN_E_INVALID_IP Handle = 0x803B001E + HCN_E_SWITCH_EXTENSION_NOT_FOUND Handle = 0x803B001F + HCN_E_MANAGER_STOPPED Handle = 0x803B0020 + GCN_E_MODULE_NOT_FOUND Handle = 0x803B0021 + GCN_E_NO_REQUEST_HANDLERS Handle = 0x803B0022 + GCN_E_REQUEST_UNSUPPORTED Handle = 0x803B0023 + GCN_E_RUNTIMEKEYS_FAILED Handle = 0x803B0024 + GCN_E_NETADAPTER_TIMEOUT Handle = 0x803B0025 + GCN_E_NETADAPTER_NOT_FOUND Handle = 0x803B0026 + GCN_E_NETCOMPARTMENT_NOT_FOUND Handle = 0x803B0027 + GCN_E_NETINTERFACE_NOT_FOUND Handle = 0x803B0028 + GCN_E_DEFAULTNAMESPACE_EXISTS Handle = 0x803B0029 + SDIAG_E_CANCELLED syscall.Errno = 0x803C0100 + SDIAG_E_SCRIPT syscall.Errno = 0x803C0101 + SDIAG_E_POWERSHELL syscall.Errno = 0x803C0102 + SDIAG_E_MANAGEDHOST syscall.Errno = 0x803C0103 + SDIAG_E_NOVERIFIER syscall.Errno = 0x803C0104 + SDIAG_S_CANNOTRUN syscall.Errno = 0x003C0105 + SDIAG_E_DISABLED syscall.Errno = 0x803C0106 + SDIAG_E_TRUST syscall.Errno = 0x803C0107 + SDIAG_E_CANNOTRUN syscall.Errno = 0x803C0108 + SDIAG_E_VERSION syscall.Errno = 0x803C0109 + SDIAG_E_RESOURCE syscall.Errno = 0x803C010A + SDIAG_E_ROOTCAUSE syscall.Errno = 0x803C010B + WPN_E_CHANNEL_CLOSED Handle = 0x803E0100 + WPN_E_CHANNEL_REQUEST_NOT_COMPLETE Handle = 0x803E0101 + WPN_E_INVALID_APP Handle = 0x803E0102 + WPN_E_OUTSTANDING_CHANNEL_REQUEST Handle = 0x803E0103 + WPN_E_DUPLICATE_CHANNEL Handle = 0x803E0104 + WPN_E_PLATFORM_UNAVAILABLE Handle = 0x803E0105 + WPN_E_NOTIFICATION_POSTED Handle = 0x803E0106 + WPN_E_NOTIFICATION_HIDDEN Handle = 0x803E0107 + WPN_E_NOTIFICATION_NOT_POSTED Handle = 0x803E0108 + WPN_E_CLOUD_DISABLED Handle = 0x803E0109 + WPN_E_CLOUD_INCAPABLE Handle = 0x803E0110 + WPN_E_CLOUD_AUTH_UNAVAILABLE Handle = 0x803E011A + WPN_E_CLOUD_SERVICE_UNAVAILABLE Handle = 0x803E011B + WPN_E_FAILED_LOCK_SCREEN_UPDATE_INTIALIZATION Handle = 0x803E011C + WPN_E_NOTIFICATION_DISABLED Handle = 0x803E0111 + WPN_E_NOTIFICATION_INCAPABLE Handle = 0x803E0112 + WPN_E_INTERNET_INCAPABLE Handle = 0x803E0113 + WPN_E_NOTIFICATION_TYPE_DISABLED Handle = 0x803E0114 + WPN_E_NOTIFICATION_SIZE Handle = 0x803E0115 + WPN_E_TAG_SIZE Handle = 0x803E0116 + WPN_E_ACCESS_DENIED Handle = 0x803E0117 + WPN_E_DUPLICATE_REGISTRATION Handle = 0x803E0118 + WPN_E_PUSH_NOTIFICATION_INCAPABLE Handle = 0x803E0119 + WPN_E_DEV_ID_SIZE Handle = 0x803E0120 + WPN_E_TAG_ALPHANUMERIC Handle = 0x803E012A + WPN_E_INVALID_HTTP_STATUS_CODE Handle = 0x803E012B + WPN_E_OUT_OF_SESSION Handle = 0x803E0200 + WPN_E_POWER_SAVE Handle = 0x803E0201 + WPN_E_IMAGE_NOT_FOUND_IN_CACHE Handle = 0x803E0202 + WPN_E_ALL_URL_NOT_COMPLETED Handle = 0x803E0203 + WPN_E_INVALID_CLOUD_IMAGE Handle = 0x803E0204 + WPN_E_NOTIFICATION_ID_MATCHED Handle = 0x803E0205 + WPN_E_CALLBACK_ALREADY_REGISTERED Handle = 0x803E0206 + WPN_E_TOAST_NOTIFICATION_DROPPED Handle = 0x803E0207 + WPN_E_STORAGE_LOCKED Handle = 0x803E0208 + WPN_E_GROUP_SIZE Handle = 0x803E0209 + WPN_E_GROUP_ALPHANUMERIC Handle = 0x803E020A + WPN_E_CLOUD_DISABLED_FOR_APP Handle = 0x803E020B + E_MBN_CONTEXT_NOT_ACTIVATED Handle = 0x80548201 + E_MBN_BAD_SIM Handle = 0x80548202 + E_MBN_DATA_CLASS_NOT_AVAILABLE Handle = 0x80548203 + E_MBN_INVALID_ACCESS_STRING Handle = 0x80548204 + E_MBN_MAX_ACTIVATED_CONTEXTS Handle = 0x80548205 + E_MBN_PACKET_SVC_DETACHED Handle = 0x80548206 + E_MBN_PROVIDER_NOT_VISIBLE Handle = 0x80548207 + E_MBN_RADIO_POWER_OFF Handle = 0x80548208 + E_MBN_SERVICE_NOT_ACTIVATED Handle = 0x80548209 + E_MBN_SIM_NOT_INSERTED Handle = 0x8054820A + E_MBN_VOICE_CALL_IN_PROGRESS Handle = 0x8054820B + E_MBN_INVALID_CACHE Handle = 0x8054820C + E_MBN_NOT_REGISTERED Handle = 0x8054820D + E_MBN_PROVIDERS_NOT_FOUND Handle = 0x8054820E + E_MBN_PIN_NOT_SUPPORTED Handle = 0x8054820F + E_MBN_PIN_REQUIRED Handle = 0x80548210 + E_MBN_PIN_DISABLED Handle = 0x80548211 + E_MBN_FAILURE Handle = 0x80548212 + E_MBN_INVALID_PROFILE Handle = 0x80548218 + E_MBN_DEFAULT_PROFILE_EXIST Handle = 0x80548219 + E_MBN_SMS_ENCODING_NOT_SUPPORTED Handle = 0x80548220 + E_MBN_SMS_FILTER_NOT_SUPPORTED Handle = 0x80548221 + E_MBN_SMS_INVALID_MEMORY_INDEX Handle = 0x80548222 + E_MBN_SMS_LANG_NOT_SUPPORTED Handle = 0x80548223 + E_MBN_SMS_MEMORY_FAILURE Handle = 0x80548224 + E_MBN_SMS_NETWORK_TIMEOUT Handle = 0x80548225 + E_MBN_SMS_UNKNOWN_SMSC_ADDRESS Handle = 0x80548226 + E_MBN_SMS_FORMAT_NOT_SUPPORTED Handle = 0x80548227 + E_MBN_SMS_OPERATION_NOT_ALLOWED Handle = 0x80548228 + E_MBN_SMS_MEMORY_FULL Handle = 0x80548229 + PEER_E_IPV6_NOT_INSTALLED Handle = 0x80630001 + PEER_E_NOT_INITIALIZED Handle = 0x80630002 + PEER_E_CANNOT_START_SERVICE Handle = 0x80630003 + PEER_E_NOT_LICENSED Handle = 0x80630004 + PEER_E_INVALID_GRAPH Handle = 0x80630010 + PEER_E_DBNAME_CHANGED Handle = 0x80630011 + PEER_E_DUPLICATE_GRAPH Handle = 0x80630012 + PEER_E_GRAPH_NOT_READY Handle = 0x80630013 + PEER_E_GRAPH_SHUTTING_DOWN Handle = 0x80630014 + PEER_E_GRAPH_IN_USE Handle = 0x80630015 + PEER_E_INVALID_DATABASE Handle = 0x80630016 + PEER_E_TOO_MANY_ATTRIBUTES Handle = 0x80630017 + PEER_E_CONNECTION_NOT_FOUND Handle = 0x80630103 + PEER_E_CONNECT_SELF Handle = 0x80630106 + PEER_E_ALREADY_LISTENING Handle = 0x80630107 + PEER_E_NODE_NOT_FOUND Handle = 0x80630108 + PEER_E_CONNECTION_FAILED Handle = 0x80630109 + PEER_E_CONNECTION_NOT_AUTHENTICATED Handle = 0x8063010A + PEER_E_CONNECTION_REFUSED Handle = 0x8063010B + PEER_E_CLASSIFIER_TOO_LONG Handle = 0x80630201 + PEER_E_TOO_MANY_IDENTITIES Handle = 0x80630202 + PEER_E_NO_KEY_ACCESS Handle = 0x80630203 + PEER_E_GROUPS_EXIST Handle = 0x80630204 + PEER_E_RECORD_NOT_FOUND Handle = 0x80630301 + PEER_E_DATABASE_ACCESSDENIED Handle = 0x80630302 + PEER_E_DBINITIALIZATION_FAILED Handle = 0x80630303 + PEER_E_MAX_RECORD_SIZE_EXCEEDED Handle = 0x80630304 + PEER_E_DATABASE_ALREADY_PRESENT Handle = 0x80630305 + PEER_E_DATABASE_NOT_PRESENT Handle = 0x80630306 + PEER_E_IDENTITY_NOT_FOUND Handle = 0x80630401 + PEER_E_EVENT_HANDLE_NOT_FOUND Handle = 0x80630501 + PEER_E_INVALID_SEARCH Handle = 0x80630601 + PEER_E_INVALID_ATTRIBUTES Handle = 0x80630602 + PEER_E_INVITATION_NOT_TRUSTED Handle = 0x80630701 + PEER_E_CHAIN_TOO_LONG Handle = 0x80630703 + PEER_E_INVALID_TIME_PERIOD Handle = 0x80630705 + PEER_E_CIRCULAR_CHAIN_DETECTED Handle = 0x80630706 + PEER_E_CERT_STORE_CORRUPTED Handle = 0x80630801 + PEER_E_NO_CLOUD Handle = 0x80631001 + PEER_E_CLOUD_NAME_AMBIGUOUS Handle = 0x80631005 + PEER_E_INVALID_RECORD Handle = 0x80632010 + PEER_E_NOT_AUTHORIZED Handle = 0x80632020 + PEER_E_PASSWORD_DOES_NOT_MEET_POLICY Handle = 0x80632021 + PEER_E_DEFERRED_VALIDATION Handle = 0x80632030 + PEER_E_INVALID_GROUP_PROPERTIES Handle = 0x80632040 + PEER_E_INVALID_PEER_NAME Handle = 0x80632050 + PEER_E_INVALID_CLASSIFIER Handle = 0x80632060 + PEER_E_INVALID_FRIENDLY_NAME Handle = 0x80632070 + PEER_E_INVALID_ROLE_PROPERTY Handle = 0x80632071 + PEER_E_INVALID_CLASSIFIER_PROPERTY Handle = 0x80632072 + PEER_E_INVALID_RECORD_EXPIRATION Handle = 0x80632080 + PEER_E_INVALID_CREDENTIAL_INFO Handle = 0x80632081 + PEER_E_INVALID_CREDENTIAL Handle = 0x80632082 + PEER_E_INVALID_RECORD_SIZE Handle = 0x80632083 + PEER_E_UNSUPPORTED_VERSION Handle = 0x80632090 + PEER_E_GROUP_NOT_READY Handle = 0x80632091 + PEER_E_GROUP_IN_USE Handle = 0x80632092 + PEER_E_INVALID_GROUP Handle = 0x80632093 + PEER_E_NO_MEMBERS_FOUND Handle = 0x80632094 + PEER_E_NO_MEMBER_CONNECTIONS Handle = 0x80632095 + PEER_E_UNABLE_TO_LISTEN Handle = 0x80632096 + PEER_E_IDENTITY_DELETED Handle = 0x806320A0 + PEER_E_SERVICE_NOT_AVAILABLE Handle = 0x806320A1 + PEER_E_CONTACT_NOT_FOUND Handle = 0x80636001 + PEER_S_GRAPH_DATA_CREATED Handle = 0x00630001 + PEER_S_NO_EVENT_DATA Handle = 0x00630002 + PEER_S_ALREADY_CONNECTED Handle = 0x00632000 + PEER_S_SUBSCRIPTION_EXISTS Handle = 0x00636000 + PEER_S_NO_CONNECTIVITY Handle = 0x00630005 + PEER_S_ALREADY_A_MEMBER Handle = 0x00630006 + PEER_E_CANNOT_CONVERT_PEER_NAME Handle = 0x80634001 + PEER_E_INVALID_PEER_HOST_NAME Handle = 0x80634002 + PEER_E_NO_MORE Handle = 0x80634003 + PEER_E_PNRP_DUPLICATE_PEER_NAME Handle = 0x80634005 + PEER_E_INVITE_CANCELLED Handle = 0x80637000 + PEER_E_INVITE_RESPONSE_NOT_AVAILABLE Handle = 0x80637001 + PEER_E_NOT_SIGNED_IN Handle = 0x80637003 + PEER_E_PRIVACY_DECLINED Handle = 0x80637004 + PEER_E_TIMEOUT Handle = 0x80637005 + PEER_E_INVALID_ADDRESS Handle = 0x80637007 + PEER_E_FW_EXCEPTION_DISABLED Handle = 0x80637008 + PEER_E_FW_BLOCKED_BY_POLICY Handle = 0x80637009 + PEER_E_FW_BLOCKED_BY_SHIELDS_UP Handle = 0x8063700A + PEER_E_FW_DECLINED Handle = 0x8063700B + UI_E_CREATE_FAILED Handle = 0x802A0001 + UI_E_SHUTDOWN_CALLED Handle = 0x802A0002 + UI_E_ILLEGAL_REENTRANCY Handle = 0x802A0003 + UI_E_OBJECT_SEALED Handle = 0x802A0004 + UI_E_VALUE_NOT_SET Handle = 0x802A0005 + UI_E_VALUE_NOT_DETERMINED Handle = 0x802A0006 + UI_E_INVALID_OUTPUT Handle = 0x802A0007 + UI_E_BOOLEAN_EXPECTED Handle = 0x802A0008 + UI_E_DIFFERENT_OWNER Handle = 0x802A0009 + UI_E_AMBIGUOUS_MATCH Handle = 0x802A000A + UI_E_FP_OVERFLOW Handle = 0x802A000B + UI_E_WRONG_THREAD Handle = 0x802A000C + UI_E_STORYBOARD_ACTIVE Handle = 0x802A0101 + UI_E_STORYBOARD_NOT_PLAYING Handle = 0x802A0102 + UI_E_START_KEYFRAME_AFTER_END Handle = 0x802A0103 + UI_E_END_KEYFRAME_NOT_DETERMINED Handle = 0x802A0104 + UI_E_LOOPS_OVERLAP Handle = 0x802A0105 + UI_E_TRANSITION_ALREADY_USED Handle = 0x802A0106 + UI_E_TRANSITION_NOT_IN_STORYBOARD Handle = 0x802A0107 + UI_E_TRANSITION_ECLIPSED Handle = 0x802A0108 + UI_E_TIME_BEFORE_LAST_UPDATE Handle = 0x802A0109 + UI_E_TIMER_CLIENT_ALREADY_CONNECTED Handle = 0x802A010A + UI_E_INVALID_DIMENSION Handle = 0x802A010B + UI_E_PRIMITIVE_OUT_OF_BOUNDS Handle = 0x802A010C + UI_E_WINDOW_CLOSED Handle = 0x802A0201 + E_BLUETOOTH_ATT_INVALID_HANDLE Handle = 0x80650001 + E_BLUETOOTH_ATT_READ_NOT_PERMITTED Handle = 0x80650002 + E_BLUETOOTH_ATT_WRITE_NOT_PERMITTED Handle = 0x80650003 + E_BLUETOOTH_ATT_INVALID_PDU Handle = 0x80650004 + E_BLUETOOTH_ATT_INSUFFICIENT_AUTHENTICATION Handle = 0x80650005 + E_BLUETOOTH_ATT_REQUEST_NOT_SUPPORTED Handle = 0x80650006 + E_BLUETOOTH_ATT_INVALID_OFFSET Handle = 0x80650007 + E_BLUETOOTH_ATT_INSUFFICIENT_AUTHORIZATION Handle = 0x80650008 + E_BLUETOOTH_ATT_PREPARE_QUEUE_FULL Handle = 0x80650009 + E_BLUETOOTH_ATT_ATTRIBUTE_NOT_FOUND Handle = 0x8065000A + E_BLUETOOTH_ATT_ATTRIBUTE_NOT_LONG Handle = 0x8065000B + E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION_KEY_SIZE Handle = 0x8065000C + E_BLUETOOTH_ATT_INVALID_ATTRIBUTE_VALUE_LENGTH Handle = 0x8065000D + E_BLUETOOTH_ATT_UNLIKELY Handle = 0x8065000E + E_BLUETOOTH_ATT_INSUFFICIENT_ENCRYPTION Handle = 0x8065000F + E_BLUETOOTH_ATT_UNSUPPORTED_GROUP_TYPE Handle = 0x80650010 + E_BLUETOOTH_ATT_INSUFFICIENT_RESOURCES Handle = 0x80650011 + E_BLUETOOTH_ATT_UNKNOWN_ERROR Handle = 0x80651000 + E_AUDIO_ENGINE_NODE_NOT_FOUND Handle = 0x80660001 + E_HDAUDIO_EMPTY_CONNECTION_LIST Handle = 0x80660002 + E_HDAUDIO_CONNECTION_LIST_NOT_SUPPORTED Handle = 0x80660003 + E_HDAUDIO_NO_LOGICAL_DEVICES_CREATED Handle = 0x80660004 + E_HDAUDIO_NULL_LINKED_LIST_ENTRY Handle = 0x80660005 + STATEREPOSITORY_E_CONCURRENCY_LOCKING_FAILURE Handle = 0x80670001 + STATEREPOSITORY_E_STATEMENT_INPROGRESS Handle = 0x80670002 + STATEREPOSITORY_E_CONFIGURATION_INVALID Handle = 0x80670003 + STATEREPOSITORY_E_UNKNOWN_SCHEMA_VERSION Handle = 0x80670004 + STATEREPOSITORY_ERROR_DICTIONARY_CORRUPTED Handle = 0x80670005 + STATEREPOSITORY_E_BLOCKED Handle = 0x80670006 + STATEREPOSITORY_E_BUSY_RETRY Handle = 0x80670007 + STATEREPOSITORY_E_BUSY_RECOVERY_RETRY Handle = 0x80670008 + STATEREPOSITORY_E_LOCKED_RETRY Handle = 0x80670009 + STATEREPOSITORY_E_LOCKED_SHAREDCACHE_RETRY Handle = 0x8067000A + STATEREPOSITORY_E_TRANSACTION_REQUIRED Handle = 0x8067000B + STATEREPOSITORY_E_BUSY_TIMEOUT_EXCEEDED Handle = 0x8067000C + STATEREPOSITORY_E_BUSY_RECOVERY_TIMEOUT_EXCEEDED Handle = 0x8067000D + STATEREPOSITORY_E_LOCKED_TIMEOUT_EXCEEDED Handle = 0x8067000E + STATEREPOSITORY_E_LOCKED_SHAREDCACHE_TIMEOUT_EXCEEDED Handle = 0x8067000F + STATEREPOSITORY_E_SERVICE_STOP_IN_PROGRESS Handle = 0x80670010 + STATEREPOSTORY_E_NESTED_TRANSACTION_NOT_SUPPORTED Handle = 0x80670011 + STATEREPOSITORY_ERROR_CACHE_CORRUPTED Handle = 0x80670012 + STATEREPOSITORY_TRANSACTION_CALLER_ID_CHANGED Handle = 0x00670013 + STATEREPOSITORY_TRANSACTION_IN_PROGRESS Handle = 0x00670014 + ERROR_SPACES_POOL_WAS_DELETED Handle = 0x00E70001 + ERROR_SPACES_FAULT_DOMAIN_TYPE_INVALID Handle = 0x80E70001 + ERROR_SPACES_INTERNAL_ERROR Handle = 0x80E70002 + ERROR_SPACES_RESILIENCY_TYPE_INVALID Handle = 0x80E70003 + ERROR_SPACES_DRIVE_SECTOR_SIZE_INVALID Handle = 0x80E70004 + ERROR_SPACES_DRIVE_REDUNDANCY_INVALID Handle = 0x80E70006 + ERROR_SPACES_NUMBER_OF_DATA_COPIES_INVALID Handle = 0x80E70007 + ERROR_SPACES_PARITY_LAYOUT_INVALID Handle = 0x80E70008 + ERROR_SPACES_INTERLEAVE_LENGTH_INVALID Handle = 0x80E70009 + ERROR_SPACES_NUMBER_OF_COLUMNS_INVALID Handle = 0x80E7000A + ERROR_SPACES_NOT_ENOUGH_DRIVES Handle = 0x80E7000B + ERROR_SPACES_EXTENDED_ERROR Handle = 0x80E7000C + ERROR_SPACES_PROVISIONING_TYPE_INVALID Handle = 0x80E7000D + ERROR_SPACES_ALLOCATION_SIZE_INVALID Handle = 0x80E7000E + ERROR_SPACES_ENCLOSURE_AWARE_INVALID Handle = 0x80E7000F + ERROR_SPACES_WRITE_CACHE_SIZE_INVALID Handle = 0x80E70010 + ERROR_SPACES_NUMBER_OF_GROUPS_INVALID Handle = 0x80E70011 + ERROR_SPACES_DRIVE_OPERATIONAL_STATE_INVALID Handle = 0x80E70012 + ERROR_SPACES_ENTRY_INCOMPLETE Handle = 0x80E70013 + ERROR_SPACES_ENTRY_INVALID Handle = 0x80E70014 + ERROR_VOLSNAP_BOOTFILE_NOT_VALID Handle = 0x80820001 + ERROR_VOLSNAP_ACTIVATION_TIMEOUT Handle = 0x80820002 + ERROR_TIERING_NOT_SUPPORTED_ON_VOLUME Handle = 0x80830001 + ERROR_TIERING_VOLUME_DISMOUNT_IN_PROGRESS Handle = 0x80830002 + ERROR_TIERING_STORAGE_TIER_NOT_FOUND Handle = 0x80830003 + ERROR_TIERING_INVALID_FILE_ID Handle = 0x80830004 + ERROR_TIERING_WRONG_CLUSTER_NODE Handle = 0x80830005 + ERROR_TIERING_ALREADY_PROCESSING Handle = 0x80830006 + ERROR_TIERING_CANNOT_PIN_OBJECT Handle = 0x80830007 + ERROR_TIERING_FILE_IS_NOT_PINNED Handle = 0x80830008 + ERROR_NOT_A_TIERED_VOLUME Handle = 0x80830009 + ERROR_ATTRIBUTE_NOT_PRESENT Handle = 0x8083000A + ERROR_SECCORE_INVALID_COMMAND Handle = 0xC0E80000 + ERROR_NO_APPLICABLE_APP_LICENSES_FOUND Handle = 0xC0EA0001 + ERROR_CLIP_LICENSE_NOT_FOUND Handle = 0xC0EA0002 + ERROR_CLIP_DEVICE_LICENSE_MISSING Handle = 0xC0EA0003 + ERROR_CLIP_LICENSE_INVALID_SIGNATURE Handle = 0xC0EA0004 + ERROR_CLIP_KEYHOLDER_LICENSE_MISSING_OR_INVALID Handle = 0xC0EA0005 + ERROR_CLIP_LICENSE_EXPIRED Handle = 0xC0EA0006 + ERROR_CLIP_LICENSE_SIGNED_BY_UNKNOWN_SOURCE Handle = 0xC0EA0007 + ERROR_CLIP_LICENSE_NOT_SIGNED Handle = 0xC0EA0008 + ERROR_CLIP_LICENSE_HARDWARE_ID_OUT_OF_TOLERANCE Handle = 0xC0EA0009 + ERROR_CLIP_LICENSE_DEVICE_ID_MISMATCH Handle = 0xC0EA000A + DXGI_STATUS_OCCLUDED Handle = 0x087A0001 + DXGI_STATUS_CLIPPED Handle = 0x087A0002 + DXGI_STATUS_NO_REDIRECTION Handle = 0x087A0004 + DXGI_STATUS_NO_DESKTOP_ACCESS Handle = 0x087A0005 + DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0x087A0006 + DXGI_STATUS_MODE_CHANGED Handle = 0x087A0007 + DXGI_STATUS_MODE_CHANGE_IN_PROGRESS Handle = 0x087A0008 + DXGI_ERROR_INVALID_CALL Handle = 0x887A0001 + DXGI_ERROR_NOT_FOUND Handle = 0x887A0002 + DXGI_ERROR_MORE_DATA Handle = 0x887A0003 + DXGI_ERROR_UNSUPPORTED Handle = 0x887A0004 + DXGI_ERROR_DEVICE_REMOVED Handle = 0x887A0005 + DXGI_ERROR_DEVICE_HUNG Handle = 0x887A0006 + DXGI_ERROR_DEVICE_RESET Handle = 0x887A0007 + DXGI_ERROR_WAS_STILL_DRAWING Handle = 0x887A000A + DXGI_ERROR_FRAME_STATISTICS_DISJOINT Handle = 0x887A000B + DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE Handle = 0x887A000C + DXGI_ERROR_DRIVER_INTERNAL_ERROR Handle = 0x887A0020 + DXGI_ERROR_NONEXCLUSIVE Handle = 0x887A0021 + DXGI_ERROR_NOT_CURRENTLY_AVAILABLE Handle = 0x887A0022 + DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED Handle = 0x887A0023 + DXGI_ERROR_REMOTE_OUTOFMEMORY Handle = 0x887A0024 + DXGI_ERROR_ACCESS_LOST Handle = 0x887A0026 + DXGI_ERROR_WAIT_TIMEOUT Handle = 0x887A0027 + DXGI_ERROR_SESSION_DISCONNECTED Handle = 0x887A0028 + DXGI_ERROR_RESTRICT_TO_OUTPUT_STALE Handle = 0x887A0029 + DXGI_ERROR_CANNOT_PROTECT_CONTENT Handle = 0x887A002A + DXGI_ERROR_ACCESS_DENIED Handle = 0x887A002B + DXGI_ERROR_NAME_ALREADY_EXISTS Handle = 0x887A002C + DXGI_ERROR_SDK_COMPONENT_MISSING Handle = 0x887A002D + DXGI_ERROR_NOT_CURRENT Handle = 0x887A002E + DXGI_ERROR_HW_PROTECTION_OUTOFMEMORY Handle = 0x887A0030 + DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION Handle = 0x887A0031 + DXGI_ERROR_NON_COMPOSITED_UI Handle = 0x887A0032 + DXGI_STATUS_UNOCCLUDED Handle = 0x087A0009 + DXGI_STATUS_DDA_WAS_STILL_DRAWING Handle = 0x087A000A + DXGI_ERROR_MODE_CHANGE_IN_PROGRESS Handle = 0x887A0025 + DXGI_STATUS_PRESENT_REQUIRED Handle = 0x087A002F + DXGI_ERROR_CACHE_CORRUPT Handle = 0x887A0033 + DXGI_ERROR_CACHE_FULL Handle = 0x887A0034 + DXGI_ERROR_CACHE_HASH_COLLISION Handle = 0x887A0035 + DXGI_ERROR_ALREADY_EXISTS Handle = 0x887A0036 + DXGI_DDI_ERR_WASSTILLDRAWING Handle = 0x887B0001 + DXGI_DDI_ERR_UNSUPPORTED Handle = 0x887B0002 + DXGI_DDI_ERR_NONEXCLUSIVE Handle = 0x887B0003 + D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS Handle = 0x88790001 + D3D10_ERROR_FILE_NOT_FOUND Handle = 0x88790002 + D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS Handle = 0x887C0001 + D3D11_ERROR_FILE_NOT_FOUND Handle = 0x887C0002 + D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS Handle = 0x887C0003 + D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD Handle = 0x887C0004 + D3D12_ERROR_ADAPTER_NOT_FOUND Handle = 0x887E0001 + D3D12_ERROR_DRIVER_VERSION_MISMATCH Handle = 0x887E0002 + D2DERR_WRONG_STATE Handle = 0x88990001 + D2DERR_NOT_INITIALIZED Handle = 0x88990002 + D2DERR_UNSUPPORTED_OPERATION Handle = 0x88990003 + D2DERR_SCANNER_FAILED Handle = 0x88990004 + D2DERR_SCREEN_ACCESS_DENIED Handle = 0x88990005 + D2DERR_DISPLAY_STATE_INVALID Handle = 0x88990006 + D2DERR_ZERO_VECTOR Handle = 0x88990007 + D2DERR_INTERNAL_ERROR Handle = 0x88990008 + D2DERR_DISPLAY_FORMAT_NOT_SUPPORTED Handle = 0x88990009 + D2DERR_INVALID_CALL Handle = 0x8899000A + D2DERR_NO_HARDWARE_DEVICE Handle = 0x8899000B + D2DERR_RECREATE_TARGET Handle = 0x8899000C + D2DERR_TOO_MANY_SHADER_ELEMENTS Handle = 0x8899000D + D2DERR_SHADER_COMPILE_FAILED Handle = 0x8899000E + D2DERR_MAX_TEXTURE_SIZE_EXCEEDED Handle = 0x8899000F + D2DERR_UNSUPPORTED_VERSION Handle = 0x88990010 + D2DERR_BAD_NUMBER Handle = 0x88990011 + D2DERR_WRONG_FACTORY Handle = 0x88990012 + D2DERR_LAYER_ALREADY_IN_USE Handle = 0x88990013 + D2DERR_POP_CALL_DID_NOT_MATCH_PUSH Handle = 0x88990014 + D2DERR_WRONG_RESOURCE_DOMAIN Handle = 0x88990015 + D2DERR_PUSH_POP_UNBALANCED Handle = 0x88990016 + D2DERR_RENDER_TARGET_HAS_LAYER_OR_CLIPRECT Handle = 0x88990017 + D2DERR_INCOMPATIBLE_BRUSH_TYPES Handle = 0x88990018 + D2DERR_WIN32_ERROR Handle = 0x88990019 + D2DERR_TARGET_NOT_GDI_COMPATIBLE Handle = 0x8899001A + D2DERR_TEXT_EFFECT_IS_WRONG_TYPE Handle = 0x8899001B + D2DERR_TEXT_RENDERER_NOT_RELEASED Handle = 0x8899001C + D2DERR_EXCEEDS_MAX_BITMAP_SIZE Handle = 0x8899001D + D2DERR_INVALID_GRAPH_CONFIGURATION Handle = 0x8899001E + D2DERR_INVALID_INTERNAL_GRAPH_CONFIGURATION Handle = 0x8899001F + D2DERR_CYCLIC_GRAPH Handle = 0x88990020 + D2DERR_BITMAP_CANNOT_DRAW Handle = 0x88990021 + D2DERR_OUTSTANDING_BITMAP_REFERENCES Handle = 0x88990022 + D2DERR_ORIGINAL_TARGET_NOT_BOUND Handle = 0x88990023 + D2DERR_INVALID_TARGET Handle = 0x88990024 + D2DERR_BITMAP_BOUND_AS_TARGET Handle = 0x88990025 + D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES Handle = 0x88990026 + D2DERR_INTERMEDIATE_TOO_LARGE Handle = 0x88990027 + D2DERR_EFFECT_IS_NOT_REGISTERED Handle = 0x88990028 + D2DERR_INVALID_PROPERTY Handle = 0x88990029 + D2DERR_NO_SUBPROPERTIES Handle = 0x8899002A + D2DERR_PRINT_JOB_CLOSED Handle = 0x8899002B + D2DERR_PRINT_FORMAT_NOT_SUPPORTED Handle = 0x8899002C + D2DERR_TOO_MANY_TRANSFORM_INPUTS Handle = 0x8899002D + D2DERR_INVALID_GLYPH_IMAGE Handle = 0x8899002E + DWRITE_E_FILEFORMAT Handle = 0x88985000 + DWRITE_E_UNEXPECTED Handle = 0x88985001 + DWRITE_E_NOFONT Handle = 0x88985002 + DWRITE_E_FILENOTFOUND Handle = 0x88985003 + DWRITE_E_FILEACCESS Handle = 0x88985004 + DWRITE_E_FONTCOLLECTIONOBSOLETE Handle = 0x88985005 + DWRITE_E_ALREADYREGISTERED Handle = 0x88985006 + DWRITE_E_CACHEFORMAT Handle = 0x88985007 + DWRITE_E_CACHEVERSION Handle = 0x88985008 + DWRITE_E_UNSUPPORTEDOPERATION Handle = 0x88985009 + DWRITE_E_TEXTRENDERERINCOMPATIBLE Handle = 0x8898500A + DWRITE_E_FLOWDIRECTIONCONFLICTS Handle = 0x8898500B + DWRITE_E_NOCOLOR Handle = 0x8898500C + DWRITE_E_REMOTEFONT Handle = 0x8898500D + DWRITE_E_DOWNLOADCANCELLED Handle = 0x8898500E + DWRITE_E_DOWNLOADFAILED Handle = 0x8898500F + DWRITE_E_TOOMANYDOWNLOADS Handle = 0x88985010 + WINCODEC_ERR_WRONGSTATE Handle = 0x88982F04 + WINCODEC_ERR_VALUEOUTOFRANGE Handle = 0x88982F05 + WINCODEC_ERR_UNKNOWNIMAGEFORMAT Handle = 0x88982F07 + WINCODEC_ERR_UNSUPPORTEDVERSION Handle = 0x88982F0B + WINCODEC_ERR_NOTINITIALIZED Handle = 0x88982F0C + WINCODEC_ERR_ALREADYLOCKED Handle = 0x88982F0D + WINCODEC_ERR_PROPERTYNOTFOUND Handle = 0x88982F40 + WINCODEC_ERR_PROPERTYNOTSUPPORTED Handle = 0x88982F41 + WINCODEC_ERR_PROPERTYSIZE Handle = 0x88982F42 + WINCODEC_ERR_CODECPRESENT Handle = 0x88982F43 + WINCODEC_ERR_CODECNOTHUMBNAIL Handle = 0x88982F44 + WINCODEC_ERR_PALETTEUNAVAILABLE Handle = 0x88982F45 + WINCODEC_ERR_CODECTOOMANYSCANLINES Handle = 0x88982F46 + WINCODEC_ERR_INTERNALERROR Handle = 0x88982F48 + WINCODEC_ERR_SOURCERECTDOESNOTMATCHDIMENSIONS Handle = 0x88982F49 + WINCODEC_ERR_COMPONENTNOTFOUND Handle = 0x88982F50 + WINCODEC_ERR_IMAGESIZEOUTOFRANGE Handle = 0x88982F51 + WINCODEC_ERR_TOOMUCHMETADATA Handle = 0x88982F52 + WINCODEC_ERR_BADIMAGE Handle = 0x88982F60 + WINCODEC_ERR_BADHEADER Handle = 0x88982F61 + WINCODEC_ERR_FRAMEMISSING Handle = 0x88982F62 + WINCODEC_ERR_BADMETADATAHEADER Handle = 0x88982F63 + WINCODEC_ERR_BADSTREAMDATA Handle = 0x88982F70 + WINCODEC_ERR_STREAMWRITE Handle = 0x88982F71 + WINCODEC_ERR_STREAMREAD Handle = 0x88982F72 + WINCODEC_ERR_STREAMNOTAVAILABLE Handle = 0x88982F73 + WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT Handle = 0x88982F80 + WINCODEC_ERR_UNSUPPORTEDOPERATION Handle = 0x88982F81 + WINCODEC_ERR_INVALIDREGISTRATION Handle = 0x88982F8A + WINCODEC_ERR_COMPONENTINITIALIZEFAILURE Handle = 0x88982F8B + WINCODEC_ERR_INSUFFICIENTBUFFER Handle = 0x88982F8C + WINCODEC_ERR_DUPLICATEMETADATAPRESENT Handle = 0x88982F8D + WINCODEC_ERR_PROPERTYUNEXPECTEDTYPE Handle = 0x88982F8E + WINCODEC_ERR_UNEXPECTEDSIZE Handle = 0x88982F8F + WINCODEC_ERR_INVALIDQUERYREQUEST Handle = 0x88982F90 + WINCODEC_ERR_UNEXPECTEDMETADATATYPE Handle = 0x88982F91 + WINCODEC_ERR_REQUESTONLYVALIDATMETADATAROOT Handle = 0x88982F92 + WINCODEC_ERR_INVALIDQUERYCHARACTER Handle = 0x88982F93 + WINCODEC_ERR_WIN32ERROR Handle = 0x88982F94 + WINCODEC_ERR_INVALIDPROGRESSIVELEVEL Handle = 0x88982F95 + WINCODEC_ERR_INVALIDJPEGSCANINDEX Handle = 0x88982F96 + MILERR_OBJECTBUSY Handle = 0x88980001 + MILERR_INSUFFICIENTBUFFER Handle = 0x88980002 + MILERR_WIN32ERROR Handle = 0x88980003 + MILERR_SCANNER_FAILED Handle = 0x88980004 + MILERR_SCREENACCESSDENIED Handle = 0x88980005 + MILERR_DISPLAYSTATEINVALID Handle = 0x88980006 + MILERR_NONINVERTIBLEMATRIX Handle = 0x88980007 + MILERR_ZEROVECTOR Handle = 0x88980008 + MILERR_TERMINATED Handle = 0x88980009 + MILERR_BADNUMBER Handle = 0x8898000A + MILERR_INTERNALERROR Handle = 0x88980080 + MILERR_DISPLAYFORMATNOTSUPPORTED Handle = 0x88980084 + MILERR_INVALIDCALL Handle = 0x88980085 + MILERR_ALREADYLOCKED Handle = 0x88980086 + MILERR_NOTLOCKED Handle = 0x88980087 + MILERR_DEVICECANNOTRENDERTEXT Handle = 0x88980088 + MILERR_GLYPHBITMAPMISSED Handle = 0x88980089 + MILERR_MALFORMEDGLYPHCACHE Handle = 0x8898008A + MILERR_GENERIC_IGNORE Handle = 0x8898008B + MILERR_MALFORMED_GUIDELINE_DATA Handle = 0x8898008C + MILERR_NO_HARDWARE_DEVICE Handle = 0x8898008D + MILERR_NEED_RECREATE_AND_PRESENT Handle = 0x8898008E + MILERR_ALREADY_INITIALIZED Handle = 0x8898008F + MILERR_MISMATCHED_SIZE Handle = 0x88980090 + MILERR_NO_REDIRECTION_SURFACE_AVAILABLE Handle = 0x88980091 + MILERR_REMOTING_NOT_SUPPORTED Handle = 0x88980092 + MILERR_QUEUED_PRESENT_NOT_SUPPORTED Handle = 0x88980093 + MILERR_NOT_QUEUING_PRESENTS Handle = 0x88980094 + MILERR_NO_REDIRECTION_SURFACE_RETRY_LATER Handle = 0x88980095 + MILERR_TOOMANYSHADERELEMNTS Handle = 0x88980096 + MILERR_MROW_READLOCK_FAILED Handle = 0x88980097 + MILERR_MROW_UPDATE_FAILED Handle = 0x88980098 + MILERR_SHADER_COMPILE_FAILED Handle = 0x88980099 + MILERR_MAX_TEXTURE_SIZE_EXCEEDED Handle = 0x8898009A + MILERR_QPC_TIME_WENT_BACKWARD Handle = 0x8898009B + MILERR_DXGI_ENUMERATION_OUT_OF_SYNC Handle = 0x8898009D + MILERR_ADAPTER_NOT_FOUND Handle = 0x8898009E + MILERR_COLORSPACE_NOT_SUPPORTED Handle = 0x8898009F + MILERR_PREFILTER_NOT_SUPPORTED Handle = 0x889800A0 + MILERR_DISPLAYID_ACCESS_DENIED Handle = 0x889800A1 + UCEERR_INVALIDPACKETHEADER Handle = 0x88980400 + UCEERR_UNKNOWNPACKET Handle = 0x88980401 + UCEERR_ILLEGALPACKET Handle = 0x88980402 + UCEERR_MALFORMEDPACKET Handle = 0x88980403 + UCEERR_ILLEGALHANDLE Handle = 0x88980404 + UCEERR_HANDLELOOKUPFAILED Handle = 0x88980405 + UCEERR_RENDERTHREADFAILURE Handle = 0x88980406 + UCEERR_CTXSTACKFRSTTARGETNULL Handle = 0x88980407 + UCEERR_CONNECTIONIDLOOKUPFAILED Handle = 0x88980408 + UCEERR_BLOCKSFULL Handle = 0x88980409 + UCEERR_MEMORYFAILURE Handle = 0x8898040A + UCEERR_PACKETRECORDOUTOFRANGE Handle = 0x8898040B + UCEERR_ILLEGALRECORDTYPE Handle = 0x8898040C + UCEERR_OUTOFHANDLES Handle = 0x8898040D + UCEERR_UNCHANGABLE_UPDATE_ATTEMPTED Handle = 0x8898040E + UCEERR_NO_MULTIPLE_WORKER_THREADS Handle = 0x8898040F + UCEERR_REMOTINGNOTSUPPORTED Handle = 0x88980410 + UCEERR_MISSINGENDCOMMAND Handle = 0x88980411 + UCEERR_MISSINGBEGINCOMMAND Handle = 0x88980412 + UCEERR_CHANNELSYNCTIMEDOUT Handle = 0x88980413 + UCEERR_CHANNELSYNCABANDONED Handle = 0x88980414 + UCEERR_UNSUPPORTEDTRANSPORTVERSION Handle = 0x88980415 + UCEERR_TRANSPORTUNAVAILABLE Handle = 0x88980416 + UCEERR_FEEDBACK_UNSUPPORTED Handle = 0x88980417 + UCEERR_COMMANDTRANSPORTDENIED Handle = 0x88980418 + UCEERR_GRAPHICSSTREAMUNAVAILABLE Handle = 0x88980419 + UCEERR_GRAPHICSSTREAMALREADYOPEN Handle = 0x88980420 + UCEERR_TRANSPORTDISCONNECTED Handle = 0x88980421 + UCEERR_TRANSPORTOVERLOADED Handle = 0x88980422 + UCEERR_PARTITION_ZOMBIED Handle = 0x88980423 + MILAVERR_NOCLOCK Handle = 0x88980500 + MILAVERR_NOMEDIATYPE Handle = 0x88980501 + MILAVERR_NOVIDEOMIXER Handle = 0x88980502 + MILAVERR_NOVIDEOPRESENTER Handle = 0x88980503 + MILAVERR_NOREADYFRAMES Handle = 0x88980504 + MILAVERR_MODULENOTLOADED Handle = 0x88980505 + MILAVERR_WMPFACTORYNOTREGISTERED Handle = 0x88980506 + MILAVERR_INVALIDWMPVERSION Handle = 0x88980507 + MILAVERR_INSUFFICIENTVIDEORESOURCES Handle = 0x88980508 + MILAVERR_VIDEOACCELERATIONNOTAVAILABLE Handle = 0x88980509 + MILAVERR_REQUESTEDTEXTURETOOBIG Handle = 0x8898050A + MILAVERR_SEEKFAILED Handle = 0x8898050B + MILAVERR_UNEXPECTEDWMPFAILURE Handle = 0x8898050C + MILAVERR_MEDIAPLAYERCLOSED Handle = 0x8898050D + MILAVERR_UNKNOWNHARDWAREERROR Handle = 0x8898050E + MILEFFECTSERR_UNKNOWNPROPERTY Handle = 0x8898060E + MILEFFECTSERR_EFFECTNOTPARTOFGROUP Handle = 0x8898060F + MILEFFECTSERR_NOINPUTSOURCEATTACHED Handle = 0x88980610 + MILEFFECTSERR_CONNECTORNOTCONNECTED Handle = 0x88980611 + MILEFFECTSERR_CONNECTORNOTASSOCIATEDWITHEFFECT Handle = 0x88980612 + MILEFFECTSERR_RESERVED Handle = 0x88980613 + MILEFFECTSERR_CYCLEDETECTED Handle = 0x88980614 + MILEFFECTSERR_EFFECTINMORETHANONEGRAPH Handle = 0x88980615 + MILEFFECTSERR_EFFECTALREADYINAGRAPH Handle = 0x88980616 + MILEFFECTSERR_EFFECTHASNOCHILDREN Handle = 0x88980617 + MILEFFECTSERR_ALREADYATTACHEDTOLISTENER Handle = 0x88980618 + MILEFFECTSERR_NOTAFFINETRANSFORM Handle = 0x88980619 + MILEFFECTSERR_EMPTYBOUNDS Handle = 0x8898061A + MILEFFECTSERR_OUTPUTSIZETOOLARGE Handle = 0x8898061B + DWMERR_STATE_TRANSITION_FAILED Handle = 0x88980700 + DWMERR_THEME_FAILED Handle = 0x88980701 + DWMERR_CATASTROPHIC_FAILURE Handle = 0x88980702 + DCOMPOSITION_ERROR_WINDOW_ALREADY_COMPOSED Handle = 0x88980800 + DCOMPOSITION_ERROR_SURFACE_BEING_RENDERED Handle = 0x88980801 + DCOMPOSITION_ERROR_SURFACE_NOT_BEING_RENDERED Handle = 0x88980802 + ONL_E_INVALID_AUTHENTICATION_TARGET Handle = 0x80860001 + ONL_E_ACCESS_DENIED_BY_TOU Handle = 0x80860002 + ONL_E_INVALID_APPLICATION Handle = 0x80860003 + ONL_E_PASSWORD_UPDATE_REQUIRED Handle = 0x80860004 + ONL_E_ACCOUNT_UPDATE_REQUIRED Handle = 0x80860005 + ONL_E_FORCESIGNIN Handle = 0x80860006 + ONL_E_ACCOUNT_LOCKED Handle = 0x80860007 + ONL_E_PARENTAL_CONSENT_REQUIRED Handle = 0x80860008 + ONL_E_EMAIL_VERIFICATION_REQUIRED Handle = 0x80860009 + ONL_E_ACCOUNT_SUSPENDED_COMPROIMISE Handle = 0x8086000A + ONL_E_ACCOUNT_SUSPENDED_ABUSE Handle = 0x8086000B + ONL_E_ACTION_REQUIRED Handle = 0x8086000C + ONL_CONNECTION_COUNT_LIMIT Handle = 0x8086000D + ONL_E_CONNECTED_ACCOUNT_CAN_NOT_SIGNOUT Handle = 0x8086000E + ONL_E_USER_AUTHENTICATION_REQUIRED Handle = 0x8086000F + ONL_E_REQUEST_THROTTLED Handle = 0x80860010 + FA_E_MAX_PERSISTED_ITEMS_REACHED Handle = 0x80270220 + FA_E_HOMEGROUP_NOT_AVAILABLE Handle = 0x80270222 + E_MONITOR_RESOLUTION_TOO_LOW Handle = 0x80270250 + E_ELEVATED_ACTIVATION_NOT_SUPPORTED Handle = 0x80270251 + E_UAC_DISABLED Handle = 0x80270252 + E_FULL_ADMIN_NOT_SUPPORTED Handle = 0x80270253 + E_APPLICATION_NOT_REGISTERED Handle = 0x80270254 + E_MULTIPLE_EXTENSIONS_FOR_APPLICATION Handle = 0x80270255 + E_MULTIPLE_PACKAGES_FOR_FAMILY Handle = 0x80270256 + E_APPLICATION_MANAGER_NOT_RUNNING Handle = 0x80270257 + S_STORE_LAUNCHED_FOR_REMEDIATION Handle = 0x00270258 + S_APPLICATION_ACTIVATION_ERROR_HANDLED_BY_DIALOG Handle = 0x00270259 + E_APPLICATION_ACTIVATION_TIMED_OUT Handle = 0x8027025A + E_APPLICATION_ACTIVATION_EXEC_FAILURE Handle = 0x8027025B + E_APPLICATION_TEMPORARY_LICENSE_ERROR Handle = 0x8027025C + E_APPLICATION_TRIAL_LICENSE_EXPIRED Handle = 0x8027025D + E_SKYDRIVE_ROOT_TARGET_FILE_SYSTEM_NOT_SUPPORTED Handle = 0x80270260 + E_SKYDRIVE_ROOT_TARGET_OVERLAP Handle = 0x80270261 + E_SKYDRIVE_ROOT_TARGET_CANNOT_INDEX Handle = 0x80270262 + E_SKYDRIVE_FILE_NOT_UPLOADED Handle = 0x80270263 + E_SKYDRIVE_UPDATE_AVAILABILITY_FAIL Handle = 0x80270264 + E_SKYDRIVE_ROOT_TARGET_VOLUME_ROOT_NOT_SUPPORTED Handle = 0x80270265 + E_SYNCENGINE_FILE_SIZE_OVER_LIMIT Handle = 0x8802B001 + E_SYNCENGINE_FILE_SIZE_EXCEEDS_REMAINING_QUOTA Handle = 0x8802B002 + E_SYNCENGINE_UNSUPPORTED_FILE_NAME Handle = 0x8802B003 + E_SYNCENGINE_FOLDER_ITEM_COUNT_LIMIT_EXCEEDED Handle = 0x8802B004 + E_SYNCENGINE_FILE_SYNC_PARTNER_ERROR Handle = 0x8802B005 + E_SYNCENGINE_SYNC_PAUSED_BY_SERVICE Handle = 0x8802B006 + E_SYNCENGINE_FILE_IDENTIFIER_UNKNOWN Handle = 0x8802C002 + E_SYNCENGINE_SERVICE_AUTHENTICATION_FAILED Handle = 0x8802C003 + E_SYNCENGINE_UNKNOWN_SERVICE_ERROR Handle = 0x8802C004 + E_SYNCENGINE_SERVICE_RETURNED_UNEXPECTED_SIZE Handle = 0x8802C005 + E_SYNCENGINE_REQUEST_BLOCKED_BY_SERVICE Handle = 0x8802C006 + E_SYNCENGINE_REQUEST_BLOCKED_DUE_TO_CLIENT_ERROR Handle = 0x8802C007 + E_SYNCENGINE_FOLDER_INACCESSIBLE Handle = 0x8802D001 + E_SYNCENGINE_UNSUPPORTED_FOLDER_NAME Handle = 0x8802D002 + E_SYNCENGINE_UNSUPPORTED_MARKET Handle = 0x8802D003 + E_SYNCENGINE_PATH_LENGTH_LIMIT_EXCEEDED Handle = 0x8802D004 + E_SYNCENGINE_REMOTE_PATH_LENGTH_LIMIT_EXCEEDED Handle = 0x8802D005 + E_SYNCENGINE_CLIENT_UPDATE_NEEDED Handle = 0x8802D006 + E_SYNCENGINE_PROXY_AUTHENTICATION_REQUIRED Handle = 0x8802D007 + E_SYNCENGINE_STORAGE_SERVICE_PROVISIONING_FAILED Handle = 0x8802D008 + E_SYNCENGINE_UNSUPPORTED_REPARSE_POINT Handle = 0x8802D009 + E_SYNCENGINE_STORAGE_SERVICE_BLOCKED Handle = 0x8802D00A + E_SYNCENGINE_FOLDER_IN_REDIRECTION Handle = 0x8802D00B + EAS_E_POLICY_NOT_MANAGED_BY_OS Handle = 0x80550001 + EAS_E_POLICY_COMPLIANT_WITH_ACTIONS Handle = 0x80550002 + EAS_E_REQUESTED_POLICY_NOT_ENFORCEABLE Handle = 0x80550003 + EAS_E_CURRENT_USER_HAS_BLANK_PASSWORD Handle = 0x80550004 + EAS_E_REQUESTED_POLICY_PASSWORD_EXPIRATION_INCOMPATIBLE Handle = 0x80550005 + EAS_E_USER_CANNOT_CHANGE_PASSWORD Handle = 0x80550006 + EAS_E_ADMINS_HAVE_BLANK_PASSWORD Handle = 0x80550007 + EAS_E_ADMINS_CANNOT_CHANGE_PASSWORD Handle = 0x80550008 + EAS_E_LOCAL_CONTROLLED_USERS_CANNOT_CHANGE_PASSWORD Handle = 0x80550009 + EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CONNECTED_ADMINS Handle = 0x8055000A + EAS_E_CONNECTED_ADMINS_NEED_TO_CHANGE_PASSWORD Handle = 0x8055000B + EAS_E_PASSWORD_POLICY_NOT_ENFORCEABLE_FOR_CURRENT_CONNECTED_USER Handle = 0x8055000C + EAS_E_CURRENT_CONNECTED_USER_NEED_TO_CHANGE_PASSWORD Handle = 0x8055000D + WEB_E_UNSUPPORTED_FORMAT Handle = 0x83750001 + WEB_E_INVALID_XML Handle = 0x83750002 + WEB_E_MISSING_REQUIRED_ELEMENT Handle = 0x83750003 + WEB_E_MISSING_REQUIRED_ATTRIBUTE Handle = 0x83750004 + WEB_E_UNEXPECTED_CONTENT Handle = 0x83750005 + WEB_E_RESOURCE_TOO_LARGE Handle = 0x83750006 + WEB_E_INVALID_JSON_STRING Handle = 0x83750007 + WEB_E_INVALID_JSON_NUMBER Handle = 0x83750008 + WEB_E_JSON_VALUE_NOT_FOUND Handle = 0x83750009 + HTTP_E_STATUS_UNEXPECTED Handle = 0x80190001 + HTTP_E_STATUS_UNEXPECTED_REDIRECTION Handle = 0x80190003 + HTTP_E_STATUS_UNEXPECTED_CLIENT_ERROR Handle = 0x80190004 + HTTP_E_STATUS_UNEXPECTED_SERVER_ERROR Handle = 0x80190005 + HTTP_E_STATUS_AMBIGUOUS Handle = 0x8019012C + HTTP_E_STATUS_MOVED Handle = 0x8019012D + HTTP_E_STATUS_REDIRECT Handle = 0x8019012E + HTTP_E_STATUS_REDIRECT_METHOD Handle = 0x8019012F + HTTP_E_STATUS_NOT_MODIFIED Handle = 0x80190130 + HTTP_E_STATUS_USE_PROXY Handle = 0x80190131 + HTTP_E_STATUS_REDIRECT_KEEP_VERB Handle = 0x80190133 + HTTP_E_STATUS_BAD_REQUEST Handle = 0x80190190 + HTTP_E_STATUS_DENIED Handle = 0x80190191 + HTTP_E_STATUS_PAYMENT_REQ Handle = 0x80190192 + HTTP_E_STATUS_FORBIDDEN Handle = 0x80190193 + HTTP_E_STATUS_NOT_FOUND Handle = 0x80190194 + HTTP_E_STATUS_BAD_METHOD Handle = 0x80190195 + HTTP_E_STATUS_NONE_ACCEPTABLE Handle = 0x80190196 + HTTP_E_STATUS_PROXY_AUTH_REQ Handle = 0x80190197 + HTTP_E_STATUS_REQUEST_TIMEOUT Handle = 0x80190198 + HTTP_E_STATUS_CONFLICT Handle = 0x80190199 + HTTP_E_STATUS_GONE Handle = 0x8019019A + HTTP_E_STATUS_LENGTH_REQUIRED Handle = 0x8019019B + HTTP_E_STATUS_PRECOND_FAILED Handle = 0x8019019C + HTTP_E_STATUS_REQUEST_TOO_LARGE Handle = 0x8019019D + HTTP_E_STATUS_URI_TOO_LONG Handle = 0x8019019E + HTTP_E_STATUS_UNSUPPORTED_MEDIA Handle = 0x8019019F + HTTP_E_STATUS_RANGE_NOT_SATISFIABLE Handle = 0x801901A0 + HTTP_E_STATUS_EXPECTATION_FAILED Handle = 0x801901A1 + HTTP_E_STATUS_SERVER_ERROR Handle = 0x801901F4 + HTTP_E_STATUS_NOT_SUPPORTED Handle = 0x801901F5 + HTTP_E_STATUS_BAD_GATEWAY Handle = 0x801901F6 + HTTP_E_STATUS_SERVICE_UNAVAIL Handle = 0x801901F7 + HTTP_E_STATUS_GATEWAY_TIMEOUT Handle = 0x801901F8 + HTTP_E_STATUS_VERSION_NOT_SUP Handle = 0x801901F9 + E_INVALID_PROTOCOL_OPERATION Handle = 0x83760001 + E_INVALID_PROTOCOL_FORMAT Handle = 0x83760002 + E_PROTOCOL_EXTENSIONS_NOT_SUPPORTED Handle = 0x83760003 + E_SUBPROTOCOL_NOT_SUPPORTED Handle = 0x83760004 + E_PROTOCOL_VERSION_NOT_SUPPORTED Handle = 0x83760005 + INPUT_E_OUT_OF_ORDER Handle = 0x80400000 + INPUT_E_REENTRANCY Handle = 0x80400001 + INPUT_E_MULTIMODAL Handle = 0x80400002 + INPUT_E_PACKET Handle = 0x80400003 + INPUT_E_FRAME Handle = 0x80400004 + INPUT_E_HISTORY Handle = 0x80400005 + INPUT_E_DEVICE_INFO Handle = 0x80400006 + INPUT_E_TRANSFORM Handle = 0x80400007 + INPUT_E_DEVICE_PROPERTY Handle = 0x80400008 + INET_E_INVALID_URL Handle = 0x800C0002 + INET_E_NO_SESSION Handle = 0x800C0003 + INET_E_CANNOT_CONNECT Handle = 0x800C0004 + INET_E_RESOURCE_NOT_FOUND Handle = 0x800C0005 + INET_E_OBJECT_NOT_FOUND Handle = 0x800C0006 + INET_E_DATA_NOT_AVAILABLE Handle = 0x800C0007 + INET_E_DOWNLOAD_FAILURE Handle = 0x800C0008 + INET_E_AUTHENTICATION_REQUIRED Handle = 0x800C0009 + INET_E_NO_VALID_MEDIA Handle = 0x800C000A + INET_E_CONNECTION_TIMEOUT Handle = 0x800C000B + INET_E_INVALID_REQUEST Handle = 0x800C000C + INET_E_UNKNOWN_PROTOCOL Handle = 0x800C000D + INET_E_SECURITY_PROBLEM Handle = 0x800C000E + INET_E_CANNOT_LOAD_DATA Handle = 0x800C000F + INET_E_CANNOT_INSTANTIATE_OBJECT Handle = 0x800C0010 + INET_E_INVALID_CERTIFICATE Handle = 0x800C0019 + INET_E_REDIRECT_FAILED Handle = 0x800C0014 + INET_E_REDIRECT_TO_DIR Handle = 0x800C0015 + ERROR_DBG_CREATE_PROCESS_FAILURE_LOCKDOWN Handle = 0x80B00001 + ERROR_DBG_ATTACH_PROCESS_FAILURE_LOCKDOWN Handle = 0x80B00002 + ERROR_DBG_CONNECT_SERVER_FAILURE_LOCKDOWN Handle = 0x80B00003 + ERROR_DBG_START_SERVER_FAILURE_LOCKDOWN Handle = 0x80B00004 + ERROR_IO_PREEMPTED Handle = 0x89010001 + JSCRIPT_E_CANTEXECUTE Handle = 0x89020001 + WEP_E_NOT_PROVISIONED_ON_ALL_VOLUMES Handle = 0x88010001 + WEP_E_FIXED_DATA_NOT_SUPPORTED Handle = 0x88010002 + WEP_E_HARDWARE_NOT_COMPLIANT Handle = 0x88010003 + WEP_E_LOCK_NOT_CONFIGURED Handle = 0x88010004 + WEP_E_PROTECTION_SUSPENDED Handle = 0x88010005 + WEP_E_NO_LICENSE Handle = 0x88010006 + WEP_E_OS_NOT_PROTECTED Handle = 0x88010007 + WEP_E_UNEXPECTED_FAIL Handle = 0x88010008 + WEP_E_BUFFER_TOO_LARGE Handle = 0x88010009 + ERROR_SVHDX_ERROR_STORED Handle = 0xC05C0000 + ERROR_SVHDX_ERROR_NOT_AVAILABLE Handle = 0xC05CFF00 + ERROR_SVHDX_UNIT_ATTENTION_AVAILABLE Handle = 0xC05CFF01 + ERROR_SVHDX_UNIT_ATTENTION_CAPACITY_DATA_CHANGED Handle = 0xC05CFF02 + ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_PREEMPTED Handle = 0xC05CFF03 + ERROR_SVHDX_UNIT_ATTENTION_RESERVATIONS_RELEASED Handle = 0xC05CFF04 + ERROR_SVHDX_UNIT_ATTENTION_REGISTRATIONS_PREEMPTED Handle = 0xC05CFF05 + ERROR_SVHDX_UNIT_ATTENTION_OPERATING_DEFINITION_CHANGED Handle = 0xC05CFF06 + ERROR_SVHDX_RESERVATION_CONFLICT Handle = 0xC05CFF07 + ERROR_SVHDX_WRONG_FILE_TYPE Handle = 0xC05CFF08 + ERROR_SVHDX_VERSION_MISMATCH Handle = 0xC05CFF09 + ERROR_VHD_SHARED Handle = 0xC05CFF0A + ERROR_SVHDX_NO_INITIATOR Handle = 0xC05CFF0B + ERROR_VHDSET_BACKING_STORAGE_NOT_FOUND Handle = 0xC05CFF0C + ERROR_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP Handle = 0xC05D0000 + ERROR_SMB_BAD_CLUSTER_DIALECT Handle = 0xC05D0001 + WININET_E_OUT_OF_HANDLES Handle = 0x80072EE1 + WININET_E_TIMEOUT Handle = 0x80072EE2 + WININET_E_EXTENDED_ERROR Handle = 0x80072EE3 + WININET_E_INTERNAL_ERROR Handle = 0x80072EE4 + WININET_E_INVALID_URL Handle = 0x80072EE5 + WININET_E_UNRECOGNIZED_SCHEME Handle = 0x80072EE6 + WININET_E_NAME_NOT_RESOLVED Handle = 0x80072EE7 + WININET_E_PROTOCOL_NOT_FOUND Handle = 0x80072EE8 + WININET_E_INVALID_OPTION Handle = 0x80072EE9 + WININET_E_BAD_OPTION_LENGTH Handle = 0x80072EEA + WININET_E_OPTION_NOT_SETTABLE Handle = 0x80072EEB + WININET_E_SHUTDOWN Handle = 0x80072EEC + WININET_E_INCORRECT_USER_NAME Handle = 0x80072EED + WININET_E_INCORRECT_PASSWORD Handle = 0x80072EEE + WININET_E_LOGIN_FAILURE Handle = 0x80072EEF + WININET_E_INVALID_OPERATION Handle = 0x80072EF0 + WININET_E_OPERATION_CANCELLED Handle = 0x80072EF1 + WININET_E_INCORRECT_HANDLE_TYPE Handle = 0x80072EF2 + WININET_E_INCORRECT_HANDLE_STATE Handle = 0x80072EF3 + WININET_E_NOT_PROXY_REQUEST Handle = 0x80072EF4 + WININET_E_REGISTRY_VALUE_NOT_FOUND Handle = 0x80072EF5 + WININET_E_BAD_REGISTRY_PARAMETER Handle = 0x80072EF6 + WININET_E_NO_DIRECT_ACCESS Handle = 0x80072EF7 + WININET_E_NO_CONTEXT Handle = 0x80072EF8 + WININET_E_NO_CALLBACK Handle = 0x80072EF9 + WININET_E_REQUEST_PENDING Handle = 0x80072EFA + WININET_E_INCORRECT_FORMAT Handle = 0x80072EFB + WININET_E_ITEM_NOT_FOUND Handle = 0x80072EFC + WININET_E_CANNOT_CONNECT Handle = 0x80072EFD + WININET_E_CONNECTION_ABORTED Handle = 0x80072EFE + WININET_E_CONNECTION_RESET Handle = 0x80072EFF + WININET_E_FORCE_RETRY Handle = 0x80072F00 + WININET_E_INVALID_PROXY_REQUEST Handle = 0x80072F01 + WININET_E_NEED_UI Handle = 0x80072F02 + WININET_E_HANDLE_EXISTS Handle = 0x80072F04 + WININET_E_SEC_CERT_DATE_INVALID Handle = 0x80072F05 + WININET_E_SEC_CERT_CN_INVALID Handle = 0x80072F06 + WININET_E_HTTP_TO_HTTPS_ON_REDIR Handle = 0x80072F07 + WININET_E_HTTPS_TO_HTTP_ON_REDIR Handle = 0x80072F08 + WININET_E_MIXED_SECURITY Handle = 0x80072F09 + WININET_E_CHG_POST_IS_NON_SECURE Handle = 0x80072F0A + WININET_E_POST_IS_NON_SECURE Handle = 0x80072F0B + WININET_E_CLIENT_AUTH_CERT_NEEDED Handle = 0x80072F0C + WININET_E_INVALID_CA Handle = 0x80072F0D + WININET_E_CLIENT_AUTH_NOT_SETUP Handle = 0x80072F0E + WININET_E_ASYNC_THREAD_FAILED Handle = 0x80072F0F + WININET_E_REDIRECT_SCHEME_CHANGE Handle = 0x80072F10 + WININET_E_DIALOG_PENDING Handle = 0x80072F11 + WININET_E_RETRY_DIALOG Handle = 0x80072F12 + WININET_E_NO_NEW_CONTAINERS Handle = 0x80072F13 + WININET_E_HTTPS_HTTP_SUBMIT_REDIR Handle = 0x80072F14 + WININET_E_SEC_CERT_ERRORS Handle = 0x80072F17 + WININET_E_SEC_CERT_REV_FAILED Handle = 0x80072F19 + WININET_E_HEADER_NOT_FOUND Handle = 0x80072F76 + WININET_E_DOWNLEVEL_SERVER Handle = 0x80072F77 + WININET_E_INVALID_SERVER_RESPONSE Handle = 0x80072F78 + WININET_E_INVALID_HEADER Handle = 0x80072F79 + WININET_E_INVALID_QUERY_REQUEST Handle = 0x80072F7A + WININET_E_HEADER_ALREADY_EXISTS Handle = 0x80072F7B + WININET_E_REDIRECT_FAILED Handle = 0x80072F7C + WININET_E_SECURITY_CHANNEL_ERROR Handle = 0x80072F7D + WININET_E_UNABLE_TO_CACHE_FILE Handle = 0x80072F7E + WININET_E_TCPIP_NOT_INSTALLED Handle = 0x80072F7F + WININET_E_DISCONNECTED Handle = 0x80072F83 + WININET_E_SERVER_UNREACHABLE Handle = 0x80072F84 + WININET_E_PROXY_SERVER_UNREACHABLE Handle = 0x80072F85 + WININET_E_BAD_AUTO_PROXY_SCRIPT Handle = 0x80072F86 + WININET_E_UNABLE_TO_DOWNLOAD_SCRIPT Handle = 0x80072F87 + WININET_E_SEC_INVALID_CERT Handle = 0x80072F89 + WININET_E_SEC_CERT_REVOKED Handle = 0x80072F8A + WININET_E_FAILED_DUETOSECURITYCHECK Handle = 0x80072F8B + WININET_E_NOT_INITIALIZED Handle = 0x80072F8C + WININET_E_LOGIN_FAILURE_DISPLAY_ENTITY_BODY Handle = 0x80072F8E + WININET_E_DECODING_FAILED Handle = 0x80072F8F + WININET_E_NOT_REDIRECTED Handle = 0x80072F80 + WININET_E_COOKIE_NEEDS_CONFIRMATION Handle = 0x80072F81 + WININET_E_COOKIE_DECLINED Handle = 0x80072F82 + WININET_E_REDIRECT_NEEDS_CONFIRMATION Handle = 0x80072F88 + SQLITE_E_ERROR Handle = 0x87AF0001 + SQLITE_E_INTERNAL Handle = 0x87AF0002 + SQLITE_E_PERM Handle = 0x87AF0003 + SQLITE_E_ABORT Handle = 0x87AF0004 + SQLITE_E_BUSY Handle = 0x87AF0005 + SQLITE_E_LOCKED Handle = 0x87AF0006 + SQLITE_E_NOMEM Handle = 0x87AF0007 + SQLITE_E_READONLY Handle = 0x87AF0008 + SQLITE_E_INTERRUPT Handle = 0x87AF0009 + SQLITE_E_IOERR Handle = 0x87AF000A + SQLITE_E_CORRUPT Handle = 0x87AF000B + SQLITE_E_NOTFOUND Handle = 0x87AF000C + SQLITE_E_FULL Handle = 0x87AF000D + SQLITE_E_CANTOPEN Handle = 0x87AF000E + SQLITE_E_PROTOCOL Handle = 0x87AF000F + SQLITE_E_EMPTY Handle = 0x87AF0010 + SQLITE_E_SCHEMA Handle = 0x87AF0011 + SQLITE_E_TOOBIG Handle = 0x87AF0012 + SQLITE_E_CONSTRAINT Handle = 0x87AF0013 + SQLITE_E_MISMATCH Handle = 0x87AF0014 + SQLITE_E_MISUSE Handle = 0x87AF0015 + SQLITE_E_NOLFS Handle = 0x87AF0016 + SQLITE_E_AUTH Handle = 0x87AF0017 + SQLITE_E_FORMAT Handle = 0x87AF0018 + SQLITE_E_RANGE Handle = 0x87AF0019 + SQLITE_E_NOTADB Handle = 0x87AF001A + SQLITE_E_NOTICE Handle = 0x87AF001B + SQLITE_E_WARNING Handle = 0x87AF001C + SQLITE_E_ROW Handle = 0x87AF0064 + SQLITE_E_DONE Handle = 0x87AF0065 + SQLITE_E_IOERR_READ Handle = 0x87AF010A + SQLITE_E_IOERR_SHORT_READ Handle = 0x87AF020A + SQLITE_E_IOERR_WRITE Handle = 0x87AF030A + SQLITE_E_IOERR_FSYNC Handle = 0x87AF040A + SQLITE_E_IOERR_DIR_FSYNC Handle = 0x87AF050A + SQLITE_E_IOERR_TRUNCATE Handle = 0x87AF060A + SQLITE_E_IOERR_FSTAT Handle = 0x87AF070A + SQLITE_E_IOERR_UNLOCK Handle = 0x87AF080A + SQLITE_E_IOERR_RDLOCK Handle = 0x87AF090A + SQLITE_E_IOERR_DELETE Handle = 0x87AF0A0A + SQLITE_E_IOERR_BLOCKED Handle = 0x87AF0B0A + SQLITE_E_IOERR_NOMEM Handle = 0x87AF0C0A + SQLITE_E_IOERR_ACCESS Handle = 0x87AF0D0A + SQLITE_E_IOERR_CHECKRESERVEDLOCK Handle = 0x87AF0E0A + SQLITE_E_IOERR_LOCK Handle = 0x87AF0F0A + SQLITE_E_IOERR_CLOSE Handle = 0x87AF100A + SQLITE_E_IOERR_DIR_CLOSE Handle = 0x87AF110A + SQLITE_E_IOERR_SHMOPEN Handle = 0x87AF120A + SQLITE_E_IOERR_SHMSIZE Handle = 0x87AF130A + SQLITE_E_IOERR_SHMLOCK Handle = 0x87AF140A + SQLITE_E_IOERR_SHMMAP Handle = 0x87AF150A + SQLITE_E_IOERR_SEEK Handle = 0x87AF160A + SQLITE_E_IOERR_DELETE_NOENT Handle = 0x87AF170A + SQLITE_E_IOERR_MMAP Handle = 0x87AF180A + SQLITE_E_IOERR_GETTEMPPATH Handle = 0x87AF190A + SQLITE_E_IOERR_CONVPATH Handle = 0x87AF1A0A + SQLITE_E_IOERR_VNODE Handle = 0x87AF1A02 + SQLITE_E_IOERR_AUTH Handle = 0x87AF1A03 + SQLITE_E_LOCKED_SHAREDCACHE Handle = 0x87AF0106 + SQLITE_E_BUSY_RECOVERY Handle = 0x87AF0105 + SQLITE_E_BUSY_SNAPSHOT Handle = 0x87AF0205 + SQLITE_E_CANTOPEN_NOTEMPDIR Handle = 0x87AF010E + SQLITE_E_CANTOPEN_ISDIR Handle = 0x87AF020E + SQLITE_E_CANTOPEN_FULLPATH Handle = 0x87AF030E + SQLITE_E_CANTOPEN_CONVPATH Handle = 0x87AF040E + SQLITE_E_CORRUPT_VTAB Handle = 0x87AF010B + SQLITE_E_READONLY_RECOVERY Handle = 0x87AF0108 + SQLITE_E_READONLY_CANTLOCK Handle = 0x87AF0208 + SQLITE_E_READONLY_ROLLBACK Handle = 0x87AF0308 + SQLITE_E_READONLY_DBMOVED Handle = 0x87AF0408 + SQLITE_E_ABORT_ROLLBACK Handle = 0x87AF0204 + SQLITE_E_CONSTRAINT_CHECK Handle = 0x87AF0113 + SQLITE_E_CONSTRAINT_COMMITHOOK Handle = 0x87AF0213 + SQLITE_E_CONSTRAINT_FOREIGNKEY Handle = 0x87AF0313 + SQLITE_E_CONSTRAINT_FUNCTION Handle = 0x87AF0413 + SQLITE_E_CONSTRAINT_NOTNULL Handle = 0x87AF0513 + SQLITE_E_CONSTRAINT_PRIMARYKEY Handle = 0x87AF0613 + SQLITE_E_CONSTRAINT_TRIGGER Handle = 0x87AF0713 + SQLITE_E_CONSTRAINT_UNIQUE Handle = 0x87AF0813 + SQLITE_E_CONSTRAINT_VTAB Handle = 0x87AF0913 + SQLITE_E_CONSTRAINT_ROWID Handle = 0x87AF0A13 + SQLITE_E_NOTICE_RECOVER_WAL Handle = 0x87AF011B + SQLITE_E_NOTICE_RECOVER_ROLLBACK Handle = 0x87AF021B + SQLITE_E_WARNING_AUTOINDEX Handle = 0x87AF011C + UTC_E_TOGGLE_TRACE_STARTED Handle = 0x87C51001 + UTC_E_ALTERNATIVE_TRACE_CANNOT_PREEMPT Handle = 0x87C51002 + UTC_E_AOT_NOT_RUNNING Handle = 0x87C51003 + UTC_E_SCRIPT_TYPE_INVALID Handle = 0x87C51004 + UTC_E_SCENARIODEF_NOT_FOUND Handle = 0x87C51005 + UTC_E_TRACEPROFILE_NOT_FOUND Handle = 0x87C51006 + UTC_E_FORWARDER_ALREADY_ENABLED Handle = 0x87C51007 + UTC_E_FORWARDER_ALREADY_DISABLED Handle = 0x87C51008 + UTC_E_EVENTLOG_ENTRY_MALFORMED Handle = 0x87C51009 + UTC_E_DIAGRULES_SCHEMAVERSION_MISMATCH Handle = 0x87C5100A + UTC_E_SCRIPT_TERMINATED Handle = 0x87C5100B + UTC_E_INVALID_CUSTOM_FILTER Handle = 0x87C5100C + UTC_E_TRACE_NOT_RUNNING Handle = 0x87C5100D + UTC_E_REESCALATED_TOO_QUICKLY Handle = 0x87C5100E + UTC_E_ESCALATION_ALREADY_RUNNING Handle = 0x87C5100F + UTC_E_PERFTRACK_ALREADY_TRACING Handle = 0x87C51010 + UTC_E_REACHED_MAX_ESCALATIONS Handle = 0x87C51011 + UTC_E_FORWARDER_PRODUCER_MISMATCH Handle = 0x87C51012 + UTC_E_INTENTIONAL_SCRIPT_FAILURE Handle = 0x87C51013 + UTC_E_SQM_INIT_FAILED Handle = 0x87C51014 + UTC_E_NO_WER_LOGGER_SUPPORTED Handle = 0x87C51015 + UTC_E_TRACERS_DONT_EXIST Handle = 0x87C51016 + UTC_E_WINRT_INIT_FAILED Handle = 0x87C51017 + UTC_E_SCENARIODEF_SCHEMAVERSION_MISMATCH Handle = 0x87C51018 + UTC_E_INVALID_FILTER Handle = 0x87C51019 + UTC_E_EXE_TERMINATED Handle = 0x87C5101A + UTC_E_ESCALATION_NOT_AUTHORIZED Handle = 0x87C5101B + UTC_E_SETUP_NOT_AUTHORIZED Handle = 0x87C5101C + UTC_E_CHILD_PROCESS_FAILED Handle = 0x87C5101D + UTC_E_COMMAND_LINE_NOT_AUTHORIZED Handle = 0x87C5101E + UTC_E_CANNOT_LOAD_SCENARIO_EDITOR_XML Handle = 0x87C5101F + UTC_E_ESCALATION_TIMED_OUT Handle = 0x87C51020 + UTC_E_SETUP_TIMED_OUT Handle = 0x87C51021 + UTC_E_TRIGGER_MISMATCH Handle = 0x87C51022 + UTC_E_TRIGGER_NOT_FOUND Handle = 0x87C51023 + UTC_E_SIF_NOT_SUPPORTED Handle = 0x87C51024 + UTC_E_DELAY_TERMINATED Handle = 0x87C51025 + UTC_E_DEVICE_TICKET_ERROR Handle = 0x87C51026 + UTC_E_TRACE_BUFFER_LIMIT_EXCEEDED Handle = 0x87C51027 + UTC_E_API_RESULT_UNAVAILABLE Handle = 0x87C51028 + UTC_E_RPC_TIMEOUT Handle = 0x87C51029 + UTC_E_RPC_WAIT_FAILED Handle = 0x87C5102A + UTC_E_API_BUSY Handle = 0x87C5102B + UTC_E_TRACE_MIN_DURATION_REQUIREMENT_NOT_MET Handle = 0x87C5102C + UTC_E_EXCLUSIVITY_NOT_AVAILABLE Handle = 0x87C5102D + UTC_E_GETFILE_FILE_PATH_NOT_APPROVED Handle = 0x87C5102E + UTC_E_ESCALATION_DIRECTORY_ALREADY_EXISTS Handle = 0x87C5102F + UTC_E_TIME_TRIGGER_ON_START_INVALID Handle = 0x87C51030 + UTC_E_TIME_TRIGGER_ONLY_VALID_ON_SINGLE_TRANSITION Handle = 0x87C51031 + UTC_E_TIME_TRIGGER_INVALID_TIME_RANGE Handle = 0x87C51032 + UTC_E_MULTIPLE_TIME_TRIGGER_ON_SINGLE_STATE Handle = 0x87C51033 + UTC_E_BINARY_MISSING Handle = 0x87C51034 + UTC_E_NETWORK_CAPTURE_NOT_ALLOWED Handle = 0x87C51035 + UTC_E_FAILED_TO_RESOLVE_CONTAINER_ID Handle = 0x87C51036 + UTC_E_UNABLE_TO_RESOLVE_SESSION Handle = 0x87C51037 + UTC_E_THROTTLED Handle = 0x87C51038 + UTC_E_UNAPPROVED_SCRIPT Handle = 0x87C51039 + UTC_E_SCRIPT_MISSING Handle = 0x87C5103A + UTC_E_SCENARIO_THROTTLED Handle = 0x87C5103B + UTC_E_API_NOT_SUPPORTED Handle = 0x87C5103C + UTC_E_GETFILE_EXTERNAL_PATH_NOT_APPROVED Handle = 0x87C5103D + UTC_E_TRY_GET_SCENARIO_TIMEOUT_EXCEEDED Handle = 0x87C5103E + UTC_E_CERT_REV_FAILED Handle = 0x87C5103F + UTC_E_FAILED_TO_START_NDISCAP Handle = 0x87C51040 + UTC_E_KERNELDUMP_LIMIT_REACHED Handle = 0x87C51041 + UTC_E_MISSING_AGGREGATE_EVENT_TAG Handle = 0x87C51042 + UTC_E_INVALID_AGGREGATION_STRUCT Handle = 0x87C51043 + UTC_E_ACTION_NOT_SUPPORTED_IN_DESTINATION Handle = 0x87C51044 + UTC_E_FILTER_MISSING_ATTRIBUTE Handle = 0x87C51045 + UTC_E_FILTER_INVALID_TYPE Handle = 0x87C51046 + UTC_E_FILTER_VARIABLE_NOT_FOUND Handle = 0x87C51047 + UTC_E_FILTER_FUNCTION_RESTRICTED Handle = 0x87C51048 + UTC_E_FILTER_VERSION_MISMATCH Handle = 0x87C51049 + UTC_E_FILTER_INVALID_FUNCTION Handle = 0x87C51050 + UTC_E_FILTER_INVALID_FUNCTION_PARAMS Handle = 0x87C51051 + UTC_E_FILTER_INVALID_COMMAND Handle = 0x87C51052 + UTC_E_FILTER_ILLEGAL_EVAL Handle = 0x87C51053 + UTC_E_TTTRACER_RETURNED_ERROR Handle = 0x87C51054 + UTC_E_AGENT_DIAGNOSTICS_TOO_LARGE Handle = 0x87C51055 + UTC_E_FAILED_TO_RECEIVE_AGENT_DIAGNOSTICS Handle = 0x87C51056 + UTC_E_SCENARIO_HAS_NO_ACTIONS Handle = 0x87C51057 + UTC_E_TTTRACER_STORAGE_FULL Handle = 0x87C51058 + UTC_E_INSUFFICIENT_SPACE_TO_START_TRACE Handle = 0x87C51059 + UTC_E_ESCALATION_CANCELLED_AT_SHUTDOWN Handle = 0x87C5105A + UTC_E_GETFILEINFOACTION_FILE_NOT_APPROVED Handle = 0x87C5105B + WINML_ERR_INVALID_DEVICE Handle = 0x88900001 + WINML_ERR_INVALID_BINDING Handle = 0x88900002 + WINML_ERR_VALUE_NOTFOUND Handle = 0x88900003 + WINML_ERR_SIZE_MISMATCH Handle = 0x88900004 +) diff --git a/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go b/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go new file mode 100644 index 00000000..6048ac67 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/zknownfolderids_windows.go @@ -0,0 +1,149 @@ +// Code generated by 'mkknownfolderids.bash'; DO NOT EDIT. + +package windows + +type KNOWNFOLDERID GUID + +var ( + FOLDERID_NetworkFolder = &KNOWNFOLDERID{0xd20beec4, 0x5ca8, 0x4905, [8]byte{0xae, 0x3b, 0xbf, 0x25, 0x1e, 0xa0, 0x9b, 0x53}} + FOLDERID_ComputerFolder = &KNOWNFOLDERID{0x0ac0837c, 0xbbf8, 0x452a, [8]byte{0x85, 0x0d, 0x79, 0xd0, 0x8e, 0x66, 0x7c, 0xa7}} + FOLDERID_InternetFolder = &KNOWNFOLDERID{0x4d9f7874, 0x4e0c, 0x4904, [8]byte{0x96, 0x7b, 0x40, 0xb0, 0xd2, 0x0c, 0x3e, 0x4b}} + FOLDERID_ControlPanelFolder = &KNOWNFOLDERID{0x82a74aeb, 0xaeb4, 0x465c, [8]byte{0xa0, 0x14, 0xd0, 0x97, 0xee, 0x34, 0x6d, 0x63}} + FOLDERID_PrintersFolder = &KNOWNFOLDERID{0x76fc4e2d, 0xd6ad, 0x4519, [8]byte{0xa6, 0x63, 0x37, 0xbd, 0x56, 0x06, 0x81, 0x85}} + FOLDERID_SyncManagerFolder = &KNOWNFOLDERID{0x43668bf8, 0xc14e, 0x49b2, [8]byte{0x97, 0xc9, 0x74, 0x77, 0x84, 0xd7, 0x84, 0xb7}} + FOLDERID_SyncSetupFolder = &KNOWNFOLDERID{0x0f214138, 0xb1d3, 0x4a90, [8]byte{0xbb, 0xa9, 0x27, 0xcb, 0xc0, 0xc5, 0x38, 0x9a}} + FOLDERID_ConflictFolder = &KNOWNFOLDERID{0x4bfefb45, 0x347d, 0x4006, [8]byte{0xa5, 0xbe, 0xac, 0x0c, 0xb0, 0x56, 0x71, 0x92}} + FOLDERID_SyncResultsFolder = &KNOWNFOLDERID{0x289a9a43, 0xbe44, 0x4057, [8]byte{0xa4, 0x1b, 0x58, 0x7a, 0x76, 0xd7, 0xe7, 0xf9}} + FOLDERID_RecycleBinFolder = &KNOWNFOLDERID{0xb7534046, 0x3ecb, 0x4c18, [8]byte{0xbe, 0x4e, 0x64, 0xcd, 0x4c, 0xb7, 0xd6, 0xac}} + FOLDERID_ConnectionsFolder = &KNOWNFOLDERID{0x6f0cd92b, 0x2e97, 0x45d1, [8]byte{0x88, 0xff, 0xb0, 0xd1, 0x86, 0xb8, 0xde, 0xdd}} + FOLDERID_Fonts = &KNOWNFOLDERID{0xfd228cb7, 0xae11, 0x4ae3, [8]byte{0x86, 0x4c, 0x16, 0xf3, 0x91, 0x0a, 0xb8, 0xfe}} + FOLDERID_Desktop = &KNOWNFOLDERID{0xb4bfcc3a, 0xdb2c, 0x424c, [8]byte{0xb0, 0x29, 0x7f, 0xe9, 0x9a, 0x87, 0xc6, 0x41}} + FOLDERID_Startup = &KNOWNFOLDERID{0xb97d20bb, 0xf46a, 0x4c97, [8]byte{0xba, 0x10, 0x5e, 0x36, 0x08, 0x43, 0x08, 0x54}} + FOLDERID_Programs = &KNOWNFOLDERID{0xa77f5d77, 0x2e2b, 0x44c3, [8]byte{0xa6, 0xa2, 0xab, 0xa6, 0x01, 0x05, 0x4a, 0x51}} + FOLDERID_StartMenu = &KNOWNFOLDERID{0x625b53c3, 0xab48, 0x4ec1, [8]byte{0xba, 0x1f, 0xa1, 0xef, 0x41, 0x46, 0xfc, 0x19}} + FOLDERID_Recent = &KNOWNFOLDERID{0xae50c081, 0xebd2, 0x438a, [8]byte{0x86, 0x55, 0x8a, 0x09, 0x2e, 0x34, 0x98, 0x7a}} + FOLDERID_SendTo = &KNOWNFOLDERID{0x8983036c, 0x27c0, 0x404b, [8]byte{0x8f, 0x08, 0x10, 0x2d, 0x10, 0xdc, 0xfd, 0x74}} + FOLDERID_Documents = &KNOWNFOLDERID{0xfdd39ad0, 0x238f, 0x46af, [8]byte{0xad, 0xb4, 0x6c, 0x85, 0x48, 0x03, 0x69, 0xc7}} + FOLDERID_Favorites = &KNOWNFOLDERID{0x1777f761, 0x68ad, 0x4d8a, [8]byte{0x87, 0xbd, 0x30, 0xb7, 0x59, 0xfa, 0x33, 0xdd}} + FOLDERID_NetHood = &KNOWNFOLDERID{0xc5abbf53, 0xe17f, 0x4121, [8]byte{0x89, 0x00, 0x86, 0x62, 0x6f, 0xc2, 0xc9, 0x73}} + FOLDERID_PrintHood = &KNOWNFOLDERID{0x9274bd8d, 0xcfd1, 0x41c3, [8]byte{0xb3, 0x5e, 0xb1, 0x3f, 0x55, 0xa7, 0x58, 0xf4}} + FOLDERID_Templates = &KNOWNFOLDERID{0xa63293e8, 0x664e, 0x48db, [8]byte{0xa0, 0x79, 0xdf, 0x75, 0x9e, 0x05, 0x09, 0xf7}} + FOLDERID_CommonStartup = &KNOWNFOLDERID{0x82a5ea35, 0xd9cd, 0x47c5, [8]byte{0x96, 0x29, 0xe1, 0x5d, 0x2f, 0x71, 0x4e, 0x6e}} + FOLDERID_CommonPrograms = &KNOWNFOLDERID{0x0139d44e, 0x6afe, 0x49f2, [8]byte{0x86, 0x90, 0x3d, 0xaf, 0xca, 0xe6, 0xff, 0xb8}} + FOLDERID_CommonStartMenu = &KNOWNFOLDERID{0xa4115719, 0xd62e, 0x491d, [8]byte{0xaa, 0x7c, 0xe7, 0x4b, 0x8b, 0xe3, 0xb0, 0x67}} + FOLDERID_PublicDesktop = &KNOWNFOLDERID{0xc4aa340d, 0xf20f, 0x4863, [8]byte{0xaf, 0xef, 0xf8, 0x7e, 0xf2, 0xe6, 0xba, 0x25}} + FOLDERID_ProgramData = &KNOWNFOLDERID{0x62ab5d82, 0xfdc1, 0x4dc3, [8]byte{0xa9, 0xdd, 0x07, 0x0d, 0x1d, 0x49, 0x5d, 0x97}} + FOLDERID_CommonTemplates = &KNOWNFOLDERID{0xb94237e7, 0x57ac, 0x4347, [8]byte{0x91, 0x51, 0xb0, 0x8c, 0x6c, 0x32, 0xd1, 0xf7}} + FOLDERID_PublicDocuments = &KNOWNFOLDERID{0xed4824af, 0xdce4, 0x45a8, [8]byte{0x81, 0xe2, 0xfc, 0x79, 0x65, 0x08, 0x36, 0x34}} + FOLDERID_RoamingAppData = &KNOWNFOLDERID{0x3eb685db, 0x65f9, 0x4cf6, [8]byte{0xa0, 0x3a, 0xe3, 0xef, 0x65, 0x72, 0x9f, 0x3d}} + FOLDERID_LocalAppData = &KNOWNFOLDERID{0xf1b32785, 0x6fba, 0x4fcf, [8]byte{0x9d, 0x55, 0x7b, 0x8e, 0x7f, 0x15, 0x70, 0x91}} + FOLDERID_LocalAppDataLow = &KNOWNFOLDERID{0xa520a1a4, 0x1780, 0x4ff6, [8]byte{0xbd, 0x18, 0x16, 0x73, 0x43, 0xc5, 0xaf, 0x16}} + FOLDERID_InternetCache = &KNOWNFOLDERID{0x352481e8, 0x33be, 0x4251, [8]byte{0xba, 0x85, 0x60, 0x07, 0xca, 0xed, 0xcf, 0x9d}} + FOLDERID_Cookies = &KNOWNFOLDERID{0x2b0f765d, 0xc0e9, 0x4171, [8]byte{0x90, 0x8e, 0x08, 0xa6, 0x11, 0xb8, 0x4f, 0xf6}} + FOLDERID_History = &KNOWNFOLDERID{0xd9dc8a3b, 0xb784, 0x432e, [8]byte{0xa7, 0x81, 0x5a, 0x11, 0x30, 0xa7, 0x59, 0x63}} + FOLDERID_System = &KNOWNFOLDERID{0x1ac14e77, 0x02e7, 0x4e5d, [8]byte{0xb7, 0x44, 0x2e, 0xb1, 0xae, 0x51, 0x98, 0xb7}} + FOLDERID_SystemX86 = &KNOWNFOLDERID{0xd65231b0, 0xb2f1, 0x4857, [8]byte{0xa4, 0xce, 0xa8, 0xe7, 0xc6, 0xea, 0x7d, 0x27}} + FOLDERID_Windows = &KNOWNFOLDERID{0xf38bf404, 0x1d43, 0x42f2, [8]byte{0x93, 0x05, 0x67, 0xde, 0x0b, 0x28, 0xfc, 0x23}} + FOLDERID_Profile = &KNOWNFOLDERID{0x5e6c858f, 0x0e22, 0x4760, [8]byte{0x9a, 0xfe, 0xea, 0x33, 0x17, 0xb6, 0x71, 0x73}} + FOLDERID_Pictures = &KNOWNFOLDERID{0x33e28130, 0x4e1e, 0x4676, [8]byte{0x83, 0x5a, 0x98, 0x39, 0x5c, 0x3b, 0xc3, 0xbb}} + FOLDERID_ProgramFilesX86 = &KNOWNFOLDERID{0x7c5a40ef, 0xa0fb, 0x4bfc, [8]byte{0x87, 0x4a, 0xc0, 0xf2, 0xe0, 0xb9, 0xfa, 0x8e}} + FOLDERID_ProgramFilesCommonX86 = &KNOWNFOLDERID{0xde974d24, 0xd9c6, 0x4d3e, [8]byte{0xbf, 0x91, 0xf4, 0x45, 0x51, 0x20, 0xb9, 0x17}} + FOLDERID_ProgramFilesX64 = &KNOWNFOLDERID{0x6d809377, 0x6af0, 0x444b, [8]byte{0x89, 0x57, 0xa3, 0x77, 0x3f, 0x02, 0x20, 0x0e}} + FOLDERID_ProgramFilesCommonX64 = &KNOWNFOLDERID{0x6365d5a7, 0x0f0d, 0x45e5, [8]byte{0x87, 0xf6, 0x0d, 0xa5, 0x6b, 0x6a, 0x4f, 0x7d}} + FOLDERID_ProgramFiles = &KNOWNFOLDERID{0x905e63b6, 0xc1bf, 0x494e, [8]byte{0xb2, 0x9c, 0x65, 0xb7, 0x32, 0xd3, 0xd2, 0x1a}} + FOLDERID_ProgramFilesCommon = &KNOWNFOLDERID{0xf7f1ed05, 0x9f6d, 0x47a2, [8]byte{0xaa, 0xae, 0x29, 0xd3, 0x17, 0xc6, 0xf0, 0x66}} + FOLDERID_UserProgramFiles = &KNOWNFOLDERID{0x5cd7aee2, 0x2219, 0x4a67, [8]byte{0xb8, 0x5d, 0x6c, 0x9c, 0xe1, 0x56, 0x60, 0xcb}} + FOLDERID_UserProgramFilesCommon = &KNOWNFOLDERID{0xbcbd3057, 0xca5c, 0x4622, [8]byte{0xb4, 0x2d, 0xbc, 0x56, 0xdb, 0x0a, 0xe5, 0x16}} + FOLDERID_AdminTools = &KNOWNFOLDERID{0x724ef170, 0xa42d, 0x4fef, [8]byte{0x9f, 0x26, 0xb6, 0x0e, 0x84, 0x6f, 0xba, 0x4f}} + FOLDERID_CommonAdminTools = &KNOWNFOLDERID{0xd0384e7d, 0xbac3, 0x4797, [8]byte{0x8f, 0x14, 0xcb, 0xa2, 0x29, 0xb3, 0x92, 0xb5}} + FOLDERID_Music = &KNOWNFOLDERID{0x4bd8d571, 0x6d19, 0x48d3, [8]byte{0xbe, 0x97, 0x42, 0x22, 0x20, 0x08, 0x0e, 0x43}} + FOLDERID_Videos = &KNOWNFOLDERID{0x18989b1d, 0x99b5, 0x455b, [8]byte{0x84, 0x1c, 0xab, 0x7c, 0x74, 0xe4, 0xdd, 0xfc}} + FOLDERID_Ringtones = &KNOWNFOLDERID{0xc870044b, 0xf49e, 0x4126, [8]byte{0xa9, 0xc3, 0xb5, 0x2a, 0x1f, 0xf4, 0x11, 0xe8}} + FOLDERID_PublicPictures = &KNOWNFOLDERID{0xb6ebfb86, 0x6907, 0x413c, [8]byte{0x9a, 0xf7, 0x4f, 0xc2, 0xab, 0xf0, 0x7c, 0xc5}} + FOLDERID_PublicMusic = &KNOWNFOLDERID{0x3214fab5, 0x9757, 0x4298, [8]byte{0xbb, 0x61, 0x92, 0xa9, 0xde, 0xaa, 0x44, 0xff}} + FOLDERID_PublicVideos = &KNOWNFOLDERID{0x2400183a, 0x6185, 0x49fb, [8]byte{0xa2, 0xd8, 0x4a, 0x39, 0x2a, 0x60, 0x2b, 0xa3}} + FOLDERID_PublicRingtones = &KNOWNFOLDERID{0xe555ab60, 0x153b, 0x4d17, [8]byte{0x9f, 0x04, 0xa5, 0xfe, 0x99, 0xfc, 0x15, 0xec}} + FOLDERID_ResourceDir = &KNOWNFOLDERID{0x8ad10c31, 0x2adb, 0x4296, [8]byte{0xa8, 0xf7, 0xe4, 0x70, 0x12, 0x32, 0xc9, 0x72}} + FOLDERID_LocalizedResourcesDir = &KNOWNFOLDERID{0x2a00375e, 0x224c, 0x49de, [8]byte{0xb8, 0xd1, 0x44, 0x0d, 0xf7, 0xef, 0x3d, 0xdc}} + FOLDERID_CommonOEMLinks = &KNOWNFOLDERID{0xc1bae2d0, 0x10df, 0x4334, [8]byte{0xbe, 0xdd, 0x7a, 0xa2, 0x0b, 0x22, 0x7a, 0x9d}} + FOLDERID_CDBurning = &KNOWNFOLDERID{0x9e52ab10, 0xf80d, 0x49df, [8]byte{0xac, 0xb8, 0x43, 0x30, 0xf5, 0x68, 0x78, 0x55}} + FOLDERID_UserProfiles = &KNOWNFOLDERID{0x0762d272, 0xc50a, 0x4bb0, [8]byte{0xa3, 0x82, 0x69, 0x7d, 0xcd, 0x72, 0x9b, 0x80}} + FOLDERID_Playlists = &KNOWNFOLDERID{0xde92c1c7, 0x837f, 0x4f69, [8]byte{0xa3, 0xbb, 0x86, 0xe6, 0x31, 0x20, 0x4a, 0x23}} + FOLDERID_SamplePlaylists = &KNOWNFOLDERID{0x15ca69b3, 0x30ee, 0x49c1, [8]byte{0xac, 0xe1, 0x6b, 0x5e, 0xc3, 0x72, 0xaf, 0xb5}} + FOLDERID_SampleMusic = &KNOWNFOLDERID{0xb250c668, 0xf57d, 0x4ee1, [8]byte{0xa6, 0x3c, 0x29, 0x0e, 0xe7, 0xd1, 0xaa, 0x1f}} + FOLDERID_SamplePictures = &KNOWNFOLDERID{0xc4900540, 0x2379, 0x4c75, [8]byte{0x84, 0x4b, 0x64, 0xe6, 0xfa, 0xf8, 0x71, 0x6b}} + FOLDERID_SampleVideos = &KNOWNFOLDERID{0x859ead94, 0x2e85, 0x48ad, [8]byte{0xa7, 0x1a, 0x09, 0x69, 0xcb, 0x56, 0xa6, 0xcd}} + FOLDERID_PhotoAlbums = &KNOWNFOLDERID{0x69d2cf90, 0xfc33, 0x4fb7, [8]byte{0x9a, 0x0c, 0xeb, 0xb0, 0xf0, 0xfc, 0xb4, 0x3c}} + FOLDERID_Public = &KNOWNFOLDERID{0xdfdf76a2, 0xc82a, 0x4d63, [8]byte{0x90, 0x6a, 0x56, 0x44, 0xac, 0x45, 0x73, 0x85}} + FOLDERID_ChangeRemovePrograms = &KNOWNFOLDERID{0xdf7266ac, 0x9274, 0x4867, [8]byte{0x8d, 0x55, 0x3b, 0xd6, 0x61, 0xde, 0x87, 0x2d}} + FOLDERID_AppUpdates = &KNOWNFOLDERID{0xa305ce99, 0xf527, 0x492b, [8]byte{0x8b, 0x1a, 0x7e, 0x76, 0xfa, 0x98, 0xd6, 0xe4}} + FOLDERID_AddNewPrograms = &KNOWNFOLDERID{0xde61d971, 0x5ebc, 0x4f02, [8]byte{0xa3, 0xa9, 0x6c, 0x82, 0x89, 0x5e, 0x5c, 0x04}} + FOLDERID_Downloads = &KNOWNFOLDERID{0x374de290, 0x123f, 0x4565, [8]byte{0x91, 0x64, 0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b}} + FOLDERID_PublicDownloads = &KNOWNFOLDERID{0x3d644c9b, 0x1fb8, 0x4f30, [8]byte{0x9b, 0x45, 0xf6, 0x70, 0x23, 0x5f, 0x79, 0xc0}} + FOLDERID_SavedSearches = &KNOWNFOLDERID{0x7d1d3a04, 0xdebb, 0x4115, [8]byte{0x95, 0xcf, 0x2f, 0x29, 0xda, 0x29, 0x20, 0xda}} + FOLDERID_QuickLaunch = &KNOWNFOLDERID{0x52a4f021, 0x7b75, 0x48a9, [8]byte{0x9f, 0x6b, 0x4b, 0x87, 0xa2, 0x10, 0xbc, 0x8f}} + FOLDERID_Contacts = &KNOWNFOLDERID{0x56784854, 0xc6cb, 0x462b, [8]byte{0x81, 0x69, 0x88, 0xe3, 0x50, 0xac, 0xb8, 0x82}} + FOLDERID_SidebarParts = &KNOWNFOLDERID{0xa75d362e, 0x50fc, 0x4fb7, [8]byte{0xac, 0x2c, 0xa8, 0xbe, 0xaa, 0x31, 0x44, 0x93}} + FOLDERID_SidebarDefaultParts = &KNOWNFOLDERID{0x7b396e54, 0x9ec5, 0x4300, [8]byte{0xbe, 0x0a, 0x24, 0x82, 0xeb, 0xae, 0x1a, 0x26}} + FOLDERID_PublicGameTasks = &KNOWNFOLDERID{0xdebf2536, 0xe1a8, 0x4c59, [8]byte{0xb6, 0xa2, 0x41, 0x45, 0x86, 0x47, 0x6a, 0xea}} + FOLDERID_GameTasks = &KNOWNFOLDERID{0x054fae61, 0x4dd8, 0x4787, [8]byte{0x80, 0xb6, 0x09, 0x02, 0x20, 0xc4, 0xb7, 0x00}} + FOLDERID_SavedGames = &KNOWNFOLDERID{0x4c5c32ff, 0xbb9d, 0x43b0, [8]byte{0xb5, 0xb4, 0x2d, 0x72, 0xe5, 0x4e, 0xaa, 0xa4}} + FOLDERID_Games = &KNOWNFOLDERID{0xcac52c1a, 0xb53d, 0x4edc, [8]byte{0x92, 0xd7, 0x6b, 0x2e, 0x8a, 0xc1, 0x94, 0x34}} + FOLDERID_SEARCH_MAPI = &KNOWNFOLDERID{0x98ec0e18, 0x2098, 0x4d44, [8]byte{0x86, 0x44, 0x66, 0x97, 0x93, 0x15, 0xa2, 0x81}} + FOLDERID_SEARCH_CSC = &KNOWNFOLDERID{0xee32e446, 0x31ca, 0x4aba, [8]byte{0x81, 0x4f, 0xa5, 0xeb, 0xd2, 0xfd, 0x6d, 0x5e}} + FOLDERID_Links = &KNOWNFOLDERID{0xbfb9d5e0, 0xc6a9, 0x404c, [8]byte{0xb2, 0xb2, 0xae, 0x6d, 0xb6, 0xaf, 0x49, 0x68}} + FOLDERID_UsersFiles = &KNOWNFOLDERID{0xf3ce0f7c, 0x4901, 0x4acc, [8]byte{0x86, 0x48, 0xd5, 0xd4, 0x4b, 0x04, 0xef, 0x8f}} + FOLDERID_UsersLibraries = &KNOWNFOLDERID{0xa302545d, 0xdeff, 0x464b, [8]byte{0xab, 0xe8, 0x61, 0xc8, 0x64, 0x8d, 0x93, 0x9b}} + FOLDERID_SearchHome = &KNOWNFOLDERID{0x190337d1, 0xb8ca, 0x4121, [8]byte{0xa6, 0x39, 0x6d, 0x47, 0x2d, 0x16, 0x97, 0x2a}} + FOLDERID_OriginalImages = &KNOWNFOLDERID{0x2c36c0aa, 0x5812, 0x4b87, [8]byte{0xbf, 0xd0, 0x4c, 0xd0, 0xdf, 0xb1, 0x9b, 0x39}} + FOLDERID_DocumentsLibrary = &KNOWNFOLDERID{0x7b0db17d, 0x9cd2, 0x4a93, [8]byte{0x97, 0x33, 0x46, 0xcc, 0x89, 0x02, 0x2e, 0x7c}} + FOLDERID_MusicLibrary = &KNOWNFOLDERID{0x2112ab0a, 0xc86a, 0x4ffe, [8]byte{0xa3, 0x68, 0x0d, 0xe9, 0x6e, 0x47, 0x01, 0x2e}} + FOLDERID_PicturesLibrary = &KNOWNFOLDERID{0xa990ae9f, 0xa03b, 0x4e80, [8]byte{0x94, 0xbc, 0x99, 0x12, 0xd7, 0x50, 0x41, 0x04}} + FOLDERID_VideosLibrary = &KNOWNFOLDERID{0x491e922f, 0x5643, 0x4af4, [8]byte{0xa7, 0xeb, 0x4e, 0x7a, 0x13, 0x8d, 0x81, 0x74}} + FOLDERID_RecordedTVLibrary = &KNOWNFOLDERID{0x1a6fdba2, 0xf42d, 0x4358, [8]byte{0xa7, 0x98, 0xb7, 0x4d, 0x74, 0x59, 0x26, 0xc5}} + FOLDERID_HomeGroup = &KNOWNFOLDERID{0x52528a6b, 0xb9e3, 0x4add, [8]byte{0xb6, 0x0d, 0x58, 0x8c, 0x2d, 0xba, 0x84, 0x2d}} + FOLDERID_HomeGroupCurrentUser = &KNOWNFOLDERID{0x9b74b6a3, 0x0dfd, 0x4f11, [8]byte{0x9e, 0x78, 0x5f, 0x78, 0x00, 0xf2, 0xe7, 0x72}} + FOLDERID_DeviceMetadataStore = &KNOWNFOLDERID{0x5ce4a5e9, 0xe4eb, 0x479d, [8]byte{0xb8, 0x9f, 0x13, 0x0c, 0x02, 0x88, 0x61, 0x55}} + FOLDERID_Libraries = &KNOWNFOLDERID{0x1b3ea5dc, 0xb587, 0x4786, [8]byte{0xb4, 0xef, 0xbd, 0x1d, 0xc3, 0x32, 0xae, 0xae}} + FOLDERID_PublicLibraries = &KNOWNFOLDERID{0x48daf80b, 0xe6cf, 0x4f4e, [8]byte{0xb8, 0x00, 0x0e, 0x69, 0xd8, 0x4e, 0xe3, 0x84}} + FOLDERID_UserPinned = &KNOWNFOLDERID{0x9e3995ab, 0x1f9c, 0x4f13, [8]byte{0xb8, 0x27, 0x48, 0xb2, 0x4b, 0x6c, 0x71, 0x74}} + FOLDERID_ImplicitAppShortcuts = &KNOWNFOLDERID{0xbcb5256f, 0x79f6, 0x4cee, [8]byte{0xb7, 0x25, 0xdc, 0x34, 0xe4, 0x02, 0xfd, 0x46}} + FOLDERID_AccountPictures = &KNOWNFOLDERID{0x008ca0b1, 0x55b4, 0x4c56, [8]byte{0xb8, 0xa8, 0x4d, 0xe4, 0xb2, 0x99, 0xd3, 0xbe}} + FOLDERID_PublicUserTiles = &KNOWNFOLDERID{0x0482af6c, 0x08f1, 0x4c34, [8]byte{0x8c, 0x90, 0xe1, 0x7e, 0xc9, 0x8b, 0x1e, 0x17}} + FOLDERID_AppsFolder = &KNOWNFOLDERID{0x1e87508d, 0x89c2, 0x42f0, [8]byte{0x8a, 0x7e, 0x64, 0x5a, 0x0f, 0x50, 0xca, 0x58}} + FOLDERID_StartMenuAllPrograms = &KNOWNFOLDERID{0xf26305ef, 0x6948, 0x40b9, [8]byte{0xb2, 0x55, 0x81, 0x45, 0x3d, 0x09, 0xc7, 0x85}} + FOLDERID_CommonStartMenuPlaces = &KNOWNFOLDERID{0xa440879f, 0x87a0, 0x4f7d, [8]byte{0xb7, 0x00, 0x02, 0x07, 0xb9, 0x66, 0x19, 0x4a}} + FOLDERID_ApplicationShortcuts = &KNOWNFOLDERID{0xa3918781, 0xe5f2, 0x4890, [8]byte{0xb3, 0xd9, 0xa7, 0xe5, 0x43, 0x32, 0x32, 0x8c}} + FOLDERID_RoamingTiles = &KNOWNFOLDERID{0x00bcfc5a, 0xed94, 0x4e48, [8]byte{0x96, 0xa1, 0x3f, 0x62, 0x17, 0xf2, 0x19, 0x90}} + FOLDERID_RoamedTileImages = &KNOWNFOLDERID{0xaaa8d5a5, 0xf1d6, 0x4259, [8]byte{0xba, 0xa8, 0x78, 0xe7, 0xef, 0x60, 0x83, 0x5e}} + FOLDERID_Screenshots = &KNOWNFOLDERID{0xb7bede81, 0xdf94, 0x4682, [8]byte{0xa7, 0xd8, 0x57, 0xa5, 0x26, 0x20, 0xb8, 0x6f}} + FOLDERID_CameraRoll = &KNOWNFOLDERID{0xab5fb87b, 0x7ce2, 0x4f83, [8]byte{0x91, 0x5d, 0x55, 0x08, 0x46, 0xc9, 0x53, 0x7b}} + FOLDERID_SkyDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}} + FOLDERID_OneDrive = &KNOWNFOLDERID{0xa52bba46, 0xe9e1, 0x435f, [8]byte{0xb3, 0xd9, 0x28, 0xda, 0xa6, 0x48, 0xc0, 0xf6}} + FOLDERID_SkyDriveDocuments = &KNOWNFOLDERID{0x24d89e24, 0x2f19, 0x4534, [8]byte{0x9d, 0xde, 0x6a, 0x66, 0x71, 0xfb, 0xb8, 0xfe}} + FOLDERID_SkyDrivePictures = &KNOWNFOLDERID{0x339719b5, 0x8c47, 0x4894, [8]byte{0x94, 0xc2, 0xd8, 0xf7, 0x7a, 0xdd, 0x44, 0xa6}} + FOLDERID_SkyDriveMusic = &KNOWNFOLDERID{0xc3f2459e, 0x80d6, 0x45dc, [8]byte{0xbf, 0xef, 0x1f, 0x76, 0x9f, 0x2b, 0xe7, 0x30}} + FOLDERID_SkyDriveCameraRoll = &KNOWNFOLDERID{0x767e6811, 0x49cb, 0x4273, [8]byte{0x87, 0xc2, 0x20, 0xf3, 0x55, 0xe1, 0x08, 0x5b}} + FOLDERID_SearchHistory = &KNOWNFOLDERID{0x0d4c3db6, 0x03a3, 0x462f, [8]byte{0xa0, 0xe6, 0x08, 0x92, 0x4c, 0x41, 0xb5, 0xd4}} + FOLDERID_SearchTemplates = &KNOWNFOLDERID{0x7e636bfe, 0xdfa9, 0x4d5e, [8]byte{0xb4, 0x56, 0xd7, 0xb3, 0x98, 0x51, 0xd8, 0xa9}} + FOLDERID_CameraRollLibrary = &KNOWNFOLDERID{0x2b20df75, 0x1eda, 0x4039, [8]byte{0x80, 0x97, 0x38, 0x79, 0x82, 0x27, 0xd5, 0xb7}} + FOLDERID_SavedPictures = &KNOWNFOLDERID{0x3b193882, 0xd3ad, 0x4eab, [8]byte{0x96, 0x5a, 0x69, 0x82, 0x9d, 0x1f, 0xb5, 0x9f}} + FOLDERID_SavedPicturesLibrary = &KNOWNFOLDERID{0xe25b5812, 0xbe88, 0x4bd9, [8]byte{0x94, 0xb0, 0x29, 0x23, 0x34, 0x77, 0xb6, 0xc3}} + FOLDERID_RetailDemo = &KNOWNFOLDERID{0x12d4c69e, 0x24ad, 0x4923, [8]byte{0xbe, 0x19, 0x31, 0x32, 0x1c, 0x43, 0xa7, 0x67}} + FOLDERID_Device = &KNOWNFOLDERID{0x1c2ac1dc, 0x4358, 0x4b6c, [8]byte{0x97, 0x33, 0xaf, 0x21, 0x15, 0x65, 0x76, 0xf0}} + FOLDERID_DevelopmentFiles = &KNOWNFOLDERID{0xdbe8e08e, 0x3053, 0x4bbc, [8]byte{0xb1, 0x83, 0x2a, 0x7b, 0x2b, 0x19, 0x1e, 0x59}} + FOLDERID_Objects3D = &KNOWNFOLDERID{0x31c0dd25, 0x9439, 0x4f12, [8]byte{0xbf, 0x41, 0x7f, 0xf4, 0xed, 0xa3, 0x87, 0x22}} + FOLDERID_AppCaptures = &KNOWNFOLDERID{0xedc0fe71, 0x98d8, 0x4f4a, [8]byte{0xb9, 0x20, 0xc8, 0xdc, 0x13, 0x3c, 0xb1, 0x65}} + FOLDERID_LocalDocuments = &KNOWNFOLDERID{0xf42ee2d3, 0x909f, 0x4907, [8]byte{0x88, 0x71, 0x4c, 0x22, 0xfc, 0x0b, 0xf7, 0x56}} + FOLDERID_LocalPictures = &KNOWNFOLDERID{0x0ddd015d, 0xb06c, 0x45d5, [8]byte{0x8c, 0x4c, 0xf5, 0x97, 0x13, 0x85, 0x46, 0x39}} + FOLDERID_LocalVideos = &KNOWNFOLDERID{0x35286a68, 0x3c57, 0x41a1, [8]byte{0xbb, 0xb1, 0x0e, 0xae, 0x73, 0xd7, 0x6c, 0x95}} + FOLDERID_LocalMusic = &KNOWNFOLDERID{0xa0c69a99, 0x21c8, 0x4671, [8]byte{0x87, 0x03, 0x79, 0x34, 0x16, 0x2f, 0xcf, 0x1d}} + FOLDERID_LocalDownloads = &KNOWNFOLDERID{0x7d83ee9b, 0x2244, 0x4e70, [8]byte{0xb1, 0xf5, 0x53, 0x93, 0x04, 0x2a, 0xf1, 0xe4}} + FOLDERID_RecordedCalls = &KNOWNFOLDERID{0x2f8b40c2, 0x83ed, 0x48ee, [8]byte{0xb3, 0x83, 0xa1, 0xf1, 0x57, 0xec, 0x6f, 0x9a}} + FOLDERID_AllAppMods = &KNOWNFOLDERID{0x7ad67899, 0x66af, 0x43ba, [8]byte{0x91, 0x56, 0x6a, 0xad, 0x42, 0xe6, 0xc5, 0x96}} + FOLDERID_CurrentAppMods = &KNOWNFOLDERID{0x3db40b20, 0x2a30, 0x4dbe, [8]byte{0x91, 0x7e, 0x77, 0x1d, 0xd2, 0x1d, 0xd0, 0x99}} + FOLDERID_AppDataDesktop = &KNOWNFOLDERID{0xb2c5e279, 0x7add, 0x439f, [8]byte{0xb2, 0x8c, 0xc4, 0x1f, 0xe1, 0xbb, 0xf6, 0x72}} + FOLDERID_AppDataDocuments = &KNOWNFOLDERID{0x7be16610, 0x1f7f, 0x44ac, [8]byte{0xbf, 0xf0, 0x83, 0xe1, 0x5f, 0x2f, 0xfc, 0xa1}} + FOLDERID_AppDataFavorites = &KNOWNFOLDERID{0x7cfbefbc, 0xde1f, 0x45aa, [8]byte{0xb8, 0x43, 0xa5, 0x42, 0xac, 0x53, 0x6c, 0xc9}} + FOLDERID_AppDataProgramData = &KNOWNFOLDERID{0x559d40a3, 0xa036, 0x40fa, [8]byte{0xaf, 0x61, 0x84, 0xcb, 0x43, 0x0a, 0x4d, 0x34}} +) diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index eb9f0629..d461bed9 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -38,14 +38,18 @@ var ( modadvapi32 = NewLazySystemDLL("advapi32.dll") modkernel32 = NewLazySystemDLL("kernel32.dll") modshell32 = NewLazySystemDLL("shell32.dll") + moduserenv = NewLazySystemDLL("userenv.dll") modmswsock = NewLazySystemDLL("mswsock.dll") modcrypt32 = NewLazySystemDLL("crypt32.dll") + moduser32 = NewLazySystemDLL("user32.dll") + modole32 = NewLazySystemDLL("ole32.dll") + modntdll = NewLazySystemDLL("ntdll.dll") modws2_32 = NewLazySystemDLL("ws2_32.dll") moddnsapi = NewLazySystemDLL("dnsapi.dll") modiphlpapi = NewLazySystemDLL("iphlpapi.dll") modsecur32 = NewLazySystemDLL("secur32.dll") modnetapi32 = NewLazySystemDLL("netapi32.dll") - moduserenv = NewLazySystemDLL("userenv.dll") + modwtsapi32 = NewLazySystemDLL("wtsapi32.dll") procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW") procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource") @@ -57,6 +61,7 @@ var ( procDeleteService = modadvapi32.NewProc("DeleteService") procStartServiceW = modadvapi32.NewProc("StartServiceW") procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus") + procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW") procControlService = modadvapi32.NewProc("ControlService") procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW") procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus") @@ -66,6 +71,7 @@ var ( procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W") procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx") + procNotifyServiceStatusChangeW = modadvapi32.NewProc("NotifyServiceStatusChangeW") procGetLastError = modkernel32.NewProc("GetLastError") procLoadLibraryW = modkernel32.NewProc("LoadLibraryW") procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW") @@ -74,6 +80,7 @@ var ( procGetVersion = modkernel32.NewProc("GetVersion") procFormatMessageW = modkernel32.NewProc("FormatMessageW") procExitProcess = modkernel32.NewProc("ExitProcess") + procIsWow64Process = modkernel32.NewProc("IsWow64Process") procCreateFileW = modkernel32.NewProc("CreateFileW") procReadFile = modkernel32.NewProc("ReadFile") procWriteFile = modkernel32.NewProc("WriteFile") @@ -86,6 +93,7 @@ var ( procFindNextFileW = modkernel32.NewProc("FindNextFileW") procFindClose = modkernel32.NewProc("FindClose") procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle") + procGetFileInformationByHandleEx = modkernel32.NewProc("GetFileInformationByHandleEx") procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW") @@ -106,10 +114,13 @@ var ( procCancelIoEx = modkernel32.NewProc("CancelIoEx") procCreateProcessW = modkernel32.NewProc("CreateProcessW") procOpenProcess = modkernel32.NewProc("OpenProcess") + procShellExecuteW = modshell32.NewProc("ShellExecuteW") + procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath") procTerminateProcess = modkernel32.NewProc("TerminateProcess") procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess") procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW") procGetCurrentProcess = modkernel32.NewProc("GetCurrentProcess") + procGetCurrentThread = modkernel32.NewProc("GetCurrentThread") procGetProcessTimes = modkernel32.NewProc("GetProcessTimes") procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") @@ -124,6 +135,9 @@ var ( procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW") procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW") procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") + procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock") + procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock") + procGetTickCount64 = modkernel32.NewProc("GetTickCount64") procSetFileTime = modkernel32.NewProc("SetFileTime") procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW") procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW") @@ -171,6 +185,8 @@ var ( procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") procProcess32FirstW = modkernel32.NewProc("Process32FirstW") procProcess32NextW = modkernel32.NewProc("Process32NextW") + procThread32First = modkernel32.NewProc("Thread32First") + procThread32Next = modkernel32.NewProc("Thread32Next") procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW") procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW") @@ -181,6 +197,18 @@ var ( procSetEvent = modkernel32.NewProc("SetEvent") procResetEvent = modkernel32.NewProc("ResetEvent") procPulseEvent = modkernel32.NewProc("PulseEvent") + procSleepEx = modkernel32.NewProc("SleepEx") + procCreateJobObjectW = modkernel32.NewProc("CreateJobObjectW") + procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") + procTerminateJobObject = modkernel32.NewProc("TerminateJobObject") + procSetErrorMode = modkernel32.NewProc("SetErrorMode") + procResumeThread = modkernel32.NewProc("ResumeThread") + procSetPriorityClass = modkernel32.NewProc("SetPriorityClass") + procGetPriorityClass = modkernel32.NewProc("GetPriorityClass") + procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject") + procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent") + procGetProcessId = modkernel32.NewProc("GetProcessId") + procOpenThread = modkernel32.NewProc("OpenThread") procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW") procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW") procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW") @@ -200,6 +228,12 @@ var ( procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW") procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW") procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW") + procMessageBoxW = moduser32.NewProc("MessageBoxW") + procCLSIDFromString = modole32.NewProc("CLSIDFromString") + procStringFromGUID2 = modole32.NewProc("StringFromGUID2") + procCoCreateGuid = modole32.NewProc("CoCreateGuid") + procCoTaskMemFree = modole32.NewProc("CoTaskMemFree") + procRtlGetVersion = modntdll.NewProc("RtlGetVersion") procWSAStartup = modws2_32.NewProc("WSAStartup") procWSACleanup = modws2_32.NewProc("WSACleanup") procWSAIoctl = modws2_32.NewProc("WSAIoctl") @@ -248,13 +282,30 @@ var ( procCopySid = modadvapi32.NewProc("CopySid") procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid") procCreateWellKnownSid = modadvapi32.NewProc("CreateWellKnownSid") + procIsWellKnownSid = modadvapi32.NewProc("IsWellKnownSid") procFreeSid = modadvapi32.NewProc("FreeSid") procEqualSid = modadvapi32.NewProc("EqualSid") + procGetSidIdentifierAuthority = modadvapi32.NewProc("GetSidIdentifierAuthority") + procGetSidSubAuthorityCount = modadvapi32.NewProc("GetSidSubAuthorityCount") + procGetSidSubAuthority = modadvapi32.NewProc("GetSidSubAuthority") + procIsValidSid = modadvapi32.NewProc("IsValidSid") procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership") procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken") + procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken") + procImpersonateSelf = modadvapi32.NewProc("ImpersonateSelf") + procRevertToSelf = modadvapi32.NewProc("RevertToSelf") + procSetThreadToken = modadvapi32.NewProc("SetThreadToken") + procLookupPrivilegeValueW = modadvapi32.NewProc("LookupPrivilegeValueW") + procAdjustTokenPrivileges = modadvapi32.NewProc("AdjustTokenPrivileges") + procAdjustTokenGroups = modadvapi32.NewProc("AdjustTokenGroups") procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation") + procSetTokenInformation = modadvapi32.NewProc("SetTokenInformation") + procDuplicateTokenEx = modadvapi32.NewProc("DuplicateTokenEx") procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") procGetSystemDirectoryW = modkernel32.NewProc("GetSystemDirectoryW") + procWTSQueryUserToken = modwtsapi32.NewProc("WTSQueryUserToken") + procWTSEnumerateSessionsW = modwtsapi32.NewProc("WTSEnumerateSessionsW") + procWTSFreeMemory = modwtsapi32.NewProc("WTSFreeMemory") ) func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { @@ -381,6 +432,18 @@ func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { return } +func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) if r1 == 0 { @@ -489,6 +552,14 @@ func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize return } +func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) { + r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + func GetLastError() (lasterr error) { r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) if r0 != 0 { @@ -610,7 +681,19 @@ func ExitProcess(exitcode uint32) { return } -func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) { +func IsWow64Process(handle Handle, isWow64 *bool) (err error) { + r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(isWow64)), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) handle = Handle(r0) if handle == InvalidHandle { @@ -772,6 +855,18 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e return } +func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) @@ -995,14 +1090,14 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA return } -func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) { +func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) { var _p0 uint32 if inheritHandle { _p0 = 1 } else { _p0 = 0 } - r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(da), uintptr(_p0), uintptr(pid)) + r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) handle = Handle(r0) if handle == 0 { if e1 != 0 { @@ -1014,6 +1109,26 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err return } +func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { + r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { + r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + func TerminateProcess(handle Handle, exitcode uint32) (err error) { r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) if r1 == 0 { @@ -1063,6 +1178,19 @@ func GetCurrentProcess() (pseudoHandle Handle, err error) { return } +func GetCurrentThread() (pseudoHandle Handle, err error) { + r0, _, e1 := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0) + pseudoHandle = Handle(r0) + if pseudoHandle == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) if r1 == 0 { @@ -1249,6 +1377,42 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { return } +func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { + var _p0 uint32 + if inheritExisting { + _p0 = 1 + } else { + _p0 = 0 + } + r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func DestroyEnvironmentBlock(block *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func getTickCount64() (ms uint64) { + r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) + ms = uint64(r0) + return +} + func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) if r1 == 0 { @@ -1691,7 +1855,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32 return } -func getCurrentProcessId() (pid uint32) { +func GetCurrentProcessId() (pid uint32) { r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) pid = uint32(r0) return @@ -1794,6 +1958,30 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { return } +func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { + r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { + r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { @@ -1917,6 +2105,156 @@ func PulseEvent(event Handle) (err error) { return } +func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { + var _p0 uint32 + if alertable { + _p0 = 1 + } else { + _p0 = 0 + } + r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) + ret = uint32(r0) + return +} + +func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) + handle = Handle(r0) + if handle == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func AssignProcessToJobObject(job Handle, process Handle) (err error) { + r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func TerminateJobObject(job Handle, exitCode uint32) (err error) { + r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func SetErrorMode(mode uint32) (ret uint32) { + r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) + ret = uint32(r0) + return +} + +func ResumeThread(thread Handle) (ret uint32, err error) { + r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) + ret = uint32(r0) + if ret == 0xffffffff { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func SetPriorityClass(process Handle, priorityClass uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func GetPriorityClass(process Handle) (ret uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) + ret = uint32(r0) + if ret == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { + r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) + ret = int(r0) + if ret == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func GetProcessId(process Handle) (id uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) + id = uint32(r0) + if id == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) { + var _p0 uint32 + if inheritHandle { + _p0 = 1 + } else { + _p0 = 0 + } + r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) + handle = Handle(r0) + if handle == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) if r1 == 0 { @@ -2144,6 +2482,54 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro return } +func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { + r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) + ret = int32(r0) + if ret == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { + r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { + r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) + chars = int32(r0) + return +} + +func coCreateGuid(pguid *GUID) (ret error) { + r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + +func CoTaskMemFree(address unsafe.Pointer) { + syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) + return +} + +func rtlGetVersion(info *OsVersionInfoEx) (ret error) { + r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) + if r0 != 0 { + ret = syscall.Errno(r0) + } + return +} + func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) if r0 != 0 { @@ -2686,6 +3072,12 @@ func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, s return } +func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { + r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0) + isWellKnown = r0 != 0 + return +} + func FreeSid(sid *SID) (err error) { r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) if r1 != 0 { @@ -2704,6 +3096,30 @@ func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { return } +func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { + r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) + return +} + +func getSidSubAuthorityCount(sid *SID) (count *uint8) { + r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + count = (*uint8)(unsafe.Pointer(r0)) + return +} + +func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { + r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0) + subAuthority = (*uint32)(unsafe.Pointer(r0)) + return +} + +func isValidSid(sid *SID) (isValid bool) { + r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) + isValid = r0 != 0 + return +} + func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) if r1 == 0 { @@ -2716,8 +3132,8 @@ func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) ( return } -func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token))) +func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { + r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) if r1 == 0 { if e1 != 0 { err = errnoErr(e1) @@ -2728,8 +3144,134 @@ func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { return } -func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) +func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) { + var _p0 uint32 + if openAsSelf { + _p0 = 1 + } else { + _p0 = 0 + } + r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func ImpersonateSelf(impersonationlevel uint32) (err error) { + r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func RevertToSelf() (err error) { + r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func SetThreadToken(thread *Handle, token Token) (err error) { + r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { + r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) { + var _p0 uint32 + if disableAllPrivileges { + _p0 = 1 + } else { + _p0 = 0 + } + r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) { + var _p0 uint32 + if resetToDefault { + _p0 = 1 + } else { + _p0 = 0 + } + r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { + r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) if r1 == 0 { if e1 != 0 { err = errnoErr(e1) @@ -2764,3 +3306,32 @@ func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { } return } + +func WTSQueryUserToken(session uint32, token *Token) (err error) { + r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) + if r1 == 0 { + if e1 != 0 { + err = errnoErr(e1) + } else { + err = syscall.EINVAL + } + } + return +} + +func WTSFreeMemory(ptr uintptr) { + syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) + return +} diff --git a/vendor/golang.org/x/text/transform/transform.go b/vendor/golang.org/x/text/transform/transform.go index fe47b9b3..520b9ada 100644 --- a/vendor/golang.org/x/text/transform/transform.go +++ b/vendor/golang.org/x/text/transform/transform.go @@ -78,8 +78,8 @@ type SpanningTransformer interface { // considering the error err. // // A nil error means that all input bytes are known to be identical to the - // output produced by the Transformer. A nil error can be be returned - // regardless of whether atEOF is true. If err is nil, then then n must + // output produced by the Transformer. A nil error can be returned + // regardless of whether atEOF is true. If err is nil, then n must // equal len(src); the converse is not necessarily true. // // ErrEndOfSpan means that the Transformer output may differ from the @@ -493,7 +493,7 @@ func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err erro return dstL.n, srcL.p, err } -// Deprecated: use runes.Remove instead. +// Deprecated: Use runes.Remove instead. func RemoveFunc(f func(r rune) bool) Transformer { return removeF(f) } diff --git a/vendor/golang.org/x/text/unicode/bidi/bracket.go b/vendor/golang.org/x/text/unicode/bidi/bracket.go index 3fef3162..18539397 100644 --- a/vendor/golang.org/x/text/unicode/bidi/bracket.go +++ b/vendor/golang.org/x/text/unicode/bidi/bracket.go @@ -246,7 +246,7 @@ func (p *bracketPairer) getStrongTypeN0(index int) Class { // assuming the given embedding direction. // // It returns ON if no strong type is found. If a single strong type is found, -// it returns this this type. Otherwise it returns the embedding direction. +// it returns this type. Otherwise it returns the embedding direction. // // TODO: use separate type for "strong" directionality. func (p *bracketPairer) classifyPairContent(loc bracketPair, dirEmbed Class) Class { diff --git a/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go index 2e1ff195..d8c94e1b 100644 --- a/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +++ b/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go @@ -1,6 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -// +build go1.10 +// +build go1.10,!go1.13 package bidi diff --git a/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go b/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go new file mode 100644 index 00000000..022e3c69 --- /dev/null +++ b/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go @@ -0,0 +1,1887 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +// +build go1.13 + +package bidi + +// UnicodeVersion is the Unicode version from which the tables in this package are derived. +const UnicodeVersion = "11.0.0" + +// xorMasks contains masks to be xor-ed with brackets to get the reverse +// version. +var xorMasks = []int32{ // 8 elements + 0, 1, 6, 7, 3, 15, 29, 63, +} // Size: 56 bytes + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *bidiTrie) lookup(s []byte) (v uint8, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return bidiValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := bidiIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := bidiIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = bidiIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := bidiIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = bidiIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = bidiIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *bidiTrie) lookupUnsafe(s []byte) uint8 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return bidiValues[c0] + } + i := bidiIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = bidiIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = bidiIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *bidiTrie) lookupString(s string) (v uint8, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return bidiValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := bidiIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := bidiIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = bidiIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := bidiIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = bidiIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = bidiIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *bidiTrie) lookupStringUnsafe(s string) uint8 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return bidiValues[c0] + } + i := bidiIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = bidiIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = bidiIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// bidiTrie. Total size: 16512 bytes (16.12 KiB). Checksum: 2a9cf1317f2ffaa. +type bidiTrie struct{} + +func newBidiTrie(i int) *bidiTrie { + return &bidiTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *bidiTrie) lookupValue(n uint32, b byte) uint8 { + switch { + default: + return uint8(bidiValues[n<<6+uint32(b)]) + } +} + +// bidiValues: 234 blocks, 14976 entries, 14976 bytes +// The third block is the zero block. +var bidiValues = [14976]uint8{ + // Block 0x0, offset 0x0 + 0x00: 0x000b, 0x01: 0x000b, 0x02: 0x000b, 0x03: 0x000b, 0x04: 0x000b, 0x05: 0x000b, + 0x06: 0x000b, 0x07: 0x000b, 0x08: 0x000b, 0x09: 0x0008, 0x0a: 0x0007, 0x0b: 0x0008, + 0x0c: 0x0009, 0x0d: 0x0007, 0x0e: 0x000b, 0x0f: 0x000b, 0x10: 0x000b, 0x11: 0x000b, + 0x12: 0x000b, 0x13: 0x000b, 0x14: 0x000b, 0x15: 0x000b, 0x16: 0x000b, 0x17: 0x000b, + 0x18: 0x000b, 0x19: 0x000b, 0x1a: 0x000b, 0x1b: 0x000b, 0x1c: 0x0007, 0x1d: 0x0007, + 0x1e: 0x0007, 0x1f: 0x0008, 0x20: 0x0009, 0x21: 0x000a, 0x22: 0x000a, 0x23: 0x0004, + 0x24: 0x0004, 0x25: 0x0004, 0x26: 0x000a, 0x27: 0x000a, 0x28: 0x003a, 0x29: 0x002a, + 0x2a: 0x000a, 0x2b: 0x0003, 0x2c: 0x0006, 0x2d: 0x0003, 0x2e: 0x0006, 0x2f: 0x0006, + 0x30: 0x0002, 0x31: 0x0002, 0x32: 0x0002, 0x33: 0x0002, 0x34: 0x0002, 0x35: 0x0002, + 0x36: 0x0002, 0x37: 0x0002, 0x38: 0x0002, 0x39: 0x0002, 0x3a: 0x0006, 0x3b: 0x000a, + 0x3c: 0x000a, 0x3d: 0x000a, 0x3e: 0x000a, 0x3f: 0x000a, + // Block 0x1, offset 0x40 + 0x40: 0x000a, + 0x5b: 0x005a, 0x5c: 0x000a, 0x5d: 0x004a, + 0x5e: 0x000a, 0x5f: 0x000a, 0x60: 0x000a, + 0x7b: 0x005a, + 0x7c: 0x000a, 0x7d: 0x004a, 0x7e: 0x000a, 0x7f: 0x000b, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x000b, 0xc1: 0x000b, 0xc2: 0x000b, 0xc3: 0x000b, 0xc4: 0x000b, 0xc5: 0x0007, + 0xc6: 0x000b, 0xc7: 0x000b, 0xc8: 0x000b, 0xc9: 0x000b, 0xca: 0x000b, 0xcb: 0x000b, + 0xcc: 0x000b, 0xcd: 0x000b, 0xce: 0x000b, 0xcf: 0x000b, 0xd0: 0x000b, 0xd1: 0x000b, + 0xd2: 0x000b, 0xd3: 0x000b, 0xd4: 0x000b, 0xd5: 0x000b, 0xd6: 0x000b, 0xd7: 0x000b, + 0xd8: 0x000b, 0xd9: 0x000b, 0xda: 0x000b, 0xdb: 0x000b, 0xdc: 0x000b, 0xdd: 0x000b, + 0xde: 0x000b, 0xdf: 0x000b, 0xe0: 0x0006, 0xe1: 0x000a, 0xe2: 0x0004, 0xe3: 0x0004, + 0xe4: 0x0004, 0xe5: 0x0004, 0xe6: 0x000a, 0xe7: 0x000a, 0xe8: 0x000a, 0xe9: 0x000a, + 0xeb: 0x000a, 0xec: 0x000a, 0xed: 0x000b, 0xee: 0x000a, 0xef: 0x000a, + 0xf0: 0x0004, 0xf1: 0x0004, 0xf2: 0x0002, 0xf3: 0x0002, 0xf4: 0x000a, + 0xf6: 0x000a, 0xf7: 0x000a, 0xf8: 0x000a, 0xf9: 0x0002, 0xfb: 0x000a, + 0xfc: 0x000a, 0xfd: 0x000a, 0xfe: 0x000a, 0xff: 0x000a, + // Block 0x4, offset 0x100 + 0x117: 0x000a, + 0x137: 0x000a, + // Block 0x5, offset 0x140 + 0x179: 0x000a, 0x17a: 0x000a, + // Block 0x6, offset 0x180 + 0x182: 0x000a, 0x183: 0x000a, 0x184: 0x000a, 0x185: 0x000a, + 0x186: 0x000a, 0x187: 0x000a, 0x188: 0x000a, 0x189: 0x000a, 0x18a: 0x000a, 0x18b: 0x000a, + 0x18c: 0x000a, 0x18d: 0x000a, 0x18e: 0x000a, 0x18f: 0x000a, + 0x192: 0x000a, 0x193: 0x000a, 0x194: 0x000a, 0x195: 0x000a, 0x196: 0x000a, 0x197: 0x000a, + 0x198: 0x000a, 0x199: 0x000a, 0x19a: 0x000a, 0x19b: 0x000a, 0x19c: 0x000a, 0x19d: 0x000a, + 0x19e: 0x000a, 0x19f: 0x000a, + 0x1a5: 0x000a, 0x1a6: 0x000a, 0x1a7: 0x000a, 0x1a8: 0x000a, 0x1a9: 0x000a, + 0x1aa: 0x000a, 0x1ab: 0x000a, 0x1ac: 0x000a, 0x1ad: 0x000a, 0x1af: 0x000a, + 0x1b0: 0x000a, 0x1b1: 0x000a, 0x1b2: 0x000a, 0x1b3: 0x000a, 0x1b4: 0x000a, 0x1b5: 0x000a, + 0x1b6: 0x000a, 0x1b7: 0x000a, 0x1b8: 0x000a, 0x1b9: 0x000a, 0x1ba: 0x000a, 0x1bb: 0x000a, + 0x1bc: 0x000a, 0x1bd: 0x000a, 0x1be: 0x000a, 0x1bf: 0x000a, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x000c, 0x1c1: 0x000c, 0x1c2: 0x000c, 0x1c3: 0x000c, 0x1c4: 0x000c, 0x1c5: 0x000c, + 0x1c6: 0x000c, 0x1c7: 0x000c, 0x1c8: 0x000c, 0x1c9: 0x000c, 0x1ca: 0x000c, 0x1cb: 0x000c, + 0x1cc: 0x000c, 0x1cd: 0x000c, 0x1ce: 0x000c, 0x1cf: 0x000c, 0x1d0: 0x000c, 0x1d1: 0x000c, + 0x1d2: 0x000c, 0x1d3: 0x000c, 0x1d4: 0x000c, 0x1d5: 0x000c, 0x1d6: 0x000c, 0x1d7: 0x000c, + 0x1d8: 0x000c, 0x1d9: 0x000c, 0x1da: 0x000c, 0x1db: 0x000c, 0x1dc: 0x000c, 0x1dd: 0x000c, + 0x1de: 0x000c, 0x1df: 0x000c, 0x1e0: 0x000c, 0x1e1: 0x000c, 0x1e2: 0x000c, 0x1e3: 0x000c, + 0x1e4: 0x000c, 0x1e5: 0x000c, 0x1e6: 0x000c, 0x1e7: 0x000c, 0x1e8: 0x000c, 0x1e9: 0x000c, + 0x1ea: 0x000c, 0x1eb: 0x000c, 0x1ec: 0x000c, 0x1ed: 0x000c, 0x1ee: 0x000c, 0x1ef: 0x000c, + 0x1f0: 0x000c, 0x1f1: 0x000c, 0x1f2: 0x000c, 0x1f3: 0x000c, 0x1f4: 0x000c, 0x1f5: 0x000c, + 0x1f6: 0x000c, 0x1f7: 0x000c, 0x1f8: 0x000c, 0x1f9: 0x000c, 0x1fa: 0x000c, 0x1fb: 0x000c, + 0x1fc: 0x000c, 0x1fd: 0x000c, 0x1fe: 0x000c, 0x1ff: 0x000c, + // Block 0x8, offset 0x200 + 0x200: 0x000c, 0x201: 0x000c, 0x202: 0x000c, 0x203: 0x000c, 0x204: 0x000c, 0x205: 0x000c, + 0x206: 0x000c, 0x207: 0x000c, 0x208: 0x000c, 0x209: 0x000c, 0x20a: 0x000c, 0x20b: 0x000c, + 0x20c: 0x000c, 0x20d: 0x000c, 0x20e: 0x000c, 0x20f: 0x000c, 0x210: 0x000c, 0x211: 0x000c, + 0x212: 0x000c, 0x213: 0x000c, 0x214: 0x000c, 0x215: 0x000c, 0x216: 0x000c, 0x217: 0x000c, + 0x218: 0x000c, 0x219: 0x000c, 0x21a: 0x000c, 0x21b: 0x000c, 0x21c: 0x000c, 0x21d: 0x000c, + 0x21e: 0x000c, 0x21f: 0x000c, 0x220: 0x000c, 0x221: 0x000c, 0x222: 0x000c, 0x223: 0x000c, + 0x224: 0x000c, 0x225: 0x000c, 0x226: 0x000c, 0x227: 0x000c, 0x228: 0x000c, 0x229: 0x000c, + 0x22a: 0x000c, 0x22b: 0x000c, 0x22c: 0x000c, 0x22d: 0x000c, 0x22e: 0x000c, 0x22f: 0x000c, + 0x234: 0x000a, 0x235: 0x000a, + 0x23e: 0x000a, + // Block 0x9, offset 0x240 + 0x244: 0x000a, 0x245: 0x000a, + 0x247: 0x000a, + // Block 0xa, offset 0x280 + 0x2b6: 0x000a, + // Block 0xb, offset 0x2c0 + 0x2c3: 0x000c, 0x2c4: 0x000c, 0x2c5: 0x000c, + 0x2c6: 0x000c, 0x2c7: 0x000c, 0x2c8: 0x000c, 0x2c9: 0x000c, + // Block 0xc, offset 0x300 + 0x30a: 0x000a, + 0x30d: 0x000a, 0x30e: 0x000a, 0x30f: 0x0004, 0x310: 0x0001, 0x311: 0x000c, + 0x312: 0x000c, 0x313: 0x000c, 0x314: 0x000c, 0x315: 0x000c, 0x316: 0x000c, 0x317: 0x000c, + 0x318: 0x000c, 0x319: 0x000c, 0x31a: 0x000c, 0x31b: 0x000c, 0x31c: 0x000c, 0x31d: 0x000c, + 0x31e: 0x000c, 0x31f: 0x000c, 0x320: 0x000c, 0x321: 0x000c, 0x322: 0x000c, 0x323: 0x000c, + 0x324: 0x000c, 0x325: 0x000c, 0x326: 0x000c, 0x327: 0x000c, 0x328: 0x000c, 0x329: 0x000c, + 0x32a: 0x000c, 0x32b: 0x000c, 0x32c: 0x000c, 0x32d: 0x000c, 0x32e: 0x000c, 0x32f: 0x000c, + 0x330: 0x000c, 0x331: 0x000c, 0x332: 0x000c, 0x333: 0x000c, 0x334: 0x000c, 0x335: 0x000c, + 0x336: 0x000c, 0x337: 0x000c, 0x338: 0x000c, 0x339: 0x000c, 0x33a: 0x000c, 0x33b: 0x000c, + 0x33c: 0x000c, 0x33d: 0x000c, 0x33e: 0x0001, 0x33f: 0x000c, + // Block 0xd, offset 0x340 + 0x340: 0x0001, 0x341: 0x000c, 0x342: 0x000c, 0x343: 0x0001, 0x344: 0x000c, 0x345: 0x000c, + 0x346: 0x0001, 0x347: 0x000c, 0x348: 0x0001, 0x349: 0x0001, 0x34a: 0x0001, 0x34b: 0x0001, + 0x34c: 0x0001, 0x34d: 0x0001, 0x34e: 0x0001, 0x34f: 0x0001, 0x350: 0x0001, 0x351: 0x0001, + 0x352: 0x0001, 0x353: 0x0001, 0x354: 0x0001, 0x355: 0x0001, 0x356: 0x0001, 0x357: 0x0001, + 0x358: 0x0001, 0x359: 0x0001, 0x35a: 0x0001, 0x35b: 0x0001, 0x35c: 0x0001, 0x35d: 0x0001, + 0x35e: 0x0001, 0x35f: 0x0001, 0x360: 0x0001, 0x361: 0x0001, 0x362: 0x0001, 0x363: 0x0001, + 0x364: 0x0001, 0x365: 0x0001, 0x366: 0x0001, 0x367: 0x0001, 0x368: 0x0001, 0x369: 0x0001, + 0x36a: 0x0001, 0x36b: 0x0001, 0x36c: 0x0001, 0x36d: 0x0001, 0x36e: 0x0001, 0x36f: 0x0001, + 0x370: 0x0001, 0x371: 0x0001, 0x372: 0x0001, 0x373: 0x0001, 0x374: 0x0001, 0x375: 0x0001, + 0x376: 0x0001, 0x377: 0x0001, 0x378: 0x0001, 0x379: 0x0001, 0x37a: 0x0001, 0x37b: 0x0001, + 0x37c: 0x0001, 0x37d: 0x0001, 0x37e: 0x0001, 0x37f: 0x0001, + // Block 0xe, offset 0x380 + 0x380: 0x0005, 0x381: 0x0005, 0x382: 0x0005, 0x383: 0x0005, 0x384: 0x0005, 0x385: 0x0005, + 0x386: 0x000a, 0x387: 0x000a, 0x388: 0x000d, 0x389: 0x0004, 0x38a: 0x0004, 0x38b: 0x000d, + 0x38c: 0x0006, 0x38d: 0x000d, 0x38e: 0x000a, 0x38f: 0x000a, 0x390: 0x000c, 0x391: 0x000c, + 0x392: 0x000c, 0x393: 0x000c, 0x394: 0x000c, 0x395: 0x000c, 0x396: 0x000c, 0x397: 0x000c, + 0x398: 0x000c, 0x399: 0x000c, 0x39a: 0x000c, 0x39b: 0x000d, 0x39c: 0x000d, 0x39d: 0x000d, + 0x39e: 0x000d, 0x39f: 0x000d, 0x3a0: 0x000d, 0x3a1: 0x000d, 0x3a2: 0x000d, 0x3a3: 0x000d, + 0x3a4: 0x000d, 0x3a5: 0x000d, 0x3a6: 0x000d, 0x3a7: 0x000d, 0x3a8: 0x000d, 0x3a9: 0x000d, + 0x3aa: 0x000d, 0x3ab: 0x000d, 0x3ac: 0x000d, 0x3ad: 0x000d, 0x3ae: 0x000d, 0x3af: 0x000d, + 0x3b0: 0x000d, 0x3b1: 0x000d, 0x3b2: 0x000d, 0x3b3: 0x000d, 0x3b4: 0x000d, 0x3b5: 0x000d, + 0x3b6: 0x000d, 0x3b7: 0x000d, 0x3b8: 0x000d, 0x3b9: 0x000d, 0x3ba: 0x000d, 0x3bb: 0x000d, + 0x3bc: 0x000d, 0x3bd: 0x000d, 0x3be: 0x000d, 0x3bf: 0x000d, + // Block 0xf, offset 0x3c0 + 0x3c0: 0x000d, 0x3c1: 0x000d, 0x3c2: 0x000d, 0x3c3: 0x000d, 0x3c4: 0x000d, 0x3c5: 0x000d, + 0x3c6: 0x000d, 0x3c7: 0x000d, 0x3c8: 0x000d, 0x3c9: 0x000d, 0x3ca: 0x000d, 0x3cb: 0x000c, + 0x3cc: 0x000c, 0x3cd: 0x000c, 0x3ce: 0x000c, 0x3cf: 0x000c, 0x3d0: 0x000c, 0x3d1: 0x000c, + 0x3d2: 0x000c, 0x3d3: 0x000c, 0x3d4: 0x000c, 0x3d5: 0x000c, 0x3d6: 0x000c, 0x3d7: 0x000c, + 0x3d8: 0x000c, 0x3d9: 0x000c, 0x3da: 0x000c, 0x3db: 0x000c, 0x3dc: 0x000c, 0x3dd: 0x000c, + 0x3de: 0x000c, 0x3df: 0x000c, 0x3e0: 0x0005, 0x3e1: 0x0005, 0x3e2: 0x0005, 0x3e3: 0x0005, + 0x3e4: 0x0005, 0x3e5: 0x0005, 0x3e6: 0x0005, 0x3e7: 0x0005, 0x3e8: 0x0005, 0x3e9: 0x0005, + 0x3ea: 0x0004, 0x3eb: 0x0005, 0x3ec: 0x0005, 0x3ed: 0x000d, 0x3ee: 0x000d, 0x3ef: 0x000d, + 0x3f0: 0x000c, 0x3f1: 0x000d, 0x3f2: 0x000d, 0x3f3: 0x000d, 0x3f4: 0x000d, 0x3f5: 0x000d, + 0x3f6: 0x000d, 0x3f7: 0x000d, 0x3f8: 0x000d, 0x3f9: 0x000d, 0x3fa: 0x000d, 0x3fb: 0x000d, + 0x3fc: 0x000d, 0x3fd: 0x000d, 0x3fe: 0x000d, 0x3ff: 0x000d, + // Block 0x10, offset 0x400 + 0x400: 0x000d, 0x401: 0x000d, 0x402: 0x000d, 0x403: 0x000d, 0x404: 0x000d, 0x405: 0x000d, + 0x406: 0x000d, 0x407: 0x000d, 0x408: 0x000d, 0x409: 0x000d, 0x40a: 0x000d, 0x40b: 0x000d, + 0x40c: 0x000d, 0x40d: 0x000d, 0x40e: 0x000d, 0x40f: 0x000d, 0x410: 0x000d, 0x411: 0x000d, + 0x412: 0x000d, 0x413: 0x000d, 0x414: 0x000d, 0x415: 0x000d, 0x416: 0x000d, 0x417: 0x000d, + 0x418: 0x000d, 0x419: 0x000d, 0x41a: 0x000d, 0x41b: 0x000d, 0x41c: 0x000d, 0x41d: 0x000d, + 0x41e: 0x000d, 0x41f: 0x000d, 0x420: 0x000d, 0x421: 0x000d, 0x422: 0x000d, 0x423: 0x000d, + 0x424: 0x000d, 0x425: 0x000d, 0x426: 0x000d, 0x427: 0x000d, 0x428: 0x000d, 0x429: 0x000d, + 0x42a: 0x000d, 0x42b: 0x000d, 0x42c: 0x000d, 0x42d: 0x000d, 0x42e: 0x000d, 0x42f: 0x000d, + 0x430: 0x000d, 0x431: 0x000d, 0x432: 0x000d, 0x433: 0x000d, 0x434: 0x000d, 0x435: 0x000d, + 0x436: 0x000d, 0x437: 0x000d, 0x438: 0x000d, 0x439: 0x000d, 0x43a: 0x000d, 0x43b: 0x000d, + 0x43c: 0x000d, 0x43d: 0x000d, 0x43e: 0x000d, 0x43f: 0x000d, + // Block 0x11, offset 0x440 + 0x440: 0x000d, 0x441: 0x000d, 0x442: 0x000d, 0x443: 0x000d, 0x444: 0x000d, 0x445: 0x000d, + 0x446: 0x000d, 0x447: 0x000d, 0x448: 0x000d, 0x449: 0x000d, 0x44a: 0x000d, 0x44b: 0x000d, + 0x44c: 0x000d, 0x44d: 0x000d, 0x44e: 0x000d, 0x44f: 0x000d, 0x450: 0x000d, 0x451: 0x000d, + 0x452: 0x000d, 0x453: 0x000d, 0x454: 0x000d, 0x455: 0x000d, 0x456: 0x000c, 0x457: 0x000c, + 0x458: 0x000c, 0x459: 0x000c, 0x45a: 0x000c, 0x45b: 0x000c, 0x45c: 0x000c, 0x45d: 0x0005, + 0x45e: 0x000a, 0x45f: 0x000c, 0x460: 0x000c, 0x461: 0x000c, 0x462: 0x000c, 0x463: 0x000c, + 0x464: 0x000c, 0x465: 0x000d, 0x466: 0x000d, 0x467: 0x000c, 0x468: 0x000c, 0x469: 0x000a, + 0x46a: 0x000c, 0x46b: 0x000c, 0x46c: 0x000c, 0x46d: 0x000c, 0x46e: 0x000d, 0x46f: 0x000d, + 0x470: 0x0002, 0x471: 0x0002, 0x472: 0x0002, 0x473: 0x0002, 0x474: 0x0002, 0x475: 0x0002, + 0x476: 0x0002, 0x477: 0x0002, 0x478: 0x0002, 0x479: 0x0002, 0x47a: 0x000d, 0x47b: 0x000d, + 0x47c: 0x000d, 0x47d: 0x000d, 0x47e: 0x000d, 0x47f: 0x000d, + // Block 0x12, offset 0x480 + 0x480: 0x000d, 0x481: 0x000d, 0x482: 0x000d, 0x483: 0x000d, 0x484: 0x000d, 0x485: 0x000d, + 0x486: 0x000d, 0x487: 0x000d, 0x488: 0x000d, 0x489: 0x000d, 0x48a: 0x000d, 0x48b: 0x000d, + 0x48c: 0x000d, 0x48d: 0x000d, 0x48e: 0x000d, 0x48f: 0x000d, 0x490: 0x000d, 0x491: 0x000c, + 0x492: 0x000d, 0x493: 0x000d, 0x494: 0x000d, 0x495: 0x000d, 0x496: 0x000d, 0x497: 0x000d, + 0x498: 0x000d, 0x499: 0x000d, 0x49a: 0x000d, 0x49b: 0x000d, 0x49c: 0x000d, 0x49d: 0x000d, + 0x49e: 0x000d, 0x49f: 0x000d, 0x4a0: 0x000d, 0x4a1: 0x000d, 0x4a2: 0x000d, 0x4a3: 0x000d, + 0x4a4: 0x000d, 0x4a5: 0x000d, 0x4a6: 0x000d, 0x4a7: 0x000d, 0x4a8: 0x000d, 0x4a9: 0x000d, + 0x4aa: 0x000d, 0x4ab: 0x000d, 0x4ac: 0x000d, 0x4ad: 0x000d, 0x4ae: 0x000d, 0x4af: 0x000d, + 0x4b0: 0x000c, 0x4b1: 0x000c, 0x4b2: 0x000c, 0x4b3: 0x000c, 0x4b4: 0x000c, 0x4b5: 0x000c, + 0x4b6: 0x000c, 0x4b7: 0x000c, 0x4b8: 0x000c, 0x4b9: 0x000c, 0x4ba: 0x000c, 0x4bb: 0x000c, + 0x4bc: 0x000c, 0x4bd: 0x000c, 0x4be: 0x000c, 0x4bf: 0x000c, + // Block 0x13, offset 0x4c0 + 0x4c0: 0x000c, 0x4c1: 0x000c, 0x4c2: 0x000c, 0x4c3: 0x000c, 0x4c4: 0x000c, 0x4c5: 0x000c, + 0x4c6: 0x000c, 0x4c7: 0x000c, 0x4c8: 0x000c, 0x4c9: 0x000c, 0x4ca: 0x000c, 0x4cb: 0x000d, + 0x4cc: 0x000d, 0x4cd: 0x000d, 0x4ce: 0x000d, 0x4cf: 0x000d, 0x4d0: 0x000d, 0x4d1: 0x000d, + 0x4d2: 0x000d, 0x4d3: 0x000d, 0x4d4: 0x000d, 0x4d5: 0x000d, 0x4d6: 0x000d, 0x4d7: 0x000d, + 0x4d8: 0x000d, 0x4d9: 0x000d, 0x4da: 0x000d, 0x4db: 0x000d, 0x4dc: 0x000d, 0x4dd: 0x000d, + 0x4de: 0x000d, 0x4df: 0x000d, 0x4e0: 0x000d, 0x4e1: 0x000d, 0x4e2: 0x000d, 0x4e3: 0x000d, + 0x4e4: 0x000d, 0x4e5: 0x000d, 0x4e6: 0x000d, 0x4e7: 0x000d, 0x4e8: 0x000d, 0x4e9: 0x000d, + 0x4ea: 0x000d, 0x4eb: 0x000d, 0x4ec: 0x000d, 0x4ed: 0x000d, 0x4ee: 0x000d, 0x4ef: 0x000d, + 0x4f0: 0x000d, 0x4f1: 0x000d, 0x4f2: 0x000d, 0x4f3: 0x000d, 0x4f4: 0x000d, 0x4f5: 0x000d, + 0x4f6: 0x000d, 0x4f7: 0x000d, 0x4f8: 0x000d, 0x4f9: 0x000d, 0x4fa: 0x000d, 0x4fb: 0x000d, + 0x4fc: 0x000d, 0x4fd: 0x000d, 0x4fe: 0x000d, 0x4ff: 0x000d, + // Block 0x14, offset 0x500 + 0x500: 0x000d, 0x501: 0x000d, 0x502: 0x000d, 0x503: 0x000d, 0x504: 0x000d, 0x505: 0x000d, + 0x506: 0x000d, 0x507: 0x000d, 0x508: 0x000d, 0x509: 0x000d, 0x50a: 0x000d, 0x50b: 0x000d, + 0x50c: 0x000d, 0x50d: 0x000d, 0x50e: 0x000d, 0x50f: 0x000d, 0x510: 0x000d, 0x511: 0x000d, + 0x512: 0x000d, 0x513: 0x000d, 0x514: 0x000d, 0x515: 0x000d, 0x516: 0x000d, 0x517: 0x000d, + 0x518: 0x000d, 0x519: 0x000d, 0x51a: 0x000d, 0x51b: 0x000d, 0x51c: 0x000d, 0x51d: 0x000d, + 0x51e: 0x000d, 0x51f: 0x000d, 0x520: 0x000d, 0x521: 0x000d, 0x522: 0x000d, 0x523: 0x000d, + 0x524: 0x000d, 0x525: 0x000d, 0x526: 0x000c, 0x527: 0x000c, 0x528: 0x000c, 0x529: 0x000c, + 0x52a: 0x000c, 0x52b: 0x000c, 0x52c: 0x000c, 0x52d: 0x000c, 0x52e: 0x000c, 0x52f: 0x000c, + 0x530: 0x000c, 0x531: 0x000d, 0x532: 0x000d, 0x533: 0x000d, 0x534: 0x000d, 0x535: 0x000d, + 0x536: 0x000d, 0x537: 0x000d, 0x538: 0x000d, 0x539: 0x000d, 0x53a: 0x000d, 0x53b: 0x000d, + 0x53c: 0x000d, 0x53d: 0x000d, 0x53e: 0x000d, 0x53f: 0x000d, + // Block 0x15, offset 0x540 + 0x540: 0x0001, 0x541: 0x0001, 0x542: 0x0001, 0x543: 0x0001, 0x544: 0x0001, 0x545: 0x0001, + 0x546: 0x0001, 0x547: 0x0001, 0x548: 0x0001, 0x549: 0x0001, 0x54a: 0x0001, 0x54b: 0x0001, + 0x54c: 0x0001, 0x54d: 0x0001, 0x54e: 0x0001, 0x54f: 0x0001, 0x550: 0x0001, 0x551: 0x0001, + 0x552: 0x0001, 0x553: 0x0001, 0x554: 0x0001, 0x555: 0x0001, 0x556: 0x0001, 0x557: 0x0001, + 0x558: 0x0001, 0x559: 0x0001, 0x55a: 0x0001, 0x55b: 0x0001, 0x55c: 0x0001, 0x55d: 0x0001, + 0x55e: 0x0001, 0x55f: 0x0001, 0x560: 0x0001, 0x561: 0x0001, 0x562: 0x0001, 0x563: 0x0001, + 0x564: 0x0001, 0x565: 0x0001, 0x566: 0x0001, 0x567: 0x0001, 0x568: 0x0001, 0x569: 0x0001, + 0x56a: 0x0001, 0x56b: 0x000c, 0x56c: 0x000c, 0x56d: 0x000c, 0x56e: 0x000c, 0x56f: 0x000c, + 0x570: 0x000c, 0x571: 0x000c, 0x572: 0x000c, 0x573: 0x000c, 0x574: 0x0001, 0x575: 0x0001, + 0x576: 0x000a, 0x577: 0x000a, 0x578: 0x000a, 0x579: 0x000a, 0x57a: 0x0001, 0x57b: 0x0001, + 0x57c: 0x0001, 0x57d: 0x000c, 0x57e: 0x0001, 0x57f: 0x0001, + // Block 0x16, offset 0x580 + 0x580: 0x0001, 0x581: 0x0001, 0x582: 0x0001, 0x583: 0x0001, 0x584: 0x0001, 0x585: 0x0001, + 0x586: 0x0001, 0x587: 0x0001, 0x588: 0x0001, 0x589: 0x0001, 0x58a: 0x0001, 0x58b: 0x0001, + 0x58c: 0x0001, 0x58d: 0x0001, 0x58e: 0x0001, 0x58f: 0x0001, 0x590: 0x0001, 0x591: 0x0001, + 0x592: 0x0001, 0x593: 0x0001, 0x594: 0x0001, 0x595: 0x0001, 0x596: 0x000c, 0x597: 0x000c, + 0x598: 0x000c, 0x599: 0x000c, 0x59a: 0x0001, 0x59b: 0x000c, 0x59c: 0x000c, 0x59d: 0x000c, + 0x59e: 0x000c, 0x59f: 0x000c, 0x5a0: 0x000c, 0x5a1: 0x000c, 0x5a2: 0x000c, 0x5a3: 0x000c, + 0x5a4: 0x0001, 0x5a5: 0x000c, 0x5a6: 0x000c, 0x5a7: 0x000c, 0x5a8: 0x0001, 0x5a9: 0x000c, + 0x5aa: 0x000c, 0x5ab: 0x000c, 0x5ac: 0x000c, 0x5ad: 0x000c, 0x5ae: 0x0001, 0x5af: 0x0001, + 0x5b0: 0x0001, 0x5b1: 0x0001, 0x5b2: 0x0001, 0x5b3: 0x0001, 0x5b4: 0x0001, 0x5b5: 0x0001, + 0x5b6: 0x0001, 0x5b7: 0x0001, 0x5b8: 0x0001, 0x5b9: 0x0001, 0x5ba: 0x0001, 0x5bb: 0x0001, + 0x5bc: 0x0001, 0x5bd: 0x0001, 0x5be: 0x0001, 0x5bf: 0x0001, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x0001, 0x5c1: 0x0001, 0x5c2: 0x0001, 0x5c3: 0x0001, 0x5c4: 0x0001, 0x5c5: 0x0001, + 0x5c6: 0x0001, 0x5c7: 0x0001, 0x5c8: 0x0001, 0x5c9: 0x0001, 0x5ca: 0x0001, 0x5cb: 0x0001, + 0x5cc: 0x0001, 0x5cd: 0x0001, 0x5ce: 0x0001, 0x5cf: 0x0001, 0x5d0: 0x0001, 0x5d1: 0x0001, + 0x5d2: 0x0001, 0x5d3: 0x0001, 0x5d4: 0x0001, 0x5d5: 0x0001, 0x5d6: 0x0001, 0x5d7: 0x0001, + 0x5d8: 0x0001, 0x5d9: 0x000c, 0x5da: 0x000c, 0x5db: 0x000c, 0x5dc: 0x0001, 0x5dd: 0x0001, + 0x5de: 0x0001, 0x5df: 0x0001, 0x5e0: 0x000d, 0x5e1: 0x000d, 0x5e2: 0x000d, 0x5e3: 0x000d, + 0x5e4: 0x000d, 0x5e5: 0x000d, 0x5e6: 0x000d, 0x5e7: 0x000d, 0x5e8: 0x000d, 0x5e9: 0x000d, + 0x5ea: 0x000d, 0x5eb: 0x000d, 0x5ec: 0x000d, 0x5ed: 0x000d, 0x5ee: 0x000d, 0x5ef: 0x000d, + 0x5f0: 0x0001, 0x5f1: 0x0001, 0x5f2: 0x0001, 0x5f3: 0x0001, 0x5f4: 0x0001, 0x5f5: 0x0001, + 0x5f6: 0x0001, 0x5f7: 0x0001, 0x5f8: 0x0001, 0x5f9: 0x0001, 0x5fa: 0x0001, 0x5fb: 0x0001, + 0x5fc: 0x0001, 0x5fd: 0x0001, 0x5fe: 0x0001, 0x5ff: 0x0001, + // Block 0x18, offset 0x600 + 0x600: 0x0001, 0x601: 0x0001, 0x602: 0x0001, 0x603: 0x0001, 0x604: 0x0001, 0x605: 0x0001, + 0x606: 0x0001, 0x607: 0x0001, 0x608: 0x0001, 0x609: 0x0001, 0x60a: 0x0001, 0x60b: 0x0001, + 0x60c: 0x0001, 0x60d: 0x0001, 0x60e: 0x0001, 0x60f: 0x0001, 0x610: 0x0001, 0x611: 0x0001, + 0x612: 0x0001, 0x613: 0x0001, 0x614: 0x0001, 0x615: 0x0001, 0x616: 0x0001, 0x617: 0x0001, + 0x618: 0x0001, 0x619: 0x0001, 0x61a: 0x0001, 0x61b: 0x0001, 0x61c: 0x0001, 0x61d: 0x0001, + 0x61e: 0x0001, 0x61f: 0x0001, 0x620: 0x000d, 0x621: 0x000d, 0x622: 0x000d, 0x623: 0x000d, + 0x624: 0x000d, 0x625: 0x000d, 0x626: 0x000d, 0x627: 0x000d, 0x628: 0x000d, 0x629: 0x000d, + 0x62a: 0x000d, 0x62b: 0x000d, 0x62c: 0x000d, 0x62d: 0x000d, 0x62e: 0x000d, 0x62f: 0x000d, + 0x630: 0x000d, 0x631: 0x000d, 0x632: 0x000d, 0x633: 0x000d, 0x634: 0x000d, 0x635: 0x000d, + 0x636: 0x000d, 0x637: 0x000d, 0x638: 0x000d, 0x639: 0x000d, 0x63a: 0x000d, 0x63b: 0x000d, + 0x63c: 0x000d, 0x63d: 0x000d, 0x63e: 0x000d, 0x63f: 0x000d, + // Block 0x19, offset 0x640 + 0x640: 0x000d, 0x641: 0x000d, 0x642: 0x000d, 0x643: 0x000d, 0x644: 0x000d, 0x645: 0x000d, + 0x646: 0x000d, 0x647: 0x000d, 0x648: 0x000d, 0x649: 0x000d, 0x64a: 0x000d, 0x64b: 0x000d, + 0x64c: 0x000d, 0x64d: 0x000d, 0x64e: 0x000d, 0x64f: 0x000d, 0x650: 0x000d, 0x651: 0x000d, + 0x652: 0x000d, 0x653: 0x000c, 0x654: 0x000c, 0x655: 0x000c, 0x656: 0x000c, 0x657: 0x000c, + 0x658: 0x000c, 0x659: 0x000c, 0x65a: 0x000c, 0x65b: 0x000c, 0x65c: 0x000c, 0x65d: 0x000c, + 0x65e: 0x000c, 0x65f: 0x000c, 0x660: 0x000c, 0x661: 0x000c, 0x662: 0x0005, 0x663: 0x000c, + 0x664: 0x000c, 0x665: 0x000c, 0x666: 0x000c, 0x667: 0x000c, 0x668: 0x000c, 0x669: 0x000c, + 0x66a: 0x000c, 0x66b: 0x000c, 0x66c: 0x000c, 0x66d: 0x000c, 0x66e: 0x000c, 0x66f: 0x000c, + 0x670: 0x000c, 0x671: 0x000c, 0x672: 0x000c, 0x673: 0x000c, 0x674: 0x000c, 0x675: 0x000c, + 0x676: 0x000c, 0x677: 0x000c, 0x678: 0x000c, 0x679: 0x000c, 0x67a: 0x000c, 0x67b: 0x000c, + 0x67c: 0x000c, 0x67d: 0x000c, 0x67e: 0x000c, 0x67f: 0x000c, + // Block 0x1a, offset 0x680 + 0x680: 0x000c, 0x681: 0x000c, 0x682: 0x000c, + 0x6ba: 0x000c, + 0x6bc: 0x000c, + // Block 0x1b, offset 0x6c0 + 0x6c1: 0x000c, 0x6c2: 0x000c, 0x6c3: 0x000c, 0x6c4: 0x000c, 0x6c5: 0x000c, + 0x6c6: 0x000c, 0x6c7: 0x000c, 0x6c8: 0x000c, + 0x6cd: 0x000c, 0x6d1: 0x000c, + 0x6d2: 0x000c, 0x6d3: 0x000c, 0x6d4: 0x000c, 0x6d5: 0x000c, 0x6d6: 0x000c, 0x6d7: 0x000c, + 0x6e2: 0x000c, 0x6e3: 0x000c, + // Block 0x1c, offset 0x700 + 0x701: 0x000c, + 0x73c: 0x000c, + // Block 0x1d, offset 0x740 + 0x741: 0x000c, 0x742: 0x000c, 0x743: 0x000c, 0x744: 0x000c, + 0x74d: 0x000c, + 0x762: 0x000c, 0x763: 0x000c, + 0x772: 0x0004, 0x773: 0x0004, + 0x77b: 0x0004, + 0x77e: 0x000c, + // Block 0x1e, offset 0x780 + 0x781: 0x000c, 0x782: 0x000c, + 0x7bc: 0x000c, + // Block 0x1f, offset 0x7c0 + 0x7c1: 0x000c, 0x7c2: 0x000c, + 0x7c7: 0x000c, 0x7c8: 0x000c, 0x7cb: 0x000c, + 0x7cc: 0x000c, 0x7cd: 0x000c, 0x7d1: 0x000c, + 0x7f0: 0x000c, 0x7f1: 0x000c, 0x7f5: 0x000c, + // Block 0x20, offset 0x800 + 0x801: 0x000c, 0x802: 0x000c, 0x803: 0x000c, 0x804: 0x000c, 0x805: 0x000c, + 0x807: 0x000c, 0x808: 0x000c, + 0x80d: 0x000c, + 0x822: 0x000c, 0x823: 0x000c, + 0x831: 0x0004, + 0x83a: 0x000c, 0x83b: 0x000c, + 0x83c: 0x000c, 0x83d: 0x000c, 0x83e: 0x000c, 0x83f: 0x000c, + // Block 0x21, offset 0x840 + 0x841: 0x000c, + 0x87c: 0x000c, 0x87f: 0x000c, + // Block 0x22, offset 0x880 + 0x881: 0x000c, 0x882: 0x000c, 0x883: 0x000c, 0x884: 0x000c, + 0x88d: 0x000c, + 0x896: 0x000c, + 0x8a2: 0x000c, 0x8a3: 0x000c, + // Block 0x23, offset 0x8c0 + 0x8c2: 0x000c, + // Block 0x24, offset 0x900 + 0x900: 0x000c, + 0x90d: 0x000c, + 0x933: 0x000a, 0x934: 0x000a, 0x935: 0x000a, + 0x936: 0x000a, 0x937: 0x000a, 0x938: 0x000a, 0x939: 0x0004, 0x93a: 0x000a, + // Block 0x25, offset 0x940 + 0x940: 0x000c, 0x944: 0x000c, + 0x97e: 0x000c, 0x97f: 0x000c, + // Block 0x26, offset 0x980 + 0x980: 0x000c, + 0x986: 0x000c, 0x987: 0x000c, 0x988: 0x000c, 0x98a: 0x000c, 0x98b: 0x000c, + 0x98c: 0x000c, 0x98d: 0x000c, + 0x995: 0x000c, 0x996: 0x000c, + 0x9a2: 0x000c, 0x9a3: 0x000c, + 0x9b8: 0x000a, 0x9b9: 0x000a, 0x9ba: 0x000a, 0x9bb: 0x000a, + 0x9bc: 0x000a, 0x9bd: 0x000a, 0x9be: 0x000a, + // Block 0x27, offset 0x9c0 + 0x9cc: 0x000c, 0x9cd: 0x000c, + 0x9e2: 0x000c, 0x9e3: 0x000c, + // Block 0x28, offset 0xa00 + 0xa00: 0x000c, 0xa01: 0x000c, + 0xa3b: 0x000c, + 0xa3c: 0x000c, + // Block 0x29, offset 0xa40 + 0xa41: 0x000c, 0xa42: 0x000c, 0xa43: 0x000c, 0xa44: 0x000c, + 0xa4d: 0x000c, + 0xa62: 0x000c, 0xa63: 0x000c, + // Block 0x2a, offset 0xa80 + 0xa8a: 0x000c, + 0xa92: 0x000c, 0xa93: 0x000c, 0xa94: 0x000c, 0xa96: 0x000c, + // Block 0x2b, offset 0xac0 + 0xaf1: 0x000c, 0xaf4: 0x000c, 0xaf5: 0x000c, + 0xaf6: 0x000c, 0xaf7: 0x000c, 0xaf8: 0x000c, 0xaf9: 0x000c, 0xafa: 0x000c, + 0xaff: 0x0004, + // Block 0x2c, offset 0xb00 + 0xb07: 0x000c, 0xb08: 0x000c, 0xb09: 0x000c, 0xb0a: 0x000c, 0xb0b: 0x000c, + 0xb0c: 0x000c, 0xb0d: 0x000c, 0xb0e: 0x000c, + // Block 0x2d, offset 0xb40 + 0xb71: 0x000c, 0xb74: 0x000c, 0xb75: 0x000c, + 0xb76: 0x000c, 0xb77: 0x000c, 0xb78: 0x000c, 0xb79: 0x000c, 0xb7b: 0x000c, + 0xb7c: 0x000c, + // Block 0x2e, offset 0xb80 + 0xb88: 0x000c, 0xb89: 0x000c, 0xb8a: 0x000c, 0xb8b: 0x000c, + 0xb8c: 0x000c, 0xb8d: 0x000c, + // Block 0x2f, offset 0xbc0 + 0xbd8: 0x000c, 0xbd9: 0x000c, + 0xbf5: 0x000c, + 0xbf7: 0x000c, 0xbf9: 0x000c, 0xbfa: 0x003a, 0xbfb: 0x002a, + 0xbfc: 0x003a, 0xbfd: 0x002a, + // Block 0x30, offset 0xc00 + 0xc31: 0x000c, 0xc32: 0x000c, 0xc33: 0x000c, 0xc34: 0x000c, 0xc35: 0x000c, + 0xc36: 0x000c, 0xc37: 0x000c, 0xc38: 0x000c, 0xc39: 0x000c, 0xc3a: 0x000c, 0xc3b: 0x000c, + 0xc3c: 0x000c, 0xc3d: 0x000c, 0xc3e: 0x000c, + // Block 0x31, offset 0xc40 + 0xc40: 0x000c, 0xc41: 0x000c, 0xc42: 0x000c, 0xc43: 0x000c, 0xc44: 0x000c, + 0xc46: 0x000c, 0xc47: 0x000c, + 0xc4d: 0x000c, 0xc4e: 0x000c, 0xc4f: 0x000c, 0xc50: 0x000c, 0xc51: 0x000c, + 0xc52: 0x000c, 0xc53: 0x000c, 0xc54: 0x000c, 0xc55: 0x000c, 0xc56: 0x000c, 0xc57: 0x000c, + 0xc59: 0x000c, 0xc5a: 0x000c, 0xc5b: 0x000c, 0xc5c: 0x000c, 0xc5d: 0x000c, + 0xc5e: 0x000c, 0xc5f: 0x000c, 0xc60: 0x000c, 0xc61: 0x000c, 0xc62: 0x000c, 0xc63: 0x000c, + 0xc64: 0x000c, 0xc65: 0x000c, 0xc66: 0x000c, 0xc67: 0x000c, 0xc68: 0x000c, 0xc69: 0x000c, + 0xc6a: 0x000c, 0xc6b: 0x000c, 0xc6c: 0x000c, 0xc6d: 0x000c, 0xc6e: 0x000c, 0xc6f: 0x000c, + 0xc70: 0x000c, 0xc71: 0x000c, 0xc72: 0x000c, 0xc73: 0x000c, 0xc74: 0x000c, 0xc75: 0x000c, + 0xc76: 0x000c, 0xc77: 0x000c, 0xc78: 0x000c, 0xc79: 0x000c, 0xc7a: 0x000c, 0xc7b: 0x000c, + 0xc7c: 0x000c, + // Block 0x32, offset 0xc80 + 0xc86: 0x000c, + // Block 0x33, offset 0xcc0 + 0xced: 0x000c, 0xcee: 0x000c, 0xcef: 0x000c, + 0xcf0: 0x000c, 0xcf2: 0x000c, 0xcf3: 0x000c, 0xcf4: 0x000c, 0xcf5: 0x000c, + 0xcf6: 0x000c, 0xcf7: 0x000c, 0xcf9: 0x000c, 0xcfa: 0x000c, + 0xcfd: 0x000c, 0xcfe: 0x000c, + // Block 0x34, offset 0xd00 + 0xd18: 0x000c, 0xd19: 0x000c, + 0xd1e: 0x000c, 0xd1f: 0x000c, 0xd20: 0x000c, + 0xd31: 0x000c, 0xd32: 0x000c, 0xd33: 0x000c, 0xd34: 0x000c, + // Block 0x35, offset 0xd40 + 0xd42: 0x000c, 0xd45: 0x000c, + 0xd46: 0x000c, + 0xd4d: 0x000c, + 0xd5d: 0x000c, + // Block 0x36, offset 0xd80 + 0xd9d: 0x000c, + 0xd9e: 0x000c, 0xd9f: 0x000c, + // Block 0x37, offset 0xdc0 + 0xdd0: 0x000a, 0xdd1: 0x000a, + 0xdd2: 0x000a, 0xdd3: 0x000a, 0xdd4: 0x000a, 0xdd5: 0x000a, 0xdd6: 0x000a, 0xdd7: 0x000a, + 0xdd8: 0x000a, 0xdd9: 0x000a, + // Block 0x38, offset 0xe00 + 0xe00: 0x000a, + // Block 0x39, offset 0xe40 + 0xe40: 0x0009, + 0xe5b: 0x007a, 0xe5c: 0x006a, + // Block 0x3a, offset 0xe80 + 0xe92: 0x000c, 0xe93: 0x000c, 0xe94: 0x000c, + 0xeb2: 0x000c, 0xeb3: 0x000c, 0xeb4: 0x000c, + // Block 0x3b, offset 0xec0 + 0xed2: 0x000c, 0xed3: 0x000c, + 0xef2: 0x000c, 0xef3: 0x000c, + // Block 0x3c, offset 0xf00 + 0xf34: 0x000c, 0xf35: 0x000c, + 0xf37: 0x000c, 0xf38: 0x000c, 0xf39: 0x000c, 0xf3a: 0x000c, 0xf3b: 0x000c, + 0xf3c: 0x000c, 0xf3d: 0x000c, + // Block 0x3d, offset 0xf40 + 0xf46: 0x000c, 0xf49: 0x000c, 0xf4a: 0x000c, 0xf4b: 0x000c, + 0xf4c: 0x000c, 0xf4d: 0x000c, 0xf4e: 0x000c, 0xf4f: 0x000c, 0xf50: 0x000c, 0xf51: 0x000c, + 0xf52: 0x000c, 0xf53: 0x000c, + 0xf5b: 0x0004, 0xf5d: 0x000c, + 0xf70: 0x000a, 0xf71: 0x000a, 0xf72: 0x000a, 0xf73: 0x000a, 0xf74: 0x000a, 0xf75: 0x000a, + 0xf76: 0x000a, 0xf77: 0x000a, 0xf78: 0x000a, 0xf79: 0x000a, + // Block 0x3e, offset 0xf80 + 0xf80: 0x000a, 0xf81: 0x000a, 0xf82: 0x000a, 0xf83: 0x000a, 0xf84: 0x000a, 0xf85: 0x000a, + 0xf86: 0x000a, 0xf87: 0x000a, 0xf88: 0x000a, 0xf89: 0x000a, 0xf8a: 0x000a, 0xf8b: 0x000c, + 0xf8c: 0x000c, 0xf8d: 0x000c, 0xf8e: 0x000b, + // Block 0x3f, offset 0xfc0 + 0xfc5: 0x000c, + 0xfc6: 0x000c, + 0xfe9: 0x000c, + // Block 0x40, offset 0x1000 + 0x1020: 0x000c, 0x1021: 0x000c, 0x1022: 0x000c, + 0x1027: 0x000c, 0x1028: 0x000c, + 0x1032: 0x000c, + 0x1039: 0x000c, 0x103a: 0x000c, 0x103b: 0x000c, + // Block 0x41, offset 0x1040 + 0x1040: 0x000a, 0x1044: 0x000a, 0x1045: 0x000a, + // Block 0x42, offset 0x1080 + 0x109e: 0x000a, 0x109f: 0x000a, 0x10a0: 0x000a, 0x10a1: 0x000a, 0x10a2: 0x000a, 0x10a3: 0x000a, + 0x10a4: 0x000a, 0x10a5: 0x000a, 0x10a6: 0x000a, 0x10a7: 0x000a, 0x10a8: 0x000a, 0x10a9: 0x000a, + 0x10aa: 0x000a, 0x10ab: 0x000a, 0x10ac: 0x000a, 0x10ad: 0x000a, 0x10ae: 0x000a, 0x10af: 0x000a, + 0x10b0: 0x000a, 0x10b1: 0x000a, 0x10b2: 0x000a, 0x10b3: 0x000a, 0x10b4: 0x000a, 0x10b5: 0x000a, + 0x10b6: 0x000a, 0x10b7: 0x000a, 0x10b8: 0x000a, 0x10b9: 0x000a, 0x10ba: 0x000a, 0x10bb: 0x000a, + 0x10bc: 0x000a, 0x10bd: 0x000a, 0x10be: 0x000a, 0x10bf: 0x000a, + // Block 0x43, offset 0x10c0 + 0x10d7: 0x000c, + 0x10d8: 0x000c, 0x10db: 0x000c, + // Block 0x44, offset 0x1100 + 0x1116: 0x000c, + 0x1118: 0x000c, 0x1119: 0x000c, 0x111a: 0x000c, 0x111b: 0x000c, 0x111c: 0x000c, 0x111d: 0x000c, + 0x111e: 0x000c, 0x1120: 0x000c, 0x1122: 0x000c, + 0x1125: 0x000c, 0x1126: 0x000c, 0x1127: 0x000c, 0x1128: 0x000c, 0x1129: 0x000c, + 0x112a: 0x000c, 0x112b: 0x000c, 0x112c: 0x000c, + 0x1133: 0x000c, 0x1134: 0x000c, 0x1135: 0x000c, + 0x1136: 0x000c, 0x1137: 0x000c, 0x1138: 0x000c, 0x1139: 0x000c, 0x113a: 0x000c, 0x113b: 0x000c, + 0x113c: 0x000c, 0x113f: 0x000c, + // Block 0x45, offset 0x1140 + 0x1170: 0x000c, 0x1171: 0x000c, 0x1172: 0x000c, 0x1173: 0x000c, 0x1174: 0x000c, 0x1175: 0x000c, + 0x1176: 0x000c, 0x1177: 0x000c, 0x1178: 0x000c, 0x1179: 0x000c, 0x117a: 0x000c, 0x117b: 0x000c, + 0x117c: 0x000c, 0x117d: 0x000c, 0x117e: 0x000c, + // Block 0x46, offset 0x1180 + 0x1180: 0x000c, 0x1181: 0x000c, 0x1182: 0x000c, 0x1183: 0x000c, + 0x11b4: 0x000c, + 0x11b6: 0x000c, 0x11b7: 0x000c, 0x11b8: 0x000c, 0x11b9: 0x000c, 0x11ba: 0x000c, + 0x11bc: 0x000c, + // Block 0x47, offset 0x11c0 + 0x11c2: 0x000c, + 0x11eb: 0x000c, 0x11ec: 0x000c, 0x11ed: 0x000c, 0x11ee: 0x000c, 0x11ef: 0x000c, + 0x11f0: 0x000c, 0x11f1: 0x000c, 0x11f2: 0x000c, 0x11f3: 0x000c, + // Block 0x48, offset 0x1200 + 0x1200: 0x000c, 0x1201: 0x000c, + 0x1222: 0x000c, 0x1223: 0x000c, + 0x1224: 0x000c, 0x1225: 0x000c, 0x1228: 0x000c, 0x1229: 0x000c, + 0x122b: 0x000c, 0x122c: 0x000c, 0x122d: 0x000c, + // Block 0x49, offset 0x1240 + 0x1266: 0x000c, 0x1268: 0x000c, 0x1269: 0x000c, + 0x126d: 0x000c, 0x126f: 0x000c, + 0x1270: 0x000c, 0x1271: 0x000c, + // Block 0x4a, offset 0x1280 + 0x12ac: 0x000c, 0x12ad: 0x000c, 0x12ae: 0x000c, 0x12af: 0x000c, + 0x12b0: 0x000c, 0x12b1: 0x000c, 0x12b2: 0x000c, 0x12b3: 0x000c, + 0x12b6: 0x000c, 0x12b7: 0x000c, + // Block 0x4b, offset 0x12c0 + 0x12d0: 0x000c, 0x12d1: 0x000c, + 0x12d2: 0x000c, 0x12d4: 0x000c, 0x12d5: 0x000c, 0x12d6: 0x000c, 0x12d7: 0x000c, + 0x12d8: 0x000c, 0x12d9: 0x000c, 0x12da: 0x000c, 0x12db: 0x000c, 0x12dc: 0x000c, 0x12dd: 0x000c, + 0x12de: 0x000c, 0x12df: 0x000c, 0x12e0: 0x000c, 0x12e2: 0x000c, 0x12e3: 0x000c, + 0x12e4: 0x000c, 0x12e5: 0x000c, 0x12e6: 0x000c, 0x12e7: 0x000c, 0x12e8: 0x000c, + 0x12ed: 0x000c, + 0x12f4: 0x000c, + 0x12f8: 0x000c, 0x12f9: 0x000c, + // Block 0x4c, offset 0x1300 + 0x1300: 0x000c, 0x1301: 0x000c, 0x1302: 0x000c, 0x1303: 0x000c, 0x1304: 0x000c, 0x1305: 0x000c, + 0x1306: 0x000c, 0x1307: 0x000c, 0x1308: 0x000c, 0x1309: 0x000c, 0x130a: 0x000c, 0x130b: 0x000c, + 0x130c: 0x000c, 0x130d: 0x000c, 0x130e: 0x000c, 0x130f: 0x000c, 0x1310: 0x000c, 0x1311: 0x000c, + 0x1312: 0x000c, 0x1313: 0x000c, 0x1314: 0x000c, 0x1315: 0x000c, 0x1316: 0x000c, 0x1317: 0x000c, + 0x1318: 0x000c, 0x1319: 0x000c, 0x131a: 0x000c, 0x131b: 0x000c, 0x131c: 0x000c, 0x131d: 0x000c, + 0x131e: 0x000c, 0x131f: 0x000c, 0x1320: 0x000c, 0x1321: 0x000c, 0x1322: 0x000c, 0x1323: 0x000c, + 0x1324: 0x000c, 0x1325: 0x000c, 0x1326: 0x000c, 0x1327: 0x000c, 0x1328: 0x000c, 0x1329: 0x000c, + 0x132a: 0x000c, 0x132b: 0x000c, 0x132c: 0x000c, 0x132d: 0x000c, 0x132e: 0x000c, 0x132f: 0x000c, + 0x1330: 0x000c, 0x1331: 0x000c, 0x1332: 0x000c, 0x1333: 0x000c, 0x1334: 0x000c, 0x1335: 0x000c, + 0x1336: 0x000c, 0x1337: 0x000c, 0x1338: 0x000c, 0x1339: 0x000c, 0x133b: 0x000c, + 0x133c: 0x000c, 0x133d: 0x000c, 0x133e: 0x000c, 0x133f: 0x000c, + // Block 0x4d, offset 0x1340 + 0x137d: 0x000a, 0x137f: 0x000a, + // Block 0x4e, offset 0x1380 + 0x1380: 0x000a, 0x1381: 0x000a, + 0x138d: 0x000a, 0x138e: 0x000a, 0x138f: 0x000a, + 0x139d: 0x000a, + 0x139e: 0x000a, 0x139f: 0x000a, + 0x13ad: 0x000a, 0x13ae: 0x000a, 0x13af: 0x000a, + 0x13bd: 0x000a, 0x13be: 0x000a, + // Block 0x4f, offset 0x13c0 + 0x13c0: 0x0009, 0x13c1: 0x0009, 0x13c2: 0x0009, 0x13c3: 0x0009, 0x13c4: 0x0009, 0x13c5: 0x0009, + 0x13c6: 0x0009, 0x13c7: 0x0009, 0x13c8: 0x0009, 0x13c9: 0x0009, 0x13ca: 0x0009, 0x13cb: 0x000b, + 0x13cc: 0x000b, 0x13cd: 0x000b, 0x13cf: 0x0001, 0x13d0: 0x000a, 0x13d1: 0x000a, + 0x13d2: 0x000a, 0x13d3: 0x000a, 0x13d4: 0x000a, 0x13d5: 0x000a, 0x13d6: 0x000a, 0x13d7: 0x000a, + 0x13d8: 0x000a, 0x13d9: 0x000a, 0x13da: 0x000a, 0x13db: 0x000a, 0x13dc: 0x000a, 0x13dd: 0x000a, + 0x13de: 0x000a, 0x13df: 0x000a, 0x13e0: 0x000a, 0x13e1: 0x000a, 0x13e2: 0x000a, 0x13e3: 0x000a, + 0x13e4: 0x000a, 0x13e5: 0x000a, 0x13e6: 0x000a, 0x13e7: 0x000a, 0x13e8: 0x0009, 0x13e9: 0x0007, + 0x13ea: 0x000e, 0x13eb: 0x000e, 0x13ec: 0x000e, 0x13ed: 0x000e, 0x13ee: 0x000e, 0x13ef: 0x0006, + 0x13f0: 0x0004, 0x13f1: 0x0004, 0x13f2: 0x0004, 0x13f3: 0x0004, 0x13f4: 0x0004, 0x13f5: 0x000a, + 0x13f6: 0x000a, 0x13f7: 0x000a, 0x13f8: 0x000a, 0x13f9: 0x000a, 0x13fa: 0x000a, 0x13fb: 0x000a, + 0x13fc: 0x000a, 0x13fd: 0x000a, 0x13fe: 0x000a, 0x13ff: 0x000a, + // Block 0x50, offset 0x1400 + 0x1400: 0x000a, 0x1401: 0x000a, 0x1402: 0x000a, 0x1403: 0x000a, 0x1404: 0x0006, 0x1405: 0x009a, + 0x1406: 0x008a, 0x1407: 0x000a, 0x1408: 0x000a, 0x1409: 0x000a, 0x140a: 0x000a, 0x140b: 0x000a, + 0x140c: 0x000a, 0x140d: 0x000a, 0x140e: 0x000a, 0x140f: 0x000a, 0x1410: 0x000a, 0x1411: 0x000a, + 0x1412: 0x000a, 0x1413: 0x000a, 0x1414: 0x000a, 0x1415: 0x000a, 0x1416: 0x000a, 0x1417: 0x000a, + 0x1418: 0x000a, 0x1419: 0x000a, 0x141a: 0x000a, 0x141b: 0x000a, 0x141c: 0x000a, 0x141d: 0x000a, + 0x141e: 0x000a, 0x141f: 0x0009, 0x1420: 0x000b, 0x1421: 0x000b, 0x1422: 0x000b, 0x1423: 0x000b, + 0x1424: 0x000b, 0x1425: 0x000b, 0x1426: 0x000e, 0x1427: 0x000e, 0x1428: 0x000e, 0x1429: 0x000e, + 0x142a: 0x000b, 0x142b: 0x000b, 0x142c: 0x000b, 0x142d: 0x000b, 0x142e: 0x000b, 0x142f: 0x000b, + 0x1430: 0x0002, 0x1434: 0x0002, 0x1435: 0x0002, + 0x1436: 0x0002, 0x1437: 0x0002, 0x1438: 0x0002, 0x1439: 0x0002, 0x143a: 0x0003, 0x143b: 0x0003, + 0x143c: 0x000a, 0x143d: 0x009a, 0x143e: 0x008a, + // Block 0x51, offset 0x1440 + 0x1440: 0x0002, 0x1441: 0x0002, 0x1442: 0x0002, 0x1443: 0x0002, 0x1444: 0x0002, 0x1445: 0x0002, + 0x1446: 0x0002, 0x1447: 0x0002, 0x1448: 0x0002, 0x1449: 0x0002, 0x144a: 0x0003, 0x144b: 0x0003, + 0x144c: 0x000a, 0x144d: 0x009a, 0x144e: 0x008a, + 0x1460: 0x0004, 0x1461: 0x0004, 0x1462: 0x0004, 0x1463: 0x0004, + 0x1464: 0x0004, 0x1465: 0x0004, 0x1466: 0x0004, 0x1467: 0x0004, 0x1468: 0x0004, 0x1469: 0x0004, + 0x146a: 0x0004, 0x146b: 0x0004, 0x146c: 0x0004, 0x146d: 0x0004, 0x146e: 0x0004, 0x146f: 0x0004, + 0x1470: 0x0004, 0x1471: 0x0004, 0x1472: 0x0004, 0x1473: 0x0004, 0x1474: 0x0004, 0x1475: 0x0004, + 0x1476: 0x0004, 0x1477: 0x0004, 0x1478: 0x0004, 0x1479: 0x0004, 0x147a: 0x0004, 0x147b: 0x0004, + 0x147c: 0x0004, 0x147d: 0x0004, 0x147e: 0x0004, 0x147f: 0x0004, + // Block 0x52, offset 0x1480 + 0x1480: 0x0004, 0x1481: 0x0004, 0x1482: 0x0004, 0x1483: 0x0004, 0x1484: 0x0004, 0x1485: 0x0004, + 0x1486: 0x0004, 0x1487: 0x0004, 0x1488: 0x0004, 0x1489: 0x0004, 0x148a: 0x0004, 0x148b: 0x0004, + 0x148c: 0x0004, 0x148d: 0x0004, 0x148e: 0x0004, 0x148f: 0x0004, 0x1490: 0x000c, 0x1491: 0x000c, + 0x1492: 0x000c, 0x1493: 0x000c, 0x1494: 0x000c, 0x1495: 0x000c, 0x1496: 0x000c, 0x1497: 0x000c, + 0x1498: 0x000c, 0x1499: 0x000c, 0x149a: 0x000c, 0x149b: 0x000c, 0x149c: 0x000c, 0x149d: 0x000c, + 0x149e: 0x000c, 0x149f: 0x000c, 0x14a0: 0x000c, 0x14a1: 0x000c, 0x14a2: 0x000c, 0x14a3: 0x000c, + 0x14a4: 0x000c, 0x14a5: 0x000c, 0x14a6: 0x000c, 0x14a7: 0x000c, 0x14a8: 0x000c, 0x14a9: 0x000c, + 0x14aa: 0x000c, 0x14ab: 0x000c, 0x14ac: 0x000c, 0x14ad: 0x000c, 0x14ae: 0x000c, 0x14af: 0x000c, + 0x14b0: 0x000c, + // Block 0x53, offset 0x14c0 + 0x14c0: 0x000a, 0x14c1: 0x000a, 0x14c3: 0x000a, 0x14c4: 0x000a, 0x14c5: 0x000a, + 0x14c6: 0x000a, 0x14c8: 0x000a, 0x14c9: 0x000a, + 0x14d4: 0x000a, 0x14d6: 0x000a, 0x14d7: 0x000a, + 0x14d8: 0x000a, + 0x14de: 0x000a, 0x14df: 0x000a, 0x14e0: 0x000a, 0x14e1: 0x000a, 0x14e2: 0x000a, 0x14e3: 0x000a, + 0x14e5: 0x000a, 0x14e7: 0x000a, 0x14e9: 0x000a, + 0x14ee: 0x0004, + 0x14fa: 0x000a, 0x14fb: 0x000a, + // Block 0x54, offset 0x1500 + 0x1500: 0x000a, 0x1501: 0x000a, 0x1502: 0x000a, 0x1503: 0x000a, 0x1504: 0x000a, + 0x150a: 0x000a, 0x150b: 0x000a, + 0x150c: 0x000a, 0x150d: 0x000a, 0x1510: 0x000a, 0x1511: 0x000a, + 0x1512: 0x000a, 0x1513: 0x000a, 0x1514: 0x000a, 0x1515: 0x000a, 0x1516: 0x000a, 0x1517: 0x000a, + 0x1518: 0x000a, 0x1519: 0x000a, 0x151a: 0x000a, 0x151b: 0x000a, 0x151c: 0x000a, 0x151d: 0x000a, + 0x151e: 0x000a, 0x151f: 0x000a, + // Block 0x55, offset 0x1540 + 0x1549: 0x000a, 0x154a: 0x000a, 0x154b: 0x000a, + 0x1550: 0x000a, 0x1551: 0x000a, + 0x1552: 0x000a, 0x1553: 0x000a, 0x1554: 0x000a, 0x1555: 0x000a, 0x1556: 0x000a, 0x1557: 0x000a, + 0x1558: 0x000a, 0x1559: 0x000a, 0x155a: 0x000a, 0x155b: 0x000a, 0x155c: 0x000a, 0x155d: 0x000a, + 0x155e: 0x000a, 0x155f: 0x000a, 0x1560: 0x000a, 0x1561: 0x000a, 0x1562: 0x000a, 0x1563: 0x000a, + 0x1564: 0x000a, 0x1565: 0x000a, 0x1566: 0x000a, 0x1567: 0x000a, 0x1568: 0x000a, 0x1569: 0x000a, + 0x156a: 0x000a, 0x156b: 0x000a, 0x156c: 0x000a, 0x156d: 0x000a, 0x156e: 0x000a, 0x156f: 0x000a, + 0x1570: 0x000a, 0x1571: 0x000a, 0x1572: 0x000a, 0x1573: 0x000a, 0x1574: 0x000a, 0x1575: 0x000a, + 0x1576: 0x000a, 0x1577: 0x000a, 0x1578: 0x000a, 0x1579: 0x000a, 0x157a: 0x000a, 0x157b: 0x000a, + 0x157c: 0x000a, 0x157d: 0x000a, 0x157e: 0x000a, 0x157f: 0x000a, + // Block 0x56, offset 0x1580 + 0x1580: 0x000a, 0x1581: 0x000a, 0x1582: 0x000a, 0x1583: 0x000a, 0x1584: 0x000a, 0x1585: 0x000a, + 0x1586: 0x000a, 0x1587: 0x000a, 0x1588: 0x000a, 0x1589: 0x000a, 0x158a: 0x000a, 0x158b: 0x000a, + 0x158c: 0x000a, 0x158d: 0x000a, 0x158e: 0x000a, 0x158f: 0x000a, 0x1590: 0x000a, 0x1591: 0x000a, + 0x1592: 0x000a, 0x1593: 0x000a, 0x1594: 0x000a, 0x1595: 0x000a, 0x1596: 0x000a, 0x1597: 0x000a, + 0x1598: 0x000a, 0x1599: 0x000a, 0x159a: 0x000a, 0x159b: 0x000a, 0x159c: 0x000a, 0x159d: 0x000a, + 0x159e: 0x000a, 0x159f: 0x000a, 0x15a0: 0x000a, 0x15a1: 0x000a, 0x15a2: 0x000a, 0x15a3: 0x000a, + 0x15a4: 0x000a, 0x15a5: 0x000a, 0x15a6: 0x000a, 0x15a7: 0x000a, 0x15a8: 0x000a, 0x15a9: 0x000a, + 0x15aa: 0x000a, 0x15ab: 0x000a, 0x15ac: 0x000a, 0x15ad: 0x000a, 0x15ae: 0x000a, 0x15af: 0x000a, + 0x15b0: 0x000a, 0x15b1: 0x000a, 0x15b2: 0x000a, 0x15b3: 0x000a, 0x15b4: 0x000a, 0x15b5: 0x000a, + 0x15b6: 0x000a, 0x15b7: 0x000a, 0x15b8: 0x000a, 0x15b9: 0x000a, 0x15ba: 0x000a, 0x15bb: 0x000a, + 0x15bc: 0x000a, 0x15bd: 0x000a, 0x15be: 0x000a, 0x15bf: 0x000a, + // Block 0x57, offset 0x15c0 + 0x15c0: 0x000a, 0x15c1: 0x000a, 0x15c2: 0x000a, 0x15c3: 0x000a, 0x15c4: 0x000a, 0x15c5: 0x000a, + 0x15c6: 0x000a, 0x15c7: 0x000a, 0x15c8: 0x000a, 0x15c9: 0x000a, 0x15ca: 0x000a, 0x15cb: 0x000a, + 0x15cc: 0x000a, 0x15cd: 0x000a, 0x15ce: 0x000a, 0x15cf: 0x000a, 0x15d0: 0x000a, 0x15d1: 0x000a, + 0x15d2: 0x0003, 0x15d3: 0x0004, 0x15d4: 0x000a, 0x15d5: 0x000a, 0x15d6: 0x000a, 0x15d7: 0x000a, + 0x15d8: 0x000a, 0x15d9: 0x000a, 0x15da: 0x000a, 0x15db: 0x000a, 0x15dc: 0x000a, 0x15dd: 0x000a, + 0x15de: 0x000a, 0x15df: 0x000a, 0x15e0: 0x000a, 0x15e1: 0x000a, 0x15e2: 0x000a, 0x15e3: 0x000a, + 0x15e4: 0x000a, 0x15e5: 0x000a, 0x15e6: 0x000a, 0x15e7: 0x000a, 0x15e8: 0x000a, 0x15e9: 0x000a, + 0x15ea: 0x000a, 0x15eb: 0x000a, 0x15ec: 0x000a, 0x15ed: 0x000a, 0x15ee: 0x000a, 0x15ef: 0x000a, + 0x15f0: 0x000a, 0x15f1: 0x000a, 0x15f2: 0x000a, 0x15f3: 0x000a, 0x15f4: 0x000a, 0x15f5: 0x000a, + 0x15f6: 0x000a, 0x15f7: 0x000a, 0x15f8: 0x000a, 0x15f9: 0x000a, 0x15fa: 0x000a, 0x15fb: 0x000a, + 0x15fc: 0x000a, 0x15fd: 0x000a, 0x15fe: 0x000a, 0x15ff: 0x000a, + // Block 0x58, offset 0x1600 + 0x1600: 0x000a, 0x1601: 0x000a, 0x1602: 0x000a, 0x1603: 0x000a, 0x1604: 0x000a, 0x1605: 0x000a, + 0x1606: 0x000a, 0x1607: 0x000a, 0x1608: 0x003a, 0x1609: 0x002a, 0x160a: 0x003a, 0x160b: 0x002a, + 0x160c: 0x000a, 0x160d: 0x000a, 0x160e: 0x000a, 0x160f: 0x000a, 0x1610: 0x000a, 0x1611: 0x000a, + 0x1612: 0x000a, 0x1613: 0x000a, 0x1614: 0x000a, 0x1615: 0x000a, 0x1616: 0x000a, 0x1617: 0x000a, + 0x1618: 0x000a, 0x1619: 0x000a, 0x161a: 0x000a, 0x161b: 0x000a, 0x161c: 0x000a, 0x161d: 0x000a, + 0x161e: 0x000a, 0x161f: 0x000a, 0x1620: 0x000a, 0x1621: 0x000a, 0x1622: 0x000a, 0x1623: 0x000a, + 0x1624: 0x000a, 0x1625: 0x000a, 0x1626: 0x000a, 0x1627: 0x000a, 0x1628: 0x000a, 0x1629: 0x009a, + 0x162a: 0x008a, 0x162b: 0x000a, 0x162c: 0x000a, 0x162d: 0x000a, 0x162e: 0x000a, 0x162f: 0x000a, + 0x1630: 0x000a, 0x1631: 0x000a, 0x1632: 0x000a, 0x1633: 0x000a, 0x1634: 0x000a, 0x1635: 0x000a, + // Block 0x59, offset 0x1640 + 0x167b: 0x000a, + 0x167c: 0x000a, 0x167d: 0x000a, 0x167e: 0x000a, 0x167f: 0x000a, + // Block 0x5a, offset 0x1680 + 0x1680: 0x000a, 0x1681: 0x000a, 0x1682: 0x000a, 0x1683: 0x000a, 0x1684: 0x000a, 0x1685: 0x000a, + 0x1686: 0x000a, 0x1687: 0x000a, 0x1688: 0x000a, 0x1689: 0x000a, 0x168a: 0x000a, 0x168b: 0x000a, + 0x168c: 0x000a, 0x168d: 0x000a, 0x168e: 0x000a, 0x168f: 0x000a, 0x1690: 0x000a, 0x1691: 0x000a, + 0x1692: 0x000a, 0x1693: 0x000a, 0x1694: 0x000a, 0x1696: 0x000a, 0x1697: 0x000a, + 0x1698: 0x000a, 0x1699: 0x000a, 0x169a: 0x000a, 0x169b: 0x000a, 0x169c: 0x000a, 0x169d: 0x000a, + 0x169e: 0x000a, 0x169f: 0x000a, 0x16a0: 0x000a, 0x16a1: 0x000a, 0x16a2: 0x000a, 0x16a3: 0x000a, + 0x16a4: 0x000a, 0x16a5: 0x000a, 0x16a6: 0x000a, 0x16a7: 0x000a, 0x16a8: 0x000a, 0x16a9: 0x000a, + 0x16aa: 0x000a, 0x16ab: 0x000a, 0x16ac: 0x000a, 0x16ad: 0x000a, 0x16ae: 0x000a, 0x16af: 0x000a, + 0x16b0: 0x000a, 0x16b1: 0x000a, 0x16b2: 0x000a, 0x16b3: 0x000a, 0x16b4: 0x000a, 0x16b5: 0x000a, + 0x16b6: 0x000a, 0x16b7: 0x000a, 0x16b8: 0x000a, 0x16b9: 0x000a, 0x16ba: 0x000a, 0x16bb: 0x000a, + 0x16bc: 0x000a, 0x16bd: 0x000a, 0x16be: 0x000a, 0x16bf: 0x000a, + // Block 0x5b, offset 0x16c0 + 0x16c0: 0x000a, 0x16c1: 0x000a, 0x16c2: 0x000a, 0x16c3: 0x000a, 0x16c4: 0x000a, 0x16c5: 0x000a, + 0x16c6: 0x000a, 0x16c7: 0x000a, 0x16c8: 0x000a, 0x16c9: 0x000a, 0x16ca: 0x000a, 0x16cb: 0x000a, + 0x16cc: 0x000a, 0x16cd: 0x000a, 0x16ce: 0x000a, 0x16cf: 0x000a, 0x16d0: 0x000a, 0x16d1: 0x000a, + 0x16d2: 0x000a, 0x16d3: 0x000a, 0x16d4: 0x000a, 0x16d5: 0x000a, 0x16d6: 0x000a, 0x16d7: 0x000a, + 0x16d8: 0x000a, 0x16d9: 0x000a, 0x16da: 0x000a, 0x16db: 0x000a, 0x16dc: 0x000a, 0x16dd: 0x000a, + 0x16de: 0x000a, 0x16df: 0x000a, 0x16e0: 0x000a, 0x16e1: 0x000a, 0x16e2: 0x000a, 0x16e3: 0x000a, + 0x16e4: 0x000a, 0x16e5: 0x000a, 0x16e6: 0x000a, + // Block 0x5c, offset 0x1700 + 0x1700: 0x000a, 0x1701: 0x000a, 0x1702: 0x000a, 0x1703: 0x000a, 0x1704: 0x000a, 0x1705: 0x000a, + 0x1706: 0x000a, 0x1707: 0x000a, 0x1708: 0x000a, 0x1709: 0x000a, 0x170a: 0x000a, + 0x1720: 0x000a, 0x1721: 0x000a, 0x1722: 0x000a, 0x1723: 0x000a, + 0x1724: 0x000a, 0x1725: 0x000a, 0x1726: 0x000a, 0x1727: 0x000a, 0x1728: 0x000a, 0x1729: 0x000a, + 0x172a: 0x000a, 0x172b: 0x000a, 0x172c: 0x000a, 0x172d: 0x000a, 0x172e: 0x000a, 0x172f: 0x000a, + 0x1730: 0x000a, 0x1731: 0x000a, 0x1732: 0x000a, 0x1733: 0x000a, 0x1734: 0x000a, 0x1735: 0x000a, + 0x1736: 0x000a, 0x1737: 0x000a, 0x1738: 0x000a, 0x1739: 0x000a, 0x173a: 0x000a, 0x173b: 0x000a, + 0x173c: 0x000a, 0x173d: 0x000a, 0x173e: 0x000a, 0x173f: 0x000a, + // Block 0x5d, offset 0x1740 + 0x1740: 0x000a, 0x1741: 0x000a, 0x1742: 0x000a, 0x1743: 0x000a, 0x1744: 0x000a, 0x1745: 0x000a, + 0x1746: 0x000a, 0x1747: 0x000a, 0x1748: 0x0002, 0x1749: 0x0002, 0x174a: 0x0002, 0x174b: 0x0002, + 0x174c: 0x0002, 0x174d: 0x0002, 0x174e: 0x0002, 0x174f: 0x0002, 0x1750: 0x0002, 0x1751: 0x0002, + 0x1752: 0x0002, 0x1753: 0x0002, 0x1754: 0x0002, 0x1755: 0x0002, 0x1756: 0x0002, 0x1757: 0x0002, + 0x1758: 0x0002, 0x1759: 0x0002, 0x175a: 0x0002, 0x175b: 0x0002, + // Block 0x5e, offset 0x1780 + 0x17aa: 0x000a, 0x17ab: 0x000a, 0x17ac: 0x000a, 0x17ad: 0x000a, 0x17ae: 0x000a, 0x17af: 0x000a, + 0x17b0: 0x000a, 0x17b1: 0x000a, 0x17b2: 0x000a, 0x17b3: 0x000a, 0x17b4: 0x000a, 0x17b5: 0x000a, + 0x17b6: 0x000a, 0x17b7: 0x000a, 0x17b8: 0x000a, 0x17b9: 0x000a, 0x17ba: 0x000a, 0x17bb: 0x000a, + 0x17bc: 0x000a, 0x17bd: 0x000a, 0x17be: 0x000a, 0x17bf: 0x000a, + // Block 0x5f, offset 0x17c0 + 0x17c0: 0x000a, 0x17c1: 0x000a, 0x17c2: 0x000a, 0x17c3: 0x000a, 0x17c4: 0x000a, 0x17c5: 0x000a, + 0x17c6: 0x000a, 0x17c7: 0x000a, 0x17c8: 0x000a, 0x17c9: 0x000a, 0x17ca: 0x000a, 0x17cb: 0x000a, + 0x17cc: 0x000a, 0x17cd: 0x000a, 0x17ce: 0x000a, 0x17cf: 0x000a, 0x17d0: 0x000a, 0x17d1: 0x000a, + 0x17d2: 0x000a, 0x17d3: 0x000a, 0x17d4: 0x000a, 0x17d5: 0x000a, 0x17d6: 0x000a, 0x17d7: 0x000a, + 0x17d8: 0x000a, 0x17d9: 0x000a, 0x17da: 0x000a, 0x17db: 0x000a, 0x17dc: 0x000a, 0x17dd: 0x000a, + 0x17de: 0x000a, 0x17df: 0x000a, 0x17e0: 0x000a, 0x17e1: 0x000a, 0x17e2: 0x000a, 0x17e3: 0x000a, + 0x17e4: 0x000a, 0x17e5: 0x000a, 0x17e6: 0x000a, 0x17e7: 0x000a, 0x17e8: 0x000a, 0x17e9: 0x000a, + 0x17ea: 0x000a, 0x17eb: 0x000a, 0x17ed: 0x000a, 0x17ee: 0x000a, 0x17ef: 0x000a, + 0x17f0: 0x000a, 0x17f1: 0x000a, 0x17f2: 0x000a, 0x17f3: 0x000a, 0x17f4: 0x000a, 0x17f5: 0x000a, + 0x17f6: 0x000a, 0x17f7: 0x000a, 0x17f8: 0x000a, 0x17f9: 0x000a, 0x17fa: 0x000a, 0x17fb: 0x000a, + 0x17fc: 0x000a, 0x17fd: 0x000a, 0x17fe: 0x000a, 0x17ff: 0x000a, + // Block 0x60, offset 0x1800 + 0x1800: 0x000a, 0x1801: 0x000a, 0x1802: 0x000a, 0x1803: 0x000a, 0x1804: 0x000a, 0x1805: 0x000a, + 0x1806: 0x000a, 0x1807: 0x000a, 0x1808: 0x000a, 0x1809: 0x000a, 0x180a: 0x000a, 0x180b: 0x000a, + 0x180c: 0x000a, 0x180d: 0x000a, 0x180e: 0x000a, 0x180f: 0x000a, 0x1810: 0x000a, 0x1811: 0x000a, + 0x1812: 0x000a, 0x1813: 0x000a, 0x1814: 0x000a, 0x1815: 0x000a, 0x1816: 0x000a, 0x1817: 0x000a, + 0x1818: 0x000a, 0x1819: 0x000a, 0x181a: 0x000a, 0x181b: 0x000a, 0x181c: 0x000a, 0x181d: 0x000a, + 0x181e: 0x000a, 0x181f: 0x000a, 0x1820: 0x000a, 0x1821: 0x000a, 0x1822: 0x000a, 0x1823: 0x000a, + 0x1824: 0x000a, 0x1825: 0x000a, 0x1826: 0x000a, 0x1827: 0x000a, 0x1828: 0x003a, 0x1829: 0x002a, + 0x182a: 0x003a, 0x182b: 0x002a, 0x182c: 0x003a, 0x182d: 0x002a, 0x182e: 0x003a, 0x182f: 0x002a, + 0x1830: 0x003a, 0x1831: 0x002a, 0x1832: 0x003a, 0x1833: 0x002a, 0x1834: 0x003a, 0x1835: 0x002a, + 0x1836: 0x000a, 0x1837: 0x000a, 0x1838: 0x000a, 0x1839: 0x000a, 0x183a: 0x000a, 0x183b: 0x000a, + 0x183c: 0x000a, 0x183d: 0x000a, 0x183e: 0x000a, 0x183f: 0x000a, + // Block 0x61, offset 0x1840 + 0x1840: 0x000a, 0x1841: 0x000a, 0x1842: 0x000a, 0x1843: 0x000a, 0x1844: 0x000a, 0x1845: 0x009a, + 0x1846: 0x008a, 0x1847: 0x000a, 0x1848: 0x000a, 0x1849: 0x000a, 0x184a: 0x000a, 0x184b: 0x000a, + 0x184c: 0x000a, 0x184d: 0x000a, 0x184e: 0x000a, 0x184f: 0x000a, 0x1850: 0x000a, 0x1851: 0x000a, + 0x1852: 0x000a, 0x1853: 0x000a, 0x1854: 0x000a, 0x1855: 0x000a, 0x1856: 0x000a, 0x1857: 0x000a, + 0x1858: 0x000a, 0x1859: 0x000a, 0x185a: 0x000a, 0x185b: 0x000a, 0x185c: 0x000a, 0x185d: 0x000a, + 0x185e: 0x000a, 0x185f: 0x000a, 0x1860: 0x000a, 0x1861: 0x000a, 0x1862: 0x000a, 0x1863: 0x000a, + 0x1864: 0x000a, 0x1865: 0x000a, 0x1866: 0x003a, 0x1867: 0x002a, 0x1868: 0x003a, 0x1869: 0x002a, + 0x186a: 0x003a, 0x186b: 0x002a, 0x186c: 0x003a, 0x186d: 0x002a, 0x186e: 0x003a, 0x186f: 0x002a, + 0x1870: 0x000a, 0x1871: 0x000a, 0x1872: 0x000a, 0x1873: 0x000a, 0x1874: 0x000a, 0x1875: 0x000a, + 0x1876: 0x000a, 0x1877: 0x000a, 0x1878: 0x000a, 0x1879: 0x000a, 0x187a: 0x000a, 0x187b: 0x000a, + 0x187c: 0x000a, 0x187d: 0x000a, 0x187e: 0x000a, 0x187f: 0x000a, + // Block 0x62, offset 0x1880 + 0x1880: 0x000a, 0x1881: 0x000a, 0x1882: 0x000a, 0x1883: 0x007a, 0x1884: 0x006a, 0x1885: 0x009a, + 0x1886: 0x008a, 0x1887: 0x00ba, 0x1888: 0x00aa, 0x1889: 0x009a, 0x188a: 0x008a, 0x188b: 0x007a, + 0x188c: 0x006a, 0x188d: 0x00da, 0x188e: 0x002a, 0x188f: 0x003a, 0x1890: 0x00ca, 0x1891: 0x009a, + 0x1892: 0x008a, 0x1893: 0x007a, 0x1894: 0x006a, 0x1895: 0x009a, 0x1896: 0x008a, 0x1897: 0x00ba, + 0x1898: 0x00aa, 0x1899: 0x000a, 0x189a: 0x000a, 0x189b: 0x000a, 0x189c: 0x000a, 0x189d: 0x000a, + 0x189e: 0x000a, 0x189f: 0x000a, 0x18a0: 0x000a, 0x18a1: 0x000a, 0x18a2: 0x000a, 0x18a3: 0x000a, + 0x18a4: 0x000a, 0x18a5: 0x000a, 0x18a6: 0x000a, 0x18a7: 0x000a, 0x18a8: 0x000a, 0x18a9: 0x000a, + 0x18aa: 0x000a, 0x18ab: 0x000a, 0x18ac: 0x000a, 0x18ad: 0x000a, 0x18ae: 0x000a, 0x18af: 0x000a, + 0x18b0: 0x000a, 0x18b1: 0x000a, 0x18b2: 0x000a, 0x18b3: 0x000a, 0x18b4: 0x000a, 0x18b5: 0x000a, + 0x18b6: 0x000a, 0x18b7: 0x000a, 0x18b8: 0x000a, 0x18b9: 0x000a, 0x18ba: 0x000a, 0x18bb: 0x000a, + 0x18bc: 0x000a, 0x18bd: 0x000a, 0x18be: 0x000a, 0x18bf: 0x000a, + // Block 0x63, offset 0x18c0 + 0x18c0: 0x000a, 0x18c1: 0x000a, 0x18c2: 0x000a, 0x18c3: 0x000a, 0x18c4: 0x000a, 0x18c5: 0x000a, + 0x18c6: 0x000a, 0x18c7: 0x000a, 0x18c8: 0x000a, 0x18c9: 0x000a, 0x18ca: 0x000a, 0x18cb: 0x000a, + 0x18cc: 0x000a, 0x18cd: 0x000a, 0x18ce: 0x000a, 0x18cf: 0x000a, 0x18d0: 0x000a, 0x18d1: 0x000a, + 0x18d2: 0x000a, 0x18d3: 0x000a, 0x18d4: 0x000a, 0x18d5: 0x000a, 0x18d6: 0x000a, 0x18d7: 0x000a, + 0x18d8: 0x003a, 0x18d9: 0x002a, 0x18da: 0x003a, 0x18db: 0x002a, 0x18dc: 0x000a, 0x18dd: 0x000a, + 0x18de: 0x000a, 0x18df: 0x000a, 0x18e0: 0x000a, 0x18e1: 0x000a, 0x18e2: 0x000a, 0x18e3: 0x000a, + 0x18e4: 0x000a, 0x18e5: 0x000a, 0x18e6: 0x000a, 0x18e7: 0x000a, 0x18e8: 0x000a, 0x18e9: 0x000a, + 0x18ea: 0x000a, 0x18eb: 0x000a, 0x18ec: 0x000a, 0x18ed: 0x000a, 0x18ee: 0x000a, 0x18ef: 0x000a, + 0x18f0: 0x000a, 0x18f1: 0x000a, 0x18f2: 0x000a, 0x18f3: 0x000a, 0x18f4: 0x000a, 0x18f5: 0x000a, + 0x18f6: 0x000a, 0x18f7: 0x000a, 0x18f8: 0x000a, 0x18f9: 0x000a, 0x18fa: 0x000a, 0x18fb: 0x000a, + 0x18fc: 0x003a, 0x18fd: 0x002a, 0x18fe: 0x000a, 0x18ff: 0x000a, + // Block 0x64, offset 0x1900 + 0x1900: 0x000a, 0x1901: 0x000a, 0x1902: 0x000a, 0x1903: 0x000a, 0x1904: 0x000a, 0x1905: 0x000a, + 0x1906: 0x000a, 0x1907: 0x000a, 0x1908: 0x000a, 0x1909: 0x000a, 0x190a: 0x000a, 0x190b: 0x000a, + 0x190c: 0x000a, 0x190d: 0x000a, 0x190e: 0x000a, 0x190f: 0x000a, 0x1910: 0x000a, 0x1911: 0x000a, + 0x1912: 0x000a, 0x1913: 0x000a, 0x1914: 0x000a, 0x1915: 0x000a, 0x1916: 0x000a, 0x1917: 0x000a, + 0x1918: 0x000a, 0x1919: 0x000a, 0x191a: 0x000a, 0x191b: 0x000a, 0x191c: 0x000a, 0x191d: 0x000a, + 0x191e: 0x000a, 0x191f: 0x000a, 0x1920: 0x000a, 0x1921: 0x000a, 0x1922: 0x000a, 0x1923: 0x000a, + 0x1924: 0x000a, 0x1925: 0x000a, 0x1926: 0x000a, 0x1927: 0x000a, 0x1928: 0x000a, 0x1929: 0x000a, + 0x192a: 0x000a, 0x192b: 0x000a, 0x192c: 0x000a, 0x192d: 0x000a, 0x192e: 0x000a, 0x192f: 0x000a, + 0x1930: 0x000a, 0x1931: 0x000a, 0x1932: 0x000a, 0x1933: 0x000a, + 0x1936: 0x000a, 0x1937: 0x000a, 0x1938: 0x000a, 0x1939: 0x000a, 0x193a: 0x000a, 0x193b: 0x000a, + 0x193c: 0x000a, 0x193d: 0x000a, 0x193e: 0x000a, 0x193f: 0x000a, + // Block 0x65, offset 0x1940 + 0x1940: 0x000a, 0x1941: 0x000a, 0x1942: 0x000a, 0x1943: 0x000a, 0x1944: 0x000a, 0x1945: 0x000a, + 0x1946: 0x000a, 0x1947: 0x000a, 0x1948: 0x000a, 0x1949: 0x000a, 0x194a: 0x000a, 0x194b: 0x000a, + 0x194c: 0x000a, 0x194d: 0x000a, 0x194e: 0x000a, 0x194f: 0x000a, 0x1950: 0x000a, 0x1951: 0x000a, + 0x1952: 0x000a, 0x1953: 0x000a, 0x1954: 0x000a, 0x1955: 0x000a, + 0x1958: 0x000a, 0x1959: 0x000a, 0x195a: 0x000a, 0x195b: 0x000a, 0x195c: 0x000a, 0x195d: 0x000a, + 0x195e: 0x000a, 0x195f: 0x000a, 0x1960: 0x000a, 0x1961: 0x000a, 0x1962: 0x000a, 0x1963: 0x000a, + 0x1964: 0x000a, 0x1965: 0x000a, 0x1966: 0x000a, 0x1967: 0x000a, 0x1968: 0x000a, 0x1969: 0x000a, + 0x196a: 0x000a, 0x196b: 0x000a, 0x196c: 0x000a, 0x196d: 0x000a, 0x196e: 0x000a, 0x196f: 0x000a, + 0x1970: 0x000a, 0x1971: 0x000a, 0x1972: 0x000a, 0x1973: 0x000a, 0x1974: 0x000a, 0x1975: 0x000a, + 0x1976: 0x000a, 0x1977: 0x000a, 0x1978: 0x000a, 0x1979: 0x000a, 0x197a: 0x000a, 0x197b: 0x000a, + 0x197c: 0x000a, 0x197d: 0x000a, 0x197e: 0x000a, 0x197f: 0x000a, + // Block 0x66, offset 0x1980 + 0x1980: 0x000a, 0x1981: 0x000a, 0x1982: 0x000a, 0x1983: 0x000a, 0x1984: 0x000a, 0x1985: 0x000a, + 0x1986: 0x000a, 0x1987: 0x000a, 0x1988: 0x000a, 0x198a: 0x000a, 0x198b: 0x000a, + 0x198c: 0x000a, 0x198d: 0x000a, 0x198e: 0x000a, 0x198f: 0x000a, 0x1990: 0x000a, 0x1991: 0x000a, + 0x1992: 0x000a, 0x1993: 0x000a, 0x1994: 0x000a, 0x1995: 0x000a, 0x1996: 0x000a, 0x1997: 0x000a, + 0x1998: 0x000a, 0x1999: 0x000a, 0x199a: 0x000a, 0x199b: 0x000a, 0x199c: 0x000a, 0x199d: 0x000a, + 0x199e: 0x000a, 0x199f: 0x000a, 0x19a0: 0x000a, 0x19a1: 0x000a, 0x19a2: 0x000a, 0x19a3: 0x000a, + 0x19a4: 0x000a, 0x19a5: 0x000a, 0x19a6: 0x000a, 0x19a7: 0x000a, 0x19a8: 0x000a, 0x19a9: 0x000a, + 0x19aa: 0x000a, 0x19ab: 0x000a, 0x19ac: 0x000a, 0x19ad: 0x000a, 0x19ae: 0x000a, 0x19af: 0x000a, + 0x19b0: 0x000a, 0x19b1: 0x000a, 0x19b2: 0x000a, 0x19b3: 0x000a, 0x19b4: 0x000a, 0x19b5: 0x000a, + 0x19b6: 0x000a, 0x19b7: 0x000a, 0x19b8: 0x000a, 0x19b9: 0x000a, 0x19ba: 0x000a, 0x19bb: 0x000a, + 0x19bc: 0x000a, 0x19bd: 0x000a, 0x19be: 0x000a, + // Block 0x67, offset 0x19c0 + 0x19e5: 0x000a, 0x19e6: 0x000a, 0x19e7: 0x000a, 0x19e8: 0x000a, 0x19e9: 0x000a, + 0x19ea: 0x000a, 0x19ef: 0x000c, + 0x19f0: 0x000c, 0x19f1: 0x000c, + 0x19f9: 0x000a, 0x19fa: 0x000a, 0x19fb: 0x000a, + 0x19fc: 0x000a, 0x19fd: 0x000a, 0x19fe: 0x000a, 0x19ff: 0x000a, + // Block 0x68, offset 0x1a00 + 0x1a3f: 0x000c, + // Block 0x69, offset 0x1a40 + 0x1a60: 0x000c, 0x1a61: 0x000c, 0x1a62: 0x000c, 0x1a63: 0x000c, + 0x1a64: 0x000c, 0x1a65: 0x000c, 0x1a66: 0x000c, 0x1a67: 0x000c, 0x1a68: 0x000c, 0x1a69: 0x000c, + 0x1a6a: 0x000c, 0x1a6b: 0x000c, 0x1a6c: 0x000c, 0x1a6d: 0x000c, 0x1a6e: 0x000c, 0x1a6f: 0x000c, + 0x1a70: 0x000c, 0x1a71: 0x000c, 0x1a72: 0x000c, 0x1a73: 0x000c, 0x1a74: 0x000c, 0x1a75: 0x000c, + 0x1a76: 0x000c, 0x1a77: 0x000c, 0x1a78: 0x000c, 0x1a79: 0x000c, 0x1a7a: 0x000c, 0x1a7b: 0x000c, + 0x1a7c: 0x000c, 0x1a7d: 0x000c, 0x1a7e: 0x000c, 0x1a7f: 0x000c, + // Block 0x6a, offset 0x1a80 + 0x1a80: 0x000a, 0x1a81: 0x000a, 0x1a82: 0x000a, 0x1a83: 0x000a, 0x1a84: 0x000a, 0x1a85: 0x000a, + 0x1a86: 0x000a, 0x1a87: 0x000a, 0x1a88: 0x000a, 0x1a89: 0x000a, 0x1a8a: 0x000a, 0x1a8b: 0x000a, + 0x1a8c: 0x000a, 0x1a8d: 0x000a, 0x1a8e: 0x000a, 0x1a8f: 0x000a, 0x1a90: 0x000a, 0x1a91: 0x000a, + 0x1a92: 0x000a, 0x1a93: 0x000a, 0x1a94: 0x000a, 0x1a95: 0x000a, 0x1a96: 0x000a, 0x1a97: 0x000a, + 0x1a98: 0x000a, 0x1a99: 0x000a, 0x1a9a: 0x000a, 0x1a9b: 0x000a, 0x1a9c: 0x000a, 0x1a9d: 0x000a, + 0x1a9e: 0x000a, 0x1a9f: 0x000a, 0x1aa0: 0x000a, 0x1aa1: 0x000a, 0x1aa2: 0x003a, 0x1aa3: 0x002a, + 0x1aa4: 0x003a, 0x1aa5: 0x002a, 0x1aa6: 0x003a, 0x1aa7: 0x002a, 0x1aa8: 0x003a, 0x1aa9: 0x002a, + 0x1aaa: 0x000a, 0x1aab: 0x000a, 0x1aac: 0x000a, 0x1aad: 0x000a, 0x1aae: 0x000a, 0x1aaf: 0x000a, + 0x1ab0: 0x000a, 0x1ab1: 0x000a, 0x1ab2: 0x000a, 0x1ab3: 0x000a, 0x1ab4: 0x000a, 0x1ab5: 0x000a, + 0x1ab6: 0x000a, 0x1ab7: 0x000a, 0x1ab8: 0x000a, 0x1ab9: 0x000a, 0x1aba: 0x000a, 0x1abb: 0x000a, + 0x1abc: 0x000a, 0x1abd: 0x000a, 0x1abe: 0x000a, 0x1abf: 0x000a, + // Block 0x6b, offset 0x1ac0 + 0x1ac0: 0x000a, 0x1ac1: 0x000a, 0x1ac2: 0x000a, 0x1ac3: 0x000a, 0x1ac4: 0x000a, 0x1ac5: 0x000a, + 0x1ac6: 0x000a, 0x1ac7: 0x000a, 0x1ac8: 0x000a, 0x1ac9: 0x000a, 0x1aca: 0x000a, 0x1acb: 0x000a, + 0x1acc: 0x000a, 0x1acd: 0x000a, 0x1ace: 0x000a, + // Block 0x6c, offset 0x1b00 + 0x1b00: 0x000a, 0x1b01: 0x000a, 0x1b02: 0x000a, 0x1b03: 0x000a, 0x1b04: 0x000a, 0x1b05: 0x000a, + 0x1b06: 0x000a, 0x1b07: 0x000a, 0x1b08: 0x000a, 0x1b09: 0x000a, 0x1b0a: 0x000a, 0x1b0b: 0x000a, + 0x1b0c: 0x000a, 0x1b0d: 0x000a, 0x1b0e: 0x000a, 0x1b0f: 0x000a, 0x1b10: 0x000a, 0x1b11: 0x000a, + 0x1b12: 0x000a, 0x1b13: 0x000a, 0x1b14: 0x000a, 0x1b15: 0x000a, 0x1b16: 0x000a, 0x1b17: 0x000a, + 0x1b18: 0x000a, 0x1b19: 0x000a, 0x1b1b: 0x000a, 0x1b1c: 0x000a, 0x1b1d: 0x000a, + 0x1b1e: 0x000a, 0x1b1f: 0x000a, 0x1b20: 0x000a, 0x1b21: 0x000a, 0x1b22: 0x000a, 0x1b23: 0x000a, + 0x1b24: 0x000a, 0x1b25: 0x000a, 0x1b26: 0x000a, 0x1b27: 0x000a, 0x1b28: 0x000a, 0x1b29: 0x000a, + 0x1b2a: 0x000a, 0x1b2b: 0x000a, 0x1b2c: 0x000a, 0x1b2d: 0x000a, 0x1b2e: 0x000a, 0x1b2f: 0x000a, + 0x1b30: 0x000a, 0x1b31: 0x000a, 0x1b32: 0x000a, 0x1b33: 0x000a, 0x1b34: 0x000a, 0x1b35: 0x000a, + 0x1b36: 0x000a, 0x1b37: 0x000a, 0x1b38: 0x000a, 0x1b39: 0x000a, 0x1b3a: 0x000a, 0x1b3b: 0x000a, + 0x1b3c: 0x000a, 0x1b3d: 0x000a, 0x1b3e: 0x000a, 0x1b3f: 0x000a, + // Block 0x6d, offset 0x1b40 + 0x1b40: 0x000a, 0x1b41: 0x000a, 0x1b42: 0x000a, 0x1b43: 0x000a, 0x1b44: 0x000a, 0x1b45: 0x000a, + 0x1b46: 0x000a, 0x1b47: 0x000a, 0x1b48: 0x000a, 0x1b49: 0x000a, 0x1b4a: 0x000a, 0x1b4b: 0x000a, + 0x1b4c: 0x000a, 0x1b4d: 0x000a, 0x1b4e: 0x000a, 0x1b4f: 0x000a, 0x1b50: 0x000a, 0x1b51: 0x000a, + 0x1b52: 0x000a, 0x1b53: 0x000a, 0x1b54: 0x000a, 0x1b55: 0x000a, 0x1b56: 0x000a, 0x1b57: 0x000a, + 0x1b58: 0x000a, 0x1b59: 0x000a, 0x1b5a: 0x000a, 0x1b5b: 0x000a, 0x1b5c: 0x000a, 0x1b5d: 0x000a, + 0x1b5e: 0x000a, 0x1b5f: 0x000a, 0x1b60: 0x000a, 0x1b61: 0x000a, 0x1b62: 0x000a, 0x1b63: 0x000a, + 0x1b64: 0x000a, 0x1b65: 0x000a, 0x1b66: 0x000a, 0x1b67: 0x000a, 0x1b68: 0x000a, 0x1b69: 0x000a, + 0x1b6a: 0x000a, 0x1b6b: 0x000a, 0x1b6c: 0x000a, 0x1b6d: 0x000a, 0x1b6e: 0x000a, 0x1b6f: 0x000a, + 0x1b70: 0x000a, 0x1b71: 0x000a, 0x1b72: 0x000a, 0x1b73: 0x000a, + // Block 0x6e, offset 0x1b80 + 0x1b80: 0x000a, 0x1b81: 0x000a, 0x1b82: 0x000a, 0x1b83: 0x000a, 0x1b84: 0x000a, 0x1b85: 0x000a, + 0x1b86: 0x000a, 0x1b87: 0x000a, 0x1b88: 0x000a, 0x1b89: 0x000a, 0x1b8a: 0x000a, 0x1b8b: 0x000a, + 0x1b8c: 0x000a, 0x1b8d: 0x000a, 0x1b8e: 0x000a, 0x1b8f: 0x000a, 0x1b90: 0x000a, 0x1b91: 0x000a, + 0x1b92: 0x000a, 0x1b93: 0x000a, 0x1b94: 0x000a, 0x1b95: 0x000a, + 0x1bb0: 0x000a, 0x1bb1: 0x000a, 0x1bb2: 0x000a, 0x1bb3: 0x000a, 0x1bb4: 0x000a, 0x1bb5: 0x000a, + 0x1bb6: 0x000a, 0x1bb7: 0x000a, 0x1bb8: 0x000a, 0x1bb9: 0x000a, 0x1bba: 0x000a, 0x1bbb: 0x000a, + // Block 0x6f, offset 0x1bc0 + 0x1bc0: 0x0009, 0x1bc1: 0x000a, 0x1bc2: 0x000a, 0x1bc3: 0x000a, 0x1bc4: 0x000a, + 0x1bc8: 0x003a, 0x1bc9: 0x002a, 0x1bca: 0x003a, 0x1bcb: 0x002a, + 0x1bcc: 0x003a, 0x1bcd: 0x002a, 0x1bce: 0x003a, 0x1bcf: 0x002a, 0x1bd0: 0x003a, 0x1bd1: 0x002a, + 0x1bd2: 0x000a, 0x1bd3: 0x000a, 0x1bd4: 0x003a, 0x1bd5: 0x002a, 0x1bd6: 0x003a, 0x1bd7: 0x002a, + 0x1bd8: 0x003a, 0x1bd9: 0x002a, 0x1bda: 0x003a, 0x1bdb: 0x002a, 0x1bdc: 0x000a, 0x1bdd: 0x000a, + 0x1bde: 0x000a, 0x1bdf: 0x000a, 0x1be0: 0x000a, + 0x1bea: 0x000c, 0x1beb: 0x000c, 0x1bec: 0x000c, 0x1bed: 0x000c, + 0x1bf0: 0x000a, + 0x1bf6: 0x000a, 0x1bf7: 0x000a, + 0x1bfd: 0x000a, 0x1bfe: 0x000a, 0x1bff: 0x000a, + // Block 0x70, offset 0x1c00 + 0x1c19: 0x000c, 0x1c1a: 0x000c, 0x1c1b: 0x000a, 0x1c1c: 0x000a, + 0x1c20: 0x000a, + // Block 0x71, offset 0x1c40 + 0x1c7b: 0x000a, + // Block 0x72, offset 0x1c80 + 0x1c80: 0x000a, 0x1c81: 0x000a, 0x1c82: 0x000a, 0x1c83: 0x000a, 0x1c84: 0x000a, 0x1c85: 0x000a, + 0x1c86: 0x000a, 0x1c87: 0x000a, 0x1c88: 0x000a, 0x1c89: 0x000a, 0x1c8a: 0x000a, 0x1c8b: 0x000a, + 0x1c8c: 0x000a, 0x1c8d: 0x000a, 0x1c8e: 0x000a, 0x1c8f: 0x000a, 0x1c90: 0x000a, 0x1c91: 0x000a, + 0x1c92: 0x000a, 0x1c93: 0x000a, 0x1c94: 0x000a, 0x1c95: 0x000a, 0x1c96: 0x000a, 0x1c97: 0x000a, + 0x1c98: 0x000a, 0x1c99: 0x000a, 0x1c9a: 0x000a, 0x1c9b: 0x000a, 0x1c9c: 0x000a, 0x1c9d: 0x000a, + 0x1c9e: 0x000a, 0x1c9f: 0x000a, 0x1ca0: 0x000a, 0x1ca1: 0x000a, 0x1ca2: 0x000a, 0x1ca3: 0x000a, + // Block 0x73, offset 0x1cc0 + 0x1cdd: 0x000a, + 0x1cde: 0x000a, + // Block 0x74, offset 0x1d00 + 0x1d10: 0x000a, 0x1d11: 0x000a, + 0x1d12: 0x000a, 0x1d13: 0x000a, 0x1d14: 0x000a, 0x1d15: 0x000a, 0x1d16: 0x000a, 0x1d17: 0x000a, + 0x1d18: 0x000a, 0x1d19: 0x000a, 0x1d1a: 0x000a, 0x1d1b: 0x000a, 0x1d1c: 0x000a, 0x1d1d: 0x000a, + 0x1d1e: 0x000a, 0x1d1f: 0x000a, + 0x1d3c: 0x000a, 0x1d3d: 0x000a, 0x1d3e: 0x000a, + // Block 0x75, offset 0x1d40 + 0x1d71: 0x000a, 0x1d72: 0x000a, 0x1d73: 0x000a, 0x1d74: 0x000a, 0x1d75: 0x000a, + 0x1d76: 0x000a, 0x1d77: 0x000a, 0x1d78: 0x000a, 0x1d79: 0x000a, 0x1d7a: 0x000a, 0x1d7b: 0x000a, + 0x1d7c: 0x000a, 0x1d7d: 0x000a, 0x1d7e: 0x000a, 0x1d7f: 0x000a, + // Block 0x76, offset 0x1d80 + 0x1d8c: 0x000a, 0x1d8d: 0x000a, 0x1d8e: 0x000a, 0x1d8f: 0x000a, + // Block 0x77, offset 0x1dc0 + 0x1df7: 0x000a, 0x1df8: 0x000a, 0x1df9: 0x000a, 0x1dfa: 0x000a, + // Block 0x78, offset 0x1e00 + 0x1e1e: 0x000a, 0x1e1f: 0x000a, + 0x1e3f: 0x000a, + // Block 0x79, offset 0x1e40 + 0x1e50: 0x000a, 0x1e51: 0x000a, + 0x1e52: 0x000a, 0x1e53: 0x000a, 0x1e54: 0x000a, 0x1e55: 0x000a, 0x1e56: 0x000a, 0x1e57: 0x000a, + 0x1e58: 0x000a, 0x1e59: 0x000a, 0x1e5a: 0x000a, 0x1e5b: 0x000a, 0x1e5c: 0x000a, 0x1e5d: 0x000a, + 0x1e5e: 0x000a, 0x1e5f: 0x000a, 0x1e60: 0x000a, 0x1e61: 0x000a, 0x1e62: 0x000a, 0x1e63: 0x000a, + 0x1e64: 0x000a, 0x1e65: 0x000a, 0x1e66: 0x000a, 0x1e67: 0x000a, 0x1e68: 0x000a, 0x1e69: 0x000a, + 0x1e6a: 0x000a, 0x1e6b: 0x000a, 0x1e6c: 0x000a, 0x1e6d: 0x000a, 0x1e6e: 0x000a, 0x1e6f: 0x000a, + 0x1e70: 0x000a, 0x1e71: 0x000a, 0x1e72: 0x000a, 0x1e73: 0x000a, 0x1e74: 0x000a, 0x1e75: 0x000a, + 0x1e76: 0x000a, 0x1e77: 0x000a, 0x1e78: 0x000a, 0x1e79: 0x000a, 0x1e7a: 0x000a, 0x1e7b: 0x000a, + 0x1e7c: 0x000a, 0x1e7d: 0x000a, 0x1e7e: 0x000a, 0x1e7f: 0x000a, + // Block 0x7a, offset 0x1e80 + 0x1e80: 0x000a, 0x1e81: 0x000a, 0x1e82: 0x000a, 0x1e83: 0x000a, 0x1e84: 0x000a, 0x1e85: 0x000a, + 0x1e86: 0x000a, + // Block 0x7b, offset 0x1ec0 + 0x1ecd: 0x000a, 0x1ece: 0x000a, 0x1ecf: 0x000a, + // Block 0x7c, offset 0x1f00 + 0x1f2f: 0x000c, + 0x1f30: 0x000c, 0x1f31: 0x000c, 0x1f32: 0x000c, 0x1f33: 0x000a, 0x1f34: 0x000c, 0x1f35: 0x000c, + 0x1f36: 0x000c, 0x1f37: 0x000c, 0x1f38: 0x000c, 0x1f39: 0x000c, 0x1f3a: 0x000c, 0x1f3b: 0x000c, + 0x1f3c: 0x000c, 0x1f3d: 0x000c, 0x1f3e: 0x000a, 0x1f3f: 0x000a, + // Block 0x7d, offset 0x1f40 + 0x1f5e: 0x000c, 0x1f5f: 0x000c, + // Block 0x7e, offset 0x1f80 + 0x1fb0: 0x000c, 0x1fb1: 0x000c, + // Block 0x7f, offset 0x1fc0 + 0x1fc0: 0x000a, 0x1fc1: 0x000a, 0x1fc2: 0x000a, 0x1fc3: 0x000a, 0x1fc4: 0x000a, 0x1fc5: 0x000a, + 0x1fc6: 0x000a, 0x1fc7: 0x000a, 0x1fc8: 0x000a, 0x1fc9: 0x000a, 0x1fca: 0x000a, 0x1fcb: 0x000a, + 0x1fcc: 0x000a, 0x1fcd: 0x000a, 0x1fce: 0x000a, 0x1fcf: 0x000a, 0x1fd0: 0x000a, 0x1fd1: 0x000a, + 0x1fd2: 0x000a, 0x1fd3: 0x000a, 0x1fd4: 0x000a, 0x1fd5: 0x000a, 0x1fd6: 0x000a, 0x1fd7: 0x000a, + 0x1fd8: 0x000a, 0x1fd9: 0x000a, 0x1fda: 0x000a, 0x1fdb: 0x000a, 0x1fdc: 0x000a, 0x1fdd: 0x000a, + 0x1fde: 0x000a, 0x1fdf: 0x000a, 0x1fe0: 0x000a, 0x1fe1: 0x000a, + // Block 0x80, offset 0x2000 + 0x2008: 0x000a, + // Block 0x81, offset 0x2040 + 0x2042: 0x000c, + 0x2046: 0x000c, 0x204b: 0x000c, + 0x2065: 0x000c, 0x2066: 0x000c, 0x2068: 0x000a, 0x2069: 0x000a, + 0x206a: 0x000a, 0x206b: 0x000a, + 0x2078: 0x0004, 0x2079: 0x0004, + // Block 0x82, offset 0x2080 + 0x20b4: 0x000a, 0x20b5: 0x000a, + 0x20b6: 0x000a, 0x20b7: 0x000a, + // Block 0x83, offset 0x20c0 + 0x20c4: 0x000c, 0x20c5: 0x000c, + 0x20e0: 0x000c, 0x20e1: 0x000c, 0x20e2: 0x000c, 0x20e3: 0x000c, + 0x20e4: 0x000c, 0x20e5: 0x000c, 0x20e6: 0x000c, 0x20e7: 0x000c, 0x20e8: 0x000c, 0x20e9: 0x000c, + 0x20ea: 0x000c, 0x20eb: 0x000c, 0x20ec: 0x000c, 0x20ed: 0x000c, 0x20ee: 0x000c, 0x20ef: 0x000c, + 0x20f0: 0x000c, 0x20f1: 0x000c, + 0x20ff: 0x000c, + // Block 0x84, offset 0x2100 + 0x2126: 0x000c, 0x2127: 0x000c, 0x2128: 0x000c, 0x2129: 0x000c, + 0x212a: 0x000c, 0x212b: 0x000c, 0x212c: 0x000c, 0x212d: 0x000c, + // Block 0x85, offset 0x2140 + 0x2147: 0x000c, 0x2148: 0x000c, 0x2149: 0x000c, 0x214a: 0x000c, 0x214b: 0x000c, + 0x214c: 0x000c, 0x214d: 0x000c, 0x214e: 0x000c, 0x214f: 0x000c, 0x2150: 0x000c, 0x2151: 0x000c, + // Block 0x86, offset 0x2180 + 0x2180: 0x000c, 0x2181: 0x000c, 0x2182: 0x000c, + 0x21b3: 0x000c, + 0x21b6: 0x000c, 0x21b7: 0x000c, 0x21b8: 0x000c, 0x21b9: 0x000c, + 0x21bc: 0x000c, + // Block 0x87, offset 0x21c0 + 0x21e5: 0x000c, + // Block 0x88, offset 0x2200 + 0x2229: 0x000c, + 0x222a: 0x000c, 0x222b: 0x000c, 0x222c: 0x000c, 0x222d: 0x000c, 0x222e: 0x000c, + 0x2231: 0x000c, 0x2232: 0x000c, 0x2235: 0x000c, + 0x2236: 0x000c, + // Block 0x89, offset 0x2240 + 0x2243: 0x000c, + 0x224c: 0x000c, + 0x227c: 0x000c, + // Block 0x8a, offset 0x2280 + 0x22b0: 0x000c, 0x22b2: 0x000c, 0x22b3: 0x000c, 0x22b4: 0x000c, + 0x22b7: 0x000c, 0x22b8: 0x000c, + 0x22be: 0x000c, 0x22bf: 0x000c, + // Block 0x8b, offset 0x22c0 + 0x22c1: 0x000c, + 0x22ec: 0x000c, 0x22ed: 0x000c, + 0x22f6: 0x000c, + // Block 0x8c, offset 0x2300 + 0x2325: 0x000c, 0x2328: 0x000c, + 0x232d: 0x000c, + // Block 0x8d, offset 0x2340 + 0x235d: 0x0001, + 0x235e: 0x000c, 0x235f: 0x0001, 0x2360: 0x0001, 0x2361: 0x0001, 0x2362: 0x0001, 0x2363: 0x0001, + 0x2364: 0x0001, 0x2365: 0x0001, 0x2366: 0x0001, 0x2367: 0x0001, 0x2368: 0x0001, 0x2369: 0x0003, + 0x236a: 0x0001, 0x236b: 0x0001, 0x236c: 0x0001, 0x236d: 0x0001, 0x236e: 0x0001, 0x236f: 0x0001, + 0x2370: 0x0001, 0x2371: 0x0001, 0x2372: 0x0001, 0x2373: 0x0001, 0x2374: 0x0001, 0x2375: 0x0001, + 0x2376: 0x0001, 0x2377: 0x0001, 0x2378: 0x0001, 0x2379: 0x0001, 0x237a: 0x0001, 0x237b: 0x0001, + 0x237c: 0x0001, 0x237d: 0x0001, 0x237e: 0x0001, 0x237f: 0x0001, + // Block 0x8e, offset 0x2380 + 0x2380: 0x0001, 0x2381: 0x0001, 0x2382: 0x0001, 0x2383: 0x0001, 0x2384: 0x0001, 0x2385: 0x0001, + 0x2386: 0x0001, 0x2387: 0x0001, 0x2388: 0x0001, 0x2389: 0x0001, 0x238a: 0x0001, 0x238b: 0x0001, + 0x238c: 0x0001, 0x238d: 0x0001, 0x238e: 0x0001, 0x238f: 0x0001, 0x2390: 0x000d, 0x2391: 0x000d, + 0x2392: 0x000d, 0x2393: 0x000d, 0x2394: 0x000d, 0x2395: 0x000d, 0x2396: 0x000d, 0x2397: 0x000d, + 0x2398: 0x000d, 0x2399: 0x000d, 0x239a: 0x000d, 0x239b: 0x000d, 0x239c: 0x000d, 0x239d: 0x000d, + 0x239e: 0x000d, 0x239f: 0x000d, 0x23a0: 0x000d, 0x23a1: 0x000d, 0x23a2: 0x000d, 0x23a3: 0x000d, + 0x23a4: 0x000d, 0x23a5: 0x000d, 0x23a6: 0x000d, 0x23a7: 0x000d, 0x23a8: 0x000d, 0x23a9: 0x000d, + 0x23aa: 0x000d, 0x23ab: 0x000d, 0x23ac: 0x000d, 0x23ad: 0x000d, 0x23ae: 0x000d, 0x23af: 0x000d, + 0x23b0: 0x000d, 0x23b1: 0x000d, 0x23b2: 0x000d, 0x23b3: 0x000d, 0x23b4: 0x000d, 0x23b5: 0x000d, + 0x23b6: 0x000d, 0x23b7: 0x000d, 0x23b8: 0x000d, 0x23b9: 0x000d, 0x23ba: 0x000d, 0x23bb: 0x000d, + 0x23bc: 0x000d, 0x23bd: 0x000d, 0x23be: 0x000d, 0x23bf: 0x000d, + // Block 0x8f, offset 0x23c0 + 0x23c0: 0x000d, 0x23c1: 0x000d, 0x23c2: 0x000d, 0x23c3: 0x000d, 0x23c4: 0x000d, 0x23c5: 0x000d, + 0x23c6: 0x000d, 0x23c7: 0x000d, 0x23c8: 0x000d, 0x23c9: 0x000d, 0x23ca: 0x000d, 0x23cb: 0x000d, + 0x23cc: 0x000d, 0x23cd: 0x000d, 0x23ce: 0x000d, 0x23cf: 0x000d, 0x23d0: 0x000d, 0x23d1: 0x000d, + 0x23d2: 0x000d, 0x23d3: 0x000d, 0x23d4: 0x000d, 0x23d5: 0x000d, 0x23d6: 0x000d, 0x23d7: 0x000d, + 0x23d8: 0x000d, 0x23d9: 0x000d, 0x23da: 0x000d, 0x23db: 0x000d, 0x23dc: 0x000d, 0x23dd: 0x000d, + 0x23de: 0x000d, 0x23df: 0x000d, 0x23e0: 0x000d, 0x23e1: 0x000d, 0x23e2: 0x000d, 0x23e3: 0x000d, + 0x23e4: 0x000d, 0x23e5: 0x000d, 0x23e6: 0x000d, 0x23e7: 0x000d, 0x23e8: 0x000d, 0x23e9: 0x000d, + 0x23ea: 0x000d, 0x23eb: 0x000d, 0x23ec: 0x000d, 0x23ed: 0x000d, 0x23ee: 0x000d, 0x23ef: 0x000d, + 0x23f0: 0x000d, 0x23f1: 0x000d, 0x23f2: 0x000d, 0x23f3: 0x000d, 0x23f4: 0x000d, 0x23f5: 0x000d, + 0x23f6: 0x000d, 0x23f7: 0x000d, 0x23f8: 0x000d, 0x23f9: 0x000d, 0x23fa: 0x000d, 0x23fb: 0x000d, + 0x23fc: 0x000d, 0x23fd: 0x000d, 0x23fe: 0x000a, 0x23ff: 0x000a, + // Block 0x90, offset 0x2400 + 0x2400: 0x000d, 0x2401: 0x000d, 0x2402: 0x000d, 0x2403: 0x000d, 0x2404: 0x000d, 0x2405: 0x000d, + 0x2406: 0x000d, 0x2407: 0x000d, 0x2408: 0x000d, 0x2409: 0x000d, 0x240a: 0x000d, 0x240b: 0x000d, + 0x240c: 0x000d, 0x240d: 0x000d, 0x240e: 0x000d, 0x240f: 0x000d, 0x2410: 0x000b, 0x2411: 0x000b, + 0x2412: 0x000b, 0x2413: 0x000b, 0x2414: 0x000b, 0x2415: 0x000b, 0x2416: 0x000b, 0x2417: 0x000b, + 0x2418: 0x000b, 0x2419: 0x000b, 0x241a: 0x000b, 0x241b: 0x000b, 0x241c: 0x000b, 0x241d: 0x000b, + 0x241e: 0x000b, 0x241f: 0x000b, 0x2420: 0x000b, 0x2421: 0x000b, 0x2422: 0x000b, 0x2423: 0x000b, + 0x2424: 0x000b, 0x2425: 0x000b, 0x2426: 0x000b, 0x2427: 0x000b, 0x2428: 0x000b, 0x2429: 0x000b, + 0x242a: 0x000b, 0x242b: 0x000b, 0x242c: 0x000b, 0x242d: 0x000b, 0x242e: 0x000b, 0x242f: 0x000b, + 0x2430: 0x000d, 0x2431: 0x000d, 0x2432: 0x000d, 0x2433: 0x000d, 0x2434: 0x000d, 0x2435: 0x000d, + 0x2436: 0x000d, 0x2437: 0x000d, 0x2438: 0x000d, 0x2439: 0x000d, 0x243a: 0x000d, 0x243b: 0x000d, + 0x243c: 0x000d, 0x243d: 0x000a, 0x243e: 0x000d, 0x243f: 0x000d, + // Block 0x91, offset 0x2440 + 0x2440: 0x000c, 0x2441: 0x000c, 0x2442: 0x000c, 0x2443: 0x000c, 0x2444: 0x000c, 0x2445: 0x000c, + 0x2446: 0x000c, 0x2447: 0x000c, 0x2448: 0x000c, 0x2449: 0x000c, 0x244a: 0x000c, 0x244b: 0x000c, + 0x244c: 0x000c, 0x244d: 0x000c, 0x244e: 0x000c, 0x244f: 0x000c, 0x2450: 0x000a, 0x2451: 0x000a, + 0x2452: 0x000a, 0x2453: 0x000a, 0x2454: 0x000a, 0x2455: 0x000a, 0x2456: 0x000a, 0x2457: 0x000a, + 0x2458: 0x000a, 0x2459: 0x000a, + 0x2460: 0x000c, 0x2461: 0x000c, 0x2462: 0x000c, 0x2463: 0x000c, + 0x2464: 0x000c, 0x2465: 0x000c, 0x2466: 0x000c, 0x2467: 0x000c, 0x2468: 0x000c, 0x2469: 0x000c, + 0x246a: 0x000c, 0x246b: 0x000c, 0x246c: 0x000c, 0x246d: 0x000c, 0x246e: 0x000c, 0x246f: 0x000c, + 0x2470: 0x000a, 0x2471: 0x000a, 0x2472: 0x000a, 0x2473: 0x000a, 0x2474: 0x000a, 0x2475: 0x000a, + 0x2476: 0x000a, 0x2477: 0x000a, 0x2478: 0x000a, 0x2479: 0x000a, 0x247a: 0x000a, 0x247b: 0x000a, + 0x247c: 0x000a, 0x247d: 0x000a, 0x247e: 0x000a, 0x247f: 0x000a, + // Block 0x92, offset 0x2480 + 0x2480: 0x000a, 0x2481: 0x000a, 0x2482: 0x000a, 0x2483: 0x000a, 0x2484: 0x000a, 0x2485: 0x000a, + 0x2486: 0x000a, 0x2487: 0x000a, 0x2488: 0x000a, 0x2489: 0x000a, 0x248a: 0x000a, 0x248b: 0x000a, + 0x248c: 0x000a, 0x248d: 0x000a, 0x248e: 0x000a, 0x248f: 0x000a, 0x2490: 0x0006, 0x2491: 0x000a, + 0x2492: 0x0006, 0x2494: 0x000a, 0x2495: 0x0006, 0x2496: 0x000a, 0x2497: 0x000a, + 0x2498: 0x000a, 0x2499: 0x009a, 0x249a: 0x008a, 0x249b: 0x007a, 0x249c: 0x006a, 0x249d: 0x009a, + 0x249e: 0x008a, 0x249f: 0x0004, 0x24a0: 0x000a, 0x24a1: 0x000a, 0x24a2: 0x0003, 0x24a3: 0x0003, + 0x24a4: 0x000a, 0x24a5: 0x000a, 0x24a6: 0x000a, 0x24a8: 0x000a, 0x24a9: 0x0004, + 0x24aa: 0x0004, 0x24ab: 0x000a, + 0x24b0: 0x000d, 0x24b1: 0x000d, 0x24b2: 0x000d, 0x24b3: 0x000d, 0x24b4: 0x000d, 0x24b5: 0x000d, + 0x24b6: 0x000d, 0x24b7: 0x000d, 0x24b8: 0x000d, 0x24b9: 0x000d, 0x24ba: 0x000d, 0x24bb: 0x000d, + 0x24bc: 0x000d, 0x24bd: 0x000d, 0x24be: 0x000d, 0x24bf: 0x000d, + // Block 0x93, offset 0x24c0 + 0x24c0: 0x000d, 0x24c1: 0x000d, 0x24c2: 0x000d, 0x24c3: 0x000d, 0x24c4: 0x000d, 0x24c5: 0x000d, + 0x24c6: 0x000d, 0x24c7: 0x000d, 0x24c8: 0x000d, 0x24c9: 0x000d, 0x24ca: 0x000d, 0x24cb: 0x000d, + 0x24cc: 0x000d, 0x24cd: 0x000d, 0x24ce: 0x000d, 0x24cf: 0x000d, 0x24d0: 0x000d, 0x24d1: 0x000d, + 0x24d2: 0x000d, 0x24d3: 0x000d, 0x24d4: 0x000d, 0x24d5: 0x000d, 0x24d6: 0x000d, 0x24d7: 0x000d, + 0x24d8: 0x000d, 0x24d9: 0x000d, 0x24da: 0x000d, 0x24db: 0x000d, 0x24dc: 0x000d, 0x24dd: 0x000d, + 0x24de: 0x000d, 0x24df: 0x000d, 0x24e0: 0x000d, 0x24e1: 0x000d, 0x24e2: 0x000d, 0x24e3: 0x000d, + 0x24e4: 0x000d, 0x24e5: 0x000d, 0x24e6: 0x000d, 0x24e7: 0x000d, 0x24e8: 0x000d, 0x24e9: 0x000d, + 0x24ea: 0x000d, 0x24eb: 0x000d, 0x24ec: 0x000d, 0x24ed: 0x000d, 0x24ee: 0x000d, 0x24ef: 0x000d, + 0x24f0: 0x000d, 0x24f1: 0x000d, 0x24f2: 0x000d, 0x24f3: 0x000d, 0x24f4: 0x000d, 0x24f5: 0x000d, + 0x24f6: 0x000d, 0x24f7: 0x000d, 0x24f8: 0x000d, 0x24f9: 0x000d, 0x24fa: 0x000d, 0x24fb: 0x000d, + 0x24fc: 0x000d, 0x24fd: 0x000d, 0x24fe: 0x000d, 0x24ff: 0x000b, + // Block 0x94, offset 0x2500 + 0x2501: 0x000a, 0x2502: 0x000a, 0x2503: 0x0004, 0x2504: 0x0004, 0x2505: 0x0004, + 0x2506: 0x000a, 0x2507: 0x000a, 0x2508: 0x003a, 0x2509: 0x002a, 0x250a: 0x000a, 0x250b: 0x0003, + 0x250c: 0x0006, 0x250d: 0x0003, 0x250e: 0x0006, 0x250f: 0x0006, 0x2510: 0x0002, 0x2511: 0x0002, + 0x2512: 0x0002, 0x2513: 0x0002, 0x2514: 0x0002, 0x2515: 0x0002, 0x2516: 0x0002, 0x2517: 0x0002, + 0x2518: 0x0002, 0x2519: 0x0002, 0x251a: 0x0006, 0x251b: 0x000a, 0x251c: 0x000a, 0x251d: 0x000a, + 0x251e: 0x000a, 0x251f: 0x000a, 0x2520: 0x000a, + 0x253b: 0x005a, + 0x253c: 0x000a, 0x253d: 0x004a, 0x253e: 0x000a, 0x253f: 0x000a, + // Block 0x95, offset 0x2540 + 0x2540: 0x000a, + 0x255b: 0x005a, 0x255c: 0x000a, 0x255d: 0x004a, + 0x255e: 0x000a, 0x255f: 0x00fa, 0x2560: 0x00ea, 0x2561: 0x000a, 0x2562: 0x003a, 0x2563: 0x002a, + 0x2564: 0x000a, 0x2565: 0x000a, + // Block 0x96, offset 0x2580 + 0x25a0: 0x0004, 0x25a1: 0x0004, 0x25a2: 0x000a, 0x25a3: 0x000a, + 0x25a4: 0x000a, 0x25a5: 0x0004, 0x25a6: 0x0004, 0x25a8: 0x000a, 0x25a9: 0x000a, + 0x25aa: 0x000a, 0x25ab: 0x000a, 0x25ac: 0x000a, 0x25ad: 0x000a, 0x25ae: 0x000a, + 0x25b0: 0x000b, 0x25b1: 0x000b, 0x25b2: 0x000b, 0x25b3: 0x000b, 0x25b4: 0x000b, 0x25b5: 0x000b, + 0x25b6: 0x000b, 0x25b7: 0x000b, 0x25b8: 0x000b, 0x25b9: 0x000a, 0x25ba: 0x000a, 0x25bb: 0x000a, + 0x25bc: 0x000a, 0x25bd: 0x000a, 0x25be: 0x000b, 0x25bf: 0x000b, + // Block 0x97, offset 0x25c0 + 0x25c1: 0x000a, + // Block 0x98, offset 0x2600 + 0x2600: 0x000a, 0x2601: 0x000a, 0x2602: 0x000a, 0x2603: 0x000a, 0x2604: 0x000a, 0x2605: 0x000a, + 0x2606: 0x000a, 0x2607: 0x000a, 0x2608: 0x000a, 0x2609: 0x000a, 0x260a: 0x000a, 0x260b: 0x000a, + 0x260c: 0x000a, 0x2610: 0x000a, 0x2611: 0x000a, + 0x2612: 0x000a, 0x2613: 0x000a, 0x2614: 0x000a, 0x2615: 0x000a, 0x2616: 0x000a, 0x2617: 0x000a, + 0x2618: 0x000a, 0x2619: 0x000a, 0x261a: 0x000a, 0x261b: 0x000a, + 0x2620: 0x000a, + // Block 0x99, offset 0x2640 + 0x267d: 0x000c, + // Block 0x9a, offset 0x2680 + 0x26a0: 0x000c, 0x26a1: 0x0002, 0x26a2: 0x0002, 0x26a3: 0x0002, + 0x26a4: 0x0002, 0x26a5: 0x0002, 0x26a6: 0x0002, 0x26a7: 0x0002, 0x26a8: 0x0002, 0x26a9: 0x0002, + 0x26aa: 0x0002, 0x26ab: 0x0002, 0x26ac: 0x0002, 0x26ad: 0x0002, 0x26ae: 0x0002, 0x26af: 0x0002, + 0x26b0: 0x0002, 0x26b1: 0x0002, 0x26b2: 0x0002, 0x26b3: 0x0002, 0x26b4: 0x0002, 0x26b5: 0x0002, + 0x26b6: 0x0002, 0x26b7: 0x0002, 0x26b8: 0x0002, 0x26b9: 0x0002, 0x26ba: 0x0002, 0x26bb: 0x0002, + // Block 0x9b, offset 0x26c0 + 0x26f6: 0x000c, 0x26f7: 0x000c, 0x26f8: 0x000c, 0x26f9: 0x000c, 0x26fa: 0x000c, + // Block 0x9c, offset 0x2700 + 0x2700: 0x0001, 0x2701: 0x0001, 0x2702: 0x0001, 0x2703: 0x0001, 0x2704: 0x0001, 0x2705: 0x0001, + 0x2706: 0x0001, 0x2707: 0x0001, 0x2708: 0x0001, 0x2709: 0x0001, 0x270a: 0x0001, 0x270b: 0x0001, + 0x270c: 0x0001, 0x270d: 0x0001, 0x270e: 0x0001, 0x270f: 0x0001, 0x2710: 0x0001, 0x2711: 0x0001, + 0x2712: 0x0001, 0x2713: 0x0001, 0x2714: 0x0001, 0x2715: 0x0001, 0x2716: 0x0001, 0x2717: 0x0001, + 0x2718: 0x0001, 0x2719: 0x0001, 0x271a: 0x0001, 0x271b: 0x0001, 0x271c: 0x0001, 0x271d: 0x0001, + 0x271e: 0x0001, 0x271f: 0x0001, 0x2720: 0x0001, 0x2721: 0x0001, 0x2722: 0x0001, 0x2723: 0x0001, + 0x2724: 0x0001, 0x2725: 0x0001, 0x2726: 0x0001, 0x2727: 0x0001, 0x2728: 0x0001, 0x2729: 0x0001, + 0x272a: 0x0001, 0x272b: 0x0001, 0x272c: 0x0001, 0x272d: 0x0001, 0x272e: 0x0001, 0x272f: 0x0001, + 0x2730: 0x0001, 0x2731: 0x0001, 0x2732: 0x0001, 0x2733: 0x0001, 0x2734: 0x0001, 0x2735: 0x0001, + 0x2736: 0x0001, 0x2737: 0x0001, 0x2738: 0x0001, 0x2739: 0x0001, 0x273a: 0x0001, 0x273b: 0x0001, + 0x273c: 0x0001, 0x273d: 0x0001, 0x273e: 0x0001, 0x273f: 0x0001, + // Block 0x9d, offset 0x2740 + 0x2740: 0x0001, 0x2741: 0x0001, 0x2742: 0x0001, 0x2743: 0x0001, 0x2744: 0x0001, 0x2745: 0x0001, + 0x2746: 0x0001, 0x2747: 0x0001, 0x2748: 0x0001, 0x2749: 0x0001, 0x274a: 0x0001, 0x274b: 0x0001, + 0x274c: 0x0001, 0x274d: 0x0001, 0x274e: 0x0001, 0x274f: 0x0001, 0x2750: 0x0001, 0x2751: 0x0001, + 0x2752: 0x0001, 0x2753: 0x0001, 0x2754: 0x0001, 0x2755: 0x0001, 0x2756: 0x0001, 0x2757: 0x0001, + 0x2758: 0x0001, 0x2759: 0x0001, 0x275a: 0x0001, 0x275b: 0x0001, 0x275c: 0x0001, 0x275d: 0x0001, + 0x275e: 0x0001, 0x275f: 0x000a, 0x2760: 0x0001, 0x2761: 0x0001, 0x2762: 0x0001, 0x2763: 0x0001, + 0x2764: 0x0001, 0x2765: 0x0001, 0x2766: 0x0001, 0x2767: 0x0001, 0x2768: 0x0001, 0x2769: 0x0001, + 0x276a: 0x0001, 0x276b: 0x0001, 0x276c: 0x0001, 0x276d: 0x0001, 0x276e: 0x0001, 0x276f: 0x0001, + 0x2770: 0x0001, 0x2771: 0x0001, 0x2772: 0x0001, 0x2773: 0x0001, 0x2774: 0x0001, 0x2775: 0x0001, + 0x2776: 0x0001, 0x2777: 0x0001, 0x2778: 0x0001, 0x2779: 0x0001, 0x277a: 0x0001, 0x277b: 0x0001, + 0x277c: 0x0001, 0x277d: 0x0001, 0x277e: 0x0001, 0x277f: 0x0001, + // Block 0x9e, offset 0x2780 + 0x2780: 0x0001, 0x2781: 0x000c, 0x2782: 0x000c, 0x2783: 0x000c, 0x2784: 0x0001, 0x2785: 0x000c, + 0x2786: 0x000c, 0x2787: 0x0001, 0x2788: 0x0001, 0x2789: 0x0001, 0x278a: 0x0001, 0x278b: 0x0001, + 0x278c: 0x000c, 0x278d: 0x000c, 0x278e: 0x000c, 0x278f: 0x000c, 0x2790: 0x0001, 0x2791: 0x0001, + 0x2792: 0x0001, 0x2793: 0x0001, 0x2794: 0x0001, 0x2795: 0x0001, 0x2796: 0x0001, 0x2797: 0x0001, + 0x2798: 0x0001, 0x2799: 0x0001, 0x279a: 0x0001, 0x279b: 0x0001, 0x279c: 0x0001, 0x279d: 0x0001, + 0x279e: 0x0001, 0x279f: 0x0001, 0x27a0: 0x0001, 0x27a1: 0x0001, 0x27a2: 0x0001, 0x27a3: 0x0001, + 0x27a4: 0x0001, 0x27a5: 0x0001, 0x27a6: 0x0001, 0x27a7: 0x0001, 0x27a8: 0x0001, 0x27a9: 0x0001, + 0x27aa: 0x0001, 0x27ab: 0x0001, 0x27ac: 0x0001, 0x27ad: 0x0001, 0x27ae: 0x0001, 0x27af: 0x0001, + 0x27b0: 0x0001, 0x27b1: 0x0001, 0x27b2: 0x0001, 0x27b3: 0x0001, 0x27b4: 0x0001, 0x27b5: 0x0001, + 0x27b6: 0x0001, 0x27b7: 0x0001, 0x27b8: 0x000c, 0x27b9: 0x000c, 0x27ba: 0x000c, 0x27bb: 0x0001, + 0x27bc: 0x0001, 0x27bd: 0x0001, 0x27be: 0x0001, 0x27bf: 0x000c, + // Block 0x9f, offset 0x27c0 + 0x27c0: 0x0001, 0x27c1: 0x0001, 0x27c2: 0x0001, 0x27c3: 0x0001, 0x27c4: 0x0001, 0x27c5: 0x0001, + 0x27c6: 0x0001, 0x27c7: 0x0001, 0x27c8: 0x0001, 0x27c9: 0x0001, 0x27ca: 0x0001, 0x27cb: 0x0001, + 0x27cc: 0x0001, 0x27cd: 0x0001, 0x27ce: 0x0001, 0x27cf: 0x0001, 0x27d0: 0x0001, 0x27d1: 0x0001, + 0x27d2: 0x0001, 0x27d3: 0x0001, 0x27d4: 0x0001, 0x27d5: 0x0001, 0x27d6: 0x0001, 0x27d7: 0x0001, + 0x27d8: 0x0001, 0x27d9: 0x0001, 0x27da: 0x0001, 0x27db: 0x0001, 0x27dc: 0x0001, 0x27dd: 0x0001, + 0x27de: 0x0001, 0x27df: 0x0001, 0x27e0: 0x0001, 0x27e1: 0x0001, 0x27e2: 0x0001, 0x27e3: 0x0001, + 0x27e4: 0x0001, 0x27e5: 0x000c, 0x27e6: 0x000c, 0x27e7: 0x0001, 0x27e8: 0x0001, 0x27e9: 0x0001, + 0x27ea: 0x0001, 0x27eb: 0x0001, 0x27ec: 0x0001, 0x27ed: 0x0001, 0x27ee: 0x0001, 0x27ef: 0x0001, + 0x27f0: 0x0001, 0x27f1: 0x0001, 0x27f2: 0x0001, 0x27f3: 0x0001, 0x27f4: 0x0001, 0x27f5: 0x0001, + 0x27f6: 0x0001, 0x27f7: 0x0001, 0x27f8: 0x0001, 0x27f9: 0x0001, 0x27fa: 0x0001, 0x27fb: 0x0001, + 0x27fc: 0x0001, 0x27fd: 0x0001, 0x27fe: 0x0001, 0x27ff: 0x0001, + // Block 0xa0, offset 0x2800 + 0x2800: 0x0001, 0x2801: 0x0001, 0x2802: 0x0001, 0x2803: 0x0001, 0x2804: 0x0001, 0x2805: 0x0001, + 0x2806: 0x0001, 0x2807: 0x0001, 0x2808: 0x0001, 0x2809: 0x0001, 0x280a: 0x0001, 0x280b: 0x0001, + 0x280c: 0x0001, 0x280d: 0x0001, 0x280e: 0x0001, 0x280f: 0x0001, 0x2810: 0x0001, 0x2811: 0x0001, + 0x2812: 0x0001, 0x2813: 0x0001, 0x2814: 0x0001, 0x2815: 0x0001, 0x2816: 0x0001, 0x2817: 0x0001, + 0x2818: 0x0001, 0x2819: 0x0001, 0x281a: 0x0001, 0x281b: 0x0001, 0x281c: 0x0001, 0x281d: 0x0001, + 0x281e: 0x0001, 0x281f: 0x0001, 0x2820: 0x0001, 0x2821: 0x0001, 0x2822: 0x0001, 0x2823: 0x0001, + 0x2824: 0x0001, 0x2825: 0x0001, 0x2826: 0x0001, 0x2827: 0x0001, 0x2828: 0x0001, 0x2829: 0x0001, + 0x282a: 0x0001, 0x282b: 0x0001, 0x282c: 0x0001, 0x282d: 0x0001, 0x282e: 0x0001, 0x282f: 0x0001, + 0x2830: 0x0001, 0x2831: 0x0001, 0x2832: 0x0001, 0x2833: 0x0001, 0x2834: 0x0001, 0x2835: 0x0001, + 0x2836: 0x0001, 0x2837: 0x0001, 0x2838: 0x0001, 0x2839: 0x000a, 0x283a: 0x000a, 0x283b: 0x000a, + 0x283c: 0x000a, 0x283d: 0x000a, 0x283e: 0x000a, 0x283f: 0x000a, + // Block 0xa1, offset 0x2840 + 0x2840: 0x000d, 0x2841: 0x000d, 0x2842: 0x000d, 0x2843: 0x000d, 0x2844: 0x000d, 0x2845: 0x000d, + 0x2846: 0x000d, 0x2847: 0x000d, 0x2848: 0x000d, 0x2849: 0x000d, 0x284a: 0x000d, 0x284b: 0x000d, + 0x284c: 0x000d, 0x284d: 0x000d, 0x284e: 0x000d, 0x284f: 0x000d, 0x2850: 0x000d, 0x2851: 0x000d, + 0x2852: 0x000d, 0x2853: 0x000d, 0x2854: 0x000d, 0x2855: 0x000d, 0x2856: 0x000d, 0x2857: 0x000d, + 0x2858: 0x000d, 0x2859: 0x000d, 0x285a: 0x000d, 0x285b: 0x000d, 0x285c: 0x000d, 0x285d: 0x000d, + 0x285e: 0x000d, 0x285f: 0x000d, 0x2860: 0x000d, 0x2861: 0x000d, 0x2862: 0x000d, 0x2863: 0x000d, + 0x2864: 0x000c, 0x2865: 0x000c, 0x2866: 0x000c, 0x2867: 0x000c, 0x2868: 0x000d, 0x2869: 0x000d, + 0x286a: 0x000d, 0x286b: 0x000d, 0x286c: 0x000d, 0x286d: 0x000d, 0x286e: 0x000d, 0x286f: 0x000d, + 0x2870: 0x0005, 0x2871: 0x0005, 0x2872: 0x0005, 0x2873: 0x0005, 0x2874: 0x0005, 0x2875: 0x0005, + 0x2876: 0x0005, 0x2877: 0x0005, 0x2878: 0x0005, 0x2879: 0x0005, 0x287a: 0x000d, 0x287b: 0x000d, + 0x287c: 0x000d, 0x287d: 0x000d, 0x287e: 0x000d, 0x287f: 0x000d, + // Block 0xa2, offset 0x2880 + 0x2880: 0x0001, 0x2881: 0x0001, 0x2882: 0x0001, 0x2883: 0x0001, 0x2884: 0x0001, 0x2885: 0x0001, + 0x2886: 0x0001, 0x2887: 0x0001, 0x2888: 0x0001, 0x2889: 0x0001, 0x288a: 0x0001, 0x288b: 0x0001, + 0x288c: 0x0001, 0x288d: 0x0001, 0x288e: 0x0001, 0x288f: 0x0001, 0x2890: 0x0001, 0x2891: 0x0001, + 0x2892: 0x0001, 0x2893: 0x0001, 0x2894: 0x0001, 0x2895: 0x0001, 0x2896: 0x0001, 0x2897: 0x0001, + 0x2898: 0x0001, 0x2899: 0x0001, 0x289a: 0x0001, 0x289b: 0x0001, 0x289c: 0x0001, 0x289d: 0x0001, + 0x289e: 0x0001, 0x289f: 0x0001, 0x28a0: 0x0005, 0x28a1: 0x0005, 0x28a2: 0x0005, 0x28a3: 0x0005, + 0x28a4: 0x0005, 0x28a5: 0x0005, 0x28a6: 0x0005, 0x28a7: 0x0005, 0x28a8: 0x0005, 0x28a9: 0x0005, + 0x28aa: 0x0005, 0x28ab: 0x0005, 0x28ac: 0x0005, 0x28ad: 0x0005, 0x28ae: 0x0005, 0x28af: 0x0005, + 0x28b0: 0x0005, 0x28b1: 0x0005, 0x28b2: 0x0005, 0x28b3: 0x0005, 0x28b4: 0x0005, 0x28b5: 0x0005, + 0x28b6: 0x0005, 0x28b7: 0x0005, 0x28b8: 0x0005, 0x28b9: 0x0005, 0x28ba: 0x0005, 0x28bb: 0x0005, + 0x28bc: 0x0005, 0x28bd: 0x0005, 0x28be: 0x0005, 0x28bf: 0x0001, + // Block 0xa3, offset 0x28c0 + 0x28c0: 0x0001, 0x28c1: 0x0001, 0x28c2: 0x0001, 0x28c3: 0x0001, 0x28c4: 0x0001, 0x28c5: 0x0001, + 0x28c6: 0x0001, 0x28c7: 0x0001, 0x28c8: 0x0001, 0x28c9: 0x0001, 0x28ca: 0x0001, 0x28cb: 0x0001, + 0x28cc: 0x0001, 0x28cd: 0x0001, 0x28ce: 0x0001, 0x28cf: 0x0001, 0x28d0: 0x0001, 0x28d1: 0x0001, + 0x28d2: 0x0001, 0x28d3: 0x0001, 0x28d4: 0x0001, 0x28d5: 0x0001, 0x28d6: 0x0001, 0x28d7: 0x0001, + 0x28d8: 0x0001, 0x28d9: 0x0001, 0x28da: 0x0001, 0x28db: 0x0001, 0x28dc: 0x0001, 0x28dd: 0x0001, + 0x28de: 0x0001, 0x28df: 0x0001, 0x28e0: 0x0001, 0x28e1: 0x0001, 0x28e2: 0x0001, 0x28e3: 0x0001, + 0x28e4: 0x0001, 0x28e5: 0x0001, 0x28e6: 0x0001, 0x28e7: 0x0001, 0x28e8: 0x0001, 0x28e9: 0x0001, + 0x28ea: 0x0001, 0x28eb: 0x0001, 0x28ec: 0x0001, 0x28ed: 0x0001, 0x28ee: 0x0001, 0x28ef: 0x0001, + 0x28f0: 0x000d, 0x28f1: 0x000d, 0x28f2: 0x000d, 0x28f3: 0x000d, 0x28f4: 0x000d, 0x28f5: 0x000d, + 0x28f6: 0x000d, 0x28f7: 0x000d, 0x28f8: 0x000d, 0x28f9: 0x000d, 0x28fa: 0x000d, 0x28fb: 0x000d, + 0x28fc: 0x000d, 0x28fd: 0x000d, 0x28fe: 0x000d, 0x28ff: 0x000d, + // Block 0xa4, offset 0x2900 + 0x2900: 0x000d, 0x2901: 0x000d, 0x2902: 0x000d, 0x2903: 0x000d, 0x2904: 0x000d, 0x2905: 0x000d, + 0x2906: 0x000c, 0x2907: 0x000c, 0x2908: 0x000c, 0x2909: 0x000c, 0x290a: 0x000c, 0x290b: 0x000c, + 0x290c: 0x000c, 0x290d: 0x000c, 0x290e: 0x000c, 0x290f: 0x000c, 0x2910: 0x000c, 0x2911: 0x000d, + 0x2912: 0x000d, 0x2913: 0x000d, 0x2914: 0x000d, 0x2915: 0x000d, 0x2916: 0x000d, 0x2917: 0x000d, + 0x2918: 0x000d, 0x2919: 0x000d, 0x291a: 0x000d, 0x291b: 0x000d, 0x291c: 0x000d, 0x291d: 0x000d, + 0x291e: 0x000d, 0x291f: 0x000d, 0x2920: 0x000d, 0x2921: 0x000d, 0x2922: 0x000d, 0x2923: 0x000d, + 0x2924: 0x000d, 0x2925: 0x000d, 0x2926: 0x000d, 0x2927: 0x000d, 0x2928: 0x000d, 0x2929: 0x000d, + 0x292a: 0x000d, 0x292b: 0x000d, 0x292c: 0x000d, 0x292d: 0x000d, 0x292e: 0x000d, 0x292f: 0x000d, + 0x2930: 0x0001, 0x2931: 0x0001, 0x2932: 0x0001, 0x2933: 0x0001, 0x2934: 0x0001, 0x2935: 0x0001, + 0x2936: 0x0001, 0x2937: 0x0001, 0x2938: 0x0001, 0x2939: 0x0001, 0x293a: 0x0001, 0x293b: 0x0001, + 0x293c: 0x0001, 0x293d: 0x0001, 0x293e: 0x0001, 0x293f: 0x0001, + // Block 0xa5, offset 0x2940 + 0x2941: 0x000c, + 0x2978: 0x000c, 0x2979: 0x000c, 0x297a: 0x000c, 0x297b: 0x000c, + 0x297c: 0x000c, 0x297d: 0x000c, 0x297e: 0x000c, 0x297f: 0x000c, + // Block 0xa6, offset 0x2980 + 0x2980: 0x000c, 0x2981: 0x000c, 0x2982: 0x000c, 0x2983: 0x000c, 0x2984: 0x000c, 0x2985: 0x000c, + 0x2986: 0x000c, + 0x2992: 0x000a, 0x2993: 0x000a, 0x2994: 0x000a, 0x2995: 0x000a, 0x2996: 0x000a, 0x2997: 0x000a, + 0x2998: 0x000a, 0x2999: 0x000a, 0x299a: 0x000a, 0x299b: 0x000a, 0x299c: 0x000a, 0x299d: 0x000a, + 0x299e: 0x000a, 0x299f: 0x000a, 0x29a0: 0x000a, 0x29a1: 0x000a, 0x29a2: 0x000a, 0x29a3: 0x000a, + 0x29a4: 0x000a, 0x29a5: 0x000a, + 0x29bf: 0x000c, + // Block 0xa7, offset 0x29c0 + 0x29c0: 0x000c, 0x29c1: 0x000c, + 0x29f3: 0x000c, 0x29f4: 0x000c, 0x29f5: 0x000c, + 0x29f6: 0x000c, 0x29f9: 0x000c, 0x29fa: 0x000c, + // Block 0xa8, offset 0x2a00 + 0x2a00: 0x000c, 0x2a01: 0x000c, 0x2a02: 0x000c, + 0x2a27: 0x000c, 0x2a28: 0x000c, 0x2a29: 0x000c, + 0x2a2a: 0x000c, 0x2a2b: 0x000c, 0x2a2d: 0x000c, 0x2a2e: 0x000c, 0x2a2f: 0x000c, + 0x2a30: 0x000c, 0x2a31: 0x000c, 0x2a32: 0x000c, 0x2a33: 0x000c, 0x2a34: 0x000c, + // Block 0xa9, offset 0x2a40 + 0x2a73: 0x000c, + // Block 0xaa, offset 0x2a80 + 0x2a80: 0x000c, 0x2a81: 0x000c, + 0x2ab6: 0x000c, 0x2ab7: 0x000c, 0x2ab8: 0x000c, 0x2ab9: 0x000c, 0x2aba: 0x000c, 0x2abb: 0x000c, + 0x2abc: 0x000c, 0x2abd: 0x000c, 0x2abe: 0x000c, + // Block 0xab, offset 0x2ac0 + 0x2ac9: 0x000c, 0x2aca: 0x000c, 0x2acb: 0x000c, + 0x2acc: 0x000c, + // Block 0xac, offset 0x2b00 + 0x2b2f: 0x000c, + 0x2b30: 0x000c, 0x2b31: 0x000c, 0x2b34: 0x000c, + 0x2b36: 0x000c, 0x2b37: 0x000c, + 0x2b3e: 0x000c, + // Block 0xad, offset 0x2b40 + 0x2b5f: 0x000c, 0x2b63: 0x000c, + 0x2b64: 0x000c, 0x2b65: 0x000c, 0x2b66: 0x000c, 0x2b67: 0x000c, 0x2b68: 0x000c, 0x2b69: 0x000c, + 0x2b6a: 0x000c, + // Block 0xae, offset 0x2b80 + 0x2b80: 0x000c, + 0x2ba6: 0x000c, 0x2ba7: 0x000c, 0x2ba8: 0x000c, 0x2ba9: 0x000c, + 0x2baa: 0x000c, 0x2bab: 0x000c, 0x2bac: 0x000c, + 0x2bb0: 0x000c, 0x2bb1: 0x000c, 0x2bb2: 0x000c, 0x2bb3: 0x000c, 0x2bb4: 0x000c, + // Block 0xaf, offset 0x2bc0 + 0x2bf8: 0x000c, 0x2bf9: 0x000c, 0x2bfa: 0x000c, 0x2bfb: 0x000c, + 0x2bfc: 0x000c, 0x2bfd: 0x000c, 0x2bfe: 0x000c, 0x2bff: 0x000c, + // Block 0xb0, offset 0x2c00 + 0x2c02: 0x000c, 0x2c03: 0x000c, 0x2c04: 0x000c, + 0x2c06: 0x000c, + 0x2c1e: 0x000c, + // Block 0xb1, offset 0x2c40 + 0x2c73: 0x000c, 0x2c74: 0x000c, 0x2c75: 0x000c, + 0x2c76: 0x000c, 0x2c77: 0x000c, 0x2c78: 0x000c, 0x2c7a: 0x000c, + 0x2c7f: 0x000c, + // Block 0xb2, offset 0x2c80 + 0x2c80: 0x000c, 0x2c82: 0x000c, 0x2c83: 0x000c, + // Block 0xb3, offset 0x2cc0 + 0x2cf2: 0x000c, 0x2cf3: 0x000c, 0x2cf4: 0x000c, 0x2cf5: 0x000c, + 0x2cfc: 0x000c, 0x2cfd: 0x000c, 0x2cff: 0x000c, + // Block 0xb4, offset 0x2d00 + 0x2d00: 0x000c, + 0x2d1c: 0x000c, 0x2d1d: 0x000c, + // Block 0xb5, offset 0x2d40 + 0x2d73: 0x000c, 0x2d74: 0x000c, 0x2d75: 0x000c, + 0x2d76: 0x000c, 0x2d77: 0x000c, 0x2d78: 0x000c, 0x2d79: 0x000c, 0x2d7a: 0x000c, + 0x2d7d: 0x000c, 0x2d7f: 0x000c, + // Block 0xb6, offset 0x2d80 + 0x2d80: 0x000c, + 0x2da0: 0x000a, 0x2da1: 0x000a, 0x2da2: 0x000a, 0x2da3: 0x000a, + 0x2da4: 0x000a, 0x2da5: 0x000a, 0x2da6: 0x000a, 0x2da7: 0x000a, 0x2da8: 0x000a, 0x2da9: 0x000a, + 0x2daa: 0x000a, 0x2dab: 0x000a, 0x2dac: 0x000a, + // Block 0xb7, offset 0x2dc0 + 0x2deb: 0x000c, 0x2ded: 0x000c, + 0x2df0: 0x000c, 0x2df1: 0x000c, 0x2df2: 0x000c, 0x2df3: 0x000c, 0x2df4: 0x000c, 0x2df5: 0x000c, + 0x2df7: 0x000c, + // Block 0xb8, offset 0x2e00 + 0x2e1d: 0x000c, + 0x2e1e: 0x000c, 0x2e1f: 0x000c, 0x2e22: 0x000c, 0x2e23: 0x000c, + 0x2e24: 0x000c, 0x2e25: 0x000c, 0x2e27: 0x000c, 0x2e28: 0x000c, 0x2e29: 0x000c, + 0x2e2a: 0x000c, 0x2e2b: 0x000c, + // Block 0xb9, offset 0x2e40 + 0x2e6f: 0x000c, + 0x2e70: 0x000c, 0x2e71: 0x000c, 0x2e72: 0x000c, 0x2e73: 0x000c, 0x2e74: 0x000c, 0x2e75: 0x000c, + 0x2e76: 0x000c, 0x2e77: 0x000c, 0x2e79: 0x000c, 0x2e7a: 0x000c, + // Block 0xba, offset 0x2e80 + 0x2e81: 0x000c, 0x2e82: 0x000c, 0x2e83: 0x000c, 0x2e84: 0x000c, 0x2e85: 0x000c, + 0x2e86: 0x000c, 0x2e89: 0x000c, 0x2e8a: 0x000c, + 0x2eb3: 0x000c, 0x2eb4: 0x000c, 0x2eb5: 0x000c, + 0x2eb6: 0x000c, 0x2eb7: 0x000c, 0x2eb8: 0x000c, 0x2ebb: 0x000c, + 0x2ebc: 0x000c, 0x2ebd: 0x000c, 0x2ebe: 0x000c, + // Block 0xbb, offset 0x2ec0 + 0x2ec7: 0x000c, + 0x2ed1: 0x000c, + 0x2ed2: 0x000c, 0x2ed3: 0x000c, 0x2ed4: 0x000c, 0x2ed5: 0x000c, 0x2ed6: 0x000c, + 0x2ed9: 0x000c, 0x2eda: 0x000c, 0x2edb: 0x000c, + // Block 0xbc, offset 0x2f00 + 0x2f0a: 0x000c, 0x2f0b: 0x000c, + 0x2f0c: 0x000c, 0x2f0d: 0x000c, 0x2f0e: 0x000c, 0x2f0f: 0x000c, 0x2f10: 0x000c, 0x2f11: 0x000c, + 0x2f12: 0x000c, 0x2f13: 0x000c, 0x2f14: 0x000c, 0x2f15: 0x000c, 0x2f16: 0x000c, + 0x2f18: 0x000c, 0x2f19: 0x000c, + // Block 0xbd, offset 0x2f40 + 0x2f70: 0x000c, 0x2f71: 0x000c, 0x2f72: 0x000c, 0x2f73: 0x000c, 0x2f74: 0x000c, 0x2f75: 0x000c, + 0x2f76: 0x000c, 0x2f78: 0x000c, 0x2f79: 0x000c, 0x2f7a: 0x000c, 0x2f7b: 0x000c, + 0x2f7c: 0x000c, 0x2f7d: 0x000c, + // Block 0xbe, offset 0x2f80 + 0x2f92: 0x000c, 0x2f93: 0x000c, 0x2f94: 0x000c, 0x2f95: 0x000c, 0x2f96: 0x000c, 0x2f97: 0x000c, + 0x2f98: 0x000c, 0x2f99: 0x000c, 0x2f9a: 0x000c, 0x2f9b: 0x000c, 0x2f9c: 0x000c, 0x2f9d: 0x000c, + 0x2f9e: 0x000c, 0x2f9f: 0x000c, 0x2fa0: 0x000c, 0x2fa1: 0x000c, 0x2fa2: 0x000c, 0x2fa3: 0x000c, + 0x2fa4: 0x000c, 0x2fa5: 0x000c, 0x2fa6: 0x000c, 0x2fa7: 0x000c, + 0x2faa: 0x000c, 0x2fab: 0x000c, 0x2fac: 0x000c, 0x2fad: 0x000c, 0x2fae: 0x000c, 0x2faf: 0x000c, + 0x2fb0: 0x000c, 0x2fb2: 0x000c, 0x2fb3: 0x000c, 0x2fb5: 0x000c, + 0x2fb6: 0x000c, + // Block 0xbf, offset 0x2fc0 + 0x2ff1: 0x000c, 0x2ff2: 0x000c, 0x2ff3: 0x000c, 0x2ff4: 0x000c, 0x2ff5: 0x000c, + 0x2ff6: 0x000c, 0x2ffa: 0x000c, + 0x2ffc: 0x000c, 0x2ffd: 0x000c, 0x2fff: 0x000c, + // Block 0xc0, offset 0x3000 + 0x3000: 0x000c, 0x3001: 0x000c, 0x3002: 0x000c, 0x3003: 0x000c, 0x3004: 0x000c, 0x3005: 0x000c, + 0x3007: 0x000c, + // Block 0xc1, offset 0x3040 + 0x3050: 0x000c, 0x3051: 0x000c, + 0x3055: 0x000c, 0x3057: 0x000c, + // Block 0xc2, offset 0x3080 + 0x30b3: 0x000c, 0x30b4: 0x000c, + // Block 0xc3, offset 0x30c0 + 0x30f0: 0x000c, 0x30f1: 0x000c, 0x30f2: 0x000c, 0x30f3: 0x000c, 0x30f4: 0x000c, + // Block 0xc4, offset 0x3100 + 0x3130: 0x000c, 0x3131: 0x000c, 0x3132: 0x000c, 0x3133: 0x000c, 0x3134: 0x000c, 0x3135: 0x000c, + 0x3136: 0x000c, + // Block 0xc5, offset 0x3140 + 0x314f: 0x000c, 0x3150: 0x000c, 0x3151: 0x000c, + 0x3152: 0x000c, + // Block 0xc6, offset 0x3180 + 0x319d: 0x000c, + 0x319e: 0x000c, 0x31a0: 0x000b, 0x31a1: 0x000b, 0x31a2: 0x000b, 0x31a3: 0x000b, + // Block 0xc7, offset 0x31c0 + 0x31e7: 0x000c, 0x31e8: 0x000c, 0x31e9: 0x000c, + 0x31f3: 0x000b, 0x31f4: 0x000b, 0x31f5: 0x000b, + 0x31f6: 0x000b, 0x31f7: 0x000b, 0x31f8: 0x000b, 0x31f9: 0x000b, 0x31fa: 0x000b, 0x31fb: 0x000c, + 0x31fc: 0x000c, 0x31fd: 0x000c, 0x31fe: 0x000c, 0x31ff: 0x000c, + // Block 0xc8, offset 0x3200 + 0x3200: 0x000c, 0x3201: 0x000c, 0x3202: 0x000c, 0x3205: 0x000c, + 0x3206: 0x000c, 0x3207: 0x000c, 0x3208: 0x000c, 0x3209: 0x000c, 0x320a: 0x000c, 0x320b: 0x000c, + 0x322a: 0x000c, 0x322b: 0x000c, 0x322c: 0x000c, 0x322d: 0x000c, + // Block 0xc9, offset 0x3240 + 0x3240: 0x000a, 0x3241: 0x000a, 0x3242: 0x000c, 0x3243: 0x000c, 0x3244: 0x000c, 0x3245: 0x000a, + // Block 0xca, offset 0x3280 + 0x3280: 0x000a, 0x3281: 0x000a, 0x3282: 0x000a, 0x3283: 0x000a, 0x3284: 0x000a, 0x3285: 0x000a, + 0x3286: 0x000a, 0x3287: 0x000a, 0x3288: 0x000a, 0x3289: 0x000a, 0x328a: 0x000a, 0x328b: 0x000a, + 0x328c: 0x000a, 0x328d: 0x000a, 0x328e: 0x000a, 0x328f: 0x000a, 0x3290: 0x000a, 0x3291: 0x000a, + 0x3292: 0x000a, 0x3293: 0x000a, 0x3294: 0x000a, 0x3295: 0x000a, 0x3296: 0x000a, + // Block 0xcb, offset 0x32c0 + 0x32db: 0x000a, + // Block 0xcc, offset 0x3300 + 0x3315: 0x000a, + // Block 0xcd, offset 0x3340 + 0x334f: 0x000a, + // Block 0xce, offset 0x3380 + 0x3389: 0x000a, + // Block 0xcf, offset 0x33c0 + 0x33c3: 0x000a, + 0x33ce: 0x0002, 0x33cf: 0x0002, 0x33d0: 0x0002, 0x33d1: 0x0002, + 0x33d2: 0x0002, 0x33d3: 0x0002, 0x33d4: 0x0002, 0x33d5: 0x0002, 0x33d6: 0x0002, 0x33d7: 0x0002, + 0x33d8: 0x0002, 0x33d9: 0x0002, 0x33da: 0x0002, 0x33db: 0x0002, 0x33dc: 0x0002, 0x33dd: 0x0002, + 0x33de: 0x0002, 0x33df: 0x0002, 0x33e0: 0x0002, 0x33e1: 0x0002, 0x33e2: 0x0002, 0x33e3: 0x0002, + 0x33e4: 0x0002, 0x33e5: 0x0002, 0x33e6: 0x0002, 0x33e7: 0x0002, 0x33e8: 0x0002, 0x33e9: 0x0002, + 0x33ea: 0x0002, 0x33eb: 0x0002, 0x33ec: 0x0002, 0x33ed: 0x0002, 0x33ee: 0x0002, 0x33ef: 0x0002, + 0x33f0: 0x0002, 0x33f1: 0x0002, 0x33f2: 0x0002, 0x33f3: 0x0002, 0x33f4: 0x0002, 0x33f5: 0x0002, + 0x33f6: 0x0002, 0x33f7: 0x0002, 0x33f8: 0x0002, 0x33f9: 0x0002, 0x33fa: 0x0002, 0x33fb: 0x0002, + 0x33fc: 0x0002, 0x33fd: 0x0002, 0x33fe: 0x0002, 0x33ff: 0x0002, + // Block 0xd0, offset 0x3400 + 0x3400: 0x000c, 0x3401: 0x000c, 0x3402: 0x000c, 0x3403: 0x000c, 0x3404: 0x000c, 0x3405: 0x000c, + 0x3406: 0x000c, 0x3407: 0x000c, 0x3408: 0x000c, 0x3409: 0x000c, 0x340a: 0x000c, 0x340b: 0x000c, + 0x340c: 0x000c, 0x340d: 0x000c, 0x340e: 0x000c, 0x340f: 0x000c, 0x3410: 0x000c, 0x3411: 0x000c, + 0x3412: 0x000c, 0x3413: 0x000c, 0x3414: 0x000c, 0x3415: 0x000c, 0x3416: 0x000c, 0x3417: 0x000c, + 0x3418: 0x000c, 0x3419: 0x000c, 0x341a: 0x000c, 0x341b: 0x000c, 0x341c: 0x000c, 0x341d: 0x000c, + 0x341e: 0x000c, 0x341f: 0x000c, 0x3420: 0x000c, 0x3421: 0x000c, 0x3422: 0x000c, 0x3423: 0x000c, + 0x3424: 0x000c, 0x3425: 0x000c, 0x3426: 0x000c, 0x3427: 0x000c, 0x3428: 0x000c, 0x3429: 0x000c, + 0x342a: 0x000c, 0x342b: 0x000c, 0x342c: 0x000c, 0x342d: 0x000c, 0x342e: 0x000c, 0x342f: 0x000c, + 0x3430: 0x000c, 0x3431: 0x000c, 0x3432: 0x000c, 0x3433: 0x000c, 0x3434: 0x000c, 0x3435: 0x000c, + 0x3436: 0x000c, 0x343b: 0x000c, + 0x343c: 0x000c, 0x343d: 0x000c, 0x343e: 0x000c, 0x343f: 0x000c, + // Block 0xd1, offset 0x3440 + 0x3440: 0x000c, 0x3441: 0x000c, 0x3442: 0x000c, 0x3443: 0x000c, 0x3444: 0x000c, 0x3445: 0x000c, + 0x3446: 0x000c, 0x3447: 0x000c, 0x3448: 0x000c, 0x3449: 0x000c, 0x344a: 0x000c, 0x344b: 0x000c, + 0x344c: 0x000c, 0x344d: 0x000c, 0x344e: 0x000c, 0x344f: 0x000c, 0x3450: 0x000c, 0x3451: 0x000c, + 0x3452: 0x000c, 0x3453: 0x000c, 0x3454: 0x000c, 0x3455: 0x000c, 0x3456: 0x000c, 0x3457: 0x000c, + 0x3458: 0x000c, 0x3459: 0x000c, 0x345a: 0x000c, 0x345b: 0x000c, 0x345c: 0x000c, 0x345d: 0x000c, + 0x345e: 0x000c, 0x345f: 0x000c, 0x3460: 0x000c, 0x3461: 0x000c, 0x3462: 0x000c, 0x3463: 0x000c, + 0x3464: 0x000c, 0x3465: 0x000c, 0x3466: 0x000c, 0x3467: 0x000c, 0x3468: 0x000c, 0x3469: 0x000c, + 0x346a: 0x000c, 0x346b: 0x000c, 0x346c: 0x000c, + 0x3475: 0x000c, + // Block 0xd2, offset 0x3480 + 0x3484: 0x000c, + 0x349b: 0x000c, 0x349c: 0x000c, 0x349d: 0x000c, + 0x349e: 0x000c, 0x349f: 0x000c, 0x34a1: 0x000c, 0x34a2: 0x000c, 0x34a3: 0x000c, + 0x34a4: 0x000c, 0x34a5: 0x000c, 0x34a6: 0x000c, 0x34a7: 0x000c, 0x34a8: 0x000c, 0x34a9: 0x000c, + 0x34aa: 0x000c, 0x34ab: 0x000c, 0x34ac: 0x000c, 0x34ad: 0x000c, 0x34ae: 0x000c, 0x34af: 0x000c, + // Block 0xd3, offset 0x34c0 + 0x34c0: 0x000c, 0x34c1: 0x000c, 0x34c2: 0x000c, 0x34c3: 0x000c, 0x34c4: 0x000c, 0x34c5: 0x000c, + 0x34c6: 0x000c, 0x34c8: 0x000c, 0x34c9: 0x000c, 0x34ca: 0x000c, 0x34cb: 0x000c, + 0x34cc: 0x000c, 0x34cd: 0x000c, 0x34ce: 0x000c, 0x34cf: 0x000c, 0x34d0: 0x000c, 0x34d1: 0x000c, + 0x34d2: 0x000c, 0x34d3: 0x000c, 0x34d4: 0x000c, 0x34d5: 0x000c, 0x34d6: 0x000c, 0x34d7: 0x000c, + 0x34d8: 0x000c, 0x34db: 0x000c, 0x34dc: 0x000c, 0x34dd: 0x000c, + 0x34de: 0x000c, 0x34df: 0x000c, 0x34e0: 0x000c, 0x34e1: 0x000c, 0x34e3: 0x000c, + 0x34e4: 0x000c, 0x34e6: 0x000c, 0x34e7: 0x000c, 0x34e8: 0x000c, 0x34e9: 0x000c, + 0x34ea: 0x000c, + // Block 0xd4, offset 0x3500 + 0x3500: 0x0001, 0x3501: 0x0001, 0x3502: 0x0001, 0x3503: 0x0001, 0x3504: 0x0001, 0x3505: 0x0001, + 0x3506: 0x0001, 0x3507: 0x0001, 0x3508: 0x0001, 0x3509: 0x0001, 0x350a: 0x0001, 0x350b: 0x0001, + 0x350c: 0x0001, 0x350d: 0x0001, 0x350e: 0x0001, 0x350f: 0x0001, 0x3510: 0x000c, 0x3511: 0x000c, + 0x3512: 0x000c, 0x3513: 0x000c, 0x3514: 0x000c, 0x3515: 0x000c, 0x3516: 0x000c, 0x3517: 0x0001, + 0x3518: 0x0001, 0x3519: 0x0001, 0x351a: 0x0001, 0x351b: 0x0001, 0x351c: 0x0001, 0x351d: 0x0001, + 0x351e: 0x0001, 0x351f: 0x0001, 0x3520: 0x0001, 0x3521: 0x0001, 0x3522: 0x0001, 0x3523: 0x0001, + 0x3524: 0x0001, 0x3525: 0x0001, 0x3526: 0x0001, 0x3527: 0x0001, 0x3528: 0x0001, 0x3529: 0x0001, + 0x352a: 0x0001, 0x352b: 0x0001, 0x352c: 0x0001, 0x352d: 0x0001, 0x352e: 0x0001, 0x352f: 0x0001, + 0x3530: 0x0001, 0x3531: 0x0001, 0x3532: 0x0001, 0x3533: 0x0001, 0x3534: 0x0001, 0x3535: 0x0001, + 0x3536: 0x0001, 0x3537: 0x0001, 0x3538: 0x0001, 0x3539: 0x0001, 0x353a: 0x0001, 0x353b: 0x0001, + 0x353c: 0x0001, 0x353d: 0x0001, 0x353e: 0x0001, 0x353f: 0x0001, + // Block 0xd5, offset 0x3540 + 0x3540: 0x0001, 0x3541: 0x0001, 0x3542: 0x0001, 0x3543: 0x0001, 0x3544: 0x000c, 0x3545: 0x000c, + 0x3546: 0x000c, 0x3547: 0x000c, 0x3548: 0x000c, 0x3549: 0x000c, 0x354a: 0x000c, 0x354b: 0x0001, + 0x354c: 0x0001, 0x354d: 0x0001, 0x354e: 0x0001, 0x354f: 0x0001, 0x3550: 0x0001, 0x3551: 0x0001, + 0x3552: 0x0001, 0x3553: 0x0001, 0x3554: 0x0001, 0x3555: 0x0001, 0x3556: 0x0001, 0x3557: 0x0001, + 0x3558: 0x0001, 0x3559: 0x0001, 0x355a: 0x0001, 0x355b: 0x0001, 0x355c: 0x0001, 0x355d: 0x0001, + 0x355e: 0x0001, 0x355f: 0x0001, 0x3560: 0x0001, 0x3561: 0x0001, 0x3562: 0x0001, 0x3563: 0x0001, + 0x3564: 0x0001, 0x3565: 0x0001, 0x3566: 0x0001, 0x3567: 0x0001, 0x3568: 0x0001, 0x3569: 0x0001, + 0x356a: 0x0001, 0x356b: 0x0001, 0x356c: 0x0001, 0x356d: 0x0001, 0x356e: 0x0001, 0x356f: 0x0001, + 0x3570: 0x0001, 0x3571: 0x0001, 0x3572: 0x0001, 0x3573: 0x0001, 0x3574: 0x0001, 0x3575: 0x0001, + 0x3576: 0x0001, 0x3577: 0x0001, 0x3578: 0x0001, 0x3579: 0x0001, 0x357a: 0x0001, 0x357b: 0x0001, + 0x357c: 0x0001, 0x357d: 0x0001, 0x357e: 0x0001, 0x357f: 0x0001, + // Block 0xd6, offset 0x3580 + 0x3580: 0x000d, 0x3581: 0x000d, 0x3582: 0x000d, 0x3583: 0x000d, 0x3584: 0x000d, 0x3585: 0x000d, + 0x3586: 0x000d, 0x3587: 0x000d, 0x3588: 0x000d, 0x3589: 0x000d, 0x358a: 0x000d, 0x358b: 0x000d, + 0x358c: 0x000d, 0x358d: 0x000d, 0x358e: 0x000d, 0x358f: 0x000d, 0x3590: 0x000d, 0x3591: 0x000d, + 0x3592: 0x000d, 0x3593: 0x000d, 0x3594: 0x000d, 0x3595: 0x000d, 0x3596: 0x000d, 0x3597: 0x000d, + 0x3598: 0x000d, 0x3599: 0x000d, 0x359a: 0x000d, 0x359b: 0x000d, 0x359c: 0x000d, 0x359d: 0x000d, + 0x359e: 0x000d, 0x359f: 0x000d, 0x35a0: 0x000d, 0x35a1: 0x000d, 0x35a2: 0x000d, 0x35a3: 0x000d, + 0x35a4: 0x000d, 0x35a5: 0x000d, 0x35a6: 0x000d, 0x35a7: 0x000d, 0x35a8: 0x000d, 0x35a9: 0x000d, + 0x35aa: 0x000d, 0x35ab: 0x000d, 0x35ac: 0x000d, 0x35ad: 0x000d, 0x35ae: 0x000d, 0x35af: 0x000d, + 0x35b0: 0x000a, 0x35b1: 0x000a, 0x35b2: 0x000d, 0x35b3: 0x000d, 0x35b4: 0x000d, 0x35b5: 0x000d, + 0x35b6: 0x000d, 0x35b7: 0x000d, 0x35b8: 0x000d, 0x35b9: 0x000d, 0x35ba: 0x000d, 0x35bb: 0x000d, + 0x35bc: 0x000d, 0x35bd: 0x000d, 0x35be: 0x000d, 0x35bf: 0x000d, + // Block 0xd7, offset 0x35c0 + 0x35c0: 0x000a, 0x35c1: 0x000a, 0x35c2: 0x000a, 0x35c3: 0x000a, 0x35c4: 0x000a, 0x35c5: 0x000a, + 0x35c6: 0x000a, 0x35c7: 0x000a, 0x35c8: 0x000a, 0x35c9: 0x000a, 0x35ca: 0x000a, 0x35cb: 0x000a, + 0x35cc: 0x000a, 0x35cd: 0x000a, 0x35ce: 0x000a, 0x35cf: 0x000a, 0x35d0: 0x000a, 0x35d1: 0x000a, + 0x35d2: 0x000a, 0x35d3: 0x000a, 0x35d4: 0x000a, 0x35d5: 0x000a, 0x35d6: 0x000a, 0x35d7: 0x000a, + 0x35d8: 0x000a, 0x35d9: 0x000a, 0x35da: 0x000a, 0x35db: 0x000a, 0x35dc: 0x000a, 0x35dd: 0x000a, + 0x35de: 0x000a, 0x35df: 0x000a, 0x35e0: 0x000a, 0x35e1: 0x000a, 0x35e2: 0x000a, 0x35e3: 0x000a, + 0x35e4: 0x000a, 0x35e5: 0x000a, 0x35e6: 0x000a, 0x35e7: 0x000a, 0x35e8: 0x000a, 0x35e9: 0x000a, + 0x35ea: 0x000a, 0x35eb: 0x000a, + 0x35f0: 0x000a, 0x35f1: 0x000a, 0x35f2: 0x000a, 0x35f3: 0x000a, 0x35f4: 0x000a, 0x35f5: 0x000a, + 0x35f6: 0x000a, 0x35f7: 0x000a, 0x35f8: 0x000a, 0x35f9: 0x000a, 0x35fa: 0x000a, 0x35fb: 0x000a, + 0x35fc: 0x000a, 0x35fd: 0x000a, 0x35fe: 0x000a, 0x35ff: 0x000a, + // Block 0xd8, offset 0x3600 + 0x3600: 0x000a, 0x3601: 0x000a, 0x3602: 0x000a, 0x3603: 0x000a, 0x3604: 0x000a, 0x3605: 0x000a, + 0x3606: 0x000a, 0x3607: 0x000a, 0x3608: 0x000a, 0x3609: 0x000a, 0x360a: 0x000a, 0x360b: 0x000a, + 0x360c: 0x000a, 0x360d: 0x000a, 0x360e: 0x000a, 0x360f: 0x000a, 0x3610: 0x000a, 0x3611: 0x000a, + 0x3612: 0x000a, 0x3613: 0x000a, + 0x3620: 0x000a, 0x3621: 0x000a, 0x3622: 0x000a, 0x3623: 0x000a, + 0x3624: 0x000a, 0x3625: 0x000a, 0x3626: 0x000a, 0x3627: 0x000a, 0x3628: 0x000a, 0x3629: 0x000a, + 0x362a: 0x000a, 0x362b: 0x000a, 0x362c: 0x000a, 0x362d: 0x000a, 0x362e: 0x000a, + 0x3631: 0x000a, 0x3632: 0x000a, 0x3633: 0x000a, 0x3634: 0x000a, 0x3635: 0x000a, + 0x3636: 0x000a, 0x3637: 0x000a, 0x3638: 0x000a, 0x3639: 0x000a, 0x363a: 0x000a, 0x363b: 0x000a, + 0x363c: 0x000a, 0x363d: 0x000a, 0x363e: 0x000a, 0x363f: 0x000a, + // Block 0xd9, offset 0x3640 + 0x3641: 0x000a, 0x3642: 0x000a, 0x3643: 0x000a, 0x3644: 0x000a, 0x3645: 0x000a, + 0x3646: 0x000a, 0x3647: 0x000a, 0x3648: 0x000a, 0x3649: 0x000a, 0x364a: 0x000a, 0x364b: 0x000a, + 0x364c: 0x000a, 0x364d: 0x000a, 0x364e: 0x000a, 0x364f: 0x000a, 0x3651: 0x000a, + 0x3652: 0x000a, 0x3653: 0x000a, 0x3654: 0x000a, 0x3655: 0x000a, 0x3656: 0x000a, 0x3657: 0x000a, + 0x3658: 0x000a, 0x3659: 0x000a, 0x365a: 0x000a, 0x365b: 0x000a, 0x365c: 0x000a, 0x365d: 0x000a, + 0x365e: 0x000a, 0x365f: 0x000a, 0x3660: 0x000a, 0x3661: 0x000a, 0x3662: 0x000a, 0x3663: 0x000a, + 0x3664: 0x000a, 0x3665: 0x000a, 0x3666: 0x000a, 0x3667: 0x000a, 0x3668: 0x000a, 0x3669: 0x000a, + 0x366a: 0x000a, 0x366b: 0x000a, 0x366c: 0x000a, 0x366d: 0x000a, 0x366e: 0x000a, 0x366f: 0x000a, + 0x3670: 0x000a, 0x3671: 0x000a, 0x3672: 0x000a, 0x3673: 0x000a, 0x3674: 0x000a, 0x3675: 0x000a, + // Block 0xda, offset 0x3680 + 0x3680: 0x0002, 0x3681: 0x0002, 0x3682: 0x0002, 0x3683: 0x0002, 0x3684: 0x0002, 0x3685: 0x0002, + 0x3686: 0x0002, 0x3687: 0x0002, 0x3688: 0x0002, 0x3689: 0x0002, 0x368a: 0x0002, 0x368b: 0x000a, + 0x368c: 0x000a, + 0x36af: 0x000a, + // Block 0xdb, offset 0x36c0 + 0x36ea: 0x000a, 0x36eb: 0x000a, + // Block 0xdc, offset 0x3700 + 0x3720: 0x000a, 0x3721: 0x000a, 0x3722: 0x000a, 0x3723: 0x000a, + 0x3724: 0x000a, 0x3725: 0x000a, + // Block 0xdd, offset 0x3740 + 0x3740: 0x000a, 0x3741: 0x000a, 0x3742: 0x000a, 0x3743: 0x000a, 0x3744: 0x000a, 0x3745: 0x000a, + 0x3746: 0x000a, 0x3747: 0x000a, 0x3748: 0x000a, 0x3749: 0x000a, 0x374a: 0x000a, 0x374b: 0x000a, + 0x374c: 0x000a, 0x374d: 0x000a, 0x374e: 0x000a, 0x374f: 0x000a, 0x3750: 0x000a, 0x3751: 0x000a, + 0x3752: 0x000a, 0x3753: 0x000a, 0x3754: 0x000a, + 0x3760: 0x000a, 0x3761: 0x000a, 0x3762: 0x000a, 0x3763: 0x000a, + 0x3764: 0x000a, 0x3765: 0x000a, 0x3766: 0x000a, 0x3767: 0x000a, 0x3768: 0x000a, 0x3769: 0x000a, + 0x376a: 0x000a, 0x376b: 0x000a, 0x376c: 0x000a, + 0x3770: 0x000a, 0x3771: 0x000a, 0x3772: 0x000a, 0x3773: 0x000a, 0x3774: 0x000a, 0x3775: 0x000a, + 0x3776: 0x000a, 0x3777: 0x000a, 0x3778: 0x000a, 0x3779: 0x000a, + // Block 0xde, offset 0x3780 + 0x3780: 0x000a, 0x3781: 0x000a, 0x3782: 0x000a, 0x3783: 0x000a, 0x3784: 0x000a, 0x3785: 0x000a, + 0x3786: 0x000a, 0x3787: 0x000a, 0x3788: 0x000a, 0x3789: 0x000a, 0x378a: 0x000a, 0x378b: 0x000a, + 0x378c: 0x000a, 0x378d: 0x000a, 0x378e: 0x000a, 0x378f: 0x000a, 0x3790: 0x000a, 0x3791: 0x000a, + 0x3792: 0x000a, 0x3793: 0x000a, 0x3794: 0x000a, 0x3795: 0x000a, 0x3796: 0x000a, 0x3797: 0x000a, + 0x3798: 0x000a, + // Block 0xdf, offset 0x37c0 + 0x37c0: 0x000a, 0x37c1: 0x000a, 0x37c2: 0x000a, 0x37c3: 0x000a, 0x37c4: 0x000a, 0x37c5: 0x000a, + 0x37c6: 0x000a, 0x37c7: 0x000a, 0x37c8: 0x000a, 0x37c9: 0x000a, 0x37ca: 0x000a, 0x37cb: 0x000a, + 0x37d0: 0x000a, 0x37d1: 0x000a, + 0x37d2: 0x000a, 0x37d3: 0x000a, 0x37d4: 0x000a, 0x37d5: 0x000a, 0x37d6: 0x000a, 0x37d7: 0x000a, + 0x37d8: 0x000a, 0x37d9: 0x000a, 0x37da: 0x000a, 0x37db: 0x000a, 0x37dc: 0x000a, 0x37dd: 0x000a, + 0x37de: 0x000a, 0x37df: 0x000a, 0x37e0: 0x000a, 0x37e1: 0x000a, 0x37e2: 0x000a, 0x37e3: 0x000a, + 0x37e4: 0x000a, 0x37e5: 0x000a, 0x37e6: 0x000a, 0x37e7: 0x000a, 0x37e8: 0x000a, 0x37e9: 0x000a, + 0x37ea: 0x000a, 0x37eb: 0x000a, 0x37ec: 0x000a, 0x37ed: 0x000a, 0x37ee: 0x000a, 0x37ef: 0x000a, + 0x37f0: 0x000a, 0x37f1: 0x000a, 0x37f2: 0x000a, 0x37f3: 0x000a, 0x37f4: 0x000a, 0x37f5: 0x000a, + 0x37f6: 0x000a, 0x37f7: 0x000a, 0x37f8: 0x000a, 0x37f9: 0x000a, 0x37fa: 0x000a, 0x37fb: 0x000a, + 0x37fc: 0x000a, 0x37fd: 0x000a, 0x37fe: 0x000a, 0x37ff: 0x000a, + // Block 0xe0, offset 0x3800 + 0x3800: 0x000a, 0x3801: 0x000a, 0x3802: 0x000a, 0x3803: 0x000a, 0x3804: 0x000a, 0x3805: 0x000a, + 0x3806: 0x000a, 0x3807: 0x000a, + 0x3810: 0x000a, 0x3811: 0x000a, + 0x3812: 0x000a, 0x3813: 0x000a, 0x3814: 0x000a, 0x3815: 0x000a, 0x3816: 0x000a, 0x3817: 0x000a, + 0x3818: 0x000a, 0x3819: 0x000a, + 0x3820: 0x000a, 0x3821: 0x000a, 0x3822: 0x000a, 0x3823: 0x000a, + 0x3824: 0x000a, 0x3825: 0x000a, 0x3826: 0x000a, 0x3827: 0x000a, 0x3828: 0x000a, 0x3829: 0x000a, + 0x382a: 0x000a, 0x382b: 0x000a, 0x382c: 0x000a, 0x382d: 0x000a, 0x382e: 0x000a, 0x382f: 0x000a, + 0x3830: 0x000a, 0x3831: 0x000a, 0x3832: 0x000a, 0x3833: 0x000a, 0x3834: 0x000a, 0x3835: 0x000a, + 0x3836: 0x000a, 0x3837: 0x000a, 0x3838: 0x000a, 0x3839: 0x000a, 0x383a: 0x000a, 0x383b: 0x000a, + 0x383c: 0x000a, 0x383d: 0x000a, 0x383e: 0x000a, 0x383f: 0x000a, + // Block 0xe1, offset 0x3840 + 0x3840: 0x000a, 0x3841: 0x000a, 0x3842: 0x000a, 0x3843: 0x000a, 0x3844: 0x000a, 0x3845: 0x000a, + 0x3846: 0x000a, 0x3847: 0x000a, + 0x3850: 0x000a, 0x3851: 0x000a, + 0x3852: 0x000a, 0x3853: 0x000a, 0x3854: 0x000a, 0x3855: 0x000a, 0x3856: 0x000a, 0x3857: 0x000a, + 0x3858: 0x000a, 0x3859: 0x000a, 0x385a: 0x000a, 0x385b: 0x000a, 0x385c: 0x000a, 0x385d: 0x000a, + 0x385e: 0x000a, 0x385f: 0x000a, 0x3860: 0x000a, 0x3861: 0x000a, 0x3862: 0x000a, 0x3863: 0x000a, + 0x3864: 0x000a, 0x3865: 0x000a, 0x3866: 0x000a, 0x3867: 0x000a, 0x3868: 0x000a, 0x3869: 0x000a, + 0x386a: 0x000a, 0x386b: 0x000a, 0x386c: 0x000a, 0x386d: 0x000a, + // Block 0xe2, offset 0x3880 + 0x3880: 0x000a, 0x3881: 0x000a, 0x3882: 0x000a, 0x3883: 0x000a, 0x3884: 0x000a, 0x3885: 0x000a, + 0x3886: 0x000a, 0x3887: 0x000a, 0x3888: 0x000a, 0x3889: 0x000a, 0x388a: 0x000a, 0x388b: 0x000a, + 0x3890: 0x000a, 0x3891: 0x000a, + 0x3892: 0x000a, 0x3893: 0x000a, 0x3894: 0x000a, 0x3895: 0x000a, 0x3896: 0x000a, 0x3897: 0x000a, + 0x3898: 0x000a, 0x3899: 0x000a, 0x389a: 0x000a, 0x389b: 0x000a, 0x389c: 0x000a, 0x389d: 0x000a, + 0x389e: 0x000a, 0x389f: 0x000a, 0x38a0: 0x000a, 0x38a1: 0x000a, 0x38a2: 0x000a, 0x38a3: 0x000a, + 0x38a4: 0x000a, 0x38a5: 0x000a, 0x38a6: 0x000a, 0x38a7: 0x000a, 0x38a8: 0x000a, 0x38a9: 0x000a, + 0x38aa: 0x000a, 0x38ab: 0x000a, 0x38ac: 0x000a, 0x38ad: 0x000a, 0x38ae: 0x000a, 0x38af: 0x000a, + 0x38b0: 0x000a, 0x38b1: 0x000a, 0x38b2: 0x000a, 0x38b3: 0x000a, 0x38b4: 0x000a, 0x38b5: 0x000a, + 0x38b6: 0x000a, 0x38b7: 0x000a, 0x38b8: 0x000a, 0x38b9: 0x000a, 0x38ba: 0x000a, 0x38bb: 0x000a, + 0x38bc: 0x000a, 0x38bd: 0x000a, 0x38be: 0x000a, + // Block 0xe3, offset 0x38c0 + 0x38c0: 0x000a, 0x38c1: 0x000a, 0x38c2: 0x000a, 0x38c3: 0x000a, 0x38c4: 0x000a, 0x38c5: 0x000a, + 0x38c6: 0x000a, 0x38c7: 0x000a, 0x38c8: 0x000a, 0x38c9: 0x000a, 0x38ca: 0x000a, 0x38cb: 0x000a, + 0x38cc: 0x000a, 0x38cd: 0x000a, 0x38ce: 0x000a, 0x38cf: 0x000a, 0x38d0: 0x000a, 0x38d1: 0x000a, + 0x38d2: 0x000a, 0x38d3: 0x000a, 0x38d4: 0x000a, 0x38d5: 0x000a, 0x38d6: 0x000a, 0x38d7: 0x000a, + 0x38d8: 0x000a, 0x38d9: 0x000a, 0x38da: 0x000a, 0x38db: 0x000a, 0x38dc: 0x000a, 0x38dd: 0x000a, + 0x38de: 0x000a, 0x38df: 0x000a, 0x38e0: 0x000a, 0x38e1: 0x000a, 0x38e2: 0x000a, 0x38e3: 0x000a, + 0x38e4: 0x000a, 0x38e5: 0x000a, 0x38e6: 0x000a, 0x38e7: 0x000a, 0x38e8: 0x000a, 0x38e9: 0x000a, + 0x38ea: 0x000a, 0x38eb: 0x000a, 0x38ec: 0x000a, 0x38ed: 0x000a, 0x38ee: 0x000a, 0x38ef: 0x000a, + 0x38f0: 0x000a, 0x38f3: 0x000a, 0x38f4: 0x000a, 0x38f5: 0x000a, + 0x38f6: 0x000a, 0x38fa: 0x000a, + 0x38fc: 0x000a, 0x38fd: 0x000a, 0x38fe: 0x000a, 0x38ff: 0x000a, + // Block 0xe4, offset 0x3900 + 0x3900: 0x000a, 0x3901: 0x000a, 0x3902: 0x000a, 0x3903: 0x000a, 0x3904: 0x000a, 0x3905: 0x000a, + 0x3906: 0x000a, 0x3907: 0x000a, 0x3908: 0x000a, 0x3909: 0x000a, 0x390a: 0x000a, 0x390b: 0x000a, + 0x390c: 0x000a, 0x390d: 0x000a, 0x390e: 0x000a, 0x390f: 0x000a, 0x3910: 0x000a, 0x3911: 0x000a, + 0x3912: 0x000a, 0x3913: 0x000a, 0x3914: 0x000a, 0x3915: 0x000a, 0x3916: 0x000a, 0x3917: 0x000a, + 0x3918: 0x000a, 0x3919: 0x000a, 0x391a: 0x000a, 0x391b: 0x000a, 0x391c: 0x000a, 0x391d: 0x000a, + 0x391e: 0x000a, 0x391f: 0x000a, 0x3920: 0x000a, 0x3921: 0x000a, 0x3922: 0x000a, + 0x3930: 0x000a, 0x3931: 0x000a, 0x3932: 0x000a, 0x3933: 0x000a, 0x3934: 0x000a, 0x3935: 0x000a, + 0x3936: 0x000a, 0x3937: 0x000a, 0x3938: 0x000a, 0x3939: 0x000a, + // Block 0xe5, offset 0x3940 + 0x3940: 0x000a, 0x3941: 0x000a, 0x3942: 0x000a, + 0x3950: 0x000a, 0x3951: 0x000a, + 0x3952: 0x000a, 0x3953: 0x000a, 0x3954: 0x000a, 0x3955: 0x000a, 0x3956: 0x000a, 0x3957: 0x000a, + 0x3958: 0x000a, 0x3959: 0x000a, 0x395a: 0x000a, 0x395b: 0x000a, 0x395c: 0x000a, 0x395d: 0x000a, + 0x395e: 0x000a, 0x395f: 0x000a, 0x3960: 0x000a, 0x3961: 0x000a, 0x3962: 0x000a, 0x3963: 0x000a, + 0x3964: 0x000a, 0x3965: 0x000a, 0x3966: 0x000a, 0x3967: 0x000a, 0x3968: 0x000a, 0x3969: 0x000a, + 0x396a: 0x000a, 0x396b: 0x000a, 0x396c: 0x000a, 0x396d: 0x000a, 0x396e: 0x000a, 0x396f: 0x000a, + 0x3970: 0x000a, 0x3971: 0x000a, 0x3972: 0x000a, 0x3973: 0x000a, 0x3974: 0x000a, 0x3975: 0x000a, + 0x3976: 0x000a, 0x3977: 0x000a, 0x3978: 0x000a, 0x3979: 0x000a, 0x397a: 0x000a, 0x397b: 0x000a, + 0x397c: 0x000a, 0x397d: 0x000a, 0x397e: 0x000a, 0x397f: 0x000a, + // Block 0xe6, offset 0x3980 + 0x39a0: 0x000a, 0x39a1: 0x000a, 0x39a2: 0x000a, 0x39a3: 0x000a, + 0x39a4: 0x000a, 0x39a5: 0x000a, 0x39a6: 0x000a, 0x39a7: 0x000a, 0x39a8: 0x000a, 0x39a9: 0x000a, + 0x39aa: 0x000a, 0x39ab: 0x000a, 0x39ac: 0x000a, 0x39ad: 0x000a, + // Block 0xe7, offset 0x39c0 + 0x39fe: 0x000b, 0x39ff: 0x000b, + // Block 0xe8, offset 0x3a00 + 0x3a00: 0x000b, 0x3a01: 0x000b, 0x3a02: 0x000b, 0x3a03: 0x000b, 0x3a04: 0x000b, 0x3a05: 0x000b, + 0x3a06: 0x000b, 0x3a07: 0x000b, 0x3a08: 0x000b, 0x3a09: 0x000b, 0x3a0a: 0x000b, 0x3a0b: 0x000b, + 0x3a0c: 0x000b, 0x3a0d: 0x000b, 0x3a0e: 0x000b, 0x3a0f: 0x000b, 0x3a10: 0x000b, 0x3a11: 0x000b, + 0x3a12: 0x000b, 0x3a13: 0x000b, 0x3a14: 0x000b, 0x3a15: 0x000b, 0x3a16: 0x000b, 0x3a17: 0x000b, + 0x3a18: 0x000b, 0x3a19: 0x000b, 0x3a1a: 0x000b, 0x3a1b: 0x000b, 0x3a1c: 0x000b, 0x3a1d: 0x000b, + 0x3a1e: 0x000b, 0x3a1f: 0x000b, 0x3a20: 0x000b, 0x3a21: 0x000b, 0x3a22: 0x000b, 0x3a23: 0x000b, + 0x3a24: 0x000b, 0x3a25: 0x000b, 0x3a26: 0x000b, 0x3a27: 0x000b, 0x3a28: 0x000b, 0x3a29: 0x000b, + 0x3a2a: 0x000b, 0x3a2b: 0x000b, 0x3a2c: 0x000b, 0x3a2d: 0x000b, 0x3a2e: 0x000b, 0x3a2f: 0x000b, + 0x3a30: 0x000b, 0x3a31: 0x000b, 0x3a32: 0x000b, 0x3a33: 0x000b, 0x3a34: 0x000b, 0x3a35: 0x000b, + 0x3a36: 0x000b, 0x3a37: 0x000b, 0x3a38: 0x000b, 0x3a39: 0x000b, 0x3a3a: 0x000b, 0x3a3b: 0x000b, + 0x3a3c: 0x000b, 0x3a3d: 0x000b, 0x3a3e: 0x000b, 0x3a3f: 0x000b, + // Block 0xe9, offset 0x3a40 + 0x3a40: 0x000c, 0x3a41: 0x000c, 0x3a42: 0x000c, 0x3a43: 0x000c, 0x3a44: 0x000c, 0x3a45: 0x000c, + 0x3a46: 0x000c, 0x3a47: 0x000c, 0x3a48: 0x000c, 0x3a49: 0x000c, 0x3a4a: 0x000c, 0x3a4b: 0x000c, + 0x3a4c: 0x000c, 0x3a4d: 0x000c, 0x3a4e: 0x000c, 0x3a4f: 0x000c, 0x3a50: 0x000c, 0x3a51: 0x000c, + 0x3a52: 0x000c, 0x3a53: 0x000c, 0x3a54: 0x000c, 0x3a55: 0x000c, 0x3a56: 0x000c, 0x3a57: 0x000c, + 0x3a58: 0x000c, 0x3a59: 0x000c, 0x3a5a: 0x000c, 0x3a5b: 0x000c, 0x3a5c: 0x000c, 0x3a5d: 0x000c, + 0x3a5e: 0x000c, 0x3a5f: 0x000c, 0x3a60: 0x000c, 0x3a61: 0x000c, 0x3a62: 0x000c, 0x3a63: 0x000c, + 0x3a64: 0x000c, 0x3a65: 0x000c, 0x3a66: 0x000c, 0x3a67: 0x000c, 0x3a68: 0x000c, 0x3a69: 0x000c, + 0x3a6a: 0x000c, 0x3a6b: 0x000c, 0x3a6c: 0x000c, 0x3a6d: 0x000c, 0x3a6e: 0x000c, 0x3a6f: 0x000c, + 0x3a70: 0x000b, 0x3a71: 0x000b, 0x3a72: 0x000b, 0x3a73: 0x000b, 0x3a74: 0x000b, 0x3a75: 0x000b, + 0x3a76: 0x000b, 0x3a77: 0x000b, 0x3a78: 0x000b, 0x3a79: 0x000b, 0x3a7a: 0x000b, 0x3a7b: 0x000b, + 0x3a7c: 0x000b, 0x3a7d: 0x000b, 0x3a7e: 0x000b, 0x3a7f: 0x000b, +} + +// bidiIndex: 24 blocks, 1536 entries, 1536 bytes +// Block 0 is the zero block. +var bidiIndex = [1536]uint8{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x01, 0xc3: 0x02, + 0xca: 0x03, 0xcb: 0x04, 0xcc: 0x05, 0xcd: 0x06, 0xce: 0x07, 0xcf: 0x08, + 0xd2: 0x09, 0xd6: 0x0a, 0xd7: 0x0b, + 0xd8: 0x0c, 0xd9: 0x0d, 0xda: 0x0e, 0xdb: 0x0f, 0xdc: 0x10, 0xdd: 0x11, 0xde: 0x12, 0xdf: 0x13, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, + 0xea: 0x07, 0xef: 0x08, + 0xf0: 0x11, 0xf1: 0x12, 0xf2: 0x12, 0xf3: 0x14, 0xf4: 0x15, + // Block 0x4, offset 0x100 + 0x120: 0x14, 0x121: 0x15, 0x122: 0x16, 0x123: 0x17, 0x124: 0x18, 0x125: 0x19, 0x126: 0x1a, 0x127: 0x1b, + 0x128: 0x1c, 0x129: 0x1d, 0x12a: 0x1c, 0x12b: 0x1e, 0x12c: 0x1f, 0x12d: 0x20, 0x12e: 0x21, 0x12f: 0x22, + 0x130: 0x23, 0x131: 0x24, 0x132: 0x1a, 0x133: 0x25, 0x134: 0x26, 0x135: 0x27, 0x137: 0x28, + 0x138: 0x29, 0x139: 0x2a, 0x13a: 0x2b, 0x13b: 0x2c, 0x13c: 0x2d, 0x13d: 0x2e, 0x13e: 0x2f, 0x13f: 0x30, + // Block 0x5, offset 0x140 + 0x140: 0x31, 0x141: 0x32, 0x142: 0x33, + 0x14d: 0x34, 0x14e: 0x35, + 0x150: 0x36, + 0x15a: 0x37, 0x15c: 0x38, 0x15d: 0x39, 0x15e: 0x3a, 0x15f: 0x3b, + 0x160: 0x3c, 0x162: 0x3d, 0x164: 0x3e, 0x165: 0x3f, 0x167: 0x40, + 0x168: 0x41, 0x169: 0x42, 0x16a: 0x43, 0x16c: 0x44, 0x16d: 0x45, 0x16e: 0x46, 0x16f: 0x47, + 0x170: 0x48, 0x173: 0x49, 0x177: 0x4a, + 0x17e: 0x4b, 0x17f: 0x4c, + // Block 0x6, offset 0x180 + 0x180: 0x4d, 0x181: 0x4e, 0x182: 0x4f, 0x183: 0x50, 0x184: 0x51, 0x185: 0x52, 0x186: 0x53, 0x187: 0x54, + 0x188: 0x55, 0x189: 0x54, 0x18a: 0x54, 0x18b: 0x54, 0x18c: 0x56, 0x18d: 0x57, 0x18e: 0x58, 0x18f: 0x54, + 0x190: 0x59, 0x191: 0x5a, 0x192: 0x5b, 0x193: 0x5c, 0x194: 0x54, 0x195: 0x54, 0x196: 0x54, 0x197: 0x54, + 0x198: 0x54, 0x199: 0x54, 0x19a: 0x5d, 0x19b: 0x54, 0x19c: 0x54, 0x19d: 0x5e, 0x19e: 0x54, 0x19f: 0x5f, + 0x1a4: 0x54, 0x1a5: 0x54, 0x1a6: 0x60, 0x1a7: 0x61, + 0x1a8: 0x54, 0x1a9: 0x54, 0x1aa: 0x54, 0x1ab: 0x54, 0x1ac: 0x54, 0x1ad: 0x62, 0x1ae: 0x63, 0x1af: 0x64, + 0x1b3: 0x65, 0x1b5: 0x66, 0x1b7: 0x67, + 0x1b8: 0x68, 0x1b9: 0x69, 0x1ba: 0x6a, 0x1bb: 0x6b, 0x1bc: 0x54, 0x1bd: 0x54, 0x1be: 0x54, 0x1bf: 0x6c, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x6d, 0x1c2: 0x6e, 0x1c3: 0x6f, 0x1c7: 0x70, + 0x1c8: 0x71, 0x1c9: 0x72, 0x1ca: 0x73, 0x1cb: 0x74, 0x1cd: 0x75, 0x1cf: 0x76, + // Block 0x8, offset 0x200 + 0x237: 0x54, + // Block 0x9, offset 0x240 + 0x252: 0x77, 0x253: 0x78, + 0x258: 0x79, 0x259: 0x7a, 0x25a: 0x7b, 0x25b: 0x7c, 0x25c: 0x7d, 0x25e: 0x7e, + 0x260: 0x7f, 0x261: 0x80, 0x263: 0x81, 0x264: 0x82, 0x265: 0x83, 0x266: 0x84, 0x267: 0x85, + 0x268: 0x86, 0x269: 0x87, 0x26a: 0x88, 0x26b: 0x89, 0x26f: 0x8a, + // Block 0xa, offset 0x280 + 0x2ac: 0x8b, 0x2ad: 0x8c, 0x2ae: 0x0e, 0x2af: 0x0e, + 0x2b0: 0x0e, 0x2b1: 0x0e, 0x2b2: 0x0e, 0x2b3: 0x0e, 0x2b4: 0x8d, 0x2b5: 0x0e, 0x2b6: 0x0e, 0x2b7: 0x8e, + 0x2b8: 0x8f, 0x2b9: 0x90, 0x2ba: 0x0e, 0x2bb: 0x91, 0x2bc: 0x92, 0x2bd: 0x93, 0x2bf: 0x94, + // Block 0xb, offset 0x2c0 + 0x2c4: 0x95, 0x2c5: 0x54, 0x2c6: 0x96, 0x2c7: 0x97, + 0x2cb: 0x98, 0x2cd: 0x99, + 0x2e0: 0x9a, 0x2e1: 0x9a, 0x2e2: 0x9a, 0x2e3: 0x9a, 0x2e4: 0x9b, 0x2e5: 0x9a, 0x2e6: 0x9a, 0x2e7: 0x9a, + 0x2e8: 0x9c, 0x2e9: 0x9a, 0x2ea: 0x9a, 0x2eb: 0x9d, 0x2ec: 0x9e, 0x2ed: 0x9a, 0x2ee: 0x9a, 0x2ef: 0x9a, + 0x2f0: 0x9a, 0x2f1: 0x9a, 0x2f2: 0x9a, 0x2f3: 0x9a, 0x2f4: 0x9f, 0x2f5: 0x9a, 0x2f6: 0x9a, 0x2f7: 0x9a, + 0x2f8: 0x9a, 0x2f9: 0xa0, 0x2fa: 0x9a, 0x2fb: 0x9a, 0x2fc: 0xa1, 0x2fd: 0xa2, 0x2fe: 0x9a, 0x2ff: 0x9a, + // Block 0xc, offset 0x300 + 0x300: 0xa3, 0x301: 0xa4, 0x302: 0xa5, 0x304: 0xa6, 0x305: 0xa7, 0x306: 0xa8, 0x307: 0xa9, + 0x308: 0xaa, 0x30b: 0xab, 0x30c: 0x26, 0x30d: 0xac, + 0x310: 0xad, 0x311: 0xae, 0x312: 0xaf, 0x313: 0xb0, 0x316: 0xb1, 0x317: 0xb2, + 0x318: 0xb3, 0x319: 0xb4, 0x31a: 0xb5, 0x31c: 0xb6, + 0x320: 0xb7, + 0x328: 0xb8, 0x329: 0xb9, 0x32a: 0xba, + 0x330: 0xbb, 0x332: 0xbc, 0x334: 0xbd, 0x335: 0xbe, 0x336: 0xbf, + 0x33b: 0xc0, + // Block 0xd, offset 0x340 + 0x36b: 0xc1, 0x36c: 0xc2, + 0x37e: 0xc3, + // Block 0xe, offset 0x380 + 0x3b2: 0xc4, + // Block 0xf, offset 0x3c0 + 0x3c5: 0xc5, 0x3c6: 0xc6, + 0x3c8: 0x54, 0x3c9: 0xc7, 0x3cc: 0x54, 0x3cd: 0xc8, + 0x3db: 0xc9, 0x3dc: 0xca, 0x3dd: 0xcb, 0x3de: 0xcc, 0x3df: 0xcd, + 0x3e8: 0xce, 0x3e9: 0xcf, 0x3ea: 0xd0, + // Block 0x10, offset 0x400 + 0x400: 0xd1, + 0x420: 0x9a, 0x421: 0x9a, 0x422: 0x9a, 0x423: 0xd2, 0x424: 0x9a, 0x425: 0xd3, 0x426: 0x9a, 0x427: 0x9a, + 0x428: 0x9a, 0x429: 0x9a, 0x42a: 0x9a, 0x42b: 0x9a, 0x42c: 0x9a, 0x42d: 0x9a, 0x42e: 0x9a, 0x42f: 0x9a, + 0x430: 0x9a, 0x431: 0xa1, 0x432: 0x0e, 0x433: 0x9a, 0x434: 0x9a, 0x435: 0x9a, 0x436: 0x9a, 0x437: 0x9a, + 0x438: 0x0e, 0x439: 0x0e, 0x43a: 0x0e, 0x43b: 0xd4, 0x43c: 0x9a, 0x43d: 0x9a, 0x43e: 0x9a, 0x43f: 0x9a, + // Block 0x11, offset 0x440 + 0x440: 0xd5, 0x441: 0x54, 0x442: 0xd6, 0x443: 0xd7, 0x444: 0xd8, 0x445: 0xd9, + 0x449: 0xda, 0x44c: 0x54, 0x44d: 0x54, 0x44e: 0x54, 0x44f: 0x54, + 0x450: 0x54, 0x451: 0x54, 0x452: 0x54, 0x453: 0x54, 0x454: 0x54, 0x455: 0x54, 0x456: 0x54, 0x457: 0x54, + 0x458: 0x54, 0x459: 0x54, 0x45a: 0x54, 0x45b: 0xdb, 0x45c: 0x54, 0x45d: 0x6b, 0x45e: 0x54, 0x45f: 0xdc, + 0x460: 0xdd, 0x461: 0xde, 0x462: 0xdf, 0x464: 0xe0, 0x465: 0xe1, 0x466: 0xe2, 0x467: 0xe3, + 0x469: 0xe4, + 0x47f: 0xe5, + // Block 0x12, offset 0x480 + 0x4bf: 0xe5, + // Block 0x13, offset 0x4c0 + 0x4d0: 0x09, 0x4d1: 0x0a, 0x4d6: 0x0b, + 0x4db: 0x0c, 0x4dd: 0x0d, 0x4de: 0x0e, 0x4df: 0x0f, + 0x4ef: 0x10, + 0x4ff: 0x10, + // Block 0x14, offset 0x500 + 0x50f: 0x10, + 0x51f: 0x10, + 0x52f: 0x10, + 0x53f: 0x10, + // Block 0x15, offset 0x540 + 0x540: 0xe6, 0x541: 0xe6, 0x542: 0xe6, 0x543: 0xe6, 0x544: 0x05, 0x545: 0x05, 0x546: 0x05, 0x547: 0xe7, + 0x548: 0xe6, 0x549: 0xe6, 0x54a: 0xe6, 0x54b: 0xe6, 0x54c: 0xe6, 0x54d: 0xe6, 0x54e: 0xe6, 0x54f: 0xe6, + 0x550: 0xe6, 0x551: 0xe6, 0x552: 0xe6, 0x553: 0xe6, 0x554: 0xe6, 0x555: 0xe6, 0x556: 0xe6, 0x557: 0xe6, + 0x558: 0xe6, 0x559: 0xe6, 0x55a: 0xe6, 0x55b: 0xe6, 0x55c: 0xe6, 0x55d: 0xe6, 0x55e: 0xe6, 0x55f: 0xe6, + 0x560: 0xe6, 0x561: 0xe6, 0x562: 0xe6, 0x563: 0xe6, 0x564: 0xe6, 0x565: 0xe6, 0x566: 0xe6, 0x567: 0xe6, + 0x568: 0xe6, 0x569: 0xe6, 0x56a: 0xe6, 0x56b: 0xe6, 0x56c: 0xe6, 0x56d: 0xe6, 0x56e: 0xe6, 0x56f: 0xe6, + 0x570: 0xe6, 0x571: 0xe6, 0x572: 0xe6, 0x573: 0xe6, 0x574: 0xe6, 0x575: 0xe6, 0x576: 0xe6, 0x577: 0xe6, + 0x578: 0xe6, 0x579: 0xe6, 0x57a: 0xe6, 0x57b: 0xe6, 0x57c: 0xe6, 0x57d: 0xe6, 0x57e: 0xe6, 0x57f: 0xe6, + // Block 0x16, offset 0x580 + 0x58f: 0x10, + 0x59f: 0x10, + 0x5a0: 0x13, + 0x5af: 0x10, + 0x5bf: 0x10, + // Block 0x17, offset 0x5c0 + 0x5cf: 0x10, +} + +// Total table size 16568 bytes (16KiB); checksum: F50EF68C diff --git a/vendor/golang.org/x/text/unicode/norm/composition.go b/vendor/golang.org/x/text/unicode/norm/composition.go index 9f37ef0c..e2087bce 100644 --- a/vendor/golang.org/x/text/unicode/norm/composition.go +++ b/vendor/golang.org/x/text/unicode/norm/composition.go @@ -461,6 +461,10 @@ func (rb *reorderBuffer) combineHangul(s, i, k int) { // It should only be used to recompose a single segment, as it will not // handle alternations between Hangul and non-Hangul characters correctly. func (rb *reorderBuffer) compose() { + // Lazily load the map used by the combine func below, but do + // it outside of the loop. + recompMapOnce.Do(buildRecompMap) + // UAX #15, section X5 , including Corrigendum #5 // "In any character sequence beginning with starter S, a character C is // blocked from S if and only if there is some character B between S diff --git a/vendor/golang.org/x/text/unicode/norm/forminfo.go b/vendor/golang.org/x/text/unicode/norm/forminfo.go index f7fbf86d..526c7033 100644 --- a/vendor/golang.org/x/text/unicode/norm/forminfo.go +++ b/vendor/golang.org/x/text/unicode/norm/forminfo.go @@ -199,9 +199,14 @@ func buildRecompMap() { // Note that the recomposition map for NFC and NFKC are identical. // combine returns the combined rune or 0 if it doesn't exist. +// +// The caller is responsible for calling +// recompMapOnce.Do(buildRecompMap) sometime before this is called. func combine(a, b rune) rune { key := uint32(uint16(a))<<16 + uint32(uint16(b)) - recompMapOnce.Do(buildRecompMap) + if recompMap == nil { + panic("caller error") // see func comment + } return recompMap[key] } diff --git a/vendor/golang.org/x/text/unicode/norm/iter.go b/vendor/golang.org/x/text/unicode/norm/iter.go index ce17f96c..417c6b26 100644 --- a/vendor/golang.org/x/text/unicode/norm/iter.go +++ b/vendor/golang.org/x/text/unicode/norm/iter.go @@ -128,8 +128,9 @@ func (i *Iter) Next() []byte { func nextASCIIBytes(i *Iter) []byte { p := i.p + 1 if p >= i.rb.nsrc { + p0 := i.p i.setDone() - return i.rb.src.bytes[i.p:p] + return i.rb.src.bytes[p0:p] } if i.rb.src.bytes[p] < utf8.RuneSelf { p0 := i.p diff --git a/vendor/golang.org/x/text/unicode/norm/readwriter.go b/vendor/golang.org/x/text/unicode/norm/readwriter.go index d926ee90..b38096f5 100644 --- a/vendor/golang.org/x/text/unicode/norm/readwriter.go +++ b/vendor/golang.org/x/text/unicode/norm/readwriter.go @@ -60,8 +60,8 @@ func (w *normWriter) Close() error { } // Writer returns a new writer that implements Write(b) -// by writing f(b) to w. The returned writer may use an -// an internal buffer to maintain state across Write calls. +// by writing f(b) to w. The returned writer may use an +// internal buffer to maintain state across Write calls. // Calling its Close method writes any buffered data to w. func (f Form) Writer(w io.Writer) io.WriteCloser { wr := &normWriter{rb: reorderBuffer{}, w: w} diff --git a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go index c48a97b0..26fbd55a 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go @@ -1,6 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. -// +build go1.10 +// +build go1.10,!go1.13 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go new file mode 100644 index 00000000..7297cce3 --- /dev/null +++ b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go @@ -0,0 +1,7693 @@ +// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. + +// +build go1.13 + +package norm + +import "sync" + +const ( + // Version is the Unicode edition from which the tables are derived. + Version = "11.0.0" + + // MaxTransformChunkSize indicates the maximum number of bytes that Transform + // may need to write atomically for any Form. Making a destination buffer at + // least this size ensures that Transform can always make progress and that + // the user does not need to grow the buffer on an ErrShortDst. + MaxTransformChunkSize = 35 + maxNonStarters*4 +) + +var ccc = [55]uint8{ + 0, 1, 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, + 84, 91, 103, 107, 118, 122, 129, 130, + 132, 202, 214, 216, 218, 220, 222, 224, + 226, 228, 230, 232, 233, 234, 240, +} + +const ( + firstMulti = 0x186D + firstCCC = 0x2C9E + endMulti = 0x2F60 + firstLeadingCCC = 0x49AE + firstCCCZeroExcept = 0x4A78 + firstStarterWithNLead = 0x4A9F + lastDecomp = 0x4AA1 + maxDecomp = 0x8000 +) + +// decomps: 19105 bytes +var decomps = [...]byte{ + // Bytes 0 - 3f + 0x00, 0x41, 0x20, 0x41, 0x21, 0x41, 0x22, 0x41, + 0x23, 0x41, 0x24, 0x41, 0x25, 0x41, 0x26, 0x41, + 0x27, 0x41, 0x28, 0x41, 0x29, 0x41, 0x2A, 0x41, + 0x2B, 0x41, 0x2C, 0x41, 0x2D, 0x41, 0x2E, 0x41, + 0x2F, 0x41, 0x30, 0x41, 0x31, 0x41, 0x32, 0x41, + 0x33, 0x41, 0x34, 0x41, 0x35, 0x41, 0x36, 0x41, + 0x37, 0x41, 0x38, 0x41, 0x39, 0x41, 0x3A, 0x41, + 0x3B, 0x41, 0x3C, 0x41, 0x3D, 0x41, 0x3E, 0x41, + // Bytes 40 - 7f + 0x3F, 0x41, 0x40, 0x41, 0x41, 0x41, 0x42, 0x41, + 0x43, 0x41, 0x44, 0x41, 0x45, 0x41, 0x46, 0x41, + 0x47, 0x41, 0x48, 0x41, 0x49, 0x41, 0x4A, 0x41, + 0x4B, 0x41, 0x4C, 0x41, 0x4D, 0x41, 0x4E, 0x41, + 0x4F, 0x41, 0x50, 0x41, 0x51, 0x41, 0x52, 0x41, + 0x53, 0x41, 0x54, 0x41, 0x55, 0x41, 0x56, 0x41, + 0x57, 0x41, 0x58, 0x41, 0x59, 0x41, 0x5A, 0x41, + 0x5B, 0x41, 0x5C, 0x41, 0x5D, 0x41, 0x5E, 0x41, + // Bytes 80 - bf + 0x5F, 0x41, 0x60, 0x41, 0x61, 0x41, 0x62, 0x41, + 0x63, 0x41, 0x64, 0x41, 0x65, 0x41, 0x66, 0x41, + 0x67, 0x41, 0x68, 0x41, 0x69, 0x41, 0x6A, 0x41, + 0x6B, 0x41, 0x6C, 0x41, 0x6D, 0x41, 0x6E, 0x41, + 0x6F, 0x41, 0x70, 0x41, 0x71, 0x41, 0x72, 0x41, + 0x73, 0x41, 0x74, 0x41, 0x75, 0x41, 0x76, 0x41, + 0x77, 0x41, 0x78, 0x41, 0x79, 0x41, 0x7A, 0x41, + 0x7B, 0x41, 0x7C, 0x41, 0x7D, 0x41, 0x7E, 0x42, + // Bytes c0 - ff + 0xC2, 0xA2, 0x42, 0xC2, 0xA3, 0x42, 0xC2, 0xA5, + 0x42, 0xC2, 0xA6, 0x42, 0xC2, 0xAC, 0x42, 0xC2, + 0xB7, 0x42, 0xC3, 0x86, 0x42, 0xC3, 0xB0, 0x42, + 0xC4, 0xA6, 0x42, 0xC4, 0xA7, 0x42, 0xC4, 0xB1, + 0x42, 0xC5, 0x8B, 0x42, 0xC5, 0x93, 0x42, 0xC6, + 0x8E, 0x42, 0xC6, 0x90, 0x42, 0xC6, 0xAB, 0x42, + 0xC8, 0xA2, 0x42, 0xC8, 0xB7, 0x42, 0xC9, 0x90, + 0x42, 0xC9, 0x91, 0x42, 0xC9, 0x92, 0x42, 0xC9, + // Bytes 100 - 13f + 0x94, 0x42, 0xC9, 0x95, 0x42, 0xC9, 0x99, 0x42, + 0xC9, 0x9B, 0x42, 0xC9, 0x9C, 0x42, 0xC9, 0x9F, + 0x42, 0xC9, 0xA1, 0x42, 0xC9, 0xA3, 0x42, 0xC9, + 0xA5, 0x42, 0xC9, 0xA6, 0x42, 0xC9, 0xA8, 0x42, + 0xC9, 0xA9, 0x42, 0xC9, 0xAA, 0x42, 0xC9, 0xAB, + 0x42, 0xC9, 0xAD, 0x42, 0xC9, 0xAF, 0x42, 0xC9, + 0xB0, 0x42, 0xC9, 0xB1, 0x42, 0xC9, 0xB2, 0x42, + 0xC9, 0xB3, 0x42, 0xC9, 0xB4, 0x42, 0xC9, 0xB5, + // Bytes 140 - 17f + 0x42, 0xC9, 0xB8, 0x42, 0xC9, 0xB9, 0x42, 0xC9, + 0xBB, 0x42, 0xCA, 0x81, 0x42, 0xCA, 0x82, 0x42, + 0xCA, 0x83, 0x42, 0xCA, 0x89, 0x42, 0xCA, 0x8A, + 0x42, 0xCA, 0x8B, 0x42, 0xCA, 0x8C, 0x42, 0xCA, + 0x90, 0x42, 0xCA, 0x91, 0x42, 0xCA, 0x92, 0x42, + 0xCA, 0x95, 0x42, 0xCA, 0x9D, 0x42, 0xCA, 0x9F, + 0x42, 0xCA, 0xB9, 0x42, 0xCE, 0x91, 0x42, 0xCE, + 0x92, 0x42, 0xCE, 0x93, 0x42, 0xCE, 0x94, 0x42, + // Bytes 180 - 1bf + 0xCE, 0x95, 0x42, 0xCE, 0x96, 0x42, 0xCE, 0x97, + 0x42, 0xCE, 0x98, 0x42, 0xCE, 0x99, 0x42, 0xCE, + 0x9A, 0x42, 0xCE, 0x9B, 0x42, 0xCE, 0x9C, 0x42, + 0xCE, 0x9D, 0x42, 0xCE, 0x9E, 0x42, 0xCE, 0x9F, + 0x42, 0xCE, 0xA0, 0x42, 0xCE, 0xA1, 0x42, 0xCE, + 0xA3, 0x42, 0xCE, 0xA4, 0x42, 0xCE, 0xA5, 0x42, + 0xCE, 0xA6, 0x42, 0xCE, 0xA7, 0x42, 0xCE, 0xA8, + 0x42, 0xCE, 0xA9, 0x42, 0xCE, 0xB1, 0x42, 0xCE, + // Bytes 1c0 - 1ff + 0xB2, 0x42, 0xCE, 0xB3, 0x42, 0xCE, 0xB4, 0x42, + 0xCE, 0xB5, 0x42, 0xCE, 0xB6, 0x42, 0xCE, 0xB7, + 0x42, 0xCE, 0xB8, 0x42, 0xCE, 0xB9, 0x42, 0xCE, + 0xBA, 0x42, 0xCE, 0xBB, 0x42, 0xCE, 0xBC, 0x42, + 0xCE, 0xBD, 0x42, 0xCE, 0xBE, 0x42, 0xCE, 0xBF, + 0x42, 0xCF, 0x80, 0x42, 0xCF, 0x81, 0x42, 0xCF, + 0x82, 0x42, 0xCF, 0x83, 0x42, 0xCF, 0x84, 0x42, + 0xCF, 0x85, 0x42, 0xCF, 0x86, 0x42, 0xCF, 0x87, + // Bytes 200 - 23f + 0x42, 0xCF, 0x88, 0x42, 0xCF, 0x89, 0x42, 0xCF, + 0x9C, 0x42, 0xCF, 0x9D, 0x42, 0xD0, 0xBD, 0x42, + 0xD1, 0x8A, 0x42, 0xD1, 0x8C, 0x42, 0xD7, 0x90, + 0x42, 0xD7, 0x91, 0x42, 0xD7, 0x92, 0x42, 0xD7, + 0x93, 0x42, 0xD7, 0x94, 0x42, 0xD7, 0x9B, 0x42, + 0xD7, 0x9C, 0x42, 0xD7, 0x9D, 0x42, 0xD7, 0xA2, + 0x42, 0xD7, 0xA8, 0x42, 0xD7, 0xAA, 0x42, 0xD8, + 0xA1, 0x42, 0xD8, 0xA7, 0x42, 0xD8, 0xA8, 0x42, + // Bytes 240 - 27f + 0xD8, 0xA9, 0x42, 0xD8, 0xAA, 0x42, 0xD8, 0xAB, + 0x42, 0xD8, 0xAC, 0x42, 0xD8, 0xAD, 0x42, 0xD8, + 0xAE, 0x42, 0xD8, 0xAF, 0x42, 0xD8, 0xB0, 0x42, + 0xD8, 0xB1, 0x42, 0xD8, 0xB2, 0x42, 0xD8, 0xB3, + 0x42, 0xD8, 0xB4, 0x42, 0xD8, 0xB5, 0x42, 0xD8, + 0xB6, 0x42, 0xD8, 0xB7, 0x42, 0xD8, 0xB8, 0x42, + 0xD8, 0xB9, 0x42, 0xD8, 0xBA, 0x42, 0xD9, 0x81, + 0x42, 0xD9, 0x82, 0x42, 0xD9, 0x83, 0x42, 0xD9, + // Bytes 280 - 2bf + 0x84, 0x42, 0xD9, 0x85, 0x42, 0xD9, 0x86, 0x42, + 0xD9, 0x87, 0x42, 0xD9, 0x88, 0x42, 0xD9, 0x89, + 0x42, 0xD9, 0x8A, 0x42, 0xD9, 0xAE, 0x42, 0xD9, + 0xAF, 0x42, 0xD9, 0xB1, 0x42, 0xD9, 0xB9, 0x42, + 0xD9, 0xBA, 0x42, 0xD9, 0xBB, 0x42, 0xD9, 0xBE, + 0x42, 0xD9, 0xBF, 0x42, 0xDA, 0x80, 0x42, 0xDA, + 0x83, 0x42, 0xDA, 0x84, 0x42, 0xDA, 0x86, 0x42, + 0xDA, 0x87, 0x42, 0xDA, 0x88, 0x42, 0xDA, 0x8C, + // Bytes 2c0 - 2ff + 0x42, 0xDA, 0x8D, 0x42, 0xDA, 0x8E, 0x42, 0xDA, + 0x91, 0x42, 0xDA, 0x98, 0x42, 0xDA, 0xA1, 0x42, + 0xDA, 0xA4, 0x42, 0xDA, 0xA6, 0x42, 0xDA, 0xA9, + 0x42, 0xDA, 0xAD, 0x42, 0xDA, 0xAF, 0x42, 0xDA, + 0xB1, 0x42, 0xDA, 0xB3, 0x42, 0xDA, 0xBA, 0x42, + 0xDA, 0xBB, 0x42, 0xDA, 0xBE, 0x42, 0xDB, 0x81, + 0x42, 0xDB, 0x85, 0x42, 0xDB, 0x86, 0x42, 0xDB, + 0x87, 0x42, 0xDB, 0x88, 0x42, 0xDB, 0x89, 0x42, + // Bytes 300 - 33f + 0xDB, 0x8B, 0x42, 0xDB, 0x8C, 0x42, 0xDB, 0x90, + 0x42, 0xDB, 0x92, 0x43, 0xE0, 0xBC, 0x8B, 0x43, + 0xE1, 0x83, 0x9C, 0x43, 0xE1, 0x84, 0x80, 0x43, + 0xE1, 0x84, 0x81, 0x43, 0xE1, 0x84, 0x82, 0x43, + 0xE1, 0x84, 0x83, 0x43, 0xE1, 0x84, 0x84, 0x43, + 0xE1, 0x84, 0x85, 0x43, 0xE1, 0x84, 0x86, 0x43, + 0xE1, 0x84, 0x87, 0x43, 0xE1, 0x84, 0x88, 0x43, + 0xE1, 0x84, 0x89, 0x43, 0xE1, 0x84, 0x8A, 0x43, + // Bytes 340 - 37f + 0xE1, 0x84, 0x8B, 0x43, 0xE1, 0x84, 0x8C, 0x43, + 0xE1, 0x84, 0x8D, 0x43, 0xE1, 0x84, 0x8E, 0x43, + 0xE1, 0x84, 0x8F, 0x43, 0xE1, 0x84, 0x90, 0x43, + 0xE1, 0x84, 0x91, 0x43, 0xE1, 0x84, 0x92, 0x43, + 0xE1, 0x84, 0x94, 0x43, 0xE1, 0x84, 0x95, 0x43, + 0xE1, 0x84, 0x9A, 0x43, 0xE1, 0x84, 0x9C, 0x43, + 0xE1, 0x84, 0x9D, 0x43, 0xE1, 0x84, 0x9E, 0x43, + 0xE1, 0x84, 0xA0, 0x43, 0xE1, 0x84, 0xA1, 0x43, + // Bytes 380 - 3bf + 0xE1, 0x84, 0xA2, 0x43, 0xE1, 0x84, 0xA3, 0x43, + 0xE1, 0x84, 0xA7, 0x43, 0xE1, 0x84, 0xA9, 0x43, + 0xE1, 0x84, 0xAB, 0x43, 0xE1, 0x84, 0xAC, 0x43, + 0xE1, 0x84, 0xAD, 0x43, 0xE1, 0x84, 0xAE, 0x43, + 0xE1, 0x84, 0xAF, 0x43, 0xE1, 0x84, 0xB2, 0x43, + 0xE1, 0x84, 0xB6, 0x43, 0xE1, 0x85, 0x80, 0x43, + 0xE1, 0x85, 0x87, 0x43, 0xE1, 0x85, 0x8C, 0x43, + 0xE1, 0x85, 0x97, 0x43, 0xE1, 0x85, 0x98, 0x43, + // Bytes 3c0 - 3ff + 0xE1, 0x85, 0x99, 0x43, 0xE1, 0x85, 0xA0, 0x43, + 0xE1, 0x86, 0x84, 0x43, 0xE1, 0x86, 0x85, 0x43, + 0xE1, 0x86, 0x88, 0x43, 0xE1, 0x86, 0x91, 0x43, + 0xE1, 0x86, 0x92, 0x43, 0xE1, 0x86, 0x94, 0x43, + 0xE1, 0x86, 0x9E, 0x43, 0xE1, 0x86, 0xA1, 0x43, + 0xE1, 0x87, 0x87, 0x43, 0xE1, 0x87, 0x88, 0x43, + 0xE1, 0x87, 0x8C, 0x43, 0xE1, 0x87, 0x8E, 0x43, + 0xE1, 0x87, 0x93, 0x43, 0xE1, 0x87, 0x97, 0x43, + // Bytes 400 - 43f + 0xE1, 0x87, 0x99, 0x43, 0xE1, 0x87, 0x9D, 0x43, + 0xE1, 0x87, 0x9F, 0x43, 0xE1, 0x87, 0xB1, 0x43, + 0xE1, 0x87, 0xB2, 0x43, 0xE1, 0xB4, 0x82, 0x43, + 0xE1, 0xB4, 0x96, 0x43, 0xE1, 0xB4, 0x97, 0x43, + 0xE1, 0xB4, 0x9C, 0x43, 0xE1, 0xB4, 0x9D, 0x43, + 0xE1, 0xB4, 0xA5, 0x43, 0xE1, 0xB5, 0xBB, 0x43, + 0xE1, 0xB6, 0x85, 0x43, 0xE2, 0x80, 0x82, 0x43, + 0xE2, 0x80, 0x83, 0x43, 0xE2, 0x80, 0x90, 0x43, + // Bytes 440 - 47f + 0xE2, 0x80, 0x93, 0x43, 0xE2, 0x80, 0x94, 0x43, + 0xE2, 0x82, 0xA9, 0x43, 0xE2, 0x86, 0x90, 0x43, + 0xE2, 0x86, 0x91, 0x43, 0xE2, 0x86, 0x92, 0x43, + 0xE2, 0x86, 0x93, 0x43, 0xE2, 0x88, 0x82, 0x43, + 0xE2, 0x88, 0x87, 0x43, 0xE2, 0x88, 0x91, 0x43, + 0xE2, 0x88, 0x92, 0x43, 0xE2, 0x94, 0x82, 0x43, + 0xE2, 0x96, 0xA0, 0x43, 0xE2, 0x97, 0x8B, 0x43, + 0xE2, 0xA6, 0x85, 0x43, 0xE2, 0xA6, 0x86, 0x43, + // Bytes 480 - 4bf + 0xE2, 0xB5, 0xA1, 0x43, 0xE3, 0x80, 0x81, 0x43, + 0xE3, 0x80, 0x82, 0x43, 0xE3, 0x80, 0x88, 0x43, + 0xE3, 0x80, 0x89, 0x43, 0xE3, 0x80, 0x8A, 0x43, + 0xE3, 0x80, 0x8B, 0x43, 0xE3, 0x80, 0x8C, 0x43, + 0xE3, 0x80, 0x8D, 0x43, 0xE3, 0x80, 0x8E, 0x43, + 0xE3, 0x80, 0x8F, 0x43, 0xE3, 0x80, 0x90, 0x43, + 0xE3, 0x80, 0x91, 0x43, 0xE3, 0x80, 0x92, 0x43, + 0xE3, 0x80, 0x94, 0x43, 0xE3, 0x80, 0x95, 0x43, + // Bytes 4c0 - 4ff + 0xE3, 0x80, 0x96, 0x43, 0xE3, 0x80, 0x97, 0x43, + 0xE3, 0x82, 0xA1, 0x43, 0xE3, 0x82, 0xA2, 0x43, + 0xE3, 0x82, 0xA3, 0x43, 0xE3, 0x82, 0xA4, 0x43, + 0xE3, 0x82, 0xA5, 0x43, 0xE3, 0x82, 0xA6, 0x43, + 0xE3, 0x82, 0xA7, 0x43, 0xE3, 0x82, 0xA8, 0x43, + 0xE3, 0x82, 0xA9, 0x43, 0xE3, 0x82, 0xAA, 0x43, + 0xE3, 0x82, 0xAB, 0x43, 0xE3, 0x82, 0xAD, 0x43, + 0xE3, 0x82, 0xAF, 0x43, 0xE3, 0x82, 0xB1, 0x43, + // Bytes 500 - 53f + 0xE3, 0x82, 0xB3, 0x43, 0xE3, 0x82, 0xB5, 0x43, + 0xE3, 0x82, 0xB7, 0x43, 0xE3, 0x82, 0xB9, 0x43, + 0xE3, 0x82, 0xBB, 0x43, 0xE3, 0x82, 0xBD, 0x43, + 0xE3, 0x82, 0xBF, 0x43, 0xE3, 0x83, 0x81, 0x43, + 0xE3, 0x83, 0x83, 0x43, 0xE3, 0x83, 0x84, 0x43, + 0xE3, 0x83, 0x86, 0x43, 0xE3, 0x83, 0x88, 0x43, + 0xE3, 0x83, 0x8A, 0x43, 0xE3, 0x83, 0x8B, 0x43, + 0xE3, 0x83, 0x8C, 0x43, 0xE3, 0x83, 0x8D, 0x43, + // Bytes 540 - 57f + 0xE3, 0x83, 0x8E, 0x43, 0xE3, 0x83, 0x8F, 0x43, + 0xE3, 0x83, 0x92, 0x43, 0xE3, 0x83, 0x95, 0x43, + 0xE3, 0x83, 0x98, 0x43, 0xE3, 0x83, 0x9B, 0x43, + 0xE3, 0x83, 0x9E, 0x43, 0xE3, 0x83, 0x9F, 0x43, + 0xE3, 0x83, 0xA0, 0x43, 0xE3, 0x83, 0xA1, 0x43, + 0xE3, 0x83, 0xA2, 0x43, 0xE3, 0x83, 0xA3, 0x43, + 0xE3, 0x83, 0xA4, 0x43, 0xE3, 0x83, 0xA5, 0x43, + 0xE3, 0x83, 0xA6, 0x43, 0xE3, 0x83, 0xA7, 0x43, + // Bytes 580 - 5bf + 0xE3, 0x83, 0xA8, 0x43, 0xE3, 0x83, 0xA9, 0x43, + 0xE3, 0x83, 0xAA, 0x43, 0xE3, 0x83, 0xAB, 0x43, + 0xE3, 0x83, 0xAC, 0x43, 0xE3, 0x83, 0xAD, 0x43, + 0xE3, 0x83, 0xAF, 0x43, 0xE3, 0x83, 0xB0, 0x43, + 0xE3, 0x83, 0xB1, 0x43, 0xE3, 0x83, 0xB2, 0x43, + 0xE3, 0x83, 0xB3, 0x43, 0xE3, 0x83, 0xBB, 0x43, + 0xE3, 0x83, 0xBC, 0x43, 0xE3, 0x92, 0x9E, 0x43, + 0xE3, 0x92, 0xB9, 0x43, 0xE3, 0x92, 0xBB, 0x43, + // Bytes 5c0 - 5ff + 0xE3, 0x93, 0x9F, 0x43, 0xE3, 0x94, 0x95, 0x43, + 0xE3, 0x9B, 0xAE, 0x43, 0xE3, 0x9B, 0xBC, 0x43, + 0xE3, 0x9E, 0x81, 0x43, 0xE3, 0xA0, 0xAF, 0x43, + 0xE3, 0xA1, 0xA2, 0x43, 0xE3, 0xA1, 0xBC, 0x43, + 0xE3, 0xA3, 0x87, 0x43, 0xE3, 0xA3, 0xA3, 0x43, + 0xE3, 0xA4, 0x9C, 0x43, 0xE3, 0xA4, 0xBA, 0x43, + 0xE3, 0xA8, 0xAE, 0x43, 0xE3, 0xA9, 0xAC, 0x43, + 0xE3, 0xAB, 0xA4, 0x43, 0xE3, 0xAC, 0x88, 0x43, + // Bytes 600 - 63f + 0xE3, 0xAC, 0x99, 0x43, 0xE3, 0xAD, 0x89, 0x43, + 0xE3, 0xAE, 0x9D, 0x43, 0xE3, 0xB0, 0x98, 0x43, + 0xE3, 0xB1, 0x8E, 0x43, 0xE3, 0xB4, 0xB3, 0x43, + 0xE3, 0xB6, 0x96, 0x43, 0xE3, 0xBA, 0xAC, 0x43, + 0xE3, 0xBA, 0xB8, 0x43, 0xE3, 0xBC, 0x9B, 0x43, + 0xE3, 0xBF, 0xBC, 0x43, 0xE4, 0x80, 0x88, 0x43, + 0xE4, 0x80, 0x98, 0x43, 0xE4, 0x80, 0xB9, 0x43, + 0xE4, 0x81, 0x86, 0x43, 0xE4, 0x82, 0x96, 0x43, + // Bytes 640 - 67f + 0xE4, 0x83, 0xA3, 0x43, 0xE4, 0x84, 0xAF, 0x43, + 0xE4, 0x88, 0x82, 0x43, 0xE4, 0x88, 0xA7, 0x43, + 0xE4, 0x8A, 0xA0, 0x43, 0xE4, 0x8C, 0x81, 0x43, + 0xE4, 0x8C, 0xB4, 0x43, 0xE4, 0x8D, 0x99, 0x43, + 0xE4, 0x8F, 0x95, 0x43, 0xE4, 0x8F, 0x99, 0x43, + 0xE4, 0x90, 0x8B, 0x43, 0xE4, 0x91, 0xAB, 0x43, + 0xE4, 0x94, 0xAB, 0x43, 0xE4, 0x95, 0x9D, 0x43, + 0xE4, 0x95, 0xA1, 0x43, 0xE4, 0x95, 0xAB, 0x43, + // Bytes 680 - 6bf + 0xE4, 0x97, 0x97, 0x43, 0xE4, 0x97, 0xB9, 0x43, + 0xE4, 0x98, 0xB5, 0x43, 0xE4, 0x9A, 0xBE, 0x43, + 0xE4, 0x9B, 0x87, 0x43, 0xE4, 0xA6, 0x95, 0x43, + 0xE4, 0xA7, 0xA6, 0x43, 0xE4, 0xA9, 0xAE, 0x43, + 0xE4, 0xA9, 0xB6, 0x43, 0xE4, 0xAA, 0xB2, 0x43, + 0xE4, 0xAC, 0xB3, 0x43, 0xE4, 0xAF, 0x8E, 0x43, + 0xE4, 0xB3, 0x8E, 0x43, 0xE4, 0xB3, 0xAD, 0x43, + 0xE4, 0xB3, 0xB8, 0x43, 0xE4, 0xB5, 0x96, 0x43, + // Bytes 6c0 - 6ff + 0xE4, 0xB8, 0x80, 0x43, 0xE4, 0xB8, 0x81, 0x43, + 0xE4, 0xB8, 0x83, 0x43, 0xE4, 0xB8, 0x89, 0x43, + 0xE4, 0xB8, 0x8A, 0x43, 0xE4, 0xB8, 0x8B, 0x43, + 0xE4, 0xB8, 0x8D, 0x43, 0xE4, 0xB8, 0x99, 0x43, + 0xE4, 0xB8, 0xA6, 0x43, 0xE4, 0xB8, 0xA8, 0x43, + 0xE4, 0xB8, 0xAD, 0x43, 0xE4, 0xB8, 0xB2, 0x43, + 0xE4, 0xB8, 0xB6, 0x43, 0xE4, 0xB8, 0xB8, 0x43, + 0xE4, 0xB8, 0xB9, 0x43, 0xE4, 0xB8, 0xBD, 0x43, + // Bytes 700 - 73f + 0xE4, 0xB8, 0xBF, 0x43, 0xE4, 0xB9, 0x81, 0x43, + 0xE4, 0xB9, 0x99, 0x43, 0xE4, 0xB9, 0x9D, 0x43, + 0xE4, 0xBA, 0x82, 0x43, 0xE4, 0xBA, 0x85, 0x43, + 0xE4, 0xBA, 0x86, 0x43, 0xE4, 0xBA, 0x8C, 0x43, + 0xE4, 0xBA, 0x94, 0x43, 0xE4, 0xBA, 0xA0, 0x43, + 0xE4, 0xBA, 0xA4, 0x43, 0xE4, 0xBA, 0xAE, 0x43, + 0xE4, 0xBA, 0xBA, 0x43, 0xE4, 0xBB, 0x80, 0x43, + 0xE4, 0xBB, 0x8C, 0x43, 0xE4, 0xBB, 0xA4, 0x43, + // Bytes 740 - 77f + 0xE4, 0xBC, 0x81, 0x43, 0xE4, 0xBC, 0x91, 0x43, + 0xE4, 0xBD, 0xA0, 0x43, 0xE4, 0xBE, 0x80, 0x43, + 0xE4, 0xBE, 0x86, 0x43, 0xE4, 0xBE, 0x8B, 0x43, + 0xE4, 0xBE, 0xAE, 0x43, 0xE4, 0xBE, 0xBB, 0x43, + 0xE4, 0xBE, 0xBF, 0x43, 0xE5, 0x80, 0x82, 0x43, + 0xE5, 0x80, 0xAB, 0x43, 0xE5, 0x81, 0xBA, 0x43, + 0xE5, 0x82, 0x99, 0x43, 0xE5, 0x83, 0x8F, 0x43, + 0xE5, 0x83, 0x9A, 0x43, 0xE5, 0x83, 0xA7, 0x43, + // Bytes 780 - 7bf + 0xE5, 0x84, 0xAA, 0x43, 0xE5, 0x84, 0xBF, 0x43, + 0xE5, 0x85, 0x80, 0x43, 0xE5, 0x85, 0x85, 0x43, + 0xE5, 0x85, 0x8D, 0x43, 0xE5, 0x85, 0x94, 0x43, + 0xE5, 0x85, 0xA4, 0x43, 0xE5, 0x85, 0xA5, 0x43, + 0xE5, 0x85, 0xA7, 0x43, 0xE5, 0x85, 0xA8, 0x43, + 0xE5, 0x85, 0xA9, 0x43, 0xE5, 0x85, 0xAB, 0x43, + 0xE5, 0x85, 0xAD, 0x43, 0xE5, 0x85, 0xB7, 0x43, + 0xE5, 0x86, 0x80, 0x43, 0xE5, 0x86, 0x82, 0x43, + // Bytes 7c0 - 7ff + 0xE5, 0x86, 0x8D, 0x43, 0xE5, 0x86, 0x92, 0x43, + 0xE5, 0x86, 0x95, 0x43, 0xE5, 0x86, 0x96, 0x43, + 0xE5, 0x86, 0x97, 0x43, 0xE5, 0x86, 0x99, 0x43, + 0xE5, 0x86, 0xA4, 0x43, 0xE5, 0x86, 0xAB, 0x43, + 0xE5, 0x86, 0xAC, 0x43, 0xE5, 0x86, 0xB5, 0x43, + 0xE5, 0x86, 0xB7, 0x43, 0xE5, 0x87, 0x89, 0x43, + 0xE5, 0x87, 0x8C, 0x43, 0xE5, 0x87, 0x9C, 0x43, + 0xE5, 0x87, 0x9E, 0x43, 0xE5, 0x87, 0xA0, 0x43, + // Bytes 800 - 83f + 0xE5, 0x87, 0xB5, 0x43, 0xE5, 0x88, 0x80, 0x43, + 0xE5, 0x88, 0x83, 0x43, 0xE5, 0x88, 0x87, 0x43, + 0xE5, 0x88, 0x97, 0x43, 0xE5, 0x88, 0x9D, 0x43, + 0xE5, 0x88, 0xA9, 0x43, 0xE5, 0x88, 0xBA, 0x43, + 0xE5, 0x88, 0xBB, 0x43, 0xE5, 0x89, 0x86, 0x43, + 0xE5, 0x89, 0x8D, 0x43, 0xE5, 0x89, 0xB2, 0x43, + 0xE5, 0x89, 0xB7, 0x43, 0xE5, 0x8A, 0x89, 0x43, + 0xE5, 0x8A, 0x9B, 0x43, 0xE5, 0x8A, 0xA3, 0x43, + // Bytes 840 - 87f + 0xE5, 0x8A, 0xB3, 0x43, 0xE5, 0x8A, 0xB4, 0x43, + 0xE5, 0x8B, 0x87, 0x43, 0xE5, 0x8B, 0x89, 0x43, + 0xE5, 0x8B, 0x92, 0x43, 0xE5, 0x8B, 0x9E, 0x43, + 0xE5, 0x8B, 0xA4, 0x43, 0xE5, 0x8B, 0xB5, 0x43, + 0xE5, 0x8B, 0xB9, 0x43, 0xE5, 0x8B, 0xBA, 0x43, + 0xE5, 0x8C, 0x85, 0x43, 0xE5, 0x8C, 0x86, 0x43, + 0xE5, 0x8C, 0x95, 0x43, 0xE5, 0x8C, 0x97, 0x43, + 0xE5, 0x8C, 0x9A, 0x43, 0xE5, 0x8C, 0xB8, 0x43, + // Bytes 880 - 8bf + 0xE5, 0x8C, 0xBB, 0x43, 0xE5, 0x8C, 0xBF, 0x43, + 0xE5, 0x8D, 0x81, 0x43, 0xE5, 0x8D, 0x84, 0x43, + 0xE5, 0x8D, 0x85, 0x43, 0xE5, 0x8D, 0x89, 0x43, + 0xE5, 0x8D, 0x91, 0x43, 0xE5, 0x8D, 0x94, 0x43, + 0xE5, 0x8D, 0x9A, 0x43, 0xE5, 0x8D, 0x9C, 0x43, + 0xE5, 0x8D, 0xA9, 0x43, 0xE5, 0x8D, 0xB0, 0x43, + 0xE5, 0x8D, 0xB3, 0x43, 0xE5, 0x8D, 0xB5, 0x43, + 0xE5, 0x8D, 0xBD, 0x43, 0xE5, 0x8D, 0xBF, 0x43, + // Bytes 8c0 - 8ff + 0xE5, 0x8E, 0x82, 0x43, 0xE5, 0x8E, 0xB6, 0x43, + 0xE5, 0x8F, 0x83, 0x43, 0xE5, 0x8F, 0x88, 0x43, + 0xE5, 0x8F, 0x8A, 0x43, 0xE5, 0x8F, 0x8C, 0x43, + 0xE5, 0x8F, 0x9F, 0x43, 0xE5, 0x8F, 0xA3, 0x43, + 0xE5, 0x8F, 0xA5, 0x43, 0xE5, 0x8F, 0xAB, 0x43, + 0xE5, 0x8F, 0xAF, 0x43, 0xE5, 0x8F, 0xB1, 0x43, + 0xE5, 0x8F, 0xB3, 0x43, 0xE5, 0x90, 0x86, 0x43, + 0xE5, 0x90, 0x88, 0x43, 0xE5, 0x90, 0x8D, 0x43, + // Bytes 900 - 93f + 0xE5, 0x90, 0x8F, 0x43, 0xE5, 0x90, 0x9D, 0x43, + 0xE5, 0x90, 0xB8, 0x43, 0xE5, 0x90, 0xB9, 0x43, + 0xE5, 0x91, 0x82, 0x43, 0xE5, 0x91, 0x88, 0x43, + 0xE5, 0x91, 0xA8, 0x43, 0xE5, 0x92, 0x9E, 0x43, + 0xE5, 0x92, 0xA2, 0x43, 0xE5, 0x92, 0xBD, 0x43, + 0xE5, 0x93, 0xB6, 0x43, 0xE5, 0x94, 0x90, 0x43, + 0xE5, 0x95, 0x8F, 0x43, 0xE5, 0x95, 0x93, 0x43, + 0xE5, 0x95, 0x95, 0x43, 0xE5, 0x95, 0xA3, 0x43, + // Bytes 940 - 97f + 0xE5, 0x96, 0x84, 0x43, 0xE5, 0x96, 0x87, 0x43, + 0xE5, 0x96, 0x99, 0x43, 0xE5, 0x96, 0x9D, 0x43, + 0xE5, 0x96, 0xAB, 0x43, 0xE5, 0x96, 0xB3, 0x43, + 0xE5, 0x96, 0xB6, 0x43, 0xE5, 0x97, 0x80, 0x43, + 0xE5, 0x97, 0x82, 0x43, 0xE5, 0x97, 0xA2, 0x43, + 0xE5, 0x98, 0x86, 0x43, 0xE5, 0x99, 0x91, 0x43, + 0xE5, 0x99, 0xA8, 0x43, 0xE5, 0x99, 0xB4, 0x43, + 0xE5, 0x9B, 0x97, 0x43, 0xE5, 0x9B, 0x9B, 0x43, + // Bytes 980 - 9bf + 0xE5, 0x9B, 0xB9, 0x43, 0xE5, 0x9C, 0x96, 0x43, + 0xE5, 0x9C, 0x97, 0x43, 0xE5, 0x9C, 0x9F, 0x43, + 0xE5, 0x9C, 0xB0, 0x43, 0xE5, 0x9E, 0x8B, 0x43, + 0xE5, 0x9F, 0x8E, 0x43, 0xE5, 0x9F, 0xB4, 0x43, + 0xE5, 0xA0, 0x8D, 0x43, 0xE5, 0xA0, 0xB1, 0x43, + 0xE5, 0xA0, 0xB2, 0x43, 0xE5, 0xA1, 0x80, 0x43, + 0xE5, 0xA1, 0x9A, 0x43, 0xE5, 0xA1, 0x9E, 0x43, + 0xE5, 0xA2, 0xA8, 0x43, 0xE5, 0xA2, 0xAC, 0x43, + // Bytes 9c0 - 9ff + 0xE5, 0xA2, 0xB3, 0x43, 0xE5, 0xA3, 0x98, 0x43, + 0xE5, 0xA3, 0x9F, 0x43, 0xE5, 0xA3, 0xAB, 0x43, + 0xE5, 0xA3, 0xAE, 0x43, 0xE5, 0xA3, 0xB0, 0x43, + 0xE5, 0xA3, 0xB2, 0x43, 0xE5, 0xA3, 0xB7, 0x43, + 0xE5, 0xA4, 0x82, 0x43, 0xE5, 0xA4, 0x86, 0x43, + 0xE5, 0xA4, 0x8A, 0x43, 0xE5, 0xA4, 0x95, 0x43, + 0xE5, 0xA4, 0x9A, 0x43, 0xE5, 0xA4, 0x9C, 0x43, + 0xE5, 0xA4, 0xA2, 0x43, 0xE5, 0xA4, 0xA7, 0x43, + // Bytes a00 - a3f + 0xE5, 0xA4, 0xA9, 0x43, 0xE5, 0xA5, 0x84, 0x43, + 0xE5, 0xA5, 0x88, 0x43, 0xE5, 0xA5, 0x91, 0x43, + 0xE5, 0xA5, 0x94, 0x43, 0xE5, 0xA5, 0xA2, 0x43, + 0xE5, 0xA5, 0xB3, 0x43, 0xE5, 0xA7, 0x98, 0x43, + 0xE5, 0xA7, 0xAC, 0x43, 0xE5, 0xA8, 0x9B, 0x43, + 0xE5, 0xA8, 0xA7, 0x43, 0xE5, 0xA9, 0xA2, 0x43, + 0xE5, 0xA9, 0xA6, 0x43, 0xE5, 0xAA, 0xB5, 0x43, + 0xE5, 0xAC, 0x88, 0x43, 0xE5, 0xAC, 0xA8, 0x43, + // Bytes a40 - a7f + 0xE5, 0xAC, 0xBE, 0x43, 0xE5, 0xAD, 0x90, 0x43, + 0xE5, 0xAD, 0x97, 0x43, 0xE5, 0xAD, 0xA6, 0x43, + 0xE5, 0xAE, 0x80, 0x43, 0xE5, 0xAE, 0x85, 0x43, + 0xE5, 0xAE, 0x97, 0x43, 0xE5, 0xAF, 0x83, 0x43, + 0xE5, 0xAF, 0x98, 0x43, 0xE5, 0xAF, 0xA7, 0x43, + 0xE5, 0xAF, 0xAE, 0x43, 0xE5, 0xAF, 0xB3, 0x43, + 0xE5, 0xAF, 0xB8, 0x43, 0xE5, 0xAF, 0xBF, 0x43, + 0xE5, 0xB0, 0x86, 0x43, 0xE5, 0xB0, 0x8F, 0x43, + // Bytes a80 - abf + 0xE5, 0xB0, 0xA2, 0x43, 0xE5, 0xB0, 0xB8, 0x43, + 0xE5, 0xB0, 0xBF, 0x43, 0xE5, 0xB1, 0xA0, 0x43, + 0xE5, 0xB1, 0xA2, 0x43, 0xE5, 0xB1, 0xA4, 0x43, + 0xE5, 0xB1, 0xA5, 0x43, 0xE5, 0xB1, 0xAE, 0x43, + 0xE5, 0xB1, 0xB1, 0x43, 0xE5, 0xB2, 0x8D, 0x43, + 0xE5, 0xB3, 0x80, 0x43, 0xE5, 0xB4, 0x99, 0x43, + 0xE5, 0xB5, 0x83, 0x43, 0xE5, 0xB5, 0x90, 0x43, + 0xE5, 0xB5, 0xAB, 0x43, 0xE5, 0xB5, 0xAE, 0x43, + // Bytes ac0 - aff + 0xE5, 0xB5, 0xBC, 0x43, 0xE5, 0xB6, 0xB2, 0x43, + 0xE5, 0xB6, 0xBA, 0x43, 0xE5, 0xB7, 0x9B, 0x43, + 0xE5, 0xB7, 0xA1, 0x43, 0xE5, 0xB7, 0xA2, 0x43, + 0xE5, 0xB7, 0xA5, 0x43, 0xE5, 0xB7, 0xA6, 0x43, + 0xE5, 0xB7, 0xB1, 0x43, 0xE5, 0xB7, 0xBD, 0x43, + 0xE5, 0xB7, 0xBE, 0x43, 0xE5, 0xB8, 0xA8, 0x43, + 0xE5, 0xB8, 0xBD, 0x43, 0xE5, 0xB9, 0xA9, 0x43, + 0xE5, 0xB9, 0xB2, 0x43, 0xE5, 0xB9, 0xB4, 0x43, + // Bytes b00 - b3f + 0xE5, 0xB9, 0xBA, 0x43, 0xE5, 0xB9, 0xBC, 0x43, + 0xE5, 0xB9, 0xBF, 0x43, 0xE5, 0xBA, 0xA6, 0x43, + 0xE5, 0xBA, 0xB0, 0x43, 0xE5, 0xBA, 0xB3, 0x43, + 0xE5, 0xBA, 0xB6, 0x43, 0xE5, 0xBB, 0x89, 0x43, + 0xE5, 0xBB, 0x8A, 0x43, 0xE5, 0xBB, 0x92, 0x43, + 0xE5, 0xBB, 0x93, 0x43, 0xE5, 0xBB, 0x99, 0x43, + 0xE5, 0xBB, 0xAC, 0x43, 0xE5, 0xBB, 0xB4, 0x43, + 0xE5, 0xBB, 0xBE, 0x43, 0xE5, 0xBC, 0x84, 0x43, + // Bytes b40 - b7f + 0xE5, 0xBC, 0x8B, 0x43, 0xE5, 0xBC, 0x93, 0x43, + 0xE5, 0xBC, 0xA2, 0x43, 0xE5, 0xBD, 0x90, 0x43, + 0xE5, 0xBD, 0x93, 0x43, 0xE5, 0xBD, 0xA1, 0x43, + 0xE5, 0xBD, 0xA2, 0x43, 0xE5, 0xBD, 0xA9, 0x43, + 0xE5, 0xBD, 0xAB, 0x43, 0xE5, 0xBD, 0xB3, 0x43, + 0xE5, 0xBE, 0x8B, 0x43, 0xE5, 0xBE, 0x8C, 0x43, + 0xE5, 0xBE, 0x97, 0x43, 0xE5, 0xBE, 0x9A, 0x43, + 0xE5, 0xBE, 0xA9, 0x43, 0xE5, 0xBE, 0xAD, 0x43, + // Bytes b80 - bbf + 0xE5, 0xBF, 0x83, 0x43, 0xE5, 0xBF, 0x8D, 0x43, + 0xE5, 0xBF, 0x97, 0x43, 0xE5, 0xBF, 0xB5, 0x43, + 0xE5, 0xBF, 0xB9, 0x43, 0xE6, 0x80, 0x92, 0x43, + 0xE6, 0x80, 0x9C, 0x43, 0xE6, 0x81, 0xB5, 0x43, + 0xE6, 0x82, 0x81, 0x43, 0xE6, 0x82, 0x94, 0x43, + 0xE6, 0x83, 0x87, 0x43, 0xE6, 0x83, 0x98, 0x43, + 0xE6, 0x83, 0xA1, 0x43, 0xE6, 0x84, 0x88, 0x43, + 0xE6, 0x85, 0x84, 0x43, 0xE6, 0x85, 0x88, 0x43, + // Bytes bc0 - bff + 0xE6, 0x85, 0x8C, 0x43, 0xE6, 0x85, 0x8E, 0x43, + 0xE6, 0x85, 0xA0, 0x43, 0xE6, 0x85, 0xA8, 0x43, + 0xE6, 0x85, 0xBA, 0x43, 0xE6, 0x86, 0x8E, 0x43, + 0xE6, 0x86, 0x90, 0x43, 0xE6, 0x86, 0xA4, 0x43, + 0xE6, 0x86, 0xAF, 0x43, 0xE6, 0x86, 0xB2, 0x43, + 0xE6, 0x87, 0x9E, 0x43, 0xE6, 0x87, 0xB2, 0x43, + 0xE6, 0x87, 0xB6, 0x43, 0xE6, 0x88, 0x80, 0x43, + 0xE6, 0x88, 0x88, 0x43, 0xE6, 0x88, 0x90, 0x43, + // Bytes c00 - c3f + 0xE6, 0x88, 0x9B, 0x43, 0xE6, 0x88, 0xAE, 0x43, + 0xE6, 0x88, 0xB4, 0x43, 0xE6, 0x88, 0xB6, 0x43, + 0xE6, 0x89, 0x8B, 0x43, 0xE6, 0x89, 0x93, 0x43, + 0xE6, 0x89, 0x9D, 0x43, 0xE6, 0x8A, 0x95, 0x43, + 0xE6, 0x8A, 0xB1, 0x43, 0xE6, 0x8B, 0x89, 0x43, + 0xE6, 0x8B, 0x8F, 0x43, 0xE6, 0x8B, 0x93, 0x43, + 0xE6, 0x8B, 0x94, 0x43, 0xE6, 0x8B, 0xBC, 0x43, + 0xE6, 0x8B, 0xBE, 0x43, 0xE6, 0x8C, 0x87, 0x43, + // Bytes c40 - c7f + 0xE6, 0x8C, 0xBD, 0x43, 0xE6, 0x8D, 0x90, 0x43, + 0xE6, 0x8D, 0x95, 0x43, 0xE6, 0x8D, 0xA8, 0x43, + 0xE6, 0x8D, 0xBB, 0x43, 0xE6, 0x8E, 0x83, 0x43, + 0xE6, 0x8E, 0xA0, 0x43, 0xE6, 0x8E, 0xA9, 0x43, + 0xE6, 0x8F, 0x84, 0x43, 0xE6, 0x8F, 0x85, 0x43, + 0xE6, 0x8F, 0xA4, 0x43, 0xE6, 0x90, 0x9C, 0x43, + 0xE6, 0x90, 0xA2, 0x43, 0xE6, 0x91, 0x92, 0x43, + 0xE6, 0x91, 0xA9, 0x43, 0xE6, 0x91, 0xB7, 0x43, + // Bytes c80 - cbf + 0xE6, 0x91, 0xBE, 0x43, 0xE6, 0x92, 0x9A, 0x43, + 0xE6, 0x92, 0x9D, 0x43, 0xE6, 0x93, 0x84, 0x43, + 0xE6, 0x94, 0xAF, 0x43, 0xE6, 0x94, 0xB4, 0x43, + 0xE6, 0x95, 0x8F, 0x43, 0xE6, 0x95, 0x96, 0x43, + 0xE6, 0x95, 0xAC, 0x43, 0xE6, 0x95, 0xB8, 0x43, + 0xE6, 0x96, 0x87, 0x43, 0xE6, 0x96, 0x97, 0x43, + 0xE6, 0x96, 0x99, 0x43, 0xE6, 0x96, 0xA4, 0x43, + 0xE6, 0x96, 0xB0, 0x43, 0xE6, 0x96, 0xB9, 0x43, + // Bytes cc0 - cff + 0xE6, 0x97, 0x85, 0x43, 0xE6, 0x97, 0xA0, 0x43, + 0xE6, 0x97, 0xA2, 0x43, 0xE6, 0x97, 0xA3, 0x43, + 0xE6, 0x97, 0xA5, 0x43, 0xE6, 0x98, 0x93, 0x43, + 0xE6, 0x98, 0xA0, 0x43, 0xE6, 0x99, 0x89, 0x43, + 0xE6, 0x99, 0xB4, 0x43, 0xE6, 0x9A, 0x88, 0x43, + 0xE6, 0x9A, 0x91, 0x43, 0xE6, 0x9A, 0x9C, 0x43, + 0xE6, 0x9A, 0xB4, 0x43, 0xE6, 0x9B, 0x86, 0x43, + 0xE6, 0x9B, 0xB0, 0x43, 0xE6, 0x9B, 0xB4, 0x43, + // Bytes d00 - d3f + 0xE6, 0x9B, 0xB8, 0x43, 0xE6, 0x9C, 0x80, 0x43, + 0xE6, 0x9C, 0x88, 0x43, 0xE6, 0x9C, 0x89, 0x43, + 0xE6, 0x9C, 0x97, 0x43, 0xE6, 0x9C, 0x9B, 0x43, + 0xE6, 0x9C, 0xA1, 0x43, 0xE6, 0x9C, 0xA8, 0x43, + 0xE6, 0x9D, 0x8E, 0x43, 0xE6, 0x9D, 0x93, 0x43, + 0xE6, 0x9D, 0x96, 0x43, 0xE6, 0x9D, 0x9E, 0x43, + 0xE6, 0x9D, 0xBB, 0x43, 0xE6, 0x9E, 0x85, 0x43, + 0xE6, 0x9E, 0x97, 0x43, 0xE6, 0x9F, 0xB3, 0x43, + // Bytes d40 - d7f + 0xE6, 0x9F, 0xBA, 0x43, 0xE6, 0xA0, 0x97, 0x43, + 0xE6, 0xA0, 0x9F, 0x43, 0xE6, 0xA0, 0xAA, 0x43, + 0xE6, 0xA1, 0x92, 0x43, 0xE6, 0xA2, 0x81, 0x43, + 0xE6, 0xA2, 0x85, 0x43, 0xE6, 0xA2, 0x8E, 0x43, + 0xE6, 0xA2, 0xA8, 0x43, 0xE6, 0xA4, 0x94, 0x43, + 0xE6, 0xA5, 0x82, 0x43, 0xE6, 0xA6, 0xA3, 0x43, + 0xE6, 0xA7, 0xAA, 0x43, 0xE6, 0xA8, 0x82, 0x43, + 0xE6, 0xA8, 0x93, 0x43, 0xE6, 0xAA, 0xA8, 0x43, + // Bytes d80 - dbf + 0xE6, 0xAB, 0x93, 0x43, 0xE6, 0xAB, 0x9B, 0x43, + 0xE6, 0xAC, 0x84, 0x43, 0xE6, 0xAC, 0xA0, 0x43, + 0xE6, 0xAC, 0xA1, 0x43, 0xE6, 0xAD, 0x94, 0x43, + 0xE6, 0xAD, 0xA2, 0x43, 0xE6, 0xAD, 0xA3, 0x43, + 0xE6, 0xAD, 0xB2, 0x43, 0xE6, 0xAD, 0xB7, 0x43, + 0xE6, 0xAD, 0xB9, 0x43, 0xE6, 0xAE, 0x9F, 0x43, + 0xE6, 0xAE, 0xAE, 0x43, 0xE6, 0xAE, 0xB3, 0x43, + 0xE6, 0xAE, 0xBA, 0x43, 0xE6, 0xAE, 0xBB, 0x43, + // Bytes dc0 - dff + 0xE6, 0xAF, 0x8B, 0x43, 0xE6, 0xAF, 0x8D, 0x43, + 0xE6, 0xAF, 0x94, 0x43, 0xE6, 0xAF, 0x9B, 0x43, + 0xE6, 0xB0, 0x8F, 0x43, 0xE6, 0xB0, 0x94, 0x43, + 0xE6, 0xB0, 0xB4, 0x43, 0xE6, 0xB1, 0x8E, 0x43, + 0xE6, 0xB1, 0xA7, 0x43, 0xE6, 0xB2, 0x88, 0x43, + 0xE6, 0xB2, 0xBF, 0x43, 0xE6, 0xB3, 0x8C, 0x43, + 0xE6, 0xB3, 0x8D, 0x43, 0xE6, 0xB3, 0xA5, 0x43, + 0xE6, 0xB3, 0xA8, 0x43, 0xE6, 0xB4, 0x96, 0x43, + // Bytes e00 - e3f + 0xE6, 0xB4, 0x9B, 0x43, 0xE6, 0xB4, 0x9E, 0x43, + 0xE6, 0xB4, 0xB4, 0x43, 0xE6, 0xB4, 0xBE, 0x43, + 0xE6, 0xB5, 0x81, 0x43, 0xE6, 0xB5, 0xA9, 0x43, + 0xE6, 0xB5, 0xAA, 0x43, 0xE6, 0xB5, 0xB7, 0x43, + 0xE6, 0xB5, 0xB8, 0x43, 0xE6, 0xB6, 0x85, 0x43, + 0xE6, 0xB7, 0x8B, 0x43, 0xE6, 0xB7, 0x9A, 0x43, + 0xE6, 0xB7, 0xAA, 0x43, 0xE6, 0xB7, 0xB9, 0x43, + 0xE6, 0xB8, 0x9A, 0x43, 0xE6, 0xB8, 0xAF, 0x43, + // Bytes e40 - e7f + 0xE6, 0xB9, 0xAE, 0x43, 0xE6, 0xBA, 0x80, 0x43, + 0xE6, 0xBA, 0x9C, 0x43, 0xE6, 0xBA, 0xBA, 0x43, + 0xE6, 0xBB, 0x87, 0x43, 0xE6, 0xBB, 0x8B, 0x43, + 0xE6, 0xBB, 0x91, 0x43, 0xE6, 0xBB, 0x9B, 0x43, + 0xE6, 0xBC, 0x8F, 0x43, 0xE6, 0xBC, 0x94, 0x43, + 0xE6, 0xBC, 0xA2, 0x43, 0xE6, 0xBC, 0xA3, 0x43, + 0xE6, 0xBD, 0xAE, 0x43, 0xE6, 0xBF, 0x86, 0x43, + 0xE6, 0xBF, 0xAB, 0x43, 0xE6, 0xBF, 0xBE, 0x43, + // Bytes e80 - ebf + 0xE7, 0x80, 0x9B, 0x43, 0xE7, 0x80, 0x9E, 0x43, + 0xE7, 0x80, 0xB9, 0x43, 0xE7, 0x81, 0x8A, 0x43, + 0xE7, 0x81, 0xAB, 0x43, 0xE7, 0x81, 0xB0, 0x43, + 0xE7, 0x81, 0xB7, 0x43, 0xE7, 0x81, 0xBD, 0x43, + 0xE7, 0x82, 0x99, 0x43, 0xE7, 0x82, 0xAD, 0x43, + 0xE7, 0x83, 0x88, 0x43, 0xE7, 0x83, 0x99, 0x43, + 0xE7, 0x84, 0xA1, 0x43, 0xE7, 0x85, 0x85, 0x43, + 0xE7, 0x85, 0x89, 0x43, 0xE7, 0x85, 0xAE, 0x43, + // Bytes ec0 - eff + 0xE7, 0x86, 0x9C, 0x43, 0xE7, 0x87, 0x8E, 0x43, + 0xE7, 0x87, 0x90, 0x43, 0xE7, 0x88, 0x90, 0x43, + 0xE7, 0x88, 0x9B, 0x43, 0xE7, 0x88, 0xA8, 0x43, + 0xE7, 0x88, 0xAA, 0x43, 0xE7, 0x88, 0xAB, 0x43, + 0xE7, 0x88, 0xB5, 0x43, 0xE7, 0x88, 0xB6, 0x43, + 0xE7, 0x88, 0xBB, 0x43, 0xE7, 0x88, 0xBF, 0x43, + 0xE7, 0x89, 0x87, 0x43, 0xE7, 0x89, 0x90, 0x43, + 0xE7, 0x89, 0x99, 0x43, 0xE7, 0x89, 0x9B, 0x43, + // Bytes f00 - f3f + 0xE7, 0x89, 0xA2, 0x43, 0xE7, 0x89, 0xB9, 0x43, + 0xE7, 0x8A, 0x80, 0x43, 0xE7, 0x8A, 0x95, 0x43, + 0xE7, 0x8A, 0xAC, 0x43, 0xE7, 0x8A, 0xAF, 0x43, + 0xE7, 0x8B, 0x80, 0x43, 0xE7, 0x8B, 0xBC, 0x43, + 0xE7, 0x8C, 0xAA, 0x43, 0xE7, 0x8D, 0xB5, 0x43, + 0xE7, 0x8D, 0xBA, 0x43, 0xE7, 0x8E, 0x84, 0x43, + 0xE7, 0x8E, 0x87, 0x43, 0xE7, 0x8E, 0x89, 0x43, + 0xE7, 0x8E, 0x8B, 0x43, 0xE7, 0x8E, 0xA5, 0x43, + // Bytes f40 - f7f + 0xE7, 0x8E, 0xB2, 0x43, 0xE7, 0x8F, 0x9E, 0x43, + 0xE7, 0x90, 0x86, 0x43, 0xE7, 0x90, 0x89, 0x43, + 0xE7, 0x90, 0xA2, 0x43, 0xE7, 0x91, 0x87, 0x43, + 0xE7, 0x91, 0x9C, 0x43, 0xE7, 0x91, 0xA9, 0x43, + 0xE7, 0x91, 0xB1, 0x43, 0xE7, 0x92, 0x85, 0x43, + 0xE7, 0x92, 0x89, 0x43, 0xE7, 0x92, 0x98, 0x43, + 0xE7, 0x93, 0x8A, 0x43, 0xE7, 0x93, 0x9C, 0x43, + 0xE7, 0x93, 0xA6, 0x43, 0xE7, 0x94, 0x86, 0x43, + // Bytes f80 - fbf + 0xE7, 0x94, 0x98, 0x43, 0xE7, 0x94, 0x9F, 0x43, + 0xE7, 0x94, 0xA4, 0x43, 0xE7, 0x94, 0xA8, 0x43, + 0xE7, 0x94, 0xB0, 0x43, 0xE7, 0x94, 0xB2, 0x43, + 0xE7, 0x94, 0xB3, 0x43, 0xE7, 0x94, 0xB7, 0x43, + 0xE7, 0x94, 0xBB, 0x43, 0xE7, 0x94, 0xBE, 0x43, + 0xE7, 0x95, 0x99, 0x43, 0xE7, 0x95, 0xA5, 0x43, + 0xE7, 0x95, 0xB0, 0x43, 0xE7, 0x96, 0x8B, 0x43, + 0xE7, 0x96, 0x92, 0x43, 0xE7, 0x97, 0xA2, 0x43, + // Bytes fc0 - fff + 0xE7, 0x98, 0x90, 0x43, 0xE7, 0x98, 0x9D, 0x43, + 0xE7, 0x98, 0x9F, 0x43, 0xE7, 0x99, 0x82, 0x43, + 0xE7, 0x99, 0xA9, 0x43, 0xE7, 0x99, 0xB6, 0x43, + 0xE7, 0x99, 0xBD, 0x43, 0xE7, 0x9A, 0xAE, 0x43, + 0xE7, 0x9A, 0xBF, 0x43, 0xE7, 0x9B, 0x8A, 0x43, + 0xE7, 0x9B, 0x9B, 0x43, 0xE7, 0x9B, 0xA3, 0x43, + 0xE7, 0x9B, 0xA7, 0x43, 0xE7, 0x9B, 0xAE, 0x43, + 0xE7, 0x9B, 0xB4, 0x43, 0xE7, 0x9C, 0x81, 0x43, + // Bytes 1000 - 103f + 0xE7, 0x9C, 0x9E, 0x43, 0xE7, 0x9C, 0x9F, 0x43, + 0xE7, 0x9D, 0x80, 0x43, 0xE7, 0x9D, 0x8A, 0x43, + 0xE7, 0x9E, 0x8B, 0x43, 0xE7, 0x9E, 0xA7, 0x43, + 0xE7, 0x9F, 0x9B, 0x43, 0xE7, 0x9F, 0xA2, 0x43, + 0xE7, 0x9F, 0xB3, 0x43, 0xE7, 0xA1, 0x8E, 0x43, + 0xE7, 0xA1, 0xAB, 0x43, 0xE7, 0xA2, 0x8C, 0x43, + 0xE7, 0xA2, 0x91, 0x43, 0xE7, 0xA3, 0x8A, 0x43, + 0xE7, 0xA3, 0x8C, 0x43, 0xE7, 0xA3, 0xBB, 0x43, + // Bytes 1040 - 107f + 0xE7, 0xA4, 0xAA, 0x43, 0xE7, 0xA4, 0xBA, 0x43, + 0xE7, 0xA4, 0xBC, 0x43, 0xE7, 0xA4, 0xBE, 0x43, + 0xE7, 0xA5, 0x88, 0x43, 0xE7, 0xA5, 0x89, 0x43, + 0xE7, 0xA5, 0x90, 0x43, 0xE7, 0xA5, 0x96, 0x43, + 0xE7, 0xA5, 0x9D, 0x43, 0xE7, 0xA5, 0x9E, 0x43, + 0xE7, 0xA5, 0xA5, 0x43, 0xE7, 0xA5, 0xBF, 0x43, + 0xE7, 0xA6, 0x81, 0x43, 0xE7, 0xA6, 0x8D, 0x43, + 0xE7, 0xA6, 0x8E, 0x43, 0xE7, 0xA6, 0x8F, 0x43, + // Bytes 1080 - 10bf + 0xE7, 0xA6, 0xAE, 0x43, 0xE7, 0xA6, 0xB8, 0x43, + 0xE7, 0xA6, 0xBE, 0x43, 0xE7, 0xA7, 0x8A, 0x43, + 0xE7, 0xA7, 0x98, 0x43, 0xE7, 0xA7, 0xAB, 0x43, + 0xE7, 0xA8, 0x9C, 0x43, 0xE7, 0xA9, 0x80, 0x43, + 0xE7, 0xA9, 0x8A, 0x43, 0xE7, 0xA9, 0x8F, 0x43, + 0xE7, 0xA9, 0xB4, 0x43, 0xE7, 0xA9, 0xBA, 0x43, + 0xE7, 0xAA, 0x81, 0x43, 0xE7, 0xAA, 0xB1, 0x43, + 0xE7, 0xAB, 0x8B, 0x43, 0xE7, 0xAB, 0xAE, 0x43, + // Bytes 10c0 - 10ff + 0xE7, 0xAB, 0xB9, 0x43, 0xE7, 0xAC, 0xA0, 0x43, + 0xE7, 0xAE, 0x8F, 0x43, 0xE7, 0xAF, 0x80, 0x43, + 0xE7, 0xAF, 0x86, 0x43, 0xE7, 0xAF, 0x89, 0x43, + 0xE7, 0xB0, 0xBE, 0x43, 0xE7, 0xB1, 0xA0, 0x43, + 0xE7, 0xB1, 0xB3, 0x43, 0xE7, 0xB1, 0xBB, 0x43, + 0xE7, 0xB2, 0x92, 0x43, 0xE7, 0xB2, 0xBE, 0x43, + 0xE7, 0xB3, 0x92, 0x43, 0xE7, 0xB3, 0x96, 0x43, + 0xE7, 0xB3, 0xA3, 0x43, 0xE7, 0xB3, 0xA7, 0x43, + // Bytes 1100 - 113f + 0xE7, 0xB3, 0xA8, 0x43, 0xE7, 0xB3, 0xB8, 0x43, + 0xE7, 0xB4, 0x80, 0x43, 0xE7, 0xB4, 0x90, 0x43, + 0xE7, 0xB4, 0xA2, 0x43, 0xE7, 0xB4, 0xAF, 0x43, + 0xE7, 0xB5, 0x82, 0x43, 0xE7, 0xB5, 0x9B, 0x43, + 0xE7, 0xB5, 0xA3, 0x43, 0xE7, 0xB6, 0xA0, 0x43, + 0xE7, 0xB6, 0xBE, 0x43, 0xE7, 0xB7, 0x87, 0x43, + 0xE7, 0xB7, 0xB4, 0x43, 0xE7, 0xB8, 0x82, 0x43, + 0xE7, 0xB8, 0x89, 0x43, 0xE7, 0xB8, 0xB7, 0x43, + // Bytes 1140 - 117f + 0xE7, 0xB9, 0x81, 0x43, 0xE7, 0xB9, 0x85, 0x43, + 0xE7, 0xBC, 0xB6, 0x43, 0xE7, 0xBC, 0xBE, 0x43, + 0xE7, 0xBD, 0x91, 0x43, 0xE7, 0xBD, 0xB2, 0x43, + 0xE7, 0xBD, 0xB9, 0x43, 0xE7, 0xBD, 0xBA, 0x43, + 0xE7, 0xBE, 0x85, 0x43, 0xE7, 0xBE, 0x8A, 0x43, + 0xE7, 0xBE, 0x95, 0x43, 0xE7, 0xBE, 0x9A, 0x43, + 0xE7, 0xBE, 0xBD, 0x43, 0xE7, 0xBF, 0xBA, 0x43, + 0xE8, 0x80, 0x81, 0x43, 0xE8, 0x80, 0x85, 0x43, + // Bytes 1180 - 11bf + 0xE8, 0x80, 0x8C, 0x43, 0xE8, 0x80, 0x92, 0x43, + 0xE8, 0x80, 0xB3, 0x43, 0xE8, 0x81, 0x86, 0x43, + 0xE8, 0x81, 0xA0, 0x43, 0xE8, 0x81, 0xAF, 0x43, + 0xE8, 0x81, 0xB0, 0x43, 0xE8, 0x81, 0xBE, 0x43, + 0xE8, 0x81, 0xBF, 0x43, 0xE8, 0x82, 0x89, 0x43, + 0xE8, 0x82, 0x8B, 0x43, 0xE8, 0x82, 0xAD, 0x43, + 0xE8, 0x82, 0xB2, 0x43, 0xE8, 0x84, 0x83, 0x43, + 0xE8, 0x84, 0xBE, 0x43, 0xE8, 0x87, 0x98, 0x43, + // Bytes 11c0 - 11ff + 0xE8, 0x87, 0xA3, 0x43, 0xE8, 0x87, 0xA8, 0x43, + 0xE8, 0x87, 0xAA, 0x43, 0xE8, 0x87, 0xAD, 0x43, + 0xE8, 0x87, 0xB3, 0x43, 0xE8, 0x87, 0xBC, 0x43, + 0xE8, 0x88, 0x81, 0x43, 0xE8, 0x88, 0x84, 0x43, + 0xE8, 0x88, 0x8C, 0x43, 0xE8, 0x88, 0x98, 0x43, + 0xE8, 0x88, 0x9B, 0x43, 0xE8, 0x88, 0x9F, 0x43, + 0xE8, 0x89, 0xAE, 0x43, 0xE8, 0x89, 0xAF, 0x43, + 0xE8, 0x89, 0xB2, 0x43, 0xE8, 0x89, 0xB8, 0x43, + // Bytes 1200 - 123f + 0xE8, 0x89, 0xB9, 0x43, 0xE8, 0x8A, 0x8B, 0x43, + 0xE8, 0x8A, 0x91, 0x43, 0xE8, 0x8A, 0x9D, 0x43, + 0xE8, 0x8A, 0xB1, 0x43, 0xE8, 0x8A, 0xB3, 0x43, + 0xE8, 0x8A, 0xBD, 0x43, 0xE8, 0x8B, 0xA5, 0x43, + 0xE8, 0x8B, 0xA6, 0x43, 0xE8, 0x8C, 0x9D, 0x43, + 0xE8, 0x8C, 0xA3, 0x43, 0xE8, 0x8C, 0xB6, 0x43, + 0xE8, 0x8D, 0x92, 0x43, 0xE8, 0x8D, 0x93, 0x43, + 0xE8, 0x8D, 0xA3, 0x43, 0xE8, 0x8E, 0xAD, 0x43, + // Bytes 1240 - 127f + 0xE8, 0x8E, 0xBD, 0x43, 0xE8, 0x8F, 0x89, 0x43, + 0xE8, 0x8F, 0x8A, 0x43, 0xE8, 0x8F, 0x8C, 0x43, + 0xE8, 0x8F, 0x9C, 0x43, 0xE8, 0x8F, 0xA7, 0x43, + 0xE8, 0x8F, 0xAF, 0x43, 0xE8, 0x8F, 0xB1, 0x43, + 0xE8, 0x90, 0xBD, 0x43, 0xE8, 0x91, 0x89, 0x43, + 0xE8, 0x91, 0x97, 0x43, 0xE8, 0x93, 0xAE, 0x43, + 0xE8, 0x93, 0xB1, 0x43, 0xE8, 0x93, 0xB3, 0x43, + 0xE8, 0x93, 0xBC, 0x43, 0xE8, 0x94, 0x96, 0x43, + // Bytes 1280 - 12bf + 0xE8, 0x95, 0xA4, 0x43, 0xE8, 0x97, 0x8D, 0x43, + 0xE8, 0x97, 0xBA, 0x43, 0xE8, 0x98, 0x86, 0x43, + 0xE8, 0x98, 0x92, 0x43, 0xE8, 0x98, 0xAD, 0x43, + 0xE8, 0x98, 0xBF, 0x43, 0xE8, 0x99, 0x8D, 0x43, + 0xE8, 0x99, 0x90, 0x43, 0xE8, 0x99, 0x9C, 0x43, + 0xE8, 0x99, 0xA7, 0x43, 0xE8, 0x99, 0xA9, 0x43, + 0xE8, 0x99, 0xAB, 0x43, 0xE8, 0x9A, 0x88, 0x43, + 0xE8, 0x9A, 0xA9, 0x43, 0xE8, 0x9B, 0xA2, 0x43, + // Bytes 12c0 - 12ff + 0xE8, 0x9C, 0x8E, 0x43, 0xE8, 0x9C, 0xA8, 0x43, + 0xE8, 0x9D, 0xAB, 0x43, 0xE8, 0x9D, 0xB9, 0x43, + 0xE8, 0x9E, 0x86, 0x43, 0xE8, 0x9E, 0xBA, 0x43, + 0xE8, 0x9F, 0xA1, 0x43, 0xE8, 0xA0, 0x81, 0x43, + 0xE8, 0xA0, 0x9F, 0x43, 0xE8, 0xA1, 0x80, 0x43, + 0xE8, 0xA1, 0x8C, 0x43, 0xE8, 0xA1, 0xA0, 0x43, + 0xE8, 0xA1, 0xA3, 0x43, 0xE8, 0xA3, 0x82, 0x43, + 0xE8, 0xA3, 0x8F, 0x43, 0xE8, 0xA3, 0x97, 0x43, + // Bytes 1300 - 133f + 0xE8, 0xA3, 0x9E, 0x43, 0xE8, 0xA3, 0xA1, 0x43, + 0xE8, 0xA3, 0xB8, 0x43, 0xE8, 0xA3, 0xBA, 0x43, + 0xE8, 0xA4, 0x90, 0x43, 0xE8, 0xA5, 0x81, 0x43, + 0xE8, 0xA5, 0xA4, 0x43, 0xE8, 0xA5, 0xBE, 0x43, + 0xE8, 0xA6, 0x86, 0x43, 0xE8, 0xA6, 0x8B, 0x43, + 0xE8, 0xA6, 0x96, 0x43, 0xE8, 0xA7, 0x92, 0x43, + 0xE8, 0xA7, 0xA3, 0x43, 0xE8, 0xA8, 0x80, 0x43, + 0xE8, 0xAA, 0xA0, 0x43, 0xE8, 0xAA, 0xAA, 0x43, + // Bytes 1340 - 137f + 0xE8, 0xAA, 0xBF, 0x43, 0xE8, 0xAB, 0x8B, 0x43, + 0xE8, 0xAB, 0x92, 0x43, 0xE8, 0xAB, 0x96, 0x43, + 0xE8, 0xAB, 0xAD, 0x43, 0xE8, 0xAB, 0xB8, 0x43, + 0xE8, 0xAB, 0xBE, 0x43, 0xE8, 0xAC, 0x81, 0x43, + 0xE8, 0xAC, 0xB9, 0x43, 0xE8, 0xAD, 0x98, 0x43, + 0xE8, 0xAE, 0x80, 0x43, 0xE8, 0xAE, 0x8A, 0x43, + 0xE8, 0xB0, 0xB7, 0x43, 0xE8, 0xB1, 0x86, 0x43, + 0xE8, 0xB1, 0x88, 0x43, 0xE8, 0xB1, 0x95, 0x43, + // Bytes 1380 - 13bf + 0xE8, 0xB1, 0xB8, 0x43, 0xE8, 0xB2, 0x9D, 0x43, + 0xE8, 0xB2, 0xA1, 0x43, 0xE8, 0xB2, 0xA9, 0x43, + 0xE8, 0xB2, 0xAB, 0x43, 0xE8, 0xB3, 0x81, 0x43, + 0xE8, 0xB3, 0x82, 0x43, 0xE8, 0xB3, 0x87, 0x43, + 0xE8, 0xB3, 0x88, 0x43, 0xE8, 0xB3, 0x93, 0x43, + 0xE8, 0xB4, 0x88, 0x43, 0xE8, 0xB4, 0x9B, 0x43, + 0xE8, 0xB5, 0xA4, 0x43, 0xE8, 0xB5, 0xB0, 0x43, + 0xE8, 0xB5, 0xB7, 0x43, 0xE8, 0xB6, 0xB3, 0x43, + // Bytes 13c0 - 13ff + 0xE8, 0xB6, 0xBC, 0x43, 0xE8, 0xB7, 0x8B, 0x43, + 0xE8, 0xB7, 0xAF, 0x43, 0xE8, 0xB7, 0xB0, 0x43, + 0xE8, 0xBA, 0xAB, 0x43, 0xE8, 0xBB, 0x8A, 0x43, + 0xE8, 0xBB, 0x94, 0x43, 0xE8, 0xBC, 0xA6, 0x43, + 0xE8, 0xBC, 0xAA, 0x43, 0xE8, 0xBC, 0xB8, 0x43, + 0xE8, 0xBC, 0xBB, 0x43, 0xE8, 0xBD, 0xA2, 0x43, + 0xE8, 0xBE, 0x9B, 0x43, 0xE8, 0xBE, 0x9E, 0x43, + 0xE8, 0xBE, 0xB0, 0x43, 0xE8, 0xBE, 0xB5, 0x43, + // Bytes 1400 - 143f + 0xE8, 0xBE, 0xB6, 0x43, 0xE9, 0x80, 0xA3, 0x43, + 0xE9, 0x80, 0xB8, 0x43, 0xE9, 0x81, 0x8A, 0x43, + 0xE9, 0x81, 0xA9, 0x43, 0xE9, 0x81, 0xB2, 0x43, + 0xE9, 0x81, 0xBC, 0x43, 0xE9, 0x82, 0x8F, 0x43, + 0xE9, 0x82, 0x91, 0x43, 0xE9, 0x82, 0x94, 0x43, + 0xE9, 0x83, 0x8E, 0x43, 0xE9, 0x83, 0x9E, 0x43, + 0xE9, 0x83, 0xB1, 0x43, 0xE9, 0x83, 0xBD, 0x43, + 0xE9, 0x84, 0x91, 0x43, 0xE9, 0x84, 0x9B, 0x43, + // Bytes 1440 - 147f + 0xE9, 0x85, 0x89, 0x43, 0xE9, 0x85, 0x8D, 0x43, + 0xE9, 0x85, 0xAA, 0x43, 0xE9, 0x86, 0x99, 0x43, + 0xE9, 0x86, 0xB4, 0x43, 0xE9, 0x87, 0x86, 0x43, + 0xE9, 0x87, 0x8C, 0x43, 0xE9, 0x87, 0x8F, 0x43, + 0xE9, 0x87, 0x91, 0x43, 0xE9, 0x88, 0xB4, 0x43, + 0xE9, 0x88, 0xB8, 0x43, 0xE9, 0x89, 0xB6, 0x43, + 0xE9, 0x89, 0xBC, 0x43, 0xE9, 0x8B, 0x97, 0x43, + 0xE9, 0x8B, 0x98, 0x43, 0xE9, 0x8C, 0x84, 0x43, + // Bytes 1480 - 14bf + 0xE9, 0x8D, 0x8A, 0x43, 0xE9, 0x8F, 0xB9, 0x43, + 0xE9, 0x90, 0x95, 0x43, 0xE9, 0x95, 0xB7, 0x43, + 0xE9, 0x96, 0x80, 0x43, 0xE9, 0x96, 0x8B, 0x43, + 0xE9, 0x96, 0xAD, 0x43, 0xE9, 0x96, 0xB7, 0x43, + 0xE9, 0x98, 0x9C, 0x43, 0xE9, 0x98, 0xAE, 0x43, + 0xE9, 0x99, 0x8B, 0x43, 0xE9, 0x99, 0x8D, 0x43, + 0xE9, 0x99, 0xB5, 0x43, 0xE9, 0x99, 0xB8, 0x43, + 0xE9, 0x99, 0xBC, 0x43, 0xE9, 0x9A, 0x86, 0x43, + // Bytes 14c0 - 14ff + 0xE9, 0x9A, 0xA3, 0x43, 0xE9, 0x9A, 0xB6, 0x43, + 0xE9, 0x9A, 0xB7, 0x43, 0xE9, 0x9A, 0xB8, 0x43, + 0xE9, 0x9A, 0xB9, 0x43, 0xE9, 0x9B, 0x83, 0x43, + 0xE9, 0x9B, 0xA2, 0x43, 0xE9, 0x9B, 0xA3, 0x43, + 0xE9, 0x9B, 0xA8, 0x43, 0xE9, 0x9B, 0xB6, 0x43, + 0xE9, 0x9B, 0xB7, 0x43, 0xE9, 0x9C, 0xA3, 0x43, + 0xE9, 0x9C, 0xB2, 0x43, 0xE9, 0x9D, 0x88, 0x43, + 0xE9, 0x9D, 0x91, 0x43, 0xE9, 0x9D, 0x96, 0x43, + // Bytes 1500 - 153f + 0xE9, 0x9D, 0x9E, 0x43, 0xE9, 0x9D, 0xA2, 0x43, + 0xE9, 0x9D, 0xA9, 0x43, 0xE9, 0x9F, 0x8B, 0x43, + 0xE9, 0x9F, 0x9B, 0x43, 0xE9, 0x9F, 0xA0, 0x43, + 0xE9, 0x9F, 0xAD, 0x43, 0xE9, 0x9F, 0xB3, 0x43, + 0xE9, 0x9F, 0xBF, 0x43, 0xE9, 0xA0, 0x81, 0x43, + 0xE9, 0xA0, 0x85, 0x43, 0xE9, 0xA0, 0x8B, 0x43, + 0xE9, 0xA0, 0x98, 0x43, 0xE9, 0xA0, 0xA9, 0x43, + 0xE9, 0xA0, 0xBB, 0x43, 0xE9, 0xA1, 0x9E, 0x43, + // Bytes 1540 - 157f + 0xE9, 0xA2, 0xA8, 0x43, 0xE9, 0xA3, 0x9B, 0x43, + 0xE9, 0xA3, 0x9F, 0x43, 0xE9, 0xA3, 0xA2, 0x43, + 0xE9, 0xA3, 0xAF, 0x43, 0xE9, 0xA3, 0xBC, 0x43, + 0xE9, 0xA4, 0xA8, 0x43, 0xE9, 0xA4, 0xA9, 0x43, + 0xE9, 0xA6, 0x96, 0x43, 0xE9, 0xA6, 0x99, 0x43, + 0xE9, 0xA6, 0xA7, 0x43, 0xE9, 0xA6, 0xAC, 0x43, + 0xE9, 0xA7, 0x82, 0x43, 0xE9, 0xA7, 0xB1, 0x43, + 0xE9, 0xA7, 0xBE, 0x43, 0xE9, 0xA9, 0xAA, 0x43, + // Bytes 1580 - 15bf + 0xE9, 0xAA, 0xA8, 0x43, 0xE9, 0xAB, 0x98, 0x43, + 0xE9, 0xAB, 0x9F, 0x43, 0xE9, 0xAC, 0x92, 0x43, + 0xE9, 0xAC, 0xA5, 0x43, 0xE9, 0xAC, 0xAF, 0x43, + 0xE9, 0xAC, 0xB2, 0x43, 0xE9, 0xAC, 0xBC, 0x43, + 0xE9, 0xAD, 0x9A, 0x43, 0xE9, 0xAD, 0xAF, 0x43, + 0xE9, 0xB1, 0x80, 0x43, 0xE9, 0xB1, 0x97, 0x43, + 0xE9, 0xB3, 0xA5, 0x43, 0xE9, 0xB3, 0xBD, 0x43, + 0xE9, 0xB5, 0xA7, 0x43, 0xE9, 0xB6, 0xB4, 0x43, + // Bytes 15c0 - 15ff + 0xE9, 0xB7, 0xBA, 0x43, 0xE9, 0xB8, 0x9E, 0x43, + 0xE9, 0xB9, 0xB5, 0x43, 0xE9, 0xB9, 0xBF, 0x43, + 0xE9, 0xBA, 0x97, 0x43, 0xE9, 0xBA, 0x9F, 0x43, + 0xE9, 0xBA, 0xA5, 0x43, 0xE9, 0xBA, 0xBB, 0x43, + 0xE9, 0xBB, 0x83, 0x43, 0xE9, 0xBB, 0x8D, 0x43, + 0xE9, 0xBB, 0x8E, 0x43, 0xE9, 0xBB, 0x91, 0x43, + 0xE9, 0xBB, 0xB9, 0x43, 0xE9, 0xBB, 0xBD, 0x43, + 0xE9, 0xBB, 0xBE, 0x43, 0xE9, 0xBC, 0x85, 0x43, + // Bytes 1600 - 163f + 0xE9, 0xBC, 0x8E, 0x43, 0xE9, 0xBC, 0x8F, 0x43, + 0xE9, 0xBC, 0x93, 0x43, 0xE9, 0xBC, 0x96, 0x43, + 0xE9, 0xBC, 0xA0, 0x43, 0xE9, 0xBC, 0xBB, 0x43, + 0xE9, 0xBD, 0x83, 0x43, 0xE9, 0xBD, 0x8A, 0x43, + 0xE9, 0xBD, 0x92, 0x43, 0xE9, 0xBE, 0x8D, 0x43, + 0xE9, 0xBE, 0x8E, 0x43, 0xE9, 0xBE, 0x9C, 0x43, + 0xE9, 0xBE, 0x9F, 0x43, 0xE9, 0xBE, 0xA0, 0x43, + 0xEA, 0x9C, 0xA7, 0x43, 0xEA, 0x9D, 0xAF, 0x43, + // Bytes 1640 - 167f + 0xEA, 0xAC, 0xB7, 0x43, 0xEA, 0xAD, 0x92, 0x44, + 0xF0, 0xA0, 0x84, 0xA2, 0x44, 0xF0, 0xA0, 0x94, + 0x9C, 0x44, 0xF0, 0xA0, 0x94, 0xA5, 0x44, 0xF0, + 0xA0, 0x95, 0x8B, 0x44, 0xF0, 0xA0, 0x98, 0xBA, + 0x44, 0xF0, 0xA0, 0xA0, 0x84, 0x44, 0xF0, 0xA0, + 0xA3, 0x9E, 0x44, 0xF0, 0xA0, 0xA8, 0xAC, 0x44, + 0xF0, 0xA0, 0xAD, 0xA3, 0x44, 0xF0, 0xA1, 0x93, + 0xA4, 0x44, 0xF0, 0xA1, 0x9A, 0xA8, 0x44, 0xF0, + // Bytes 1680 - 16bf + 0xA1, 0x9B, 0xAA, 0x44, 0xF0, 0xA1, 0xA7, 0x88, + 0x44, 0xF0, 0xA1, 0xAC, 0x98, 0x44, 0xF0, 0xA1, + 0xB4, 0x8B, 0x44, 0xF0, 0xA1, 0xB7, 0xA4, 0x44, + 0xF0, 0xA1, 0xB7, 0xA6, 0x44, 0xF0, 0xA2, 0x86, + 0x83, 0x44, 0xF0, 0xA2, 0x86, 0x9F, 0x44, 0xF0, + 0xA2, 0x8C, 0xB1, 0x44, 0xF0, 0xA2, 0x9B, 0x94, + 0x44, 0xF0, 0xA2, 0xA1, 0x84, 0x44, 0xF0, 0xA2, + 0xA1, 0x8A, 0x44, 0xF0, 0xA2, 0xAC, 0x8C, 0x44, + // Bytes 16c0 - 16ff + 0xF0, 0xA2, 0xAF, 0xB1, 0x44, 0xF0, 0xA3, 0x80, + 0x8A, 0x44, 0xF0, 0xA3, 0x8A, 0xB8, 0x44, 0xF0, + 0xA3, 0x8D, 0x9F, 0x44, 0xF0, 0xA3, 0x8E, 0x93, + 0x44, 0xF0, 0xA3, 0x8E, 0x9C, 0x44, 0xF0, 0xA3, + 0x8F, 0x83, 0x44, 0xF0, 0xA3, 0x8F, 0x95, 0x44, + 0xF0, 0xA3, 0x91, 0xAD, 0x44, 0xF0, 0xA3, 0x9A, + 0xA3, 0x44, 0xF0, 0xA3, 0xA2, 0xA7, 0x44, 0xF0, + 0xA3, 0xAA, 0x8D, 0x44, 0xF0, 0xA3, 0xAB, 0xBA, + // Bytes 1700 - 173f + 0x44, 0xF0, 0xA3, 0xB2, 0xBC, 0x44, 0xF0, 0xA3, + 0xB4, 0x9E, 0x44, 0xF0, 0xA3, 0xBB, 0x91, 0x44, + 0xF0, 0xA3, 0xBD, 0x9E, 0x44, 0xF0, 0xA3, 0xBE, + 0x8E, 0x44, 0xF0, 0xA4, 0x89, 0xA3, 0x44, 0xF0, + 0xA4, 0x8B, 0xAE, 0x44, 0xF0, 0xA4, 0x8E, 0xAB, + 0x44, 0xF0, 0xA4, 0x98, 0x88, 0x44, 0xF0, 0xA4, + 0x9C, 0xB5, 0x44, 0xF0, 0xA4, 0xA0, 0x94, 0x44, + 0xF0, 0xA4, 0xB0, 0xB6, 0x44, 0xF0, 0xA4, 0xB2, + // Bytes 1740 - 177f + 0x92, 0x44, 0xF0, 0xA4, 0xBE, 0xA1, 0x44, 0xF0, + 0xA4, 0xBE, 0xB8, 0x44, 0xF0, 0xA5, 0x81, 0x84, + 0x44, 0xF0, 0xA5, 0x83, 0xB2, 0x44, 0xF0, 0xA5, + 0x83, 0xB3, 0x44, 0xF0, 0xA5, 0x84, 0x99, 0x44, + 0xF0, 0xA5, 0x84, 0xB3, 0x44, 0xF0, 0xA5, 0x89, + 0x89, 0x44, 0xF0, 0xA5, 0x90, 0x9D, 0x44, 0xF0, + 0xA5, 0x98, 0xA6, 0x44, 0xF0, 0xA5, 0x9A, 0x9A, + 0x44, 0xF0, 0xA5, 0x9B, 0x85, 0x44, 0xF0, 0xA5, + // Bytes 1780 - 17bf + 0xA5, 0xBC, 0x44, 0xF0, 0xA5, 0xAA, 0xA7, 0x44, + 0xF0, 0xA5, 0xAE, 0xAB, 0x44, 0xF0, 0xA5, 0xB2, + 0x80, 0x44, 0xF0, 0xA5, 0xB3, 0x90, 0x44, 0xF0, + 0xA5, 0xBE, 0x86, 0x44, 0xF0, 0xA6, 0x87, 0x9A, + 0x44, 0xF0, 0xA6, 0x88, 0xA8, 0x44, 0xF0, 0xA6, + 0x89, 0x87, 0x44, 0xF0, 0xA6, 0x8B, 0x99, 0x44, + 0xF0, 0xA6, 0x8C, 0xBE, 0x44, 0xF0, 0xA6, 0x93, + 0x9A, 0x44, 0xF0, 0xA6, 0x94, 0xA3, 0x44, 0xF0, + // Bytes 17c0 - 17ff + 0xA6, 0x96, 0xA8, 0x44, 0xF0, 0xA6, 0x9E, 0xA7, + 0x44, 0xF0, 0xA6, 0x9E, 0xB5, 0x44, 0xF0, 0xA6, + 0xAC, 0xBC, 0x44, 0xF0, 0xA6, 0xB0, 0xB6, 0x44, + 0xF0, 0xA6, 0xB3, 0x95, 0x44, 0xF0, 0xA6, 0xB5, + 0xAB, 0x44, 0xF0, 0xA6, 0xBC, 0xAC, 0x44, 0xF0, + 0xA6, 0xBE, 0xB1, 0x44, 0xF0, 0xA7, 0x83, 0x92, + 0x44, 0xF0, 0xA7, 0x8F, 0x8A, 0x44, 0xF0, 0xA7, + 0x99, 0xA7, 0x44, 0xF0, 0xA7, 0xA2, 0xAE, 0x44, + // Bytes 1800 - 183f + 0xF0, 0xA7, 0xA5, 0xA6, 0x44, 0xF0, 0xA7, 0xB2, + 0xA8, 0x44, 0xF0, 0xA7, 0xBB, 0x93, 0x44, 0xF0, + 0xA7, 0xBC, 0xAF, 0x44, 0xF0, 0xA8, 0x97, 0x92, + 0x44, 0xF0, 0xA8, 0x97, 0xAD, 0x44, 0xF0, 0xA8, + 0x9C, 0xAE, 0x44, 0xF0, 0xA8, 0xAF, 0xBA, 0x44, + 0xF0, 0xA8, 0xB5, 0xB7, 0x44, 0xF0, 0xA9, 0x85, + 0x85, 0x44, 0xF0, 0xA9, 0x87, 0x9F, 0x44, 0xF0, + 0xA9, 0x88, 0x9A, 0x44, 0xF0, 0xA9, 0x90, 0x8A, + // Bytes 1840 - 187f + 0x44, 0xF0, 0xA9, 0x92, 0x96, 0x44, 0xF0, 0xA9, + 0x96, 0xB6, 0x44, 0xF0, 0xA9, 0xAC, 0xB0, 0x44, + 0xF0, 0xAA, 0x83, 0x8E, 0x44, 0xF0, 0xAA, 0x84, + 0x85, 0x44, 0xF0, 0xAA, 0x88, 0x8E, 0x44, 0xF0, + 0xAA, 0x8A, 0x91, 0x44, 0xF0, 0xAA, 0x8E, 0x92, + 0x44, 0xF0, 0xAA, 0x98, 0x80, 0x42, 0x21, 0x21, + 0x42, 0x21, 0x3F, 0x42, 0x2E, 0x2E, 0x42, 0x30, + 0x2C, 0x42, 0x30, 0x2E, 0x42, 0x31, 0x2C, 0x42, + // Bytes 1880 - 18bf + 0x31, 0x2E, 0x42, 0x31, 0x30, 0x42, 0x31, 0x31, + 0x42, 0x31, 0x32, 0x42, 0x31, 0x33, 0x42, 0x31, + 0x34, 0x42, 0x31, 0x35, 0x42, 0x31, 0x36, 0x42, + 0x31, 0x37, 0x42, 0x31, 0x38, 0x42, 0x31, 0x39, + 0x42, 0x32, 0x2C, 0x42, 0x32, 0x2E, 0x42, 0x32, + 0x30, 0x42, 0x32, 0x31, 0x42, 0x32, 0x32, 0x42, + 0x32, 0x33, 0x42, 0x32, 0x34, 0x42, 0x32, 0x35, + 0x42, 0x32, 0x36, 0x42, 0x32, 0x37, 0x42, 0x32, + // Bytes 18c0 - 18ff + 0x38, 0x42, 0x32, 0x39, 0x42, 0x33, 0x2C, 0x42, + 0x33, 0x2E, 0x42, 0x33, 0x30, 0x42, 0x33, 0x31, + 0x42, 0x33, 0x32, 0x42, 0x33, 0x33, 0x42, 0x33, + 0x34, 0x42, 0x33, 0x35, 0x42, 0x33, 0x36, 0x42, + 0x33, 0x37, 0x42, 0x33, 0x38, 0x42, 0x33, 0x39, + 0x42, 0x34, 0x2C, 0x42, 0x34, 0x2E, 0x42, 0x34, + 0x30, 0x42, 0x34, 0x31, 0x42, 0x34, 0x32, 0x42, + 0x34, 0x33, 0x42, 0x34, 0x34, 0x42, 0x34, 0x35, + // Bytes 1900 - 193f + 0x42, 0x34, 0x36, 0x42, 0x34, 0x37, 0x42, 0x34, + 0x38, 0x42, 0x34, 0x39, 0x42, 0x35, 0x2C, 0x42, + 0x35, 0x2E, 0x42, 0x35, 0x30, 0x42, 0x36, 0x2C, + 0x42, 0x36, 0x2E, 0x42, 0x37, 0x2C, 0x42, 0x37, + 0x2E, 0x42, 0x38, 0x2C, 0x42, 0x38, 0x2E, 0x42, + 0x39, 0x2C, 0x42, 0x39, 0x2E, 0x42, 0x3D, 0x3D, + 0x42, 0x3F, 0x21, 0x42, 0x3F, 0x3F, 0x42, 0x41, + 0x55, 0x42, 0x42, 0x71, 0x42, 0x43, 0x44, 0x42, + // Bytes 1940 - 197f + 0x44, 0x4A, 0x42, 0x44, 0x5A, 0x42, 0x44, 0x7A, + 0x42, 0x47, 0x42, 0x42, 0x47, 0x79, 0x42, 0x48, + 0x50, 0x42, 0x48, 0x56, 0x42, 0x48, 0x67, 0x42, + 0x48, 0x7A, 0x42, 0x49, 0x49, 0x42, 0x49, 0x4A, + 0x42, 0x49, 0x55, 0x42, 0x49, 0x56, 0x42, 0x49, + 0x58, 0x42, 0x4B, 0x42, 0x42, 0x4B, 0x4B, 0x42, + 0x4B, 0x4D, 0x42, 0x4C, 0x4A, 0x42, 0x4C, 0x6A, + 0x42, 0x4D, 0x42, 0x42, 0x4D, 0x43, 0x42, 0x4D, + // Bytes 1980 - 19bf + 0x44, 0x42, 0x4D, 0x56, 0x42, 0x4D, 0x57, 0x42, + 0x4E, 0x4A, 0x42, 0x4E, 0x6A, 0x42, 0x4E, 0x6F, + 0x42, 0x50, 0x48, 0x42, 0x50, 0x52, 0x42, 0x50, + 0x61, 0x42, 0x52, 0x73, 0x42, 0x53, 0x44, 0x42, + 0x53, 0x4D, 0x42, 0x53, 0x53, 0x42, 0x53, 0x76, + 0x42, 0x54, 0x4D, 0x42, 0x56, 0x49, 0x42, 0x57, + 0x43, 0x42, 0x57, 0x5A, 0x42, 0x57, 0x62, 0x42, + 0x58, 0x49, 0x42, 0x63, 0x63, 0x42, 0x63, 0x64, + // Bytes 19c0 - 19ff + 0x42, 0x63, 0x6D, 0x42, 0x64, 0x42, 0x42, 0x64, + 0x61, 0x42, 0x64, 0x6C, 0x42, 0x64, 0x6D, 0x42, + 0x64, 0x7A, 0x42, 0x65, 0x56, 0x42, 0x66, 0x66, + 0x42, 0x66, 0x69, 0x42, 0x66, 0x6C, 0x42, 0x66, + 0x6D, 0x42, 0x68, 0x61, 0x42, 0x69, 0x69, 0x42, + 0x69, 0x6A, 0x42, 0x69, 0x6E, 0x42, 0x69, 0x76, + 0x42, 0x69, 0x78, 0x42, 0x6B, 0x41, 0x42, 0x6B, + 0x56, 0x42, 0x6B, 0x57, 0x42, 0x6B, 0x67, 0x42, + // Bytes 1a00 - 1a3f + 0x6B, 0x6C, 0x42, 0x6B, 0x6D, 0x42, 0x6B, 0x74, + 0x42, 0x6C, 0x6A, 0x42, 0x6C, 0x6D, 0x42, 0x6C, + 0x6E, 0x42, 0x6C, 0x78, 0x42, 0x6D, 0x32, 0x42, + 0x6D, 0x33, 0x42, 0x6D, 0x41, 0x42, 0x6D, 0x56, + 0x42, 0x6D, 0x57, 0x42, 0x6D, 0x62, 0x42, 0x6D, + 0x67, 0x42, 0x6D, 0x6C, 0x42, 0x6D, 0x6D, 0x42, + 0x6D, 0x73, 0x42, 0x6E, 0x41, 0x42, 0x6E, 0x46, + 0x42, 0x6E, 0x56, 0x42, 0x6E, 0x57, 0x42, 0x6E, + // Bytes 1a40 - 1a7f + 0x6A, 0x42, 0x6E, 0x6D, 0x42, 0x6E, 0x73, 0x42, + 0x6F, 0x56, 0x42, 0x70, 0x41, 0x42, 0x70, 0x46, + 0x42, 0x70, 0x56, 0x42, 0x70, 0x57, 0x42, 0x70, + 0x63, 0x42, 0x70, 0x73, 0x42, 0x73, 0x72, 0x42, + 0x73, 0x74, 0x42, 0x76, 0x69, 0x42, 0x78, 0x69, + 0x43, 0x28, 0x31, 0x29, 0x43, 0x28, 0x32, 0x29, + 0x43, 0x28, 0x33, 0x29, 0x43, 0x28, 0x34, 0x29, + 0x43, 0x28, 0x35, 0x29, 0x43, 0x28, 0x36, 0x29, + // Bytes 1a80 - 1abf + 0x43, 0x28, 0x37, 0x29, 0x43, 0x28, 0x38, 0x29, + 0x43, 0x28, 0x39, 0x29, 0x43, 0x28, 0x41, 0x29, + 0x43, 0x28, 0x42, 0x29, 0x43, 0x28, 0x43, 0x29, + 0x43, 0x28, 0x44, 0x29, 0x43, 0x28, 0x45, 0x29, + 0x43, 0x28, 0x46, 0x29, 0x43, 0x28, 0x47, 0x29, + 0x43, 0x28, 0x48, 0x29, 0x43, 0x28, 0x49, 0x29, + 0x43, 0x28, 0x4A, 0x29, 0x43, 0x28, 0x4B, 0x29, + 0x43, 0x28, 0x4C, 0x29, 0x43, 0x28, 0x4D, 0x29, + // Bytes 1ac0 - 1aff + 0x43, 0x28, 0x4E, 0x29, 0x43, 0x28, 0x4F, 0x29, + 0x43, 0x28, 0x50, 0x29, 0x43, 0x28, 0x51, 0x29, + 0x43, 0x28, 0x52, 0x29, 0x43, 0x28, 0x53, 0x29, + 0x43, 0x28, 0x54, 0x29, 0x43, 0x28, 0x55, 0x29, + 0x43, 0x28, 0x56, 0x29, 0x43, 0x28, 0x57, 0x29, + 0x43, 0x28, 0x58, 0x29, 0x43, 0x28, 0x59, 0x29, + 0x43, 0x28, 0x5A, 0x29, 0x43, 0x28, 0x61, 0x29, + 0x43, 0x28, 0x62, 0x29, 0x43, 0x28, 0x63, 0x29, + // Bytes 1b00 - 1b3f + 0x43, 0x28, 0x64, 0x29, 0x43, 0x28, 0x65, 0x29, + 0x43, 0x28, 0x66, 0x29, 0x43, 0x28, 0x67, 0x29, + 0x43, 0x28, 0x68, 0x29, 0x43, 0x28, 0x69, 0x29, + 0x43, 0x28, 0x6A, 0x29, 0x43, 0x28, 0x6B, 0x29, + 0x43, 0x28, 0x6C, 0x29, 0x43, 0x28, 0x6D, 0x29, + 0x43, 0x28, 0x6E, 0x29, 0x43, 0x28, 0x6F, 0x29, + 0x43, 0x28, 0x70, 0x29, 0x43, 0x28, 0x71, 0x29, + 0x43, 0x28, 0x72, 0x29, 0x43, 0x28, 0x73, 0x29, + // Bytes 1b40 - 1b7f + 0x43, 0x28, 0x74, 0x29, 0x43, 0x28, 0x75, 0x29, + 0x43, 0x28, 0x76, 0x29, 0x43, 0x28, 0x77, 0x29, + 0x43, 0x28, 0x78, 0x29, 0x43, 0x28, 0x79, 0x29, + 0x43, 0x28, 0x7A, 0x29, 0x43, 0x2E, 0x2E, 0x2E, + 0x43, 0x31, 0x30, 0x2E, 0x43, 0x31, 0x31, 0x2E, + 0x43, 0x31, 0x32, 0x2E, 0x43, 0x31, 0x33, 0x2E, + 0x43, 0x31, 0x34, 0x2E, 0x43, 0x31, 0x35, 0x2E, + 0x43, 0x31, 0x36, 0x2E, 0x43, 0x31, 0x37, 0x2E, + // Bytes 1b80 - 1bbf + 0x43, 0x31, 0x38, 0x2E, 0x43, 0x31, 0x39, 0x2E, + 0x43, 0x32, 0x30, 0x2E, 0x43, 0x3A, 0x3A, 0x3D, + 0x43, 0x3D, 0x3D, 0x3D, 0x43, 0x43, 0x6F, 0x2E, + 0x43, 0x46, 0x41, 0x58, 0x43, 0x47, 0x48, 0x7A, + 0x43, 0x47, 0x50, 0x61, 0x43, 0x49, 0x49, 0x49, + 0x43, 0x4C, 0x54, 0x44, 0x43, 0x4C, 0xC2, 0xB7, + 0x43, 0x4D, 0x48, 0x7A, 0x43, 0x4D, 0x50, 0x61, + 0x43, 0x4D, 0xCE, 0xA9, 0x43, 0x50, 0x50, 0x4D, + // Bytes 1bc0 - 1bff + 0x43, 0x50, 0x50, 0x56, 0x43, 0x50, 0x54, 0x45, + 0x43, 0x54, 0x45, 0x4C, 0x43, 0x54, 0x48, 0x7A, + 0x43, 0x56, 0x49, 0x49, 0x43, 0x58, 0x49, 0x49, + 0x43, 0x61, 0x2F, 0x63, 0x43, 0x61, 0x2F, 0x73, + 0x43, 0x61, 0xCA, 0xBE, 0x43, 0x62, 0x61, 0x72, + 0x43, 0x63, 0x2F, 0x6F, 0x43, 0x63, 0x2F, 0x75, + 0x43, 0x63, 0x61, 0x6C, 0x43, 0x63, 0x6D, 0x32, + 0x43, 0x63, 0x6D, 0x33, 0x43, 0x64, 0x6D, 0x32, + // Bytes 1c00 - 1c3f + 0x43, 0x64, 0x6D, 0x33, 0x43, 0x65, 0x72, 0x67, + 0x43, 0x66, 0x66, 0x69, 0x43, 0x66, 0x66, 0x6C, + 0x43, 0x67, 0x61, 0x6C, 0x43, 0x68, 0x50, 0x61, + 0x43, 0x69, 0x69, 0x69, 0x43, 0x6B, 0x48, 0x7A, + 0x43, 0x6B, 0x50, 0x61, 0x43, 0x6B, 0x6D, 0x32, + 0x43, 0x6B, 0x6D, 0x33, 0x43, 0x6B, 0xCE, 0xA9, + 0x43, 0x6C, 0x6F, 0x67, 0x43, 0x6C, 0xC2, 0xB7, + 0x43, 0x6D, 0x69, 0x6C, 0x43, 0x6D, 0x6D, 0x32, + // Bytes 1c40 - 1c7f + 0x43, 0x6D, 0x6D, 0x33, 0x43, 0x6D, 0x6F, 0x6C, + 0x43, 0x72, 0x61, 0x64, 0x43, 0x76, 0x69, 0x69, + 0x43, 0x78, 0x69, 0x69, 0x43, 0xC2, 0xB0, 0x43, + 0x43, 0xC2, 0xB0, 0x46, 0x43, 0xCA, 0xBC, 0x6E, + 0x43, 0xCE, 0xBC, 0x41, 0x43, 0xCE, 0xBC, 0x46, + 0x43, 0xCE, 0xBC, 0x56, 0x43, 0xCE, 0xBC, 0x57, + 0x43, 0xCE, 0xBC, 0x67, 0x43, 0xCE, 0xBC, 0x6C, + 0x43, 0xCE, 0xBC, 0x6D, 0x43, 0xCE, 0xBC, 0x73, + // Bytes 1c80 - 1cbf + 0x44, 0x28, 0x31, 0x30, 0x29, 0x44, 0x28, 0x31, + 0x31, 0x29, 0x44, 0x28, 0x31, 0x32, 0x29, 0x44, + 0x28, 0x31, 0x33, 0x29, 0x44, 0x28, 0x31, 0x34, + 0x29, 0x44, 0x28, 0x31, 0x35, 0x29, 0x44, 0x28, + 0x31, 0x36, 0x29, 0x44, 0x28, 0x31, 0x37, 0x29, + 0x44, 0x28, 0x31, 0x38, 0x29, 0x44, 0x28, 0x31, + 0x39, 0x29, 0x44, 0x28, 0x32, 0x30, 0x29, 0x44, + 0x30, 0xE7, 0x82, 0xB9, 0x44, 0x31, 0xE2, 0x81, + // Bytes 1cc0 - 1cff + 0x84, 0x44, 0x31, 0xE6, 0x97, 0xA5, 0x44, 0x31, + 0xE6, 0x9C, 0x88, 0x44, 0x31, 0xE7, 0x82, 0xB9, + 0x44, 0x32, 0xE6, 0x97, 0xA5, 0x44, 0x32, 0xE6, + 0x9C, 0x88, 0x44, 0x32, 0xE7, 0x82, 0xB9, 0x44, + 0x33, 0xE6, 0x97, 0xA5, 0x44, 0x33, 0xE6, 0x9C, + 0x88, 0x44, 0x33, 0xE7, 0x82, 0xB9, 0x44, 0x34, + 0xE6, 0x97, 0xA5, 0x44, 0x34, 0xE6, 0x9C, 0x88, + 0x44, 0x34, 0xE7, 0x82, 0xB9, 0x44, 0x35, 0xE6, + // Bytes 1d00 - 1d3f + 0x97, 0xA5, 0x44, 0x35, 0xE6, 0x9C, 0x88, 0x44, + 0x35, 0xE7, 0x82, 0xB9, 0x44, 0x36, 0xE6, 0x97, + 0xA5, 0x44, 0x36, 0xE6, 0x9C, 0x88, 0x44, 0x36, + 0xE7, 0x82, 0xB9, 0x44, 0x37, 0xE6, 0x97, 0xA5, + 0x44, 0x37, 0xE6, 0x9C, 0x88, 0x44, 0x37, 0xE7, + 0x82, 0xB9, 0x44, 0x38, 0xE6, 0x97, 0xA5, 0x44, + 0x38, 0xE6, 0x9C, 0x88, 0x44, 0x38, 0xE7, 0x82, + 0xB9, 0x44, 0x39, 0xE6, 0x97, 0xA5, 0x44, 0x39, + // Bytes 1d40 - 1d7f + 0xE6, 0x9C, 0x88, 0x44, 0x39, 0xE7, 0x82, 0xB9, + 0x44, 0x56, 0x49, 0x49, 0x49, 0x44, 0x61, 0x2E, + 0x6D, 0x2E, 0x44, 0x6B, 0x63, 0x61, 0x6C, 0x44, + 0x70, 0x2E, 0x6D, 0x2E, 0x44, 0x76, 0x69, 0x69, + 0x69, 0x44, 0xD5, 0xA5, 0xD6, 0x82, 0x44, 0xD5, + 0xB4, 0xD5, 0xA5, 0x44, 0xD5, 0xB4, 0xD5, 0xAB, + 0x44, 0xD5, 0xB4, 0xD5, 0xAD, 0x44, 0xD5, 0xB4, + 0xD5, 0xB6, 0x44, 0xD5, 0xBE, 0xD5, 0xB6, 0x44, + // Bytes 1d80 - 1dbf + 0xD7, 0x90, 0xD7, 0x9C, 0x44, 0xD8, 0xA7, 0xD9, + 0xB4, 0x44, 0xD8, 0xA8, 0xD8, 0xAC, 0x44, 0xD8, + 0xA8, 0xD8, 0xAD, 0x44, 0xD8, 0xA8, 0xD8, 0xAE, + 0x44, 0xD8, 0xA8, 0xD8, 0xB1, 0x44, 0xD8, 0xA8, + 0xD8, 0xB2, 0x44, 0xD8, 0xA8, 0xD9, 0x85, 0x44, + 0xD8, 0xA8, 0xD9, 0x86, 0x44, 0xD8, 0xA8, 0xD9, + 0x87, 0x44, 0xD8, 0xA8, 0xD9, 0x89, 0x44, 0xD8, + 0xA8, 0xD9, 0x8A, 0x44, 0xD8, 0xAA, 0xD8, 0xAC, + // Bytes 1dc0 - 1dff + 0x44, 0xD8, 0xAA, 0xD8, 0xAD, 0x44, 0xD8, 0xAA, + 0xD8, 0xAE, 0x44, 0xD8, 0xAA, 0xD8, 0xB1, 0x44, + 0xD8, 0xAA, 0xD8, 0xB2, 0x44, 0xD8, 0xAA, 0xD9, + 0x85, 0x44, 0xD8, 0xAA, 0xD9, 0x86, 0x44, 0xD8, + 0xAA, 0xD9, 0x87, 0x44, 0xD8, 0xAA, 0xD9, 0x89, + 0x44, 0xD8, 0xAA, 0xD9, 0x8A, 0x44, 0xD8, 0xAB, + 0xD8, 0xAC, 0x44, 0xD8, 0xAB, 0xD8, 0xB1, 0x44, + 0xD8, 0xAB, 0xD8, 0xB2, 0x44, 0xD8, 0xAB, 0xD9, + // Bytes 1e00 - 1e3f + 0x85, 0x44, 0xD8, 0xAB, 0xD9, 0x86, 0x44, 0xD8, + 0xAB, 0xD9, 0x87, 0x44, 0xD8, 0xAB, 0xD9, 0x89, + 0x44, 0xD8, 0xAB, 0xD9, 0x8A, 0x44, 0xD8, 0xAC, + 0xD8, 0xAD, 0x44, 0xD8, 0xAC, 0xD9, 0x85, 0x44, + 0xD8, 0xAC, 0xD9, 0x89, 0x44, 0xD8, 0xAC, 0xD9, + 0x8A, 0x44, 0xD8, 0xAD, 0xD8, 0xAC, 0x44, 0xD8, + 0xAD, 0xD9, 0x85, 0x44, 0xD8, 0xAD, 0xD9, 0x89, + 0x44, 0xD8, 0xAD, 0xD9, 0x8A, 0x44, 0xD8, 0xAE, + // Bytes 1e40 - 1e7f + 0xD8, 0xAC, 0x44, 0xD8, 0xAE, 0xD8, 0xAD, 0x44, + 0xD8, 0xAE, 0xD9, 0x85, 0x44, 0xD8, 0xAE, 0xD9, + 0x89, 0x44, 0xD8, 0xAE, 0xD9, 0x8A, 0x44, 0xD8, + 0xB3, 0xD8, 0xAC, 0x44, 0xD8, 0xB3, 0xD8, 0xAD, + 0x44, 0xD8, 0xB3, 0xD8, 0xAE, 0x44, 0xD8, 0xB3, + 0xD8, 0xB1, 0x44, 0xD8, 0xB3, 0xD9, 0x85, 0x44, + 0xD8, 0xB3, 0xD9, 0x87, 0x44, 0xD8, 0xB3, 0xD9, + 0x89, 0x44, 0xD8, 0xB3, 0xD9, 0x8A, 0x44, 0xD8, + // Bytes 1e80 - 1ebf + 0xB4, 0xD8, 0xAC, 0x44, 0xD8, 0xB4, 0xD8, 0xAD, + 0x44, 0xD8, 0xB4, 0xD8, 0xAE, 0x44, 0xD8, 0xB4, + 0xD8, 0xB1, 0x44, 0xD8, 0xB4, 0xD9, 0x85, 0x44, + 0xD8, 0xB4, 0xD9, 0x87, 0x44, 0xD8, 0xB4, 0xD9, + 0x89, 0x44, 0xD8, 0xB4, 0xD9, 0x8A, 0x44, 0xD8, + 0xB5, 0xD8, 0xAD, 0x44, 0xD8, 0xB5, 0xD8, 0xAE, + 0x44, 0xD8, 0xB5, 0xD8, 0xB1, 0x44, 0xD8, 0xB5, + 0xD9, 0x85, 0x44, 0xD8, 0xB5, 0xD9, 0x89, 0x44, + // Bytes 1ec0 - 1eff + 0xD8, 0xB5, 0xD9, 0x8A, 0x44, 0xD8, 0xB6, 0xD8, + 0xAC, 0x44, 0xD8, 0xB6, 0xD8, 0xAD, 0x44, 0xD8, + 0xB6, 0xD8, 0xAE, 0x44, 0xD8, 0xB6, 0xD8, 0xB1, + 0x44, 0xD8, 0xB6, 0xD9, 0x85, 0x44, 0xD8, 0xB6, + 0xD9, 0x89, 0x44, 0xD8, 0xB6, 0xD9, 0x8A, 0x44, + 0xD8, 0xB7, 0xD8, 0xAD, 0x44, 0xD8, 0xB7, 0xD9, + 0x85, 0x44, 0xD8, 0xB7, 0xD9, 0x89, 0x44, 0xD8, + 0xB7, 0xD9, 0x8A, 0x44, 0xD8, 0xB8, 0xD9, 0x85, + // Bytes 1f00 - 1f3f + 0x44, 0xD8, 0xB9, 0xD8, 0xAC, 0x44, 0xD8, 0xB9, + 0xD9, 0x85, 0x44, 0xD8, 0xB9, 0xD9, 0x89, 0x44, + 0xD8, 0xB9, 0xD9, 0x8A, 0x44, 0xD8, 0xBA, 0xD8, + 0xAC, 0x44, 0xD8, 0xBA, 0xD9, 0x85, 0x44, 0xD8, + 0xBA, 0xD9, 0x89, 0x44, 0xD8, 0xBA, 0xD9, 0x8A, + 0x44, 0xD9, 0x81, 0xD8, 0xAC, 0x44, 0xD9, 0x81, + 0xD8, 0xAD, 0x44, 0xD9, 0x81, 0xD8, 0xAE, 0x44, + 0xD9, 0x81, 0xD9, 0x85, 0x44, 0xD9, 0x81, 0xD9, + // Bytes 1f40 - 1f7f + 0x89, 0x44, 0xD9, 0x81, 0xD9, 0x8A, 0x44, 0xD9, + 0x82, 0xD8, 0xAD, 0x44, 0xD9, 0x82, 0xD9, 0x85, + 0x44, 0xD9, 0x82, 0xD9, 0x89, 0x44, 0xD9, 0x82, + 0xD9, 0x8A, 0x44, 0xD9, 0x83, 0xD8, 0xA7, 0x44, + 0xD9, 0x83, 0xD8, 0xAC, 0x44, 0xD9, 0x83, 0xD8, + 0xAD, 0x44, 0xD9, 0x83, 0xD8, 0xAE, 0x44, 0xD9, + 0x83, 0xD9, 0x84, 0x44, 0xD9, 0x83, 0xD9, 0x85, + 0x44, 0xD9, 0x83, 0xD9, 0x89, 0x44, 0xD9, 0x83, + // Bytes 1f80 - 1fbf + 0xD9, 0x8A, 0x44, 0xD9, 0x84, 0xD8, 0xA7, 0x44, + 0xD9, 0x84, 0xD8, 0xAC, 0x44, 0xD9, 0x84, 0xD8, + 0xAD, 0x44, 0xD9, 0x84, 0xD8, 0xAE, 0x44, 0xD9, + 0x84, 0xD9, 0x85, 0x44, 0xD9, 0x84, 0xD9, 0x87, + 0x44, 0xD9, 0x84, 0xD9, 0x89, 0x44, 0xD9, 0x84, + 0xD9, 0x8A, 0x44, 0xD9, 0x85, 0xD8, 0xA7, 0x44, + 0xD9, 0x85, 0xD8, 0xAC, 0x44, 0xD9, 0x85, 0xD8, + 0xAD, 0x44, 0xD9, 0x85, 0xD8, 0xAE, 0x44, 0xD9, + // Bytes 1fc0 - 1fff + 0x85, 0xD9, 0x85, 0x44, 0xD9, 0x85, 0xD9, 0x89, + 0x44, 0xD9, 0x85, 0xD9, 0x8A, 0x44, 0xD9, 0x86, + 0xD8, 0xAC, 0x44, 0xD9, 0x86, 0xD8, 0xAD, 0x44, + 0xD9, 0x86, 0xD8, 0xAE, 0x44, 0xD9, 0x86, 0xD8, + 0xB1, 0x44, 0xD9, 0x86, 0xD8, 0xB2, 0x44, 0xD9, + 0x86, 0xD9, 0x85, 0x44, 0xD9, 0x86, 0xD9, 0x86, + 0x44, 0xD9, 0x86, 0xD9, 0x87, 0x44, 0xD9, 0x86, + 0xD9, 0x89, 0x44, 0xD9, 0x86, 0xD9, 0x8A, 0x44, + // Bytes 2000 - 203f + 0xD9, 0x87, 0xD8, 0xAC, 0x44, 0xD9, 0x87, 0xD9, + 0x85, 0x44, 0xD9, 0x87, 0xD9, 0x89, 0x44, 0xD9, + 0x87, 0xD9, 0x8A, 0x44, 0xD9, 0x88, 0xD9, 0xB4, + 0x44, 0xD9, 0x8A, 0xD8, 0xAC, 0x44, 0xD9, 0x8A, + 0xD8, 0xAD, 0x44, 0xD9, 0x8A, 0xD8, 0xAE, 0x44, + 0xD9, 0x8A, 0xD8, 0xB1, 0x44, 0xD9, 0x8A, 0xD8, + 0xB2, 0x44, 0xD9, 0x8A, 0xD9, 0x85, 0x44, 0xD9, + 0x8A, 0xD9, 0x86, 0x44, 0xD9, 0x8A, 0xD9, 0x87, + // Bytes 2040 - 207f + 0x44, 0xD9, 0x8A, 0xD9, 0x89, 0x44, 0xD9, 0x8A, + 0xD9, 0x8A, 0x44, 0xD9, 0x8A, 0xD9, 0xB4, 0x44, + 0xDB, 0x87, 0xD9, 0xB4, 0x45, 0x28, 0xE1, 0x84, + 0x80, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x82, 0x29, + 0x45, 0x28, 0xE1, 0x84, 0x83, 0x29, 0x45, 0x28, + 0xE1, 0x84, 0x85, 0x29, 0x45, 0x28, 0xE1, 0x84, + 0x86, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x87, 0x29, + 0x45, 0x28, 0xE1, 0x84, 0x89, 0x29, 0x45, 0x28, + // Bytes 2080 - 20bf + 0xE1, 0x84, 0x8B, 0x29, 0x45, 0x28, 0xE1, 0x84, + 0x8C, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x8E, 0x29, + 0x45, 0x28, 0xE1, 0x84, 0x8F, 0x29, 0x45, 0x28, + 0xE1, 0x84, 0x90, 0x29, 0x45, 0x28, 0xE1, 0x84, + 0x91, 0x29, 0x45, 0x28, 0xE1, 0x84, 0x92, 0x29, + 0x45, 0x28, 0xE4, 0xB8, 0x80, 0x29, 0x45, 0x28, + 0xE4, 0xB8, 0x83, 0x29, 0x45, 0x28, 0xE4, 0xB8, + 0x89, 0x29, 0x45, 0x28, 0xE4, 0xB9, 0x9D, 0x29, + // Bytes 20c0 - 20ff + 0x45, 0x28, 0xE4, 0xBA, 0x8C, 0x29, 0x45, 0x28, + 0xE4, 0xBA, 0x94, 0x29, 0x45, 0x28, 0xE4, 0xBB, + 0xA3, 0x29, 0x45, 0x28, 0xE4, 0xBC, 0x81, 0x29, + 0x45, 0x28, 0xE4, 0xBC, 0x91, 0x29, 0x45, 0x28, + 0xE5, 0x85, 0xAB, 0x29, 0x45, 0x28, 0xE5, 0x85, + 0xAD, 0x29, 0x45, 0x28, 0xE5, 0x8A, 0xB4, 0x29, + 0x45, 0x28, 0xE5, 0x8D, 0x81, 0x29, 0x45, 0x28, + 0xE5, 0x8D, 0x94, 0x29, 0x45, 0x28, 0xE5, 0x90, + // Bytes 2100 - 213f + 0x8D, 0x29, 0x45, 0x28, 0xE5, 0x91, 0xBC, 0x29, + 0x45, 0x28, 0xE5, 0x9B, 0x9B, 0x29, 0x45, 0x28, + 0xE5, 0x9C, 0x9F, 0x29, 0x45, 0x28, 0xE5, 0xAD, + 0xA6, 0x29, 0x45, 0x28, 0xE6, 0x97, 0xA5, 0x29, + 0x45, 0x28, 0xE6, 0x9C, 0x88, 0x29, 0x45, 0x28, + 0xE6, 0x9C, 0x89, 0x29, 0x45, 0x28, 0xE6, 0x9C, + 0xA8, 0x29, 0x45, 0x28, 0xE6, 0xA0, 0xAA, 0x29, + 0x45, 0x28, 0xE6, 0xB0, 0xB4, 0x29, 0x45, 0x28, + // Bytes 2140 - 217f + 0xE7, 0x81, 0xAB, 0x29, 0x45, 0x28, 0xE7, 0x89, + 0xB9, 0x29, 0x45, 0x28, 0xE7, 0x9B, 0xA3, 0x29, + 0x45, 0x28, 0xE7, 0xA4, 0xBE, 0x29, 0x45, 0x28, + 0xE7, 0xA5, 0x9D, 0x29, 0x45, 0x28, 0xE7, 0xA5, + 0xAD, 0x29, 0x45, 0x28, 0xE8, 0x87, 0xAA, 0x29, + 0x45, 0x28, 0xE8, 0x87, 0xB3, 0x29, 0x45, 0x28, + 0xE8, 0xB2, 0xA1, 0x29, 0x45, 0x28, 0xE8, 0xB3, + 0x87, 0x29, 0x45, 0x28, 0xE9, 0x87, 0x91, 0x29, + // Bytes 2180 - 21bf + 0x45, 0x30, 0xE2, 0x81, 0x84, 0x33, 0x45, 0x31, + 0x30, 0xE6, 0x97, 0xA5, 0x45, 0x31, 0x30, 0xE6, + 0x9C, 0x88, 0x45, 0x31, 0x30, 0xE7, 0x82, 0xB9, + 0x45, 0x31, 0x31, 0xE6, 0x97, 0xA5, 0x45, 0x31, + 0x31, 0xE6, 0x9C, 0x88, 0x45, 0x31, 0x31, 0xE7, + 0x82, 0xB9, 0x45, 0x31, 0x32, 0xE6, 0x97, 0xA5, + 0x45, 0x31, 0x32, 0xE6, 0x9C, 0x88, 0x45, 0x31, + 0x32, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x33, 0xE6, + // Bytes 21c0 - 21ff + 0x97, 0xA5, 0x45, 0x31, 0x33, 0xE7, 0x82, 0xB9, + 0x45, 0x31, 0x34, 0xE6, 0x97, 0xA5, 0x45, 0x31, + 0x34, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x35, 0xE6, + 0x97, 0xA5, 0x45, 0x31, 0x35, 0xE7, 0x82, 0xB9, + 0x45, 0x31, 0x36, 0xE6, 0x97, 0xA5, 0x45, 0x31, + 0x36, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x37, 0xE6, + 0x97, 0xA5, 0x45, 0x31, 0x37, 0xE7, 0x82, 0xB9, + 0x45, 0x31, 0x38, 0xE6, 0x97, 0xA5, 0x45, 0x31, + // Bytes 2200 - 223f + 0x38, 0xE7, 0x82, 0xB9, 0x45, 0x31, 0x39, 0xE6, + 0x97, 0xA5, 0x45, 0x31, 0x39, 0xE7, 0x82, 0xB9, + 0x45, 0x31, 0xE2, 0x81, 0x84, 0x32, 0x45, 0x31, + 0xE2, 0x81, 0x84, 0x33, 0x45, 0x31, 0xE2, 0x81, + 0x84, 0x34, 0x45, 0x31, 0xE2, 0x81, 0x84, 0x35, + 0x45, 0x31, 0xE2, 0x81, 0x84, 0x36, 0x45, 0x31, + 0xE2, 0x81, 0x84, 0x37, 0x45, 0x31, 0xE2, 0x81, + 0x84, 0x38, 0x45, 0x31, 0xE2, 0x81, 0x84, 0x39, + // Bytes 2240 - 227f + 0x45, 0x32, 0x30, 0xE6, 0x97, 0xA5, 0x45, 0x32, + 0x30, 0xE7, 0x82, 0xB9, 0x45, 0x32, 0x31, 0xE6, + 0x97, 0xA5, 0x45, 0x32, 0x31, 0xE7, 0x82, 0xB9, + 0x45, 0x32, 0x32, 0xE6, 0x97, 0xA5, 0x45, 0x32, + 0x32, 0xE7, 0x82, 0xB9, 0x45, 0x32, 0x33, 0xE6, + 0x97, 0xA5, 0x45, 0x32, 0x33, 0xE7, 0x82, 0xB9, + 0x45, 0x32, 0x34, 0xE6, 0x97, 0xA5, 0x45, 0x32, + 0x34, 0xE7, 0x82, 0xB9, 0x45, 0x32, 0x35, 0xE6, + // Bytes 2280 - 22bf + 0x97, 0xA5, 0x45, 0x32, 0x36, 0xE6, 0x97, 0xA5, + 0x45, 0x32, 0x37, 0xE6, 0x97, 0xA5, 0x45, 0x32, + 0x38, 0xE6, 0x97, 0xA5, 0x45, 0x32, 0x39, 0xE6, + 0x97, 0xA5, 0x45, 0x32, 0xE2, 0x81, 0x84, 0x33, + 0x45, 0x32, 0xE2, 0x81, 0x84, 0x35, 0x45, 0x33, + 0x30, 0xE6, 0x97, 0xA5, 0x45, 0x33, 0x31, 0xE6, + 0x97, 0xA5, 0x45, 0x33, 0xE2, 0x81, 0x84, 0x34, + 0x45, 0x33, 0xE2, 0x81, 0x84, 0x35, 0x45, 0x33, + // Bytes 22c0 - 22ff + 0xE2, 0x81, 0x84, 0x38, 0x45, 0x34, 0xE2, 0x81, + 0x84, 0x35, 0x45, 0x35, 0xE2, 0x81, 0x84, 0x36, + 0x45, 0x35, 0xE2, 0x81, 0x84, 0x38, 0x45, 0x37, + 0xE2, 0x81, 0x84, 0x38, 0x45, 0x41, 0xE2, 0x88, + 0x95, 0x6D, 0x45, 0x56, 0xE2, 0x88, 0x95, 0x6D, + 0x45, 0x6D, 0xE2, 0x88, 0x95, 0x73, 0x46, 0x31, + 0xE2, 0x81, 0x84, 0x31, 0x30, 0x46, 0x43, 0xE2, + 0x88, 0x95, 0x6B, 0x67, 0x46, 0x6D, 0xE2, 0x88, + // Bytes 2300 - 233f + 0x95, 0x73, 0x32, 0x46, 0xD8, 0xA8, 0xD8, 0xAD, + 0xD9, 0x8A, 0x46, 0xD8, 0xA8, 0xD8, 0xAE, 0xD9, + 0x8A, 0x46, 0xD8, 0xAA, 0xD8, 0xAC, 0xD9, 0x85, + 0x46, 0xD8, 0xAA, 0xD8, 0xAC, 0xD9, 0x89, 0x46, + 0xD8, 0xAA, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD8, + 0xAA, 0xD8, 0xAD, 0xD8, 0xAC, 0x46, 0xD8, 0xAA, + 0xD8, 0xAD, 0xD9, 0x85, 0x46, 0xD8, 0xAA, 0xD8, + 0xAE, 0xD9, 0x85, 0x46, 0xD8, 0xAA, 0xD8, 0xAE, + // Bytes 2340 - 237f + 0xD9, 0x89, 0x46, 0xD8, 0xAA, 0xD8, 0xAE, 0xD9, + 0x8A, 0x46, 0xD8, 0xAA, 0xD9, 0x85, 0xD8, 0xAC, + 0x46, 0xD8, 0xAA, 0xD9, 0x85, 0xD8, 0xAD, 0x46, + 0xD8, 0xAA, 0xD9, 0x85, 0xD8, 0xAE, 0x46, 0xD8, + 0xAA, 0xD9, 0x85, 0xD9, 0x89, 0x46, 0xD8, 0xAA, + 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD8, 0xAC, 0xD8, + 0xAD, 0xD9, 0x89, 0x46, 0xD8, 0xAC, 0xD8, 0xAD, + 0xD9, 0x8A, 0x46, 0xD8, 0xAC, 0xD9, 0x85, 0xD8, + // Bytes 2380 - 23bf + 0xAD, 0x46, 0xD8, 0xAC, 0xD9, 0x85, 0xD9, 0x89, + 0x46, 0xD8, 0xAC, 0xD9, 0x85, 0xD9, 0x8A, 0x46, + 0xD8, 0xAD, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD8, + 0xAD, 0xD9, 0x85, 0xD9, 0x89, 0x46, 0xD8, 0xAD, + 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD8, 0xB3, 0xD8, + 0xAC, 0xD8, 0xAD, 0x46, 0xD8, 0xB3, 0xD8, 0xAC, + 0xD9, 0x89, 0x46, 0xD8, 0xB3, 0xD8, 0xAD, 0xD8, + 0xAC, 0x46, 0xD8, 0xB3, 0xD8, 0xAE, 0xD9, 0x89, + // Bytes 23c0 - 23ff + 0x46, 0xD8, 0xB3, 0xD8, 0xAE, 0xD9, 0x8A, 0x46, + 0xD8, 0xB3, 0xD9, 0x85, 0xD8, 0xAC, 0x46, 0xD8, + 0xB3, 0xD9, 0x85, 0xD8, 0xAD, 0x46, 0xD8, 0xB3, + 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD8, 0xB4, 0xD8, + 0xAC, 0xD9, 0x8A, 0x46, 0xD8, 0xB4, 0xD8, 0xAD, + 0xD9, 0x85, 0x46, 0xD8, 0xB4, 0xD8, 0xAD, 0xD9, + 0x8A, 0x46, 0xD8, 0xB4, 0xD9, 0x85, 0xD8, 0xAE, + 0x46, 0xD8, 0xB4, 0xD9, 0x85, 0xD9, 0x85, 0x46, + // Bytes 2400 - 243f + 0xD8, 0xB5, 0xD8, 0xAD, 0xD8, 0xAD, 0x46, 0xD8, + 0xB5, 0xD8, 0xAD, 0xD9, 0x8A, 0x46, 0xD8, 0xB5, + 0xD9, 0x84, 0xD9, 0x89, 0x46, 0xD8, 0xB5, 0xD9, + 0x84, 0xDB, 0x92, 0x46, 0xD8, 0xB5, 0xD9, 0x85, + 0xD9, 0x85, 0x46, 0xD8, 0xB6, 0xD8, 0xAD, 0xD9, + 0x89, 0x46, 0xD8, 0xB6, 0xD8, 0xAD, 0xD9, 0x8A, + 0x46, 0xD8, 0xB6, 0xD8, 0xAE, 0xD9, 0x85, 0x46, + 0xD8, 0xB7, 0xD9, 0x85, 0xD8, 0xAD, 0x46, 0xD8, + // Bytes 2440 - 247f + 0xB7, 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD8, 0xB7, + 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD8, 0xB9, 0xD8, + 0xAC, 0xD9, 0x85, 0x46, 0xD8, 0xB9, 0xD9, 0x85, + 0xD9, 0x85, 0x46, 0xD8, 0xB9, 0xD9, 0x85, 0xD9, + 0x89, 0x46, 0xD8, 0xB9, 0xD9, 0x85, 0xD9, 0x8A, + 0x46, 0xD8, 0xBA, 0xD9, 0x85, 0xD9, 0x85, 0x46, + 0xD8, 0xBA, 0xD9, 0x85, 0xD9, 0x89, 0x46, 0xD8, + 0xBA, 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x81, + // Bytes 2480 - 24bf + 0xD8, 0xAE, 0xD9, 0x85, 0x46, 0xD9, 0x81, 0xD9, + 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x82, 0xD9, 0x84, + 0xDB, 0x92, 0x46, 0xD9, 0x82, 0xD9, 0x85, 0xD8, + 0xAD, 0x46, 0xD9, 0x82, 0xD9, 0x85, 0xD9, 0x85, + 0x46, 0xD9, 0x82, 0xD9, 0x85, 0xD9, 0x8A, 0x46, + 0xD9, 0x83, 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD9, + 0x83, 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x84, + 0xD8, 0xAC, 0xD8, 0xAC, 0x46, 0xD9, 0x84, 0xD8, + // Bytes 24c0 - 24ff + 0xAC, 0xD9, 0x85, 0x46, 0xD9, 0x84, 0xD8, 0xAC, + 0xD9, 0x8A, 0x46, 0xD9, 0x84, 0xD8, 0xAD, 0xD9, + 0x85, 0x46, 0xD9, 0x84, 0xD8, 0xAD, 0xD9, 0x89, + 0x46, 0xD9, 0x84, 0xD8, 0xAD, 0xD9, 0x8A, 0x46, + 0xD9, 0x84, 0xD8, 0xAE, 0xD9, 0x85, 0x46, 0xD9, + 0x84, 0xD9, 0x85, 0xD8, 0xAD, 0x46, 0xD9, 0x84, + 0xD9, 0x85, 0xD9, 0x8A, 0x46, 0xD9, 0x85, 0xD8, + 0xAC, 0xD8, 0xAD, 0x46, 0xD9, 0x85, 0xD8, 0xAC, + // Bytes 2500 - 253f + 0xD8, 0xAE, 0x46, 0xD9, 0x85, 0xD8, 0xAC, 0xD9, + 0x85, 0x46, 0xD9, 0x85, 0xD8, 0xAC, 0xD9, 0x8A, + 0x46, 0xD9, 0x85, 0xD8, 0xAD, 0xD8, 0xAC, 0x46, + 0xD9, 0x85, 0xD8, 0xAD, 0xD9, 0x85, 0x46, 0xD9, + 0x85, 0xD8, 0xAD, 0xD9, 0x8A, 0x46, 0xD9, 0x85, + 0xD8, 0xAE, 0xD8, 0xAC, 0x46, 0xD9, 0x85, 0xD8, + 0xAE, 0xD9, 0x85, 0x46, 0xD9, 0x85, 0xD8, 0xAE, + 0xD9, 0x8A, 0x46, 0xD9, 0x85, 0xD9, 0x85, 0xD9, + // Bytes 2540 - 257f + 0x8A, 0x46, 0xD9, 0x86, 0xD8, 0xAC, 0xD8, 0xAD, + 0x46, 0xD9, 0x86, 0xD8, 0xAC, 0xD9, 0x85, 0x46, + 0xD9, 0x86, 0xD8, 0xAC, 0xD9, 0x89, 0x46, 0xD9, + 0x86, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD9, 0x86, + 0xD8, 0xAD, 0xD9, 0x85, 0x46, 0xD9, 0x86, 0xD8, + 0xAD, 0xD9, 0x89, 0x46, 0xD9, 0x86, 0xD8, 0xAD, + 0xD9, 0x8A, 0x46, 0xD9, 0x86, 0xD9, 0x85, 0xD9, + 0x89, 0x46, 0xD9, 0x86, 0xD9, 0x85, 0xD9, 0x8A, + // Bytes 2580 - 25bf + 0x46, 0xD9, 0x87, 0xD9, 0x85, 0xD8, 0xAC, 0x46, + 0xD9, 0x87, 0xD9, 0x85, 0xD9, 0x85, 0x46, 0xD9, + 0x8A, 0xD8, 0xAC, 0xD9, 0x8A, 0x46, 0xD9, 0x8A, + 0xD8, 0xAD, 0xD9, 0x8A, 0x46, 0xD9, 0x8A, 0xD9, + 0x85, 0xD9, 0x85, 0x46, 0xD9, 0x8A, 0xD9, 0x85, + 0xD9, 0x8A, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD8, + 0xA7, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD8, 0xAC, + 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD8, 0xAD, 0x46, + // Bytes 25c0 - 25ff + 0xD9, 0x8A, 0xD9, 0x94, 0xD8, 0xAE, 0x46, 0xD9, + 0x8A, 0xD9, 0x94, 0xD8, 0xB1, 0x46, 0xD9, 0x8A, + 0xD9, 0x94, 0xD8, 0xB2, 0x46, 0xD9, 0x8A, 0xD9, + 0x94, 0xD9, 0x85, 0x46, 0xD9, 0x8A, 0xD9, 0x94, + 0xD9, 0x86, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD9, + 0x87, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD9, 0x88, + 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xD9, 0x89, 0x46, + 0xD9, 0x8A, 0xD9, 0x94, 0xD9, 0x8A, 0x46, 0xD9, + // Bytes 2600 - 263f + 0x8A, 0xD9, 0x94, 0xDB, 0x86, 0x46, 0xD9, 0x8A, + 0xD9, 0x94, 0xDB, 0x87, 0x46, 0xD9, 0x8A, 0xD9, + 0x94, 0xDB, 0x88, 0x46, 0xD9, 0x8A, 0xD9, 0x94, + 0xDB, 0x90, 0x46, 0xD9, 0x8A, 0xD9, 0x94, 0xDB, + 0x95, 0x46, 0xE0, 0xB9, 0x8D, 0xE0, 0xB8, 0xB2, + 0x46, 0xE0, 0xBA, 0xAB, 0xE0, 0xBA, 0x99, 0x46, + 0xE0, 0xBA, 0xAB, 0xE0, 0xBA, 0xA1, 0x46, 0xE0, + 0xBB, 0x8D, 0xE0, 0xBA, 0xB2, 0x46, 0xE0, 0xBD, + // Bytes 2640 - 267f + 0x80, 0xE0, 0xBE, 0xB5, 0x46, 0xE0, 0xBD, 0x82, + 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBD, 0x8C, 0xE0, + 0xBE, 0xB7, 0x46, 0xE0, 0xBD, 0x91, 0xE0, 0xBE, + 0xB7, 0x46, 0xE0, 0xBD, 0x96, 0xE0, 0xBE, 0xB7, + 0x46, 0xE0, 0xBD, 0x9B, 0xE0, 0xBE, 0xB7, 0x46, + 0xE0, 0xBE, 0x90, 0xE0, 0xBE, 0xB5, 0x46, 0xE0, + 0xBE, 0x92, 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBE, + 0x9C, 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBE, 0xA1, + // Bytes 2680 - 26bf + 0xE0, 0xBE, 0xB7, 0x46, 0xE0, 0xBE, 0xA6, 0xE0, + 0xBE, 0xB7, 0x46, 0xE0, 0xBE, 0xAB, 0xE0, 0xBE, + 0xB7, 0x46, 0xE2, 0x80, 0xB2, 0xE2, 0x80, 0xB2, + 0x46, 0xE2, 0x80, 0xB5, 0xE2, 0x80, 0xB5, 0x46, + 0xE2, 0x88, 0xAB, 0xE2, 0x88, 0xAB, 0x46, 0xE2, + 0x88, 0xAE, 0xE2, 0x88, 0xAE, 0x46, 0xE3, 0x81, + 0xBB, 0xE3, 0x81, 0x8B, 0x46, 0xE3, 0x82, 0x88, + 0xE3, 0x82, 0x8A, 0x46, 0xE3, 0x82, 0xAD, 0xE3, + // Bytes 26c0 - 26ff + 0x83, 0xAD, 0x46, 0xE3, 0x82, 0xB3, 0xE3, 0x82, + 0xB3, 0x46, 0xE3, 0x82, 0xB3, 0xE3, 0x83, 0x88, + 0x46, 0xE3, 0x83, 0x88, 0xE3, 0x83, 0xB3, 0x46, + 0xE3, 0x83, 0x8A, 0xE3, 0x83, 0x8E, 0x46, 0xE3, + 0x83, 0x9B, 0xE3, 0x83, 0xB3, 0x46, 0xE3, 0x83, + 0x9F, 0xE3, 0x83, 0xAA, 0x46, 0xE3, 0x83, 0xAA, + 0xE3, 0x83, 0xA9, 0x46, 0xE3, 0x83, 0xAC, 0xE3, + 0x83, 0xA0, 0x46, 0xE5, 0xA4, 0xA7, 0xE6, 0xAD, + // Bytes 2700 - 273f + 0xA3, 0x46, 0xE5, 0xB9, 0xB3, 0xE6, 0x88, 0x90, + 0x46, 0xE6, 0x98, 0x8E, 0xE6, 0xB2, 0xBB, 0x46, + 0xE6, 0x98, 0xAD, 0xE5, 0x92, 0x8C, 0x47, 0x72, + 0x61, 0x64, 0xE2, 0x88, 0x95, 0x73, 0x47, 0xE3, + 0x80, 0x94, 0x53, 0xE3, 0x80, 0x95, 0x48, 0x28, + 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xA1, 0x29, 0x48, + 0x28, 0xE1, 0x84, 0x82, 0xE1, 0x85, 0xA1, 0x29, + 0x48, 0x28, 0xE1, 0x84, 0x83, 0xE1, 0x85, 0xA1, + // Bytes 2740 - 277f + 0x29, 0x48, 0x28, 0xE1, 0x84, 0x85, 0xE1, 0x85, + 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x86, 0xE1, + 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x87, + 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, + 0x89, 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, + 0x84, 0x8B, 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, + 0xE1, 0x84, 0x8C, 0xE1, 0x85, 0xA1, 0x29, 0x48, + 0x28, 0xE1, 0x84, 0x8C, 0xE1, 0x85, 0xAE, 0x29, + // Bytes 2780 - 27bf + 0x48, 0x28, 0xE1, 0x84, 0x8E, 0xE1, 0x85, 0xA1, + 0x29, 0x48, 0x28, 0xE1, 0x84, 0x8F, 0xE1, 0x85, + 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x90, 0xE1, + 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, 0x91, + 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x28, 0xE1, 0x84, + 0x92, 0xE1, 0x85, 0xA1, 0x29, 0x48, 0x72, 0x61, + 0x64, 0xE2, 0x88, 0x95, 0x73, 0x32, 0x48, 0xD8, + 0xA7, 0xD9, 0x83, 0xD8, 0xA8, 0xD8, 0xB1, 0x48, + // Bytes 27c0 - 27ff + 0xD8, 0xA7, 0xD9, 0x84, 0xD9, 0x84, 0xD9, 0x87, + 0x48, 0xD8, 0xB1, 0xD8, 0xB3, 0xD9, 0x88, 0xD9, + 0x84, 0x48, 0xD8, 0xB1, 0xDB, 0x8C, 0xD8, 0xA7, + 0xD9, 0x84, 0x48, 0xD8, 0xB5, 0xD9, 0x84, 0xD8, + 0xB9, 0xD9, 0x85, 0x48, 0xD8, 0xB9, 0xD9, 0x84, + 0xD9, 0x8A, 0xD9, 0x87, 0x48, 0xD9, 0x85, 0xD8, + 0xAD, 0xD9, 0x85, 0xD8, 0xAF, 0x48, 0xD9, 0x88, + 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85, 0x49, 0xE2, + // Bytes 2800 - 283f + 0x80, 0xB2, 0xE2, 0x80, 0xB2, 0xE2, 0x80, 0xB2, + 0x49, 0xE2, 0x80, 0xB5, 0xE2, 0x80, 0xB5, 0xE2, + 0x80, 0xB5, 0x49, 0xE2, 0x88, 0xAB, 0xE2, 0x88, + 0xAB, 0xE2, 0x88, 0xAB, 0x49, 0xE2, 0x88, 0xAE, + 0xE2, 0x88, 0xAE, 0xE2, 0x88, 0xAE, 0x49, 0xE3, + 0x80, 0x94, 0xE4, 0xB8, 0x89, 0xE3, 0x80, 0x95, + 0x49, 0xE3, 0x80, 0x94, 0xE4, 0xBA, 0x8C, 0xE3, + 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, 0xE5, 0x8B, + // Bytes 2840 - 287f + 0x9D, 0xE3, 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, + 0xE5, 0xAE, 0x89, 0xE3, 0x80, 0x95, 0x49, 0xE3, + 0x80, 0x94, 0xE6, 0x89, 0x93, 0xE3, 0x80, 0x95, + 0x49, 0xE3, 0x80, 0x94, 0xE6, 0x95, 0x97, 0xE3, + 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, 0xE6, 0x9C, + 0xAC, 0xE3, 0x80, 0x95, 0x49, 0xE3, 0x80, 0x94, + 0xE7, 0x82, 0xB9, 0xE3, 0x80, 0x95, 0x49, 0xE3, + 0x80, 0x94, 0xE7, 0x9B, 0x97, 0xE3, 0x80, 0x95, + // Bytes 2880 - 28bf + 0x49, 0xE3, 0x82, 0xA2, 0xE3, 0x83, 0xBC, 0xE3, + 0x83, 0xAB, 0x49, 0xE3, 0x82, 0xA4, 0xE3, 0x83, + 0xB3, 0xE3, 0x83, 0x81, 0x49, 0xE3, 0x82, 0xA6, + 0xE3, 0x82, 0xA9, 0xE3, 0x83, 0xB3, 0x49, 0xE3, + 0x82, 0xAA, 0xE3, 0x83, 0xB3, 0xE3, 0x82, 0xB9, + 0x49, 0xE3, 0x82, 0xAA, 0xE3, 0x83, 0xBC, 0xE3, + 0x83, 0xA0, 0x49, 0xE3, 0x82, 0xAB, 0xE3, 0x82, + 0xA4, 0xE3, 0x83, 0xAA, 0x49, 0xE3, 0x82, 0xB1, + // Bytes 28c0 - 28ff + 0xE3, 0x83, 0xBC, 0xE3, 0x82, 0xB9, 0x49, 0xE3, + 0x82, 0xB3, 0xE3, 0x83, 0xAB, 0xE3, 0x83, 0x8A, + 0x49, 0xE3, 0x82, 0xBB, 0xE3, 0x83, 0xB3, 0xE3, + 0x83, 0x81, 0x49, 0xE3, 0x82, 0xBB, 0xE3, 0x83, + 0xB3, 0xE3, 0x83, 0x88, 0x49, 0xE3, 0x83, 0x86, + 0xE3, 0x82, 0x99, 0xE3, 0x82, 0xB7, 0x49, 0xE3, + 0x83, 0x88, 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xAB, + 0x49, 0xE3, 0x83, 0x8E, 0xE3, 0x83, 0x83, 0xE3, + // Bytes 2900 - 293f + 0x83, 0x88, 0x49, 0xE3, 0x83, 0x8F, 0xE3, 0x82, + 0xA4, 0xE3, 0x83, 0x84, 0x49, 0xE3, 0x83, 0x92, + 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xAB, 0x49, 0xE3, + 0x83, 0x92, 0xE3, 0x82, 0x9A, 0xE3, 0x82, 0xB3, + 0x49, 0xE3, 0x83, 0x95, 0xE3, 0x83, 0xA9, 0xE3, + 0x83, 0xB3, 0x49, 0xE3, 0x83, 0x98, 0xE3, 0x82, + 0x9A, 0xE3, 0x82, 0xBD, 0x49, 0xE3, 0x83, 0x98, + 0xE3, 0x83, 0xAB, 0xE3, 0x83, 0x84, 0x49, 0xE3, + // Bytes 2940 - 297f + 0x83, 0x9B, 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0xAB, + 0x49, 0xE3, 0x83, 0x9B, 0xE3, 0x83, 0xBC, 0xE3, + 0x83, 0xB3, 0x49, 0xE3, 0x83, 0x9E, 0xE3, 0x82, + 0xA4, 0xE3, 0x83, 0xAB, 0x49, 0xE3, 0x83, 0x9E, + 0xE3, 0x83, 0x83, 0xE3, 0x83, 0x8F, 0x49, 0xE3, + 0x83, 0x9E, 0xE3, 0x83, 0xAB, 0xE3, 0x82, 0xAF, + 0x49, 0xE3, 0x83, 0xA4, 0xE3, 0x83, 0xBC, 0xE3, + 0x83, 0xAB, 0x49, 0xE3, 0x83, 0xA6, 0xE3, 0x82, + // Bytes 2980 - 29bf + 0xA2, 0xE3, 0x83, 0xB3, 0x49, 0xE3, 0x83, 0xAF, + 0xE3, 0x83, 0x83, 0xE3, 0x83, 0x88, 0x4C, 0xE2, + 0x80, 0xB2, 0xE2, 0x80, 0xB2, 0xE2, 0x80, 0xB2, + 0xE2, 0x80, 0xB2, 0x4C, 0xE2, 0x88, 0xAB, 0xE2, + 0x88, 0xAB, 0xE2, 0x88, 0xAB, 0xE2, 0x88, 0xAB, + 0x4C, 0xE3, 0x82, 0xA2, 0xE3, 0x83, 0xAB, 0xE3, + 0x83, 0x95, 0xE3, 0x82, 0xA1, 0x4C, 0xE3, 0x82, + 0xA8, 0xE3, 0x83, 0xBC, 0xE3, 0x82, 0xAB, 0xE3, + // Bytes 29c0 - 29ff + 0x83, 0xBC, 0x4C, 0xE3, 0x82, 0xAB, 0xE3, 0x82, + 0x99, 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xB3, 0x4C, + 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0xE3, 0x83, + 0xB3, 0xE3, 0x83, 0x9E, 0x4C, 0xE3, 0x82, 0xAB, + 0xE3, 0x83, 0xA9, 0xE3, 0x83, 0x83, 0xE3, 0x83, + 0x88, 0x4C, 0xE3, 0x82, 0xAB, 0xE3, 0x83, 0xAD, + 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0xBC, 0x4C, 0xE3, + 0x82, 0xAD, 0xE3, 0x82, 0x99, 0xE3, 0x83, 0x8B, + // Bytes 2a00 - 2a3f + 0xE3, 0x83, 0xBC, 0x4C, 0xE3, 0x82, 0xAD, 0xE3, + 0x83, 0xA5, 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0xBC, + 0x4C, 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0xE3, + 0x83, 0xA9, 0xE3, 0x83, 0xA0, 0x4C, 0xE3, 0x82, + 0xAF, 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xBC, 0xE3, + 0x83, 0x8D, 0x4C, 0xE3, 0x82, 0xB5, 0xE3, 0x82, + 0xA4, 0xE3, 0x82, 0xAF, 0xE3, 0x83, 0xAB, 0x4C, + 0xE3, 0x82, 0xBF, 0xE3, 0x82, 0x99, 0xE3, 0x83, + // Bytes 2a40 - 2a7f + 0xBC, 0xE3, 0x82, 0xB9, 0x4C, 0xE3, 0x83, 0x8F, + 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, 0xE3, 0x83, + 0x84, 0x4C, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x9A, + 0xE3, 0x82, 0xAF, 0xE3, 0x83, 0xAB, 0x4C, 0xE3, + 0x83, 0x95, 0xE3, 0x82, 0xA3, 0xE3, 0x83, 0xBC, + 0xE3, 0x83, 0x88, 0x4C, 0xE3, 0x83, 0x98, 0xE3, + 0x82, 0x99, 0xE3, 0x83, 0xBC, 0xE3, 0x82, 0xBF, + 0x4C, 0xE3, 0x83, 0x98, 0xE3, 0x82, 0x9A, 0xE3, + // Bytes 2a80 - 2abf + 0x83, 0x8B, 0xE3, 0x83, 0x92, 0x4C, 0xE3, 0x83, + 0x98, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xB3, 0xE3, + 0x82, 0xB9, 0x4C, 0xE3, 0x83, 0x9B, 0xE3, 0x82, + 0x99, 0xE3, 0x83, 0xAB, 0xE3, 0x83, 0x88, 0x4C, + 0xE3, 0x83, 0x9E, 0xE3, 0x82, 0xA4, 0xE3, 0x82, + 0xAF, 0xE3, 0x83, 0xAD, 0x4C, 0xE3, 0x83, 0x9F, + 0xE3, 0x82, 0xAF, 0xE3, 0x83, 0xAD, 0xE3, 0x83, + 0xB3, 0x4C, 0xE3, 0x83, 0xA1, 0xE3, 0x83, 0xBC, + // Bytes 2ac0 - 2aff + 0xE3, 0x83, 0x88, 0xE3, 0x83, 0xAB, 0x4C, 0xE3, + 0x83, 0xAA, 0xE3, 0x83, 0x83, 0xE3, 0x83, 0x88, + 0xE3, 0x83, 0xAB, 0x4C, 0xE3, 0x83, 0xAB, 0xE3, + 0x83, 0x92, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, + 0x4C, 0xE6, 0xA0, 0xAA, 0xE5, 0xBC, 0x8F, 0xE4, + 0xBC, 0x9A, 0xE7, 0xA4, 0xBE, 0x4E, 0x28, 0xE1, + 0x84, 0x8B, 0xE1, 0x85, 0xA9, 0xE1, 0x84, 0x92, + 0xE1, 0x85, 0xAE, 0x29, 0x4F, 0xD8, 0xAC, 0xD9, + // Bytes 2b00 - 2b3f + 0x84, 0x20, 0xD8, 0xAC, 0xD9, 0x84, 0xD8, 0xA7, + 0xD9, 0x84, 0xD9, 0x87, 0x4F, 0xE3, 0x82, 0xA2, + 0xE3, 0x83, 0x8F, 0xE3, 0x82, 0x9A, 0xE3, 0x83, + 0xBC, 0xE3, 0x83, 0x88, 0x4F, 0xE3, 0x82, 0xA2, + 0xE3, 0x83, 0xB3, 0xE3, 0x83, 0x98, 0xE3, 0x82, + 0x9A, 0xE3, 0x82, 0xA2, 0x4F, 0xE3, 0x82, 0xAD, + 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xAF, 0xE3, 0x83, + 0x83, 0xE3, 0x83, 0x88, 0x4F, 0xE3, 0x82, 0xB5, + // Bytes 2b40 - 2b7f + 0xE3, 0x83, 0xB3, 0xE3, 0x83, 0x81, 0xE3, 0x83, + 0xBC, 0xE3, 0x83, 0xA0, 0x4F, 0xE3, 0x83, 0x8F, + 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xBC, 0xE3, 0x83, + 0xAC, 0xE3, 0x83, 0xAB, 0x4F, 0xE3, 0x83, 0x98, + 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0xBF, 0xE3, 0x83, + 0xBC, 0xE3, 0x83, 0xAB, 0x4F, 0xE3, 0x83, 0x9B, + 0xE3, 0x82, 0x9A, 0xE3, 0x82, 0xA4, 0xE3, 0x83, + 0xB3, 0xE3, 0x83, 0x88, 0x4F, 0xE3, 0x83, 0x9E, + // Bytes 2b80 - 2bbf + 0xE3, 0x83, 0xB3, 0xE3, 0x82, 0xB7, 0xE3, 0x83, + 0xA7, 0xE3, 0x83, 0xB3, 0x4F, 0xE3, 0x83, 0xA1, + 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0xE3, 0x83, + 0x88, 0xE3, 0x83, 0xB3, 0x4F, 0xE3, 0x83, 0xAB, + 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0x95, 0xE3, 0x82, + 0x99, 0xE3, 0x83, 0xAB, 0x51, 0x28, 0xE1, 0x84, + 0x8B, 0xE1, 0x85, 0xA9, 0xE1, 0x84, 0x8C, 0xE1, + 0x85, 0xA5, 0xE1, 0x86, 0xAB, 0x29, 0x52, 0xE3, + // Bytes 2bc0 - 2bff + 0x82, 0xAD, 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xAB, + 0xE3, 0x82, 0xBF, 0xE3, 0x82, 0x99, 0xE3, 0x83, + 0xBC, 0x52, 0xE3, 0x82, 0xAD, 0xE3, 0x83, 0xAD, + 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0xE3, 0x83, + 0xA9, 0xE3, 0x83, 0xA0, 0x52, 0xE3, 0x82, 0xAD, + 0xE3, 0x83, 0xAD, 0xE3, 0x83, 0xA1, 0xE3, 0x83, + 0xBC, 0xE3, 0x83, 0x88, 0xE3, 0x83, 0xAB, 0x52, + 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0xE3, 0x83, + // Bytes 2c00 - 2c3f + 0xA9, 0xE3, 0x83, 0xA0, 0xE3, 0x83, 0x88, 0xE3, + 0x83, 0xB3, 0x52, 0xE3, 0x82, 0xAF, 0xE3, 0x83, + 0xAB, 0xE3, 0x82, 0xBB, 0xE3, 0x82, 0x99, 0xE3, + 0x82, 0xA4, 0xE3, 0x83, 0xAD, 0x52, 0xE3, 0x83, + 0x8F, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, 0xE3, + 0x82, 0xBB, 0xE3, 0x83, 0xB3, 0xE3, 0x83, 0x88, + 0x52, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x9A, 0xE3, + 0x82, 0xA2, 0xE3, 0x82, 0xB9, 0xE3, 0x83, 0x88, + // Bytes 2c40 - 2c7f + 0xE3, 0x83, 0xAB, 0x52, 0xE3, 0x83, 0x95, 0xE3, + 0x82, 0x99, 0xE3, 0x83, 0x83, 0xE3, 0x82, 0xB7, + 0xE3, 0x82, 0xA7, 0xE3, 0x83, 0xAB, 0x52, 0xE3, + 0x83, 0x9F, 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0x8F, + 0xE3, 0x82, 0x99, 0xE3, 0x83, 0xBC, 0xE3, 0x83, + 0xAB, 0x52, 0xE3, 0x83, 0xAC, 0xE3, 0x83, 0xB3, + 0xE3, 0x83, 0x88, 0xE3, 0x82, 0xB1, 0xE3, 0x82, + 0x99, 0xE3, 0x83, 0xB3, 0x61, 0xD8, 0xB5, 0xD9, + // Bytes 2c80 - 2cbf + 0x84, 0xD9, 0x89, 0x20, 0xD8, 0xA7, 0xD9, 0x84, + 0xD9, 0x84, 0xD9, 0x87, 0x20, 0xD8, 0xB9, 0xD9, + 0x84, 0xD9, 0x8A, 0xD9, 0x87, 0x20, 0xD9, 0x88, + 0xD8, 0xB3, 0xD9, 0x84, 0xD9, 0x85, 0x06, 0xE0, + 0xA7, 0x87, 0xE0, 0xA6, 0xBE, 0x01, 0x06, 0xE0, + 0xA7, 0x87, 0xE0, 0xA7, 0x97, 0x01, 0x06, 0xE0, + 0xAD, 0x87, 0xE0, 0xAC, 0xBE, 0x01, 0x06, 0xE0, + 0xAD, 0x87, 0xE0, 0xAD, 0x96, 0x01, 0x06, 0xE0, + // Bytes 2cc0 - 2cff + 0xAD, 0x87, 0xE0, 0xAD, 0x97, 0x01, 0x06, 0xE0, + 0xAE, 0x92, 0xE0, 0xAF, 0x97, 0x01, 0x06, 0xE0, + 0xAF, 0x86, 0xE0, 0xAE, 0xBE, 0x01, 0x06, 0xE0, + 0xAF, 0x86, 0xE0, 0xAF, 0x97, 0x01, 0x06, 0xE0, + 0xAF, 0x87, 0xE0, 0xAE, 0xBE, 0x01, 0x06, 0xE0, + 0xB2, 0xBF, 0xE0, 0xB3, 0x95, 0x01, 0x06, 0xE0, + 0xB3, 0x86, 0xE0, 0xB3, 0x95, 0x01, 0x06, 0xE0, + 0xB3, 0x86, 0xE0, 0xB3, 0x96, 0x01, 0x06, 0xE0, + // Bytes 2d00 - 2d3f + 0xB5, 0x86, 0xE0, 0xB4, 0xBE, 0x01, 0x06, 0xE0, + 0xB5, 0x86, 0xE0, 0xB5, 0x97, 0x01, 0x06, 0xE0, + 0xB5, 0x87, 0xE0, 0xB4, 0xBE, 0x01, 0x06, 0xE0, + 0xB7, 0x99, 0xE0, 0xB7, 0x9F, 0x01, 0x06, 0xE1, + 0x80, 0xA5, 0xE1, 0x80, 0xAE, 0x01, 0x06, 0xE1, + 0xAC, 0x85, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0x87, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0x89, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + // Bytes 2d40 - 2d7f + 0xAC, 0x8B, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0x8D, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0x91, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0xBA, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0xBC, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0xBE, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAC, 0xBF, 0xE1, 0xAC, 0xB5, 0x01, 0x06, 0xE1, + 0xAD, 0x82, 0xE1, 0xAC, 0xB5, 0x01, 0x08, 0xF0, + // Bytes 2d80 - 2dbf + 0x91, 0x84, 0xB1, 0xF0, 0x91, 0x84, 0xA7, 0x01, + 0x08, 0xF0, 0x91, 0x84, 0xB2, 0xF0, 0x91, 0x84, + 0xA7, 0x01, 0x08, 0xF0, 0x91, 0x8D, 0x87, 0xF0, + 0x91, 0x8C, 0xBE, 0x01, 0x08, 0xF0, 0x91, 0x8D, + 0x87, 0xF0, 0x91, 0x8D, 0x97, 0x01, 0x08, 0xF0, + 0x91, 0x92, 0xB9, 0xF0, 0x91, 0x92, 0xB0, 0x01, + 0x08, 0xF0, 0x91, 0x92, 0xB9, 0xF0, 0x91, 0x92, + 0xBA, 0x01, 0x08, 0xF0, 0x91, 0x92, 0xB9, 0xF0, + // Bytes 2dc0 - 2dff + 0x91, 0x92, 0xBD, 0x01, 0x08, 0xF0, 0x91, 0x96, + 0xB8, 0xF0, 0x91, 0x96, 0xAF, 0x01, 0x08, 0xF0, + 0x91, 0x96, 0xB9, 0xF0, 0x91, 0x96, 0xAF, 0x01, + 0x09, 0xE0, 0xB3, 0x86, 0xE0, 0xB3, 0x82, 0xE0, + 0xB3, 0x95, 0x02, 0x09, 0xE0, 0xB7, 0x99, 0xE0, + 0xB7, 0x8F, 0xE0, 0xB7, 0x8A, 0x12, 0x44, 0x44, + 0x5A, 0xCC, 0x8C, 0xC9, 0x44, 0x44, 0x7A, 0xCC, + 0x8C, 0xC9, 0x44, 0x64, 0x7A, 0xCC, 0x8C, 0xC9, + // Bytes 2e00 - 2e3f + 0x46, 0xD9, 0x84, 0xD8, 0xA7, 0xD9, 0x93, 0xC9, + 0x46, 0xD9, 0x84, 0xD8, 0xA7, 0xD9, 0x94, 0xC9, + 0x46, 0xD9, 0x84, 0xD8, 0xA7, 0xD9, 0x95, 0xB5, + 0x46, 0xE1, 0x84, 0x80, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x82, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x83, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x85, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x86, 0xE1, 0x85, 0xA1, 0x01, + // Bytes 2e40 - 2e7f + 0x46, 0xE1, 0x84, 0x87, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x89, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x8B, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x8B, 0xE1, 0x85, 0xAE, 0x01, + 0x46, 0xE1, 0x84, 0x8C, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x8E, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x8F, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x90, 0xE1, 0x85, 0xA1, 0x01, + // Bytes 2e80 - 2ebf + 0x46, 0xE1, 0x84, 0x91, 0xE1, 0x85, 0xA1, 0x01, + 0x46, 0xE1, 0x84, 0x92, 0xE1, 0x85, 0xA1, 0x01, + 0x49, 0xE3, 0x83, 0xA1, 0xE3, 0x82, 0xAB, 0xE3, + 0x82, 0x99, 0x0D, 0x4C, 0xE1, 0x84, 0x8C, 0xE1, + 0x85, 0xAE, 0xE1, 0x84, 0x8B, 0xE1, 0x85, 0xB4, + 0x01, 0x4C, 0xE3, 0x82, 0xAD, 0xE3, 0x82, 0x99, + 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0x0D, 0x4C, + 0xE3, 0x82, 0xB3, 0xE3, 0x83, 0xBC, 0xE3, 0x83, + // Bytes 2ec0 - 2eff + 0x9B, 0xE3, 0x82, 0x9A, 0x0D, 0x4C, 0xE3, 0x83, + 0xA4, 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0x88, 0xE3, + 0x82, 0x99, 0x0D, 0x4F, 0xE1, 0x84, 0x8E, 0xE1, + 0x85, 0xA1, 0xE1, 0x86, 0xB7, 0xE1, 0x84, 0x80, + 0xE1, 0x85, 0xA9, 0x01, 0x4F, 0xE3, 0x82, 0xA4, + 0xE3, 0x83, 0x8B, 0xE3, 0x83, 0xB3, 0xE3, 0x82, + 0xAF, 0xE3, 0x82, 0x99, 0x0D, 0x4F, 0xE3, 0x82, + 0xB7, 0xE3, 0x83, 0xAA, 0xE3, 0x83, 0xB3, 0xE3, + // Bytes 2f00 - 2f3f + 0x82, 0xAF, 0xE3, 0x82, 0x99, 0x0D, 0x4F, 0xE3, + 0x83, 0x98, 0xE3, 0x82, 0x9A, 0xE3, 0x83, 0xBC, + 0xE3, 0x82, 0xB7, 0xE3, 0x82, 0x99, 0x0D, 0x4F, + 0xE3, 0x83, 0x9B, 0xE3, 0x82, 0x9A, 0xE3, 0x83, + 0xB3, 0xE3, 0x83, 0x88, 0xE3, 0x82, 0x99, 0x0D, + 0x52, 0xE3, 0x82, 0xA8, 0xE3, 0x82, 0xB9, 0xE3, + 0x82, 0xAF, 0xE3, 0x83, 0xBC, 0xE3, 0x83, 0x88, + 0xE3, 0x82, 0x99, 0x0D, 0x52, 0xE3, 0x83, 0x95, + // Bytes 2f40 - 2f7f + 0xE3, 0x82, 0xA1, 0xE3, 0x83, 0xA9, 0xE3, 0x83, + 0x83, 0xE3, 0x83, 0x88, 0xE3, 0x82, 0x99, 0x0D, + 0x86, 0xE0, 0xB3, 0x86, 0xE0, 0xB3, 0x82, 0x01, + 0x86, 0xE0, 0xB7, 0x99, 0xE0, 0xB7, 0x8F, 0x01, + 0x03, 0x3C, 0xCC, 0xB8, 0x05, 0x03, 0x3D, 0xCC, + 0xB8, 0x05, 0x03, 0x3E, 0xCC, 0xB8, 0x05, 0x03, + 0x41, 0xCC, 0x80, 0xC9, 0x03, 0x41, 0xCC, 0x81, + 0xC9, 0x03, 0x41, 0xCC, 0x83, 0xC9, 0x03, 0x41, + // Bytes 2f80 - 2fbf + 0xCC, 0x84, 0xC9, 0x03, 0x41, 0xCC, 0x89, 0xC9, + 0x03, 0x41, 0xCC, 0x8C, 0xC9, 0x03, 0x41, 0xCC, + 0x8F, 0xC9, 0x03, 0x41, 0xCC, 0x91, 0xC9, 0x03, + 0x41, 0xCC, 0xA5, 0xB5, 0x03, 0x41, 0xCC, 0xA8, + 0xA5, 0x03, 0x42, 0xCC, 0x87, 0xC9, 0x03, 0x42, + 0xCC, 0xA3, 0xB5, 0x03, 0x42, 0xCC, 0xB1, 0xB5, + 0x03, 0x43, 0xCC, 0x81, 0xC9, 0x03, 0x43, 0xCC, + 0x82, 0xC9, 0x03, 0x43, 0xCC, 0x87, 0xC9, 0x03, + // Bytes 2fc0 - 2fff + 0x43, 0xCC, 0x8C, 0xC9, 0x03, 0x44, 0xCC, 0x87, + 0xC9, 0x03, 0x44, 0xCC, 0x8C, 0xC9, 0x03, 0x44, + 0xCC, 0xA3, 0xB5, 0x03, 0x44, 0xCC, 0xA7, 0xA5, + 0x03, 0x44, 0xCC, 0xAD, 0xB5, 0x03, 0x44, 0xCC, + 0xB1, 0xB5, 0x03, 0x45, 0xCC, 0x80, 0xC9, 0x03, + 0x45, 0xCC, 0x81, 0xC9, 0x03, 0x45, 0xCC, 0x83, + 0xC9, 0x03, 0x45, 0xCC, 0x86, 0xC9, 0x03, 0x45, + 0xCC, 0x87, 0xC9, 0x03, 0x45, 0xCC, 0x88, 0xC9, + // Bytes 3000 - 303f + 0x03, 0x45, 0xCC, 0x89, 0xC9, 0x03, 0x45, 0xCC, + 0x8C, 0xC9, 0x03, 0x45, 0xCC, 0x8F, 0xC9, 0x03, + 0x45, 0xCC, 0x91, 0xC9, 0x03, 0x45, 0xCC, 0xA8, + 0xA5, 0x03, 0x45, 0xCC, 0xAD, 0xB5, 0x03, 0x45, + 0xCC, 0xB0, 0xB5, 0x03, 0x46, 0xCC, 0x87, 0xC9, + 0x03, 0x47, 0xCC, 0x81, 0xC9, 0x03, 0x47, 0xCC, + 0x82, 0xC9, 0x03, 0x47, 0xCC, 0x84, 0xC9, 0x03, + 0x47, 0xCC, 0x86, 0xC9, 0x03, 0x47, 0xCC, 0x87, + // Bytes 3040 - 307f + 0xC9, 0x03, 0x47, 0xCC, 0x8C, 0xC9, 0x03, 0x47, + 0xCC, 0xA7, 0xA5, 0x03, 0x48, 0xCC, 0x82, 0xC9, + 0x03, 0x48, 0xCC, 0x87, 0xC9, 0x03, 0x48, 0xCC, + 0x88, 0xC9, 0x03, 0x48, 0xCC, 0x8C, 0xC9, 0x03, + 0x48, 0xCC, 0xA3, 0xB5, 0x03, 0x48, 0xCC, 0xA7, + 0xA5, 0x03, 0x48, 0xCC, 0xAE, 0xB5, 0x03, 0x49, + 0xCC, 0x80, 0xC9, 0x03, 0x49, 0xCC, 0x81, 0xC9, + 0x03, 0x49, 0xCC, 0x82, 0xC9, 0x03, 0x49, 0xCC, + // Bytes 3080 - 30bf + 0x83, 0xC9, 0x03, 0x49, 0xCC, 0x84, 0xC9, 0x03, + 0x49, 0xCC, 0x86, 0xC9, 0x03, 0x49, 0xCC, 0x87, + 0xC9, 0x03, 0x49, 0xCC, 0x89, 0xC9, 0x03, 0x49, + 0xCC, 0x8C, 0xC9, 0x03, 0x49, 0xCC, 0x8F, 0xC9, + 0x03, 0x49, 0xCC, 0x91, 0xC9, 0x03, 0x49, 0xCC, + 0xA3, 0xB5, 0x03, 0x49, 0xCC, 0xA8, 0xA5, 0x03, + 0x49, 0xCC, 0xB0, 0xB5, 0x03, 0x4A, 0xCC, 0x82, + 0xC9, 0x03, 0x4B, 0xCC, 0x81, 0xC9, 0x03, 0x4B, + // Bytes 30c0 - 30ff + 0xCC, 0x8C, 0xC9, 0x03, 0x4B, 0xCC, 0xA3, 0xB5, + 0x03, 0x4B, 0xCC, 0xA7, 0xA5, 0x03, 0x4B, 0xCC, + 0xB1, 0xB5, 0x03, 0x4C, 0xCC, 0x81, 0xC9, 0x03, + 0x4C, 0xCC, 0x8C, 0xC9, 0x03, 0x4C, 0xCC, 0xA7, + 0xA5, 0x03, 0x4C, 0xCC, 0xAD, 0xB5, 0x03, 0x4C, + 0xCC, 0xB1, 0xB5, 0x03, 0x4D, 0xCC, 0x81, 0xC9, + 0x03, 0x4D, 0xCC, 0x87, 0xC9, 0x03, 0x4D, 0xCC, + 0xA3, 0xB5, 0x03, 0x4E, 0xCC, 0x80, 0xC9, 0x03, + // Bytes 3100 - 313f + 0x4E, 0xCC, 0x81, 0xC9, 0x03, 0x4E, 0xCC, 0x83, + 0xC9, 0x03, 0x4E, 0xCC, 0x87, 0xC9, 0x03, 0x4E, + 0xCC, 0x8C, 0xC9, 0x03, 0x4E, 0xCC, 0xA3, 0xB5, + 0x03, 0x4E, 0xCC, 0xA7, 0xA5, 0x03, 0x4E, 0xCC, + 0xAD, 0xB5, 0x03, 0x4E, 0xCC, 0xB1, 0xB5, 0x03, + 0x4F, 0xCC, 0x80, 0xC9, 0x03, 0x4F, 0xCC, 0x81, + 0xC9, 0x03, 0x4F, 0xCC, 0x86, 0xC9, 0x03, 0x4F, + 0xCC, 0x89, 0xC9, 0x03, 0x4F, 0xCC, 0x8B, 0xC9, + // Bytes 3140 - 317f + 0x03, 0x4F, 0xCC, 0x8C, 0xC9, 0x03, 0x4F, 0xCC, + 0x8F, 0xC9, 0x03, 0x4F, 0xCC, 0x91, 0xC9, 0x03, + 0x50, 0xCC, 0x81, 0xC9, 0x03, 0x50, 0xCC, 0x87, + 0xC9, 0x03, 0x52, 0xCC, 0x81, 0xC9, 0x03, 0x52, + 0xCC, 0x87, 0xC9, 0x03, 0x52, 0xCC, 0x8C, 0xC9, + 0x03, 0x52, 0xCC, 0x8F, 0xC9, 0x03, 0x52, 0xCC, + 0x91, 0xC9, 0x03, 0x52, 0xCC, 0xA7, 0xA5, 0x03, + 0x52, 0xCC, 0xB1, 0xB5, 0x03, 0x53, 0xCC, 0x82, + // Bytes 3180 - 31bf + 0xC9, 0x03, 0x53, 0xCC, 0x87, 0xC9, 0x03, 0x53, + 0xCC, 0xA6, 0xB5, 0x03, 0x53, 0xCC, 0xA7, 0xA5, + 0x03, 0x54, 0xCC, 0x87, 0xC9, 0x03, 0x54, 0xCC, + 0x8C, 0xC9, 0x03, 0x54, 0xCC, 0xA3, 0xB5, 0x03, + 0x54, 0xCC, 0xA6, 0xB5, 0x03, 0x54, 0xCC, 0xA7, + 0xA5, 0x03, 0x54, 0xCC, 0xAD, 0xB5, 0x03, 0x54, + 0xCC, 0xB1, 0xB5, 0x03, 0x55, 0xCC, 0x80, 0xC9, + 0x03, 0x55, 0xCC, 0x81, 0xC9, 0x03, 0x55, 0xCC, + // Bytes 31c0 - 31ff + 0x82, 0xC9, 0x03, 0x55, 0xCC, 0x86, 0xC9, 0x03, + 0x55, 0xCC, 0x89, 0xC9, 0x03, 0x55, 0xCC, 0x8A, + 0xC9, 0x03, 0x55, 0xCC, 0x8B, 0xC9, 0x03, 0x55, + 0xCC, 0x8C, 0xC9, 0x03, 0x55, 0xCC, 0x8F, 0xC9, + 0x03, 0x55, 0xCC, 0x91, 0xC9, 0x03, 0x55, 0xCC, + 0xA3, 0xB5, 0x03, 0x55, 0xCC, 0xA4, 0xB5, 0x03, + 0x55, 0xCC, 0xA8, 0xA5, 0x03, 0x55, 0xCC, 0xAD, + 0xB5, 0x03, 0x55, 0xCC, 0xB0, 0xB5, 0x03, 0x56, + // Bytes 3200 - 323f + 0xCC, 0x83, 0xC9, 0x03, 0x56, 0xCC, 0xA3, 0xB5, + 0x03, 0x57, 0xCC, 0x80, 0xC9, 0x03, 0x57, 0xCC, + 0x81, 0xC9, 0x03, 0x57, 0xCC, 0x82, 0xC9, 0x03, + 0x57, 0xCC, 0x87, 0xC9, 0x03, 0x57, 0xCC, 0x88, + 0xC9, 0x03, 0x57, 0xCC, 0xA3, 0xB5, 0x03, 0x58, + 0xCC, 0x87, 0xC9, 0x03, 0x58, 0xCC, 0x88, 0xC9, + 0x03, 0x59, 0xCC, 0x80, 0xC9, 0x03, 0x59, 0xCC, + 0x81, 0xC9, 0x03, 0x59, 0xCC, 0x82, 0xC9, 0x03, + // Bytes 3240 - 327f + 0x59, 0xCC, 0x83, 0xC9, 0x03, 0x59, 0xCC, 0x84, + 0xC9, 0x03, 0x59, 0xCC, 0x87, 0xC9, 0x03, 0x59, + 0xCC, 0x88, 0xC9, 0x03, 0x59, 0xCC, 0x89, 0xC9, + 0x03, 0x59, 0xCC, 0xA3, 0xB5, 0x03, 0x5A, 0xCC, + 0x81, 0xC9, 0x03, 0x5A, 0xCC, 0x82, 0xC9, 0x03, + 0x5A, 0xCC, 0x87, 0xC9, 0x03, 0x5A, 0xCC, 0x8C, + 0xC9, 0x03, 0x5A, 0xCC, 0xA3, 0xB5, 0x03, 0x5A, + 0xCC, 0xB1, 0xB5, 0x03, 0x61, 0xCC, 0x80, 0xC9, + // Bytes 3280 - 32bf + 0x03, 0x61, 0xCC, 0x81, 0xC9, 0x03, 0x61, 0xCC, + 0x83, 0xC9, 0x03, 0x61, 0xCC, 0x84, 0xC9, 0x03, + 0x61, 0xCC, 0x89, 0xC9, 0x03, 0x61, 0xCC, 0x8C, + 0xC9, 0x03, 0x61, 0xCC, 0x8F, 0xC9, 0x03, 0x61, + 0xCC, 0x91, 0xC9, 0x03, 0x61, 0xCC, 0xA5, 0xB5, + 0x03, 0x61, 0xCC, 0xA8, 0xA5, 0x03, 0x62, 0xCC, + 0x87, 0xC9, 0x03, 0x62, 0xCC, 0xA3, 0xB5, 0x03, + 0x62, 0xCC, 0xB1, 0xB5, 0x03, 0x63, 0xCC, 0x81, + // Bytes 32c0 - 32ff + 0xC9, 0x03, 0x63, 0xCC, 0x82, 0xC9, 0x03, 0x63, + 0xCC, 0x87, 0xC9, 0x03, 0x63, 0xCC, 0x8C, 0xC9, + 0x03, 0x64, 0xCC, 0x87, 0xC9, 0x03, 0x64, 0xCC, + 0x8C, 0xC9, 0x03, 0x64, 0xCC, 0xA3, 0xB5, 0x03, + 0x64, 0xCC, 0xA7, 0xA5, 0x03, 0x64, 0xCC, 0xAD, + 0xB5, 0x03, 0x64, 0xCC, 0xB1, 0xB5, 0x03, 0x65, + 0xCC, 0x80, 0xC9, 0x03, 0x65, 0xCC, 0x81, 0xC9, + 0x03, 0x65, 0xCC, 0x83, 0xC9, 0x03, 0x65, 0xCC, + // Bytes 3300 - 333f + 0x86, 0xC9, 0x03, 0x65, 0xCC, 0x87, 0xC9, 0x03, + 0x65, 0xCC, 0x88, 0xC9, 0x03, 0x65, 0xCC, 0x89, + 0xC9, 0x03, 0x65, 0xCC, 0x8C, 0xC9, 0x03, 0x65, + 0xCC, 0x8F, 0xC9, 0x03, 0x65, 0xCC, 0x91, 0xC9, + 0x03, 0x65, 0xCC, 0xA8, 0xA5, 0x03, 0x65, 0xCC, + 0xAD, 0xB5, 0x03, 0x65, 0xCC, 0xB0, 0xB5, 0x03, + 0x66, 0xCC, 0x87, 0xC9, 0x03, 0x67, 0xCC, 0x81, + 0xC9, 0x03, 0x67, 0xCC, 0x82, 0xC9, 0x03, 0x67, + // Bytes 3340 - 337f + 0xCC, 0x84, 0xC9, 0x03, 0x67, 0xCC, 0x86, 0xC9, + 0x03, 0x67, 0xCC, 0x87, 0xC9, 0x03, 0x67, 0xCC, + 0x8C, 0xC9, 0x03, 0x67, 0xCC, 0xA7, 0xA5, 0x03, + 0x68, 0xCC, 0x82, 0xC9, 0x03, 0x68, 0xCC, 0x87, + 0xC9, 0x03, 0x68, 0xCC, 0x88, 0xC9, 0x03, 0x68, + 0xCC, 0x8C, 0xC9, 0x03, 0x68, 0xCC, 0xA3, 0xB5, + 0x03, 0x68, 0xCC, 0xA7, 0xA5, 0x03, 0x68, 0xCC, + 0xAE, 0xB5, 0x03, 0x68, 0xCC, 0xB1, 0xB5, 0x03, + // Bytes 3380 - 33bf + 0x69, 0xCC, 0x80, 0xC9, 0x03, 0x69, 0xCC, 0x81, + 0xC9, 0x03, 0x69, 0xCC, 0x82, 0xC9, 0x03, 0x69, + 0xCC, 0x83, 0xC9, 0x03, 0x69, 0xCC, 0x84, 0xC9, + 0x03, 0x69, 0xCC, 0x86, 0xC9, 0x03, 0x69, 0xCC, + 0x89, 0xC9, 0x03, 0x69, 0xCC, 0x8C, 0xC9, 0x03, + 0x69, 0xCC, 0x8F, 0xC9, 0x03, 0x69, 0xCC, 0x91, + 0xC9, 0x03, 0x69, 0xCC, 0xA3, 0xB5, 0x03, 0x69, + 0xCC, 0xA8, 0xA5, 0x03, 0x69, 0xCC, 0xB0, 0xB5, + // Bytes 33c0 - 33ff + 0x03, 0x6A, 0xCC, 0x82, 0xC9, 0x03, 0x6A, 0xCC, + 0x8C, 0xC9, 0x03, 0x6B, 0xCC, 0x81, 0xC9, 0x03, + 0x6B, 0xCC, 0x8C, 0xC9, 0x03, 0x6B, 0xCC, 0xA3, + 0xB5, 0x03, 0x6B, 0xCC, 0xA7, 0xA5, 0x03, 0x6B, + 0xCC, 0xB1, 0xB5, 0x03, 0x6C, 0xCC, 0x81, 0xC9, + 0x03, 0x6C, 0xCC, 0x8C, 0xC9, 0x03, 0x6C, 0xCC, + 0xA7, 0xA5, 0x03, 0x6C, 0xCC, 0xAD, 0xB5, 0x03, + 0x6C, 0xCC, 0xB1, 0xB5, 0x03, 0x6D, 0xCC, 0x81, + // Bytes 3400 - 343f + 0xC9, 0x03, 0x6D, 0xCC, 0x87, 0xC9, 0x03, 0x6D, + 0xCC, 0xA3, 0xB5, 0x03, 0x6E, 0xCC, 0x80, 0xC9, + 0x03, 0x6E, 0xCC, 0x81, 0xC9, 0x03, 0x6E, 0xCC, + 0x83, 0xC9, 0x03, 0x6E, 0xCC, 0x87, 0xC9, 0x03, + 0x6E, 0xCC, 0x8C, 0xC9, 0x03, 0x6E, 0xCC, 0xA3, + 0xB5, 0x03, 0x6E, 0xCC, 0xA7, 0xA5, 0x03, 0x6E, + 0xCC, 0xAD, 0xB5, 0x03, 0x6E, 0xCC, 0xB1, 0xB5, + 0x03, 0x6F, 0xCC, 0x80, 0xC9, 0x03, 0x6F, 0xCC, + // Bytes 3440 - 347f + 0x81, 0xC9, 0x03, 0x6F, 0xCC, 0x86, 0xC9, 0x03, + 0x6F, 0xCC, 0x89, 0xC9, 0x03, 0x6F, 0xCC, 0x8B, + 0xC9, 0x03, 0x6F, 0xCC, 0x8C, 0xC9, 0x03, 0x6F, + 0xCC, 0x8F, 0xC9, 0x03, 0x6F, 0xCC, 0x91, 0xC9, + 0x03, 0x70, 0xCC, 0x81, 0xC9, 0x03, 0x70, 0xCC, + 0x87, 0xC9, 0x03, 0x72, 0xCC, 0x81, 0xC9, 0x03, + 0x72, 0xCC, 0x87, 0xC9, 0x03, 0x72, 0xCC, 0x8C, + 0xC9, 0x03, 0x72, 0xCC, 0x8F, 0xC9, 0x03, 0x72, + // Bytes 3480 - 34bf + 0xCC, 0x91, 0xC9, 0x03, 0x72, 0xCC, 0xA7, 0xA5, + 0x03, 0x72, 0xCC, 0xB1, 0xB5, 0x03, 0x73, 0xCC, + 0x82, 0xC9, 0x03, 0x73, 0xCC, 0x87, 0xC9, 0x03, + 0x73, 0xCC, 0xA6, 0xB5, 0x03, 0x73, 0xCC, 0xA7, + 0xA5, 0x03, 0x74, 0xCC, 0x87, 0xC9, 0x03, 0x74, + 0xCC, 0x88, 0xC9, 0x03, 0x74, 0xCC, 0x8C, 0xC9, + 0x03, 0x74, 0xCC, 0xA3, 0xB5, 0x03, 0x74, 0xCC, + 0xA6, 0xB5, 0x03, 0x74, 0xCC, 0xA7, 0xA5, 0x03, + // Bytes 34c0 - 34ff + 0x74, 0xCC, 0xAD, 0xB5, 0x03, 0x74, 0xCC, 0xB1, + 0xB5, 0x03, 0x75, 0xCC, 0x80, 0xC9, 0x03, 0x75, + 0xCC, 0x81, 0xC9, 0x03, 0x75, 0xCC, 0x82, 0xC9, + 0x03, 0x75, 0xCC, 0x86, 0xC9, 0x03, 0x75, 0xCC, + 0x89, 0xC9, 0x03, 0x75, 0xCC, 0x8A, 0xC9, 0x03, + 0x75, 0xCC, 0x8B, 0xC9, 0x03, 0x75, 0xCC, 0x8C, + 0xC9, 0x03, 0x75, 0xCC, 0x8F, 0xC9, 0x03, 0x75, + 0xCC, 0x91, 0xC9, 0x03, 0x75, 0xCC, 0xA3, 0xB5, + // Bytes 3500 - 353f + 0x03, 0x75, 0xCC, 0xA4, 0xB5, 0x03, 0x75, 0xCC, + 0xA8, 0xA5, 0x03, 0x75, 0xCC, 0xAD, 0xB5, 0x03, + 0x75, 0xCC, 0xB0, 0xB5, 0x03, 0x76, 0xCC, 0x83, + 0xC9, 0x03, 0x76, 0xCC, 0xA3, 0xB5, 0x03, 0x77, + 0xCC, 0x80, 0xC9, 0x03, 0x77, 0xCC, 0x81, 0xC9, + 0x03, 0x77, 0xCC, 0x82, 0xC9, 0x03, 0x77, 0xCC, + 0x87, 0xC9, 0x03, 0x77, 0xCC, 0x88, 0xC9, 0x03, + 0x77, 0xCC, 0x8A, 0xC9, 0x03, 0x77, 0xCC, 0xA3, + // Bytes 3540 - 357f + 0xB5, 0x03, 0x78, 0xCC, 0x87, 0xC9, 0x03, 0x78, + 0xCC, 0x88, 0xC9, 0x03, 0x79, 0xCC, 0x80, 0xC9, + 0x03, 0x79, 0xCC, 0x81, 0xC9, 0x03, 0x79, 0xCC, + 0x82, 0xC9, 0x03, 0x79, 0xCC, 0x83, 0xC9, 0x03, + 0x79, 0xCC, 0x84, 0xC9, 0x03, 0x79, 0xCC, 0x87, + 0xC9, 0x03, 0x79, 0xCC, 0x88, 0xC9, 0x03, 0x79, + 0xCC, 0x89, 0xC9, 0x03, 0x79, 0xCC, 0x8A, 0xC9, + 0x03, 0x79, 0xCC, 0xA3, 0xB5, 0x03, 0x7A, 0xCC, + // Bytes 3580 - 35bf + 0x81, 0xC9, 0x03, 0x7A, 0xCC, 0x82, 0xC9, 0x03, + 0x7A, 0xCC, 0x87, 0xC9, 0x03, 0x7A, 0xCC, 0x8C, + 0xC9, 0x03, 0x7A, 0xCC, 0xA3, 0xB5, 0x03, 0x7A, + 0xCC, 0xB1, 0xB5, 0x04, 0xC2, 0xA8, 0xCC, 0x80, + 0xCA, 0x04, 0xC2, 0xA8, 0xCC, 0x81, 0xCA, 0x04, + 0xC2, 0xA8, 0xCD, 0x82, 0xCA, 0x04, 0xC3, 0x86, + 0xCC, 0x81, 0xC9, 0x04, 0xC3, 0x86, 0xCC, 0x84, + 0xC9, 0x04, 0xC3, 0x98, 0xCC, 0x81, 0xC9, 0x04, + // Bytes 35c0 - 35ff + 0xC3, 0xA6, 0xCC, 0x81, 0xC9, 0x04, 0xC3, 0xA6, + 0xCC, 0x84, 0xC9, 0x04, 0xC3, 0xB8, 0xCC, 0x81, + 0xC9, 0x04, 0xC5, 0xBF, 0xCC, 0x87, 0xC9, 0x04, + 0xC6, 0xB7, 0xCC, 0x8C, 0xC9, 0x04, 0xCA, 0x92, + 0xCC, 0x8C, 0xC9, 0x04, 0xCE, 0x91, 0xCC, 0x80, + 0xC9, 0x04, 0xCE, 0x91, 0xCC, 0x81, 0xC9, 0x04, + 0xCE, 0x91, 0xCC, 0x84, 0xC9, 0x04, 0xCE, 0x91, + 0xCC, 0x86, 0xC9, 0x04, 0xCE, 0x91, 0xCD, 0x85, + // Bytes 3600 - 363f + 0xD9, 0x04, 0xCE, 0x95, 0xCC, 0x80, 0xC9, 0x04, + 0xCE, 0x95, 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0x97, + 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0x97, 0xCC, 0x81, + 0xC9, 0x04, 0xCE, 0x97, 0xCD, 0x85, 0xD9, 0x04, + 0xCE, 0x99, 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0x99, + 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0x99, 0xCC, 0x84, + 0xC9, 0x04, 0xCE, 0x99, 0xCC, 0x86, 0xC9, 0x04, + 0xCE, 0x99, 0xCC, 0x88, 0xC9, 0x04, 0xCE, 0x9F, + // Bytes 3640 - 367f + 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0x9F, 0xCC, 0x81, + 0xC9, 0x04, 0xCE, 0xA1, 0xCC, 0x94, 0xC9, 0x04, + 0xCE, 0xA5, 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0xA5, + 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0xA5, 0xCC, 0x84, + 0xC9, 0x04, 0xCE, 0xA5, 0xCC, 0x86, 0xC9, 0x04, + 0xCE, 0xA5, 0xCC, 0x88, 0xC9, 0x04, 0xCE, 0xA9, + 0xCC, 0x80, 0xC9, 0x04, 0xCE, 0xA9, 0xCC, 0x81, + 0xC9, 0x04, 0xCE, 0xA9, 0xCD, 0x85, 0xD9, 0x04, + // Bytes 3680 - 36bf + 0xCE, 0xB1, 0xCC, 0x84, 0xC9, 0x04, 0xCE, 0xB1, + 0xCC, 0x86, 0xC9, 0x04, 0xCE, 0xB1, 0xCD, 0x85, + 0xD9, 0x04, 0xCE, 0xB5, 0xCC, 0x80, 0xC9, 0x04, + 0xCE, 0xB5, 0xCC, 0x81, 0xC9, 0x04, 0xCE, 0xB7, + 0xCD, 0x85, 0xD9, 0x04, 0xCE, 0xB9, 0xCC, 0x80, + 0xC9, 0x04, 0xCE, 0xB9, 0xCC, 0x81, 0xC9, 0x04, + 0xCE, 0xB9, 0xCC, 0x84, 0xC9, 0x04, 0xCE, 0xB9, + 0xCC, 0x86, 0xC9, 0x04, 0xCE, 0xB9, 0xCD, 0x82, + // Bytes 36c0 - 36ff + 0xC9, 0x04, 0xCE, 0xBF, 0xCC, 0x80, 0xC9, 0x04, + 0xCE, 0xBF, 0xCC, 0x81, 0xC9, 0x04, 0xCF, 0x81, + 0xCC, 0x93, 0xC9, 0x04, 0xCF, 0x81, 0xCC, 0x94, + 0xC9, 0x04, 0xCF, 0x85, 0xCC, 0x80, 0xC9, 0x04, + 0xCF, 0x85, 0xCC, 0x81, 0xC9, 0x04, 0xCF, 0x85, + 0xCC, 0x84, 0xC9, 0x04, 0xCF, 0x85, 0xCC, 0x86, + 0xC9, 0x04, 0xCF, 0x85, 0xCD, 0x82, 0xC9, 0x04, + 0xCF, 0x89, 0xCD, 0x85, 0xD9, 0x04, 0xCF, 0x92, + // Bytes 3700 - 373f + 0xCC, 0x81, 0xC9, 0x04, 0xCF, 0x92, 0xCC, 0x88, + 0xC9, 0x04, 0xD0, 0x86, 0xCC, 0x88, 0xC9, 0x04, + 0xD0, 0x90, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0x90, + 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x93, 0xCC, 0x81, + 0xC9, 0x04, 0xD0, 0x95, 0xCC, 0x80, 0xC9, 0x04, + 0xD0, 0x95, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0x95, + 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x96, 0xCC, 0x86, + 0xC9, 0x04, 0xD0, 0x96, 0xCC, 0x88, 0xC9, 0x04, + // Bytes 3740 - 377f + 0xD0, 0x97, 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x98, + 0xCC, 0x80, 0xC9, 0x04, 0xD0, 0x98, 0xCC, 0x84, + 0xC9, 0x04, 0xD0, 0x98, 0xCC, 0x86, 0xC9, 0x04, + 0xD0, 0x98, 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0x9A, + 0xCC, 0x81, 0xC9, 0x04, 0xD0, 0x9E, 0xCC, 0x88, + 0xC9, 0x04, 0xD0, 0xA3, 0xCC, 0x84, 0xC9, 0x04, + 0xD0, 0xA3, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0xA3, + 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xA3, 0xCC, 0x8B, + // Bytes 3780 - 37bf + 0xC9, 0x04, 0xD0, 0xA7, 0xCC, 0x88, 0xC9, 0x04, + 0xD0, 0xAB, 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xAD, + 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xB0, 0xCC, 0x86, + 0xC9, 0x04, 0xD0, 0xB0, 0xCC, 0x88, 0xC9, 0x04, + 0xD0, 0xB3, 0xCC, 0x81, 0xC9, 0x04, 0xD0, 0xB5, + 0xCC, 0x80, 0xC9, 0x04, 0xD0, 0xB5, 0xCC, 0x86, + 0xC9, 0x04, 0xD0, 0xB5, 0xCC, 0x88, 0xC9, 0x04, + 0xD0, 0xB6, 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0xB6, + // Bytes 37c0 - 37ff + 0xCC, 0x88, 0xC9, 0x04, 0xD0, 0xB7, 0xCC, 0x88, + 0xC9, 0x04, 0xD0, 0xB8, 0xCC, 0x80, 0xC9, 0x04, + 0xD0, 0xB8, 0xCC, 0x84, 0xC9, 0x04, 0xD0, 0xB8, + 0xCC, 0x86, 0xC9, 0x04, 0xD0, 0xB8, 0xCC, 0x88, + 0xC9, 0x04, 0xD0, 0xBA, 0xCC, 0x81, 0xC9, 0x04, + 0xD0, 0xBE, 0xCC, 0x88, 0xC9, 0x04, 0xD1, 0x83, + 0xCC, 0x84, 0xC9, 0x04, 0xD1, 0x83, 0xCC, 0x86, + 0xC9, 0x04, 0xD1, 0x83, 0xCC, 0x88, 0xC9, 0x04, + // Bytes 3800 - 383f + 0xD1, 0x83, 0xCC, 0x8B, 0xC9, 0x04, 0xD1, 0x87, + 0xCC, 0x88, 0xC9, 0x04, 0xD1, 0x8B, 0xCC, 0x88, + 0xC9, 0x04, 0xD1, 0x8D, 0xCC, 0x88, 0xC9, 0x04, + 0xD1, 0x96, 0xCC, 0x88, 0xC9, 0x04, 0xD1, 0xB4, + 0xCC, 0x8F, 0xC9, 0x04, 0xD1, 0xB5, 0xCC, 0x8F, + 0xC9, 0x04, 0xD3, 0x98, 0xCC, 0x88, 0xC9, 0x04, + 0xD3, 0x99, 0xCC, 0x88, 0xC9, 0x04, 0xD3, 0xA8, + 0xCC, 0x88, 0xC9, 0x04, 0xD3, 0xA9, 0xCC, 0x88, + // Bytes 3840 - 387f + 0xC9, 0x04, 0xD8, 0xA7, 0xD9, 0x93, 0xC9, 0x04, + 0xD8, 0xA7, 0xD9, 0x94, 0xC9, 0x04, 0xD8, 0xA7, + 0xD9, 0x95, 0xB5, 0x04, 0xD9, 0x88, 0xD9, 0x94, + 0xC9, 0x04, 0xD9, 0x8A, 0xD9, 0x94, 0xC9, 0x04, + 0xDB, 0x81, 0xD9, 0x94, 0xC9, 0x04, 0xDB, 0x92, + 0xD9, 0x94, 0xC9, 0x04, 0xDB, 0x95, 0xD9, 0x94, + 0xC9, 0x05, 0x41, 0xCC, 0x82, 0xCC, 0x80, 0xCA, + 0x05, 0x41, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, + // Bytes 3880 - 38bf + 0x41, 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x41, + 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x41, 0xCC, + 0x86, 0xCC, 0x80, 0xCA, 0x05, 0x41, 0xCC, 0x86, + 0xCC, 0x81, 0xCA, 0x05, 0x41, 0xCC, 0x86, 0xCC, + 0x83, 0xCA, 0x05, 0x41, 0xCC, 0x86, 0xCC, 0x89, + 0xCA, 0x05, 0x41, 0xCC, 0x87, 0xCC, 0x84, 0xCA, + 0x05, 0x41, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, + 0x41, 0xCC, 0x8A, 0xCC, 0x81, 0xCA, 0x05, 0x41, + // Bytes 38c0 - 38ff + 0xCC, 0xA3, 0xCC, 0x82, 0xCA, 0x05, 0x41, 0xCC, + 0xA3, 0xCC, 0x86, 0xCA, 0x05, 0x43, 0xCC, 0xA7, + 0xCC, 0x81, 0xCA, 0x05, 0x45, 0xCC, 0x82, 0xCC, + 0x80, 0xCA, 0x05, 0x45, 0xCC, 0x82, 0xCC, 0x81, + 0xCA, 0x05, 0x45, 0xCC, 0x82, 0xCC, 0x83, 0xCA, + 0x05, 0x45, 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, + 0x45, 0xCC, 0x84, 0xCC, 0x80, 0xCA, 0x05, 0x45, + 0xCC, 0x84, 0xCC, 0x81, 0xCA, 0x05, 0x45, 0xCC, + // Bytes 3900 - 393f + 0xA3, 0xCC, 0x82, 0xCA, 0x05, 0x45, 0xCC, 0xA7, + 0xCC, 0x86, 0xCA, 0x05, 0x49, 0xCC, 0x88, 0xCC, + 0x81, 0xCA, 0x05, 0x4C, 0xCC, 0xA3, 0xCC, 0x84, + 0xCA, 0x05, 0x4F, 0xCC, 0x82, 0xCC, 0x80, 0xCA, + 0x05, 0x4F, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, + 0x4F, 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x4F, + 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x4F, 0xCC, + 0x83, 0xCC, 0x81, 0xCA, 0x05, 0x4F, 0xCC, 0x83, + // Bytes 3940 - 397f + 0xCC, 0x84, 0xCA, 0x05, 0x4F, 0xCC, 0x83, 0xCC, + 0x88, 0xCA, 0x05, 0x4F, 0xCC, 0x84, 0xCC, 0x80, + 0xCA, 0x05, 0x4F, 0xCC, 0x84, 0xCC, 0x81, 0xCA, + 0x05, 0x4F, 0xCC, 0x87, 0xCC, 0x84, 0xCA, 0x05, + 0x4F, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x4F, + 0xCC, 0x9B, 0xCC, 0x80, 0xCA, 0x05, 0x4F, 0xCC, + 0x9B, 0xCC, 0x81, 0xCA, 0x05, 0x4F, 0xCC, 0x9B, + 0xCC, 0x83, 0xCA, 0x05, 0x4F, 0xCC, 0x9B, 0xCC, + // Bytes 3980 - 39bf + 0x89, 0xCA, 0x05, 0x4F, 0xCC, 0x9B, 0xCC, 0xA3, + 0xB6, 0x05, 0x4F, 0xCC, 0xA3, 0xCC, 0x82, 0xCA, + 0x05, 0x4F, 0xCC, 0xA8, 0xCC, 0x84, 0xCA, 0x05, + 0x52, 0xCC, 0xA3, 0xCC, 0x84, 0xCA, 0x05, 0x53, + 0xCC, 0x81, 0xCC, 0x87, 0xCA, 0x05, 0x53, 0xCC, + 0x8C, 0xCC, 0x87, 0xCA, 0x05, 0x53, 0xCC, 0xA3, + 0xCC, 0x87, 0xCA, 0x05, 0x55, 0xCC, 0x83, 0xCC, + 0x81, 0xCA, 0x05, 0x55, 0xCC, 0x84, 0xCC, 0x88, + // Bytes 39c0 - 39ff + 0xCA, 0x05, 0x55, 0xCC, 0x88, 0xCC, 0x80, 0xCA, + 0x05, 0x55, 0xCC, 0x88, 0xCC, 0x81, 0xCA, 0x05, + 0x55, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x55, + 0xCC, 0x88, 0xCC, 0x8C, 0xCA, 0x05, 0x55, 0xCC, + 0x9B, 0xCC, 0x80, 0xCA, 0x05, 0x55, 0xCC, 0x9B, + 0xCC, 0x81, 0xCA, 0x05, 0x55, 0xCC, 0x9B, 0xCC, + 0x83, 0xCA, 0x05, 0x55, 0xCC, 0x9B, 0xCC, 0x89, + 0xCA, 0x05, 0x55, 0xCC, 0x9B, 0xCC, 0xA3, 0xB6, + // Bytes 3a00 - 3a3f + 0x05, 0x61, 0xCC, 0x82, 0xCC, 0x80, 0xCA, 0x05, + 0x61, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, 0x61, + 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x61, 0xCC, + 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x61, 0xCC, 0x86, + 0xCC, 0x80, 0xCA, 0x05, 0x61, 0xCC, 0x86, 0xCC, + 0x81, 0xCA, 0x05, 0x61, 0xCC, 0x86, 0xCC, 0x83, + 0xCA, 0x05, 0x61, 0xCC, 0x86, 0xCC, 0x89, 0xCA, + 0x05, 0x61, 0xCC, 0x87, 0xCC, 0x84, 0xCA, 0x05, + // Bytes 3a40 - 3a7f + 0x61, 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x61, + 0xCC, 0x8A, 0xCC, 0x81, 0xCA, 0x05, 0x61, 0xCC, + 0xA3, 0xCC, 0x82, 0xCA, 0x05, 0x61, 0xCC, 0xA3, + 0xCC, 0x86, 0xCA, 0x05, 0x63, 0xCC, 0xA7, 0xCC, + 0x81, 0xCA, 0x05, 0x65, 0xCC, 0x82, 0xCC, 0x80, + 0xCA, 0x05, 0x65, 0xCC, 0x82, 0xCC, 0x81, 0xCA, + 0x05, 0x65, 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, + 0x65, 0xCC, 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x65, + // Bytes 3a80 - 3abf + 0xCC, 0x84, 0xCC, 0x80, 0xCA, 0x05, 0x65, 0xCC, + 0x84, 0xCC, 0x81, 0xCA, 0x05, 0x65, 0xCC, 0xA3, + 0xCC, 0x82, 0xCA, 0x05, 0x65, 0xCC, 0xA7, 0xCC, + 0x86, 0xCA, 0x05, 0x69, 0xCC, 0x88, 0xCC, 0x81, + 0xCA, 0x05, 0x6C, 0xCC, 0xA3, 0xCC, 0x84, 0xCA, + 0x05, 0x6F, 0xCC, 0x82, 0xCC, 0x80, 0xCA, 0x05, + 0x6F, 0xCC, 0x82, 0xCC, 0x81, 0xCA, 0x05, 0x6F, + 0xCC, 0x82, 0xCC, 0x83, 0xCA, 0x05, 0x6F, 0xCC, + // Bytes 3ac0 - 3aff + 0x82, 0xCC, 0x89, 0xCA, 0x05, 0x6F, 0xCC, 0x83, + 0xCC, 0x81, 0xCA, 0x05, 0x6F, 0xCC, 0x83, 0xCC, + 0x84, 0xCA, 0x05, 0x6F, 0xCC, 0x83, 0xCC, 0x88, + 0xCA, 0x05, 0x6F, 0xCC, 0x84, 0xCC, 0x80, 0xCA, + 0x05, 0x6F, 0xCC, 0x84, 0xCC, 0x81, 0xCA, 0x05, + 0x6F, 0xCC, 0x87, 0xCC, 0x84, 0xCA, 0x05, 0x6F, + 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x6F, 0xCC, + 0x9B, 0xCC, 0x80, 0xCA, 0x05, 0x6F, 0xCC, 0x9B, + // Bytes 3b00 - 3b3f + 0xCC, 0x81, 0xCA, 0x05, 0x6F, 0xCC, 0x9B, 0xCC, + 0x83, 0xCA, 0x05, 0x6F, 0xCC, 0x9B, 0xCC, 0x89, + 0xCA, 0x05, 0x6F, 0xCC, 0x9B, 0xCC, 0xA3, 0xB6, + 0x05, 0x6F, 0xCC, 0xA3, 0xCC, 0x82, 0xCA, 0x05, + 0x6F, 0xCC, 0xA8, 0xCC, 0x84, 0xCA, 0x05, 0x72, + 0xCC, 0xA3, 0xCC, 0x84, 0xCA, 0x05, 0x73, 0xCC, + 0x81, 0xCC, 0x87, 0xCA, 0x05, 0x73, 0xCC, 0x8C, + 0xCC, 0x87, 0xCA, 0x05, 0x73, 0xCC, 0xA3, 0xCC, + // Bytes 3b40 - 3b7f + 0x87, 0xCA, 0x05, 0x75, 0xCC, 0x83, 0xCC, 0x81, + 0xCA, 0x05, 0x75, 0xCC, 0x84, 0xCC, 0x88, 0xCA, + 0x05, 0x75, 0xCC, 0x88, 0xCC, 0x80, 0xCA, 0x05, + 0x75, 0xCC, 0x88, 0xCC, 0x81, 0xCA, 0x05, 0x75, + 0xCC, 0x88, 0xCC, 0x84, 0xCA, 0x05, 0x75, 0xCC, + 0x88, 0xCC, 0x8C, 0xCA, 0x05, 0x75, 0xCC, 0x9B, + 0xCC, 0x80, 0xCA, 0x05, 0x75, 0xCC, 0x9B, 0xCC, + 0x81, 0xCA, 0x05, 0x75, 0xCC, 0x9B, 0xCC, 0x83, + // Bytes 3b80 - 3bbf + 0xCA, 0x05, 0x75, 0xCC, 0x9B, 0xCC, 0x89, 0xCA, + 0x05, 0x75, 0xCC, 0x9B, 0xCC, 0xA3, 0xB6, 0x05, + 0xE1, 0xBE, 0xBF, 0xCC, 0x80, 0xCA, 0x05, 0xE1, + 0xBE, 0xBF, 0xCC, 0x81, 0xCA, 0x05, 0xE1, 0xBE, + 0xBF, 0xCD, 0x82, 0xCA, 0x05, 0xE1, 0xBF, 0xBE, + 0xCC, 0x80, 0xCA, 0x05, 0xE1, 0xBF, 0xBE, 0xCC, + 0x81, 0xCA, 0x05, 0xE1, 0xBF, 0xBE, 0xCD, 0x82, + 0xCA, 0x05, 0xE2, 0x86, 0x90, 0xCC, 0xB8, 0x05, + // Bytes 3bc0 - 3bff + 0x05, 0xE2, 0x86, 0x92, 0xCC, 0xB8, 0x05, 0x05, + 0xE2, 0x86, 0x94, 0xCC, 0xB8, 0x05, 0x05, 0xE2, + 0x87, 0x90, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x87, + 0x92, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x87, 0x94, + 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x88, 0x83, 0xCC, + 0xB8, 0x05, 0x05, 0xE2, 0x88, 0x88, 0xCC, 0xB8, + 0x05, 0x05, 0xE2, 0x88, 0x8B, 0xCC, 0xB8, 0x05, + 0x05, 0xE2, 0x88, 0xA3, 0xCC, 0xB8, 0x05, 0x05, + // Bytes 3c00 - 3c3f + 0xE2, 0x88, 0xA5, 0xCC, 0xB8, 0x05, 0x05, 0xE2, + 0x88, 0xBC, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, + 0x83, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0x85, + 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0x88, 0xCC, + 0xB8, 0x05, 0x05, 0xE2, 0x89, 0x8D, 0xCC, 0xB8, + 0x05, 0x05, 0xE2, 0x89, 0xA1, 0xCC, 0xB8, 0x05, + 0x05, 0xE2, 0x89, 0xA4, 0xCC, 0xB8, 0x05, 0x05, + 0xE2, 0x89, 0xA5, 0xCC, 0xB8, 0x05, 0x05, 0xE2, + // Bytes 3c40 - 3c7f + 0x89, 0xB2, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, + 0xB3, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0xB6, + 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x89, 0xB7, 0xCC, + 0xB8, 0x05, 0x05, 0xE2, 0x89, 0xBA, 0xCC, 0xB8, + 0x05, 0x05, 0xE2, 0x89, 0xBB, 0xCC, 0xB8, 0x05, + 0x05, 0xE2, 0x89, 0xBC, 0xCC, 0xB8, 0x05, 0x05, + 0xE2, 0x89, 0xBD, 0xCC, 0xB8, 0x05, 0x05, 0xE2, + 0x8A, 0x82, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, + // Bytes 3c80 - 3cbf + 0x83, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0x86, + 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0x87, 0xCC, + 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0x91, 0xCC, 0xB8, + 0x05, 0x05, 0xE2, 0x8A, 0x92, 0xCC, 0xB8, 0x05, + 0x05, 0xE2, 0x8A, 0xA2, 0xCC, 0xB8, 0x05, 0x05, + 0xE2, 0x8A, 0xA8, 0xCC, 0xB8, 0x05, 0x05, 0xE2, + 0x8A, 0xA9, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, + 0xAB, 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0xB2, + // Bytes 3cc0 - 3cff + 0xCC, 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0xB3, 0xCC, + 0xB8, 0x05, 0x05, 0xE2, 0x8A, 0xB4, 0xCC, 0xB8, + 0x05, 0x05, 0xE2, 0x8A, 0xB5, 0xCC, 0xB8, 0x05, + 0x06, 0xCE, 0x91, 0xCC, 0x93, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0x91, 0xCC, 0x94, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0x95, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0x95, 0xCC, 0x93, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0x95, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + // Bytes 3d00 - 3d3f + 0x06, 0xCE, 0x95, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0x97, 0xCC, 0x93, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0x97, 0xCC, 0x94, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0x99, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0x99, 0xCC, 0x93, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0x99, 0xCC, 0x93, 0xCD, 0x82, 0xCA, + 0x06, 0xCE, 0x99, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0x99, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + // Bytes 3d40 - 3d7f + 0x06, 0xCE, 0x99, 0xCC, 0x94, 0xCD, 0x82, 0xCA, + 0x06, 0xCE, 0x9F, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0x9F, 0xCC, 0x93, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0x9F, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0x9F, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0xA5, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0xA5, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0xA5, 0xCC, 0x94, 0xCD, 0x82, 0xCA, + // Bytes 3d80 - 3dbf + 0x06, 0xCE, 0xA9, 0xCC, 0x93, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xA9, 0xCC, 0x94, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB1, 0xCC, 0x80, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB1, 0xCC, 0x81, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB1, 0xCC, 0x93, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB1, 0xCC, 0x94, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB1, 0xCD, 0x82, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB5, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + // Bytes 3dc0 - 3dff + 0x06, 0xCE, 0xB5, 0xCC, 0x93, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0xB5, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0xB5, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0xB7, 0xCC, 0x80, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB7, 0xCC, 0x81, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB7, 0xCC, 0x93, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB7, 0xCC, 0x94, 0xCD, 0x85, 0xDA, + 0x06, 0xCE, 0xB7, 0xCD, 0x82, 0xCD, 0x85, 0xDA, + // Bytes 3e00 - 3e3f + 0x06, 0xCE, 0xB9, 0xCC, 0x88, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0xB9, 0xCC, 0x88, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0xB9, 0xCC, 0x88, 0xCD, 0x82, 0xCA, + 0x06, 0xCE, 0xB9, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0xB9, 0xCC, 0x93, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0xB9, 0xCC, 0x93, 0xCD, 0x82, 0xCA, + 0x06, 0xCE, 0xB9, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0xB9, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + // Bytes 3e40 - 3e7f + 0x06, 0xCE, 0xB9, 0xCC, 0x94, 0xCD, 0x82, 0xCA, + 0x06, 0xCE, 0xBF, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0xBF, 0xCC, 0x93, 0xCC, 0x81, 0xCA, + 0x06, 0xCE, 0xBF, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + 0x06, 0xCE, 0xBF, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x88, 0xCC, 0x80, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x88, 0xCC, 0x81, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x88, 0xCD, 0x82, 0xCA, + // Bytes 3e80 - 3ebf + 0x06, 0xCF, 0x85, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x93, 0xCC, 0x81, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x93, 0xCD, 0x82, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x94, 0xCC, 0x80, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x94, 0xCC, 0x81, 0xCA, + 0x06, 0xCF, 0x85, 0xCC, 0x94, 0xCD, 0x82, 0xCA, + 0x06, 0xCF, 0x89, 0xCC, 0x80, 0xCD, 0x85, 0xDA, + 0x06, 0xCF, 0x89, 0xCC, 0x81, 0xCD, 0x85, 0xDA, + // Bytes 3ec0 - 3eff + 0x06, 0xCF, 0x89, 0xCC, 0x93, 0xCD, 0x85, 0xDA, + 0x06, 0xCF, 0x89, 0xCC, 0x94, 0xCD, 0x85, 0xDA, + 0x06, 0xCF, 0x89, 0xCD, 0x82, 0xCD, 0x85, 0xDA, + 0x06, 0xE0, 0xA4, 0xA8, 0xE0, 0xA4, 0xBC, 0x09, + 0x06, 0xE0, 0xA4, 0xB0, 0xE0, 0xA4, 0xBC, 0x09, + 0x06, 0xE0, 0xA4, 0xB3, 0xE0, 0xA4, 0xBC, 0x09, + 0x06, 0xE0, 0xB1, 0x86, 0xE0, 0xB1, 0x96, 0x85, + 0x06, 0xE0, 0xB7, 0x99, 0xE0, 0xB7, 0x8A, 0x11, + // Bytes 3f00 - 3f3f + 0x06, 0xE3, 0x81, 0x86, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x8B, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x8D, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x8F, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x91, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x93, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x95, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x97, 0xE3, 0x82, 0x99, 0x0D, + // Bytes 3f40 - 3f7f + 0x06, 0xE3, 0x81, 0x99, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x9B, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x9D, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0x9F, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xA1, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xA4, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xA6, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xA8, 0xE3, 0x82, 0x99, 0x0D, + // Bytes 3f80 - 3fbf + 0x06, 0xE3, 0x81, 0xAF, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xAF, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x81, 0xB2, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xB2, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x81, 0xB5, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xB5, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x81, 0xB8, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xB8, 0xE3, 0x82, 0x9A, 0x0D, + // Bytes 3fc0 - 3fff + 0x06, 0xE3, 0x81, 0xBB, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x81, 0xBB, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x82, 0x9D, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xA6, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xAB, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xAD, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xAF, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xB1, 0xE3, 0x82, 0x99, 0x0D, + // Bytes 4000 - 403f + 0x06, 0xE3, 0x82, 0xB3, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xB5, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xB7, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xB9, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xBB, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xBD, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x82, 0xBF, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x81, 0xE3, 0x82, 0x99, 0x0D, + // Bytes 4040 - 407f + 0x06, 0xE3, 0x83, 0x84, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x86, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x88, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x8F, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x8F, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x92, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x83, 0x95, 0xE3, 0x82, 0x99, 0x0D, + // Bytes 4080 - 40bf + 0x06, 0xE3, 0x83, 0x95, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x83, 0x98, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x98, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x83, 0x9B, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0x9B, 0xE3, 0x82, 0x9A, 0x0D, + 0x06, 0xE3, 0x83, 0xAF, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0xB0, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0xB1, 0xE3, 0x82, 0x99, 0x0D, + // Bytes 40c0 - 40ff + 0x06, 0xE3, 0x83, 0xB2, 0xE3, 0x82, 0x99, 0x0D, + 0x06, 0xE3, 0x83, 0xBD, 0xE3, 0x82, 0x99, 0x0D, + 0x08, 0xCE, 0x91, 0xCC, 0x93, 0xCC, 0x80, 0xCD, + 0x85, 0xDB, 0x08, 0xCE, 0x91, 0xCC, 0x93, 0xCC, + 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0x91, 0xCC, + 0x93, 0xCD, 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, + 0x91, 0xCC, 0x94, 0xCC, 0x80, 0xCD, 0x85, 0xDB, + 0x08, 0xCE, 0x91, 0xCC, 0x94, 0xCC, 0x81, 0xCD, + // Bytes 4100 - 413f + 0x85, 0xDB, 0x08, 0xCE, 0x91, 0xCC, 0x94, 0xCD, + 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0x97, 0xCC, + 0x93, 0xCC, 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, + 0x97, 0xCC, 0x93, 0xCC, 0x81, 0xCD, 0x85, 0xDB, + 0x08, 0xCE, 0x97, 0xCC, 0x93, 0xCD, 0x82, 0xCD, + 0x85, 0xDB, 0x08, 0xCE, 0x97, 0xCC, 0x94, 0xCC, + 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0x97, 0xCC, + 0x94, 0xCC, 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, + // Bytes 4140 - 417f + 0x97, 0xCC, 0x94, 0xCD, 0x82, 0xCD, 0x85, 0xDB, + 0x08, 0xCE, 0xA9, 0xCC, 0x93, 0xCC, 0x80, 0xCD, + 0x85, 0xDB, 0x08, 0xCE, 0xA9, 0xCC, 0x93, 0xCC, + 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xA9, 0xCC, + 0x93, 0xCD, 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, + 0xA9, 0xCC, 0x94, 0xCC, 0x80, 0xCD, 0x85, 0xDB, + 0x08, 0xCE, 0xA9, 0xCC, 0x94, 0xCC, 0x81, 0xCD, + 0x85, 0xDB, 0x08, 0xCE, 0xA9, 0xCC, 0x94, 0xCD, + // Bytes 4180 - 41bf + 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xB1, 0xCC, + 0x93, 0xCC, 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, + 0xB1, 0xCC, 0x93, 0xCC, 0x81, 0xCD, 0x85, 0xDB, + 0x08, 0xCE, 0xB1, 0xCC, 0x93, 0xCD, 0x82, 0xCD, + 0x85, 0xDB, 0x08, 0xCE, 0xB1, 0xCC, 0x94, 0xCC, + 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xB1, 0xCC, + 0x94, 0xCC, 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, + 0xB1, 0xCC, 0x94, 0xCD, 0x82, 0xCD, 0x85, 0xDB, + // Bytes 41c0 - 41ff + 0x08, 0xCE, 0xB7, 0xCC, 0x93, 0xCC, 0x80, 0xCD, + 0x85, 0xDB, 0x08, 0xCE, 0xB7, 0xCC, 0x93, 0xCC, + 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCE, 0xB7, 0xCC, + 0x93, 0xCD, 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCE, + 0xB7, 0xCC, 0x94, 0xCC, 0x80, 0xCD, 0x85, 0xDB, + 0x08, 0xCE, 0xB7, 0xCC, 0x94, 0xCC, 0x81, 0xCD, + 0x85, 0xDB, 0x08, 0xCE, 0xB7, 0xCC, 0x94, 0xCD, + 0x82, 0xCD, 0x85, 0xDB, 0x08, 0xCF, 0x89, 0xCC, + // Bytes 4200 - 423f + 0x93, 0xCC, 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCF, + 0x89, 0xCC, 0x93, 0xCC, 0x81, 0xCD, 0x85, 0xDB, + 0x08, 0xCF, 0x89, 0xCC, 0x93, 0xCD, 0x82, 0xCD, + 0x85, 0xDB, 0x08, 0xCF, 0x89, 0xCC, 0x94, 0xCC, + 0x80, 0xCD, 0x85, 0xDB, 0x08, 0xCF, 0x89, 0xCC, + 0x94, 0xCC, 0x81, 0xCD, 0x85, 0xDB, 0x08, 0xCF, + 0x89, 0xCC, 0x94, 0xCD, 0x82, 0xCD, 0x85, 0xDB, + 0x08, 0xF0, 0x91, 0x82, 0x99, 0xF0, 0x91, 0x82, + // Bytes 4240 - 427f + 0xBA, 0x09, 0x08, 0xF0, 0x91, 0x82, 0x9B, 0xF0, + 0x91, 0x82, 0xBA, 0x09, 0x08, 0xF0, 0x91, 0x82, + 0xA5, 0xF0, 0x91, 0x82, 0xBA, 0x09, 0x42, 0xC2, + 0xB4, 0x01, 0x43, 0x20, 0xCC, 0x81, 0xC9, 0x43, + 0x20, 0xCC, 0x83, 0xC9, 0x43, 0x20, 0xCC, 0x84, + 0xC9, 0x43, 0x20, 0xCC, 0x85, 0xC9, 0x43, 0x20, + 0xCC, 0x86, 0xC9, 0x43, 0x20, 0xCC, 0x87, 0xC9, + 0x43, 0x20, 0xCC, 0x88, 0xC9, 0x43, 0x20, 0xCC, + // Bytes 4280 - 42bf + 0x8A, 0xC9, 0x43, 0x20, 0xCC, 0x8B, 0xC9, 0x43, + 0x20, 0xCC, 0x93, 0xC9, 0x43, 0x20, 0xCC, 0x94, + 0xC9, 0x43, 0x20, 0xCC, 0xA7, 0xA5, 0x43, 0x20, + 0xCC, 0xA8, 0xA5, 0x43, 0x20, 0xCC, 0xB3, 0xB5, + 0x43, 0x20, 0xCD, 0x82, 0xC9, 0x43, 0x20, 0xCD, + 0x85, 0xD9, 0x43, 0x20, 0xD9, 0x8B, 0x59, 0x43, + 0x20, 0xD9, 0x8C, 0x5D, 0x43, 0x20, 0xD9, 0x8D, + 0x61, 0x43, 0x20, 0xD9, 0x8E, 0x65, 0x43, 0x20, + // Bytes 42c0 - 42ff + 0xD9, 0x8F, 0x69, 0x43, 0x20, 0xD9, 0x90, 0x6D, + 0x43, 0x20, 0xD9, 0x91, 0x71, 0x43, 0x20, 0xD9, + 0x92, 0x75, 0x43, 0x41, 0xCC, 0x8A, 0xC9, 0x43, + 0x73, 0xCC, 0x87, 0xC9, 0x44, 0x20, 0xE3, 0x82, + 0x99, 0x0D, 0x44, 0x20, 0xE3, 0x82, 0x9A, 0x0D, + 0x44, 0xC2, 0xA8, 0xCC, 0x81, 0xCA, 0x44, 0xCE, + 0x91, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0x95, 0xCC, + 0x81, 0xC9, 0x44, 0xCE, 0x97, 0xCC, 0x81, 0xC9, + // Bytes 4300 - 433f + 0x44, 0xCE, 0x99, 0xCC, 0x81, 0xC9, 0x44, 0xCE, + 0x9F, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0xA5, 0xCC, + 0x81, 0xC9, 0x44, 0xCE, 0xA5, 0xCC, 0x88, 0xC9, + 0x44, 0xCE, 0xA9, 0xCC, 0x81, 0xC9, 0x44, 0xCE, + 0xB1, 0xCC, 0x81, 0xC9, 0x44, 0xCE, 0xB5, 0xCC, + 0x81, 0xC9, 0x44, 0xCE, 0xB7, 0xCC, 0x81, 0xC9, + 0x44, 0xCE, 0xB9, 0xCC, 0x81, 0xC9, 0x44, 0xCE, + 0xBF, 0xCC, 0x81, 0xC9, 0x44, 0xCF, 0x85, 0xCC, + // Bytes 4340 - 437f + 0x81, 0xC9, 0x44, 0xCF, 0x89, 0xCC, 0x81, 0xC9, + 0x44, 0xD7, 0x90, 0xD6, 0xB7, 0x31, 0x44, 0xD7, + 0x90, 0xD6, 0xB8, 0x35, 0x44, 0xD7, 0x90, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0x91, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0x91, 0xD6, 0xBF, 0x49, 0x44, 0xD7, + 0x92, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x93, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0x94, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0x95, 0xD6, 0xB9, 0x39, 0x44, 0xD7, + // Bytes 4380 - 43bf + 0x95, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x96, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0x98, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0x99, 0xD6, 0xB4, 0x25, 0x44, 0xD7, + 0x99, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x9A, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0x9B, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0x9B, 0xD6, 0xBF, 0x49, 0x44, 0xD7, + 0x9C, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0x9E, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0xA0, 0xD6, 0xBC, 0x41, + // Bytes 43c0 - 43ff + 0x44, 0xD7, 0xA1, 0xD6, 0xBC, 0x41, 0x44, 0xD7, + 0xA3, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0xA4, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0xA4, 0xD6, 0xBF, 0x49, + 0x44, 0xD7, 0xA6, 0xD6, 0xBC, 0x41, 0x44, 0xD7, + 0xA7, 0xD6, 0xBC, 0x41, 0x44, 0xD7, 0xA8, 0xD6, + 0xBC, 0x41, 0x44, 0xD7, 0xA9, 0xD6, 0xBC, 0x41, + 0x44, 0xD7, 0xA9, 0xD7, 0x81, 0x4D, 0x44, 0xD7, + 0xA9, 0xD7, 0x82, 0x51, 0x44, 0xD7, 0xAA, 0xD6, + // Bytes 4400 - 443f + 0xBC, 0x41, 0x44, 0xD7, 0xB2, 0xD6, 0xB7, 0x31, + 0x44, 0xD8, 0xA7, 0xD9, 0x8B, 0x59, 0x44, 0xD8, + 0xA7, 0xD9, 0x93, 0xC9, 0x44, 0xD8, 0xA7, 0xD9, + 0x94, 0xC9, 0x44, 0xD8, 0xA7, 0xD9, 0x95, 0xB5, + 0x44, 0xD8, 0xB0, 0xD9, 0xB0, 0x79, 0x44, 0xD8, + 0xB1, 0xD9, 0xB0, 0x79, 0x44, 0xD9, 0x80, 0xD9, + 0x8B, 0x59, 0x44, 0xD9, 0x80, 0xD9, 0x8E, 0x65, + 0x44, 0xD9, 0x80, 0xD9, 0x8F, 0x69, 0x44, 0xD9, + // Bytes 4440 - 447f + 0x80, 0xD9, 0x90, 0x6D, 0x44, 0xD9, 0x80, 0xD9, + 0x91, 0x71, 0x44, 0xD9, 0x80, 0xD9, 0x92, 0x75, + 0x44, 0xD9, 0x87, 0xD9, 0xB0, 0x79, 0x44, 0xD9, + 0x88, 0xD9, 0x94, 0xC9, 0x44, 0xD9, 0x89, 0xD9, + 0xB0, 0x79, 0x44, 0xD9, 0x8A, 0xD9, 0x94, 0xC9, + 0x44, 0xDB, 0x92, 0xD9, 0x94, 0xC9, 0x44, 0xDB, + 0x95, 0xD9, 0x94, 0xC9, 0x45, 0x20, 0xCC, 0x88, + 0xCC, 0x80, 0xCA, 0x45, 0x20, 0xCC, 0x88, 0xCC, + // Bytes 4480 - 44bf + 0x81, 0xCA, 0x45, 0x20, 0xCC, 0x88, 0xCD, 0x82, + 0xCA, 0x45, 0x20, 0xCC, 0x93, 0xCC, 0x80, 0xCA, + 0x45, 0x20, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x45, + 0x20, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x45, 0x20, + 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x45, 0x20, 0xCC, + 0x94, 0xCC, 0x81, 0xCA, 0x45, 0x20, 0xCC, 0x94, + 0xCD, 0x82, 0xCA, 0x45, 0x20, 0xD9, 0x8C, 0xD9, + 0x91, 0x72, 0x45, 0x20, 0xD9, 0x8D, 0xD9, 0x91, + // Bytes 44c0 - 44ff + 0x72, 0x45, 0x20, 0xD9, 0x8E, 0xD9, 0x91, 0x72, + 0x45, 0x20, 0xD9, 0x8F, 0xD9, 0x91, 0x72, 0x45, + 0x20, 0xD9, 0x90, 0xD9, 0x91, 0x72, 0x45, 0x20, + 0xD9, 0x91, 0xD9, 0xB0, 0x7A, 0x45, 0xE2, 0xAB, + 0x9D, 0xCC, 0xB8, 0x05, 0x46, 0xCE, 0xB9, 0xCC, + 0x88, 0xCC, 0x81, 0xCA, 0x46, 0xCF, 0x85, 0xCC, + 0x88, 0xCC, 0x81, 0xCA, 0x46, 0xD7, 0xA9, 0xD6, + 0xBC, 0xD7, 0x81, 0x4E, 0x46, 0xD7, 0xA9, 0xD6, + // Bytes 4500 - 453f + 0xBC, 0xD7, 0x82, 0x52, 0x46, 0xD9, 0x80, 0xD9, + 0x8E, 0xD9, 0x91, 0x72, 0x46, 0xD9, 0x80, 0xD9, + 0x8F, 0xD9, 0x91, 0x72, 0x46, 0xD9, 0x80, 0xD9, + 0x90, 0xD9, 0x91, 0x72, 0x46, 0xE0, 0xA4, 0x95, + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x96, + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x97, + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0x9C, + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xA1, + // Bytes 4540 - 457f + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xA2, + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xAB, + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA4, 0xAF, + 0xE0, 0xA4, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xA1, + 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xA2, + 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA6, 0xAF, + 0xE0, 0xA6, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x96, + 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x97, + // Bytes 4580 - 45bf + 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0x9C, + 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0xAB, + 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0xB2, + 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xA8, 0xB8, + 0xE0, 0xA8, 0xBC, 0x09, 0x46, 0xE0, 0xAC, 0xA1, + 0xE0, 0xAC, 0xBC, 0x09, 0x46, 0xE0, 0xAC, 0xA2, + 0xE0, 0xAC, 0xBC, 0x09, 0x46, 0xE0, 0xBE, 0xB2, + 0xE0, 0xBE, 0x80, 0x9D, 0x46, 0xE0, 0xBE, 0xB3, + // Bytes 45c0 - 45ff + 0xE0, 0xBE, 0x80, 0x9D, 0x46, 0xE3, 0x83, 0x86, + 0xE3, 0x82, 0x99, 0x0D, 0x48, 0xF0, 0x9D, 0x85, + 0x97, 0xF0, 0x9D, 0x85, 0xA5, 0xAD, 0x48, 0xF0, + 0x9D, 0x85, 0x98, 0xF0, 0x9D, 0x85, 0xA5, 0xAD, + 0x48, 0xF0, 0x9D, 0x86, 0xB9, 0xF0, 0x9D, 0x85, + 0xA5, 0xAD, 0x48, 0xF0, 0x9D, 0x86, 0xBA, 0xF0, + 0x9D, 0x85, 0xA5, 0xAD, 0x49, 0xE0, 0xBE, 0xB2, + 0xE0, 0xBD, 0xB1, 0xE0, 0xBE, 0x80, 0x9E, 0x49, + // Bytes 4600 - 463f + 0xE0, 0xBE, 0xB3, 0xE0, 0xBD, 0xB1, 0xE0, 0xBE, + 0x80, 0x9E, 0x4C, 0xF0, 0x9D, 0x85, 0x98, 0xF0, + 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, 0xAE, 0xAE, + 0x4C, 0xF0, 0x9D, 0x85, 0x98, 0xF0, 0x9D, 0x85, + 0xA5, 0xF0, 0x9D, 0x85, 0xAF, 0xAE, 0x4C, 0xF0, + 0x9D, 0x85, 0x98, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, + 0x9D, 0x85, 0xB0, 0xAE, 0x4C, 0xF0, 0x9D, 0x85, + 0x98, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, + // Bytes 4640 - 467f + 0xB1, 0xAE, 0x4C, 0xF0, 0x9D, 0x85, 0x98, 0xF0, + 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, 0xB2, 0xAE, + 0x4C, 0xF0, 0x9D, 0x86, 0xB9, 0xF0, 0x9D, 0x85, + 0xA5, 0xF0, 0x9D, 0x85, 0xAE, 0xAE, 0x4C, 0xF0, + 0x9D, 0x86, 0xB9, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, + 0x9D, 0x85, 0xAF, 0xAE, 0x4C, 0xF0, 0x9D, 0x86, + 0xBA, 0xF0, 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, + 0xAE, 0xAE, 0x4C, 0xF0, 0x9D, 0x86, 0xBA, 0xF0, + // Bytes 4680 - 46bf + 0x9D, 0x85, 0xA5, 0xF0, 0x9D, 0x85, 0xAF, 0xAE, + 0x83, 0x41, 0xCC, 0x82, 0xC9, 0x83, 0x41, 0xCC, + 0x86, 0xC9, 0x83, 0x41, 0xCC, 0x87, 0xC9, 0x83, + 0x41, 0xCC, 0x88, 0xC9, 0x83, 0x41, 0xCC, 0x8A, + 0xC9, 0x83, 0x41, 0xCC, 0xA3, 0xB5, 0x83, 0x43, + 0xCC, 0xA7, 0xA5, 0x83, 0x45, 0xCC, 0x82, 0xC9, + 0x83, 0x45, 0xCC, 0x84, 0xC9, 0x83, 0x45, 0xCC, + 0xA3, 0xB5, 0x83, 0x45, 0xCC, 0xA7, 0xA5, 0x83, + // Bytes 46c0 - 46ff + 0x49, 0xCC, 0x88, 0xC9, 0x83, 0x4C, 0xCC, 0xA3, + 0xB5, 0x83, 0x4F, 0xCC, 0x82, 0xC9, 0x83, 0x4F, + 0xCC, 0x83, 0xC9, 0x83, 0x4F, 0xCC, 0x84, 0xC9, + 0x83, 0x4F, 0xCC, 0x87, 0xC9, 0x83, 0x4F, 0xCC, + 0x88, 0xC9, 0x83, 0x4F, 0xCC, 0x9B, 0xAD, 0x83, + 0x4F, 0xCC, 0xA3, 0xB5, 0x83, 0x4F, 0xCC, 0xA8, + 0xA5, 0x83, 0x52, 0xCC, 0xA3, 0xB5, 0x83, 0x53, + 0xCC, 0x81, 0xC9, 0x83, 0x53, 0xCC, 0x8C, 0xC9, + // Bytes 4700 - 473f + 0x83, 0x53, 0xCC, 0xA3, 0xB5, 0x83, 0x55, 0xCC, + 0x83, 0xC9, 0x83, 0x55, 0xCC, 0x84, 0xC9, 0x83, + 0x55, 0xCC, 0x88, 0xC9, 0x83, 0x55, 0xCC, 0x9B, + 0xAD, 0x83, 0x61, 0xCC, 0x82, 0xC9, 0x83, 0x61, + 0xCC, 0x86, 0xC9, 0x83, 0x61, 0xCC, 0x87, 0xC9, + 0x83, 0x61, 0xCC, 0x88, 0xC9, 0x83, 0x61, 0xCC, + 0x8A, 0xC9, 0x83, 0x61, 0xCC, 0xA3, 0xB5, 0x83, + 0x63, 0xCC, 0xA7, 0xA5, 0x83, 0x65, 0xCC, 0x82, + // Bytes 4740 - 477f + 0xC9, 0x83, 0x65, 0xCC, 0x84, 0xC9, 0x83, 0x65, + 0xCC, 0xA3, 0xB5, 0x83, 0x65, 0xCC, 0xA7, 0xA5, + 0x83, 0x69, 0xCC, 0x88, 0xC9, 0x83, 0x6C, 0xCC, + 0xA3, 0xB5, 0x83, 0x6F, 0xCC, 0x82, 0xC9, 0x83, + 0x6F, 0xCC, 0x83, 0xC9, 0x83, 0x6F, 0xCC, 0x84, + 0xC9, 0x83, 0x6F, 0xCC, 0x87, 0xC9, 0x83, 0x6F, + 0xCC, 0x88, 0xC9, 0x83, 0x6F, 0xCC, 0x9B, 0xAD, + 0x83, 0x6F, 0xCC, 0xA3, 0xB5, 0x83, 0x6F, 0xCC, + // Bytes 4780 - 47bf + 0xA8, 0xA5, 0x83, 0x72, 0xCC, 0xA3, 0xB5, 0x83, + 0x73, 0xCC, 0x81, 0xC9, 0x83, 0x73, 0xCC, 0x8C, + 0xC9, 0x83, 0x73, 0xCC, 0xA3, 0xB5, 0x83, 0x75, + 0xCC, 0x83, 0xC9, 0x83, 0x75, 0xCC, 0x84, 0xC9, + 0x83, 0x75, 0xCC, 0x88, 0xC9, 0x83, 0x75, 0xCC, + 0x9B, 0xAD, 0x84, 0xCE, 0x91, 0xCC, 0x93, 0xC9, + 0x84, 0xCE, 0x91, 0xCC, 0x94, 0xC9, 0x84, 0xCE, + 0x95, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0x95, 0xCC, + // Bytes 47c0 - 47ff + 0x94, 0xC9, 0x84, 0xCE, 0x97, 0xCC, 0x93, 0xC9, + 0x84, 0xCE, 0x97, 0xCC, 0x94, 0xC9, 0x84, 0xCE, + 0x99, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0x99, 0xCC, + 0x94, 0xC9, 0x84, 0xCE, 0x9F, 0xCC, 0x93, 0xC9, + 0x84, 0xCE, 0x9F, 0xCC, 0x94, 0xC9, 0x84, 0xCE, + 0xA5, 0xCC, 0x94, 0xC9, 0x84, 0xCE, 0xA9, 0xCC, + 0x93, 0xC9, 0x84, 0xCE, 0xA9, 0xCC, 0x94, 0xC9, + 0x84, 0xCE, 0xB1, 0xCC, 0x80, 0xC9, 0x84, 0xCE, + // Bytes 4800 - 483f + 0xB1, 0xCC, 0x81, 0xC9, 0x84, 0xCE, 0xB1, 0xCC, + 0x93, 0xC9, 0x84, 0xCE, 0xB1, 0xCC, 0x94, 0xC9, + 0x84, 0xCE, 0xB1, 0xCD, 0x82, 0xC9, 0x84, 0xCE, + 0xB5, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0xB5, 0xCC, + 0x94, 0xC9, 0x84, 0xCE, 0xB7, 0xCC, 0x80, 0xC9, + 0x84, 0xCE, 0xB7, 0xCC, 0x81, 0xC9, 0x84, 0xCE, + 0xB7, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0xB7, 0xCC, + 0x94, 0xC9, 0x84, 0xCE, 0xB7, 0xCD, 0x82, 0xC9, + // Bytes 4840 - 487f + 0x84, 0xCE, 0xB9, 0xCC, 0x88, 0xC9, 0x84, 0xCE, + 0xB9, 0xCC, 0x93, 0xC9, 0x84, 0xCE, 0xB9, 0xCC, + 0x94, 0xC9, 0x84, 0xCE, 0xBF, 0xCC, 0x93, 0xC9, + 0x84, 0xCE, 0xBF, 0xCC, 0x94, 0xC9, 0x84, 0xCF, + 0x85, 0xCC, 0x88, 0xC9, 0x84, 0xCF, 0x85, 0xCC, + 0x93, 0xC9, 0x84, 0xCF, 0x85, 0xCC, 0x94, 0xC9, + 0x84, 0xCF, 0x89, 0xCC, 0x80, 0xC9, 0x84, 0xCF, + 0x89, 0xCC, 0x81, 0xC9, 0x84, 0xCF, 0x89, 0xCC, + // Bytes 4880 - 48bf + 0x93, 0xC9, 0x84, 0xCF, 0x89, 0xCC, 0x94, 0xC9, + 0x84, 0xCF, 0x89, 0xCD, 0x82, 0xC9, 0x86, 0xCE, + 0x91, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0x91, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0x91, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0x91, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0x91, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0x91, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + // Bytes 48c0 - 48ff + 0x97, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0x97, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0x97, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0x97, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0x97, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0x97, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0xA9, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0xA9, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + // Bytes 4900 - 493f + 0xA9, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0xA9, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0xA9, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0xA9, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0xB1, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0xB1, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0xB1, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0xB1, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + // Bytes 4940 - 497f + 0xB1, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0xB1, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0xB7, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0xB7, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0xB7, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCE, + 0xB7, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCE, + 0xB7, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCE, + 0xB7, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x86, 0xCF, + // Bytes 4980 - 49bf + 0x89, 0xCC, 0x93, 0xCC, 0x80, 0xCA, 0x86, 0xCF, + 0x89, 0xCC, 0x93, 0xCC, 0x81, 0xCA, 0x86, 0xCF, + 0x89, 0xCC, 0x93, 0xCD, 0x82, 0xCA, 0x86, 0xCF, + 0x89, 0xCC, 0x94, 0xCC, 0x80, 0xCA, 0x86, 0xCF, + 0x89, 0xCC, 0x94, 0xCC, 0x81, 0xCA, 0x86, 0xCF, + 0x89, 0xCC, 0x94, 0xCD, 0x82, 0xCA, 0x42, 0xCC, + 0x80, 0xC9, 0x32, 0x42, 0xCC, 0x81, 0xC9, 0x32, + 0x42, 0xCC, 0x93, 0xC9, 0x32, 0x43, 0xE1, 0x85, + // Bytes 49c0 - 49ff + 0xA1, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xA2, 0x01, + 0x00, 0x43, 0xE1, 0x85, 0xA3, 0x01, 0x00, 0x43, + 0xE1, 0x85, 0xA4, 0x01, 0x00, 0x43, 0xE1, 0x85, + 0xA5, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xA6, 0x01, + 0x00, 0x43, 0xE1, 0x85, 0xA7, 0x01, 0x00, 0x43, + 0xE1, 0x85, 0xA8, 0x01, 0x00, 0x43, 0xE1, 0x85, + 0xA9, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xAA, 0x01, + 0x00, 0x43, 0xE1, 0x85, 0xAB, 0x01, 0x00, 0x43, + // Bytes 4a00 - 4a3f + 0xE1, 0x85, 0xAC, 0x01, 0x00, 0x43, 0xE1, 0x85, + 0xAD, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xAE, 0x01, + 0x00, 0x43, 0xE1, 0x85, 0xAF, 0x01, 0x00, 0x43, + 0xE1, 0x85, 0xB0, 0x01, 0x00, 0x43, 0xE1, 0x85, + 0xB1, 0x01, 0x00, 0x43, 0xE1, 0x85, 0xB2, 0x01, + 0x00, 0x43, 0xE1, 0x85, 0xB3, 0x01, 0x00, 0x43, + 0xE1, 0x85, 0xB4, 0x01, 0x00, 0x43, 0xE1, 0x85, + 0xB5, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xAA, 0x01, + // Bytes 4a40 - 4a7f + 0x00, 0x43, 0xE1, 0x86, 0xAC, 0x01, 0x00, 0x43, + 0xE1, 0x86, 0xAD, 0x01, 0x00, 0x43, 0xE1, 0x86, + 0xB0, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xB1, 0x01, + 0x00, 0x43, 0xE1, 0x86, 0xB2, 0x01, 0x00, 0x43, + 0xE1, 0x86, 0xB3, 0x01, 0x00, 0x43, 0xE1, 0x86, + 0xB4, 0x01, 0x00, 0x43, 0xE1, 0x86, 0xB5, 0x01, + 0x00, 0x44, 0xCC, 0x88, 0xCC, 0x81, 0xCA, 0x32, + 0x43, 0xE3, 0x82, 0x99, 0x0D, 0x03, 0x43, 0xE3, + // Bytes 4a80 - 4abf + 0x82, 0x9A, 0x0D, 0x03, 0x46, 0xE0, 0xBD, 0xB1, + 0xE0, 0xBD, 0xB2, 0x9E, 0x26, 0x46, 0xE0, 0xBD, + 0xB1, 0xE0, 0xBD, 0xB4, 0xA2, 0x26, 0x46, 0xE0, + 0xBD, 0xB1, 0xE0, 0xBE, 0x80, 0x9E, 0x26, 0x00, + 0x01, +} + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *nfcTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return nfcValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := nfcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := nfcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := nfcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = nfcIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *nfcTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return nfcValues[c0] + } + i := nfcIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = nfcIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = nfcIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *nfcTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return nfcValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := nfcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := nfcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := nfcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = nfcIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *nfcTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return nfcValues[c0] + } + i := nfcIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = nfcIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = nfcIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// nfcTrie. Total size: 10586 bytes (10.34 KiB). Checksum: dd926e82067bee11. +type nfcTrie struct{} + +func newNfcTrie(i int) *nfcTrie { + return &nfcTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *nfcTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 46: + return uint16(nfcValues[n<<6+uint32(b)]) + default: + n -= 46 + return uint16(nfcSparse.lookup(n, b)) + } +} + +// nfcValues: 48 blocks, 3072 entries, 6144 bytes +// The third block is the zero block. +var nfcValues = [3072]uint16{ + // Block 0x0, offset 0x0 + 0x3c: 0xa000, 0x3d: 0xa000, 0x3e: 0xa000, + // Block 0x1, offset 0x40 + 0x41: 0xa000, 0x42: 0xa000, 0x43: 0xa000, 0x44: 0xa000, 0x45: 0xa000, + 0x46: 0xa000, 0x47: 0xa000, 0x48: 0xa000, 0x49: 0xa000, 0x4a: 0xa000, 0x4b: 0xa000, + 0x4c: 0xa000, 0x4d: 0xa000, 0x4e: 0xa000, 0x4f: 0xa000, 0x50: 0xa000, + 0x52: 0xa000, 0x53: 0xa000, 0x54: 0xa000, 0x55: 0xa000, 0x56: 0xa000, 0x57: 0xa000, + 0x58: 0xa000, 0x59: 0xa000, 0x5a: 0xa000, + 0x61: 0xa000, 0x62: 0xa000, 0x63: 0xa000, + 0x64: 0xa000, 0x65: 0xa000, 0x66: 0xa000, 0x67: 0xa000, 0x68: 0xa000, 0x69: 0xa000, + 0x6a: 0xa000, 0x6b: 0xa000, 0x6c: 0xa000, 0x6d: 0xa000, 0x6e: 0xa000, 0x6f: 0xa000, + 0x70: 0xa000, 0x72: 0xa000, 0x73: 0xa000, 0x74: 0xa000, 0x75: 0xa000, + 0x76: 0xa000, 0x77: 0xa000, 0x78: 0xa000, 0x79: 0xa000, 0x7a: 0xa000, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x4688, 0xc3: 0x2f79, 0xc4: 0x4697, 0xc5: 0x469c, + 0xc6: 0xa000, 0xc7: 0x46a6, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x46ab, 0xcb: 0x2ffb, + 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x46bf, 0xd1: 0x3104, + 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x46c9, 0xd5: 0x46ce, 0xd6: 0x46dd, + 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x470f, 0xdd: 0x3235, + 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x4719, 0xe3: 0x3285, + 0xe4: 0x4728, 0xe5: 0x472d, 0xe6: 0xa000, 0xe7: 0x4737, 0xe8: 0x32ee, 0xe9: 0x32f3, + 0xea: 0x473c, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x4750, + 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x475a, 0xf5: 0x475f, + 0xf6: 0x476e, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, + 0xfc: 0x47a0, 0xfd: 0x3550, 0xff: 0x3569, + // Block 0x4, offset 0x100 + 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x468d, 0x103: 0x471e, 0x104: 0x2f9c, 0x105: 0x32a8, + 0x106: 0x2fb0, 0x107: 0x32bc, 0x108: 0x2fb5, 0x109: 0x32c1, 0x10a: 0x2fba, 0x10b: 0x32c6, + 0x10c: 0x2fbf, 0x10d: 0x32cb, 0x10e: 0x2fc9, 0x10f: 0x32d5, + 0x112: 0x46b0, 0x113: 0x4741, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, + 0x118: 0x3014, 0x119: 0x3320, 0x11a: 0x3005, 0x11b: 0x3311, 0x11c: 0x302d, 0x11d: 0x3339, + 0x11e: 0x3037, 0x11f: 0x3343, 0x120: 0x303c, 0x121: 0x3348, 0x122: 0x3046, 0x123: 0x3352, + 0x124: 0x304b, 0x125: 0x3357, 0x128: 0x307d, 0x129: 0x338e, + 0x12a: 0x3082, 0x12b: 0x3393, 0x12c: 0x3087, 0x12d: 0x3398, 0x12e: 0x30aa, 0x12f: 0x33b6, + 0x130: 0x308c, 0x134: 0x30b4, 0x135: 0x33c0, + 0x136: 0x30c8, 0x137: 0x33d9, 0x139: 0x30d2, 0x13a: 0x33e3, 0x13b: 0x30dc, + 0x13c: 0x33ed, 0x13d: 0x30d7, 0x13e: 0x33e8, + // Block 0x5, offset 0x140 + 0x143: 0x30ff, 0x144: 0x3410, 0x145: 0x3118, + 0x146: 0x3429, 0x147: 0x310e, 0x148: 0x341f, + 0x14c: 0x46d3, 0x14d: 0x4764, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, + 0x154: 0x3159, 0x155: 0x346a, 0x156: 0x3172, 0x157: 0x3483, + 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x46f6, 0x15b: 0x4787, 0x15c: 0x317c, 0x15d: 0x348d, + 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x46fb, 0x161: 0x478c, 0x162: 0x31a4, 0x163: 0x34ba, + 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x4705, 0x169: 0x4796, + 0x16a: 0x470a, 0x16b: 0x479b, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, + 0x170: 0x31d1, 0x171: 0x34e7, 0x172: 0x31ef, 0x173: 0x3505, 0x174: 0x3212, 0x175: 0x3528, + 0x176: 0x323a, 0x177: 0x3555, 0x178: 0x324e, 0x179: 0x325d, 0x17a: 0x357d, 0x17b: 0x3267, + 0x17c: 0x3587, 0x17d: 0x326c, 0x17e: 0x358c, 0x17f: 0xa000, + // Block 0x6, offset 0x180 + 0x184: 0x8100, 0x185: 0x8100, + 0x186: 0x8100, + 0x18d: 0x2f88, 0x18e: 0x3294, 0x18f: 0x3096, 0x190: 0x33a2, 0x191: 0x3140, + 0x192: 0x3451, 0x193: 0x31d6, 0x194: 0x34ec, 0x195: 0x39cf, 0x196: 0x3b5e, 0x197: 0x39c8, + 0x198: 0x3b57, 0x199: 0x39d6, 0x19a: 0x3b65, 0x19b: 0x39c1, 0x19c: 0x3b50, + 0x19e: 0x38b0, 0x19f: 0x3a3f, 0x1a0: 0x38a9, 0x1a1: 0x3a38, 0x1a2: 0x35b3, 0x1a3: 0x35c5, + 0x1a6: 0x3041, 0x1a7: 0x334d, 0x1a8: 0x30be, 0x1a9: 0x33cf, + 0x1aa: 0x46ec, 0x1ab: 0x477d, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, + 0x1b0: 0x33c5, 0x1b4: 0x3028, 0x1b5: 0x3334, + 0x1b8: 0x30fa, 0x1b9: 0x340b, 0x1ba: 0x38b7, 0x1bb: 0x3a46, + 0x1bc: 0x35ad, 0x1bd: 0x35bf, 0x1be: 0x35b9, 0x1bf: 0x35cb, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x2f8d, 0x1c1: 0x3299, 0x1c2: 0x2f92, 0x1c3: 0x329e, 0x1c4: 0x300a, 0x1c5: 0x3316, + 0x1c6: 0x300f, 0x1c7: 0x331b, 0x1c8: 0x309b, 0x1c9: 0x33a7, 0x1ca: 0x30a0, 0x1cb: 0x33ac, + 0x1cc: 0x3145, 0x1cd: 0x3456, 0x1ce: 0x314a, 0x1cf: 0x345b, 0x1d0: 0x3168, 0x1d1: 0x3479, + 0x1d2: 0x316d, 0x1d3: 0x347e, 0x1d4: 0x31db, 0x1d5: 0x34f1, 0x1d6: 0x31e0, 0x1d7: 0x34f6, + 0x1d8: 0x3186, 0x1d9: 0x3497, 0x1da: 0x319f, 0x1db: 0x34b5, + 0x1de: 0x305a, 0x1df: 0x3366, + 0x1e6: 0x4692, 0x1e7: 0x4723, 0x1e8: 0x46ba, 0x1e9: 0x474b, + 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x46d8, 0x1ef: 0x4769, + 0x1f0: 0x3958, 0x1f1: 0x3ae7, 0x1f2: 0x3244, 0x1f3: 0x355f, + // Block 0x8, offset 0x200 + 0x200: 0x9932, 0x201: 0x9932, 0x202: 0x9932, 0x203: 0x9932, 0x204: 0x9932, 0x205: 0x8132, + 0x206: 0x9932, 0x207: 0x9932, 0x208: 0x9932, 0x209: 0x9932, 0x20a: 0x9932, 0x20b: 0x9932, + 0x20c: 0x9932, 0x20d: 0x8132, 0x20e: 0x8132, 0x20f: 0x9932, 0x210: 0x8132, 0x211: 0x9932, + 0x212: 0x8132, 0x213: 0x9932, 0x214: 0x9932, 0x215: 0x8133, 0x216: 0x812d, 0x217: 0x812d, + 0x218: 0x812d, 0x219: 0x812d, 0x21a: 0x8133, 0x21b: 0x992b, 0x21c: 0x812d, 0x21d: 0x812d, + 0x21e: 0x812d, 0x21f: 0x812d, 0x220: 0x812d, 0x221: 0x8129, 0x222: 0x8129, 0x223: 0x992d, + 0x224: 0x992d, 0x225: 0x992d, 0x226: 0x992d, 0x227: 0x9929, 0x228: 0x9929, 0x229: 0x812d, + 0x22a: 0x812d, 0x22b: 0x812d, 0x22c: 0x812d, 0x22d: 0x992d, 0x22e: 0x992d, 0x22f: 0x812d, + 0x230: 0x992d, 0x231: 0x992d, 0x232: 0x812d, 0x233: 0x812d, 0x234: 0x8101, 0x235: 0x8101, + 0x236: 0x8101, 0x237: 0x8101, 0x238: 0x9901, 0x239: 0x812d, 0x23a: 0x812d, 0x23b: 0x812d, + 0x23c: 0x812d, 0x23d: 0x8132, 0x23e: 0x8132, 0x23f: 0x8132, + // Block 0x9, offset 0x240 + 0x240: 0x49ae, 0x241: 0x49b3, 0x242: 0x9932, 0x243: 0x49b8, 0x244: 0x4a71, 0x245: 0x9936, + 0x246: 0x8132, 0x247: 0x812d, 0x248: 0x812d, 0x249: 0x812d, 0x24a: 0x8132, 0x24b: 0x8132, + 0x24c: 0x8132, 0x24d: 0x812d, 0x24e: 0x812d, 0x250: 0x8132, 0x251: 0x8132, + 0x252: 0x8132, 0x253: 0x812d, 0x254: 0x812d, 0x255: 0x812d, 0x256: 0x812d, 0x257: 0x8132, + 0x258: 0x8133, 0x259: 0x812d, 0x25a: 0x812d, 0x25b: 0x8132, 0x25c: 0x8134, 0x25d: 0x8135, + 0x25e: 0x8135, 0x25f: 0x8134, 0x260: 0x8135, 0x261: 0x8135, 0x262: 0x8134, 0x263: 0x8132, + 0x264: 0x8132, 0x265: 0x8132, 0x266: 0x8132, 0x267: 0x8132, 0x268: 0x8132, 0x269: 0x8132, + 0x26a: 0x8132, 0x26b: 0x8132, 0x26c: 0x8132, 0x26d: 0x8132, 0x26e: 0x8132, 0x26f: 0x8132, + 0x274: 0x0170, + 0x27a: 0x8100, + 0x27e: 0x0037, + // Block 0xa, offset 0x280 + 0x284: 0x8100, 0x285: 0x35a1, + 0x286: 0x35e9, 0x287: 0x00ce, 0x288: 0x3607, 0x289: 0x3613, 0x28a: 0x3625, + 0x28c: 0x3643, 0x28e: 0x3655, 0x28f: 0x3673, 0x290: 0x3e08, 0x291: 0xa000, + 0x295: 0xa000, 0x297: 0xa000, + 0x299: 0xa000, + 0x29f: 0xa000, 0x2a1: 0xa000, + 0x2a5: 0xa000, 0x2a9: 0xa000, + 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x47fe, 0x2ad: 0x3697, 0x2ae: 0x4828, 0x2af: 0x36a9, + 0x2b0: 0x3e70, 0x2b1: 0xa000, 0x2b5: 0xa000, + 0x2b7: 0xa000, 0x2b9: 0xa000, + 0x2bf: 0xa000, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x3721, 0x2c1: 0x372d, 0x2c3: 0x371b, + 0x2c6: 0xa000, 0x2c7: 0x3709, + 0x2cc: 0x375d, 0x2cd: 0x3745, 0x2ce: 0x376f, 0x2d0: 0xa000, + 0x2d3: 0xa000, 0x2d5: 0xa000, 0x2d6: 0xa000, 0x2d7: 0xa000, + 0x2d8: 0xa000, 0x2d9: 0x3751, 0x2da: 0xa000, + 0x2de: 0xa000, 0x2e3: 0xa000, + 0x2e7: 0xa000, + 0x2eb: 0xa000, 0x2ed: 0xa000, + 0x2f0: 0xa000, 0x2f3: 0xa000, 0x2f5: 0xa000, + 0x2f6: 0xa000, 0x2f7: 0xa000, 0x2f8: 0xa000, 0x2f9: 0x37d5, 0x2fa: 0xa000, + 0x2fe: 0xa000, + // Block 0xc, offset 0x300 + 0x301: 0x3733, 0x302: 0x37b7, + 0x310: 0x370f, 0x311: 0x3793, + 0x312: 0x3715, 0x313: 0x3799, 0x316: 0x3727, 0x317: 0x37ab, + 0x318: 0xa000, 0x319: 0xa000, 0x31a: 0x3829, 0x31b: 0x382f, 0x31c: 0x3739, 0x31d: 0x37bd, + 0x31e: 0x373f, 0x31f: 0x37c3, 0x322: 0x374b, 0x323: 0x37cf, + 0x324: 0x3757, 0x325: 0x37db, 0x326: 0x3763, 0x327: 0x37e7, 0x328: 0xa000, 0x329: 0xa000, + 0x32a: 0x3835, 0x32b: 0x383b, 0x32c: 0x378d, 0x32d: 0x3811, 0x32e: 0x3769, 0x32f: 0x37ed, + 0x330: 0x3775, 0x331: 0x37f9, 0x332: 0x377b, 0x333: 0x37ff, 0x334: 0x3781, 0x335: 0x3805, + 0x338: 0x3787, 0x339: 0x380b, + // Block 0xd, offset 0x340 + 0x351: 0x812d, + 0x352: 0x8132, 0x353: 0x8132, 0x354: 0x8132, 0x355: 0x8132, 0x356: 0x812d, 0x357: 0x8132, + 0x358: 0x8132, 0x359: 0x8132, 0x35a: 0x812e, 0x35b: 0x812d, 0x35c: 0x8132, 0x35d: 0x8132, + 0x35e: 0x8132, 0x35f: 0x8132, 0x360: 0x8132, 0x361: 0x8132, 0x362: 0x812d, 0x363: 0x812d, + 0x364: 0x812d, 0x365: 0x812d, 0x366: 0x812d, 0x367: 0x812d, 0x368: 0x8132, 0x369: 0x8132, + 0x36a: 0x812d, 0x36b: 0x8132, 0x36c: 0x8132, 0x36d: 0x812e, 0x36e: 0x8131, 0x36f: 0x8132, + 0x370: 0x8105, 0x371: 0x8106, 0x372: 0x8107, 0x373: 0x8108, 0x374: 0x8109, 0x375: 0x810a, + 0x376: 0x810b, 0x377: 0x810c, 0x378: 0x810d, 0x379: 0x810e, 0x37a: 0x810e, 0x37b: 0x810f, + 0x37c: 0x8110, 0x37d: 0x8111, 0x37f: 0x8112, + // Block 0xe, offset 0x380 + 0x388: 0xa000, 0x38a: 0xa000, 0x38b: 0x8116, + 0x38c: 0x8117, 0x38d: 0x8118, 0x38e: 0x8119, 0x38f: 0x811a, 0x390: 0x811b, 0x391: 0x811c, + 0x392: 0x811d, 0x393: 0x9932, 0x394: 0x9932, 0x395: 0x992d, 0x396: 0x812d, 0x397: 0x8132, + 0x398: 0x8132, 0x399: 0x8132, 0x39a: 0x8132, 0x39b: 0x8132, 0x39c: 0x812d, 0x39d: 0x8132, + 0x39e: 0x8132, 0x39f: 0x812d, + 0x3b0: 0x811e, + // Block 0xf, offset 0x3c0 + 0x3d3: 0x812d, 0x3d4: 0x8132, 0x3d5: 0x8132, 0x3d6: 0x8132, 0x3d7: 0x8132, + 0x3d8: 0x8132, 0x3d9: 0x8132, 0x3da: 0x8132, 0x3db: 0x8132, 0x3dc: 0x8132, 0x3dd: 0x8132, + 0x3de: 0x8132, 0x3df: 0x8132, 0x3e0: 0x8132, 0x3e1: 0x8132, 0x3e3: 0x812d, + 0x3e4: 0x8132, 0x3e5: 0x8132, 0x3e6: 0x812d, 0x3e7: 0x8132, 0x3e8: 0x8132, 0x3e9: 0x812d, + 0x3ea: 0x8132, 0x3eb: 0x8132, 0x3ec: 0x8132, 0x3ed: 0x812d, 0x3ee: 0x812d, 0x3ef: 0x812d, + 0x3f0: 0x8116, 0x3f1: 0x8117, 0x3f2: 0x8118, 0x3f3: 0x8132, 0x3f4: 0x8132, 0x3f5: 0x8132, + 0x3f6: 0x812d, 0x3f7: 0x8132, 0x3f8: 0x8132, 0x3f9: 0x812d, 0x3fa: 0x812d, 0x3fb: 0x8132, + 0x3fc: 0x8132, 0x3fd: 0x8132, 0x3fe: 0x8132, 0x3ff: 0x8132, + // Block 0x10, offset 0x400 + 0x405: 0xa000, + 0x406: 0x2d26, 0x407: 0xa000, 0x408: 0x2d2e, 0x409: 0xa000, 0x40a: 0x2d36, 0x40b: 0xa000, + 0x40c: 0x2d3e, 0x40d: 0xa000, 0x40e: 0x2d46, 0x411: 0xa000, + 0x412: 0x2d4e, + 0x434: 0x8102, 0x435: 0x9900, + 0x43a: 0xa000, 0x43b: 0x2d56, + 0x43c: 0xa000, 0x43d: 0x2d5e, 0x43e: 0xa000, 0x43f: 0xa000, + // Block 0x11, offset 0x440 + 0x440: 0x8132, 0x441: 0x8132, 0x442: 0x812d, 0x443: 0x8132, 0x444: 0x8132, 0x445: 0x8132, + 0x446: 0x8132, 0x447: 0x8132, 0x448: 0x8132, 0x449: 0x8132, 0x44a: 0x812d, 0x44b: 0x8132, + 0x44c: 0x8132, 0x44d: 0x8135, 0x44e: 0x812a, 0x44f: 0x812d, 0x450: 0x8129, 0x451: 0x8132, + 0x452: 0x8132, 0x453: 0x8132, 0x454: 0x8132, 0x455: 0x8132, 0x456: 0x8132, 0x457: 0x8132, + 0x458: 0x8132, 0x459: 0x8132, 0x45a: 0x8132, 0x45b: 0x8132, 0x45c: 0x8132, 0x45d: 0x8132, + 0x45e: 0x8132, 0x45f: 0x8132, 0x460: 0x8132, 0x461: 0x8132, 0x462: 0x8132, 0x463: 0x8132, + 0x464: 0x8132, 0x465: 0x8132, 0x466: 0x8132, 0x467: 0x8132, 0x468: 0x8132, 0x469: 0x8132, + 0x46a: 0x8132, 0x46b: 0x8132, 0x46c: 0x8132, 0x46d: 0x8132, 0x46e: 0x8132, 0x46f: 0x8132, + 0x470: 0x8132, 0x471: 0x8132, 0x472: 0x8132, 0x473: 0x8132, 0x474: 0x8132, 0x475: 0x8132, + 0x476: 0x8133, 0x477: 0x8131, 0x478: 0x8131, 0x479: 0x812d, 0x47b: 0x8132, + 0x47c: 0x8134, 0x47d: 0x812d, 0x47e: 0x8132, 0x47f: 0x812d, + // Block 0x12, offset 0x480 + 0x480: 0x2f97, 0x481: 0x32a3, 0x482: 0x2fa1, 0x483: 0x32ad, 0x484: 0x2fa6, 0x485: 0x32b2, + 0x486: 0x2fab, 0x487: 0x32b7, 0x488: 0x38cc, 0x489: 0x3a5b, 0x48a: 0x2fc4, 0x48b: 0x32d0, + 0x48c: 0x2fce, 0x48d: 0x32da, 0x48e: 0x2fdd, 0x48f: 0x32e9, 0x490: 0x2fd3, 0x491: 0x32df, + 0x492: 0x2fd8, 0x493: 0x32e4, 0x494: 0x38ef, 0x495: 0x3a7e, 0x496: 0x38f6, 0x497: 0x3a85, + 0x498: 0x3019, 0x499: 0x3325, 0x49a: 0x301e, 0x49b: 0x332a, 0x49c: 0x3904, 0x49d: 0x3a93, + 0x49e: 0x3023, 0x49f: 0x332f, 0x4a0: 0x3032, 0x4a1: 0x333e, 0x4a2: 0x3050, 0x4a3: 0x335c, + 0x4a4: 0x305f, 0x4a5: 0x336b, 0x4a6: 0x3055, 0x4a7: 0x3361, 0x4a8: 0x3064, 0x4a9: 0x3370, + 0x4aa: 0x3069, 0x4ab: 0x3375, 0x4ac: 0x30af, 0x4ad: 0x33bb, 0x4ae: 0x390b, 0x4af: 0x3a9a, + 0x4b0: 0x30b9, 0x4b1: 0x33ca, 0x4b2: 0x30c3, 0x4b3: 0x33d4, 0x4b4: 0x30cd, 0x4b5: 0x33de, + 0x4b6: 0x46c4, 0x4b7: 0x4755, 0x4b8: 0x3912, 0x4b9: 0x3aa1, 0x4ba: 0x30e6, 0x4bb: 0x33f7, + 0x4bc: 0x30e1, 0x4bd: 0x33f2, 0x4be: 0x30eb, 0x4bf: 0x33fc, + // Block 0x13, offset 0x4c0 + 0x4c0: 0x30f0, 0x4c1: 0x3401, 0x4c2: 0x30f5, 0x4c3: 0x3406, 0x4c4: 0x3109, 0x4c5: 0x341a, + 0x4c6: 0x3113, 0x4c7: 0x3424, 0x4c8: 0x3122, 0x4c9: 0x3433, 0x4ca: 0x311d, 0x4cb: 0x342e, + 0x4cc: 0x3935, 0x4cd: 0x3ac4, 0x4ce: 0x3943, 0x4cf: 0x3ad2, 0x4d0: 0x394a, 0x4d1: 0x3ad9, + 0x4d2: 0x3951, 0x4d3: 0x3ae0, 0x4d4: 0x314f, 0x4d5: 0x3460, 0x4d6: 0x3154, 0x4d7: 0x3465, + 0x4d8: 0x315e, 0x4d9: 0x346f, 0x4da: 0x46f1, 0x4db: 0x4782, 0x4dc: 0x3997, 0x4dd: 0x3b26, + 0x4de: 0x3177, 0x4df: 0x3488, 0x4e0: 0x3181, 0x4e1: 0x3492, 0x4e2: 0x4700, 0x4e3: 0x4791, + 0x4e4: 0x399e, 0x4e5: 0x3b2d, 0x4e6: 0x39a5, 0x4e7: 0x3b34, 0x4e8: 0x39ac, 0x4e9: 0x3b3b, + 0x4ea: 0x3190, 0x4eb: 0x34a1, 0x4ec: 0x319a, 0x4ed: 0x34b0, 0x4ee: 0x31ae, 0x4ef: 0x34c4, + 0x4f0: 0x31a9, 0x4f1: 0x34bf, 0x4f2: 0x31ea, 0x4f3: 0x3500, 0x4f4: 0x31f9, 0x4f5: 0x350f, + 0x4f6: 0x31f4, 0x4f7: 0x350a, 0x4f8: 0x39b3, 0x4f9: 0x3b42, 0x4fa: 0x39ba, 0x4fb: 0x3b49, + 0x4fc: 0x31fe, 0x4fd: 0x3514, 0x4fe: 0x3203, 0x4ff: 0x3519, + // Block 0x14, offset 0x500 + 0x500: 0x3208, 0x501: 0x351e, 0x502: 0x320d, 0x503: 0x3523, 0x504: 0x321c, 0x505: 0x3532, + 0x506: 0x3217, 0x507: 0x352d, 0x508: 0x3221, 0x509: 0x353c, 0x50a: 0x3226, 0x50b: 0x3541, + 0x50c: 0x322b, 0x50d: 0x3546, 0x50e: 0x3249, 0x50f: 0x3564, 0x510: 0x3262, 0x511: 0x3582, + 0x512: 0x3271, 0x513: 0x3591, 0x514: 0x3276, 0x515: 0x3596, 0x516: 0x337a, 0x517: 0x34a6, + 0x518: 0x3537, 0x519: 0x3573, 0x51b: 0x35d1, + 0x520: 0x46a1, 0x521: 0x4732, 0x522: 0x2f83, 0x523: 0x328f, + 0x524: 0x3878, 0x525: 0x3a07, 0x526: 0x3871, 0x527: 0x3a00, 0x528: 0x3886, 0x529: 0x3a15, + 0x52a: 0x387f, 0x52b: 0x3a0e, 0x52c: 0x38be, 0x52d: 0x3a4d, 0x52e: 0x3894, 0x52f: 0x3a23, + 0x530: 0x388d, 0x531: 0x3a1c, 0x532: 0x38a2, 0x533: 0x3a31, 0x534: 0x389b, 0x535: 0x3a2a, + 0x536: 0x38c5, 0x537: 0x3a54, 0x538: 0x46b5, 0x539: 0x4746, 0x53a: 0x3000, 0x53b: 0x330c, + 0x53c: 0x2fec, 0x53d: 0x32f8, 0x53e: 0x38da, 0x53f: 0x3a69, + // Block 0x15, offset 0x540 + 0x540: 0x38d3, 0x541: 0x3a62, 0x542: 0x38e8, 0x543: 0x3a77, 0x544: 0x38e1, 0x545: 0x3a70, + 0x546: 0x38fd, 0x547: 0x3a8c, 0x548: 0x3091, 0x549: 0x339d, 0x54a: 0x30a5, 0x54b: 0x33b1, + 0x54c: 0x46e7, 0x54d: 0x4778, 0x54e: 0x3136, 0x54f: 0x3447, 0x550: 0x3920, 0x551: 0x3aaf, + 0x552: 0x3919, 0x553: 0x3aa8, 0x554: 0x392e, 0x555: 0x3abd, 0x556: 0x3927, 0x557: 0x3ab6, + 0x558: 0x3989, 0x559: 0x3b18, 0x55a: 0x396d, 0x55b: 0x3afc, 0x55c: 0x3966, 0x55d: 0x3af5, + 0x55e: 0x397b, 0x55f: 0x3b0a, 0x560: 0x3974, 0x561: 0x3b03, 0x562: 0x3982, 0x563: 0x3b11, + 0x564: 0x31e5, 0x565: 0x34fb, 0x566: 0x31c7, 0x567: 0x34dd, 0x568: 0x39e4, 0x569: 0x3b73, + 0x56a: 0x39dd, 0x56b: 0x3b6c, 0x56c: 0x39f2, 0x56d: 0x3b81, 0x56e: 0x39eb, 0x56f: 0x3b7a, + 0x570: 0x39f9, 0x571: 0x3b88, 0x572: 0x3230, 0x573: 0x354b, 0x574: 0x3258, 0x575: 0x3578, + 0x576: 0x3253, 0x577: 0x356e, 0x578: 0x323f, 0x579: 0x355a, + // Block 0x16, offset 0x580 + 0x580: 0x4804, 0x581: 0x480a, 0x582: 0x491e, 0x583: 0x4936, 0x584: 0x4926, 0x585: 0x493e, + 0x586: 0x492e, 0x587: 0x4946, 0x588: 0x47aa, 0x589: 0x47b0, 0x58a: 0x488e, 0x58b: 0x48a6, + 0x58c: 0x4896, 0x58d: 0x48ae, 0x58e: 0x489e, 0x58f: 0x48b6, 0x590: 0x4816, 0x591: 0x481c, + 0x592: 0x3db8, 0x593: 0x3dc8, 0x594: 0x3dc0, 0x595: 0x3dd0, + 0x598: 0x47b6, 0x599: 0x47bc, 0x59a: 0x3ce8, 0x59b: 0x3cf8, 0x59c: 0x3cf0, 0x59d: 0x3d00, + 0x5a0: 0x482e, 0x5a1: 0x4834, 0x5a2: 0x494e, 0x5a3: 0x4966, + 0x5a4: 0x4956, 0x5a5: 0x496e, 0x5a6: 0x495e, 0x5a7: 0x4976, 0x5a8: 0x47c2, 0x5a9: 0x47c8, + 0x5aa: 0x48be, 0x5ab: 0x48d6, 0x5ac: 0x48c6, 0x5ad: 0x48de, 0x5ae: 0x48ce, 0x5af: 0x48e6, + 0x5b0: 0x4846, 0x5b1: 0x484c, 0x5b2: 0x3e18, 0x5b3: 0x3e30, 0x5b4: 0x3e20, 0x5b5: 0x3e38, + 0x5b6: 0x3e28, 0x5b7: 0x3e40, 0x5b8: 0x47ce, 0x5b9: 0x47d4, 0x5ba: 0x3d18, 0x5bb: 0x3d30, + 0x5bc: 0x3d20, 0x5bd: 0x3d38, 0x5be: 0x3d28, 0x5bf: 0x3d40, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x4852, 0x5c1: 0x4858, 0x5c2: 0x3e48, 0x5c3: 0x3e58, 0x5c4: 0x3e50, 0x5c5: 0x3e60, + 0x5c8: 0x47da, 0x5c9: 0x47e0, 0x5ca: 0x3d48, 0x5cb: 0x3d58, + 0x5cc: 0x3d50, 0x5cd: 0x3d60, 0x5d0: 0x4864, 0x5d1: 0x486a, + 0x5d2: 0x3e80, 0x5d3: 0x3e98, 0x5d4: 0x3e88, 0x5d5: 0x3ea0, 0x5d6: 0x3e90, 0x5d7: 0x3ea8, + 0x5d9: 0x47e6, 0x5db: 0x3d68, 0x5dd: 0x3d70, + 0x5df: 0x3d78, 0x5e0: 0x487c, 0x5e1: 0x4882, 0x5e2: 0x497e, 0x5e3: 0x4996, + 0x5e4: 0x4986, 0x5e5: 0x499e, 0x5e6: 0x498e, 0x5e7: 0x49a6, 0x5e8: 0x47ec, 0x5e9: 0x47f2, + 0x5ea: 0x48ee, 0x5eb: 0x4906, 0x5ec: 0x48f6, 0x5ed: 0x490e, 0x5ee: 0x48fe, 0x5ef: 0x4916, + 0x5f0: 0x47f8, 0x5f1: 0x431e, 0x5f2: 0x3691, 0x5f3: 0x4324, 0x5f4: 0x4822, 0x5f5: 0x432a, + 0x5f6: 0x36a3, 0x5f7: 0x4330, 0x5f8: 0x36c1, 0x5f9: 0x4336, 0x5fa: 0x36d9, 0x5fb: 0x433c, + 0x5fc: 0x4870, 0x5fd: 0x4342, + // Block 0x18, offset 0x600 + 0x600: 0x3da0, 0x601: 0x3da8, 0x602: 0x4184, 0x603: 0x41a2, 0x604: 0x418e, 0x605: 0x41ac, + 0x606: 0x4198, 0x607: 0x41b6, 0x608: 0x3cd8, 0x609: 0x3ce0, 0x60a: 0x40d0, 0x60b: 0x40ee, + 0x60c: 0x40da, 0x60d: 0x40f8, 0x60e: 0x40e4, 0x60f: 0x4102, 0x610: 0x3de8, 0x611: 0x3df0, + 0x612: 0x41c0, 0x613: 0x41de, 0x614: 0x41ca, 0x615: 0x41e8, 0x616: 0x41d4, 0x617: 0x41f2, + 0x618: 0x3d08, 0x619: 0x3d10, 0x61a: 0x410c, 0x61b: 0x412a, 0x61c: 0x4116, 0x61d: 0x4134, + 0x61e: 0x4120, 0x61f: 0x413e, 0x620: 0x3ec0, 0x621: 0x3ec8, 0x622: 0x41fc, 0x623: 0x421a, + 0x624: 0x4206, 0x625: 0x4224, 0x626: 0x4210, 0x627: 0x422e, 0x628: 0x3d80, 0x629: 0x3d88, + 0x62a: 0x4148, 0x62b: 0x4166, 0x62c: 0x4152, 0x62d: 0x4170, 0x62e: 0x415c, 0x62f: 0x417a, + 0x630: 0x3685, 0x631: 0x367f, 0x632: 0x3d90, 0x633: 0x368b, 0x634: 0x3d98, + 0x636: 0x4810, 0x637: 0x3db0, 0x638: 0x35f5, 0x639: 0x35ef, 0x63a: 0x35e3, 0x63b: 0x42ee, + 0x63c: 0x35fb, 0x63d: 0x8100, 0x63e: 0x01d3, 0x63f: 0xa100, + // Block 0x19, offset 0x640 + 0x640: 0x8100, 0x641: 0x35a7, 0x642: 0x3dd8, 0x643: 0x369d, 0x644: 0x3de0, + 0x646: 0x483a, 0x647: 0x3df8, 0x648: 0x3601, 0x649: 0x42f4, 0x64a: 0x360d, 0x64b: 0x42fa, + 0x64c: 0x3619, 0x64d: 0x3b8f, 0x64e: 0x3b96, 0x64f: 0x3b9d, 0x650: 0x36b5, 0x651: 0x36af, + 0x652: 0x3e00, 0x653: 0x44e4, 0x656: 0x36bb, 0x657: 0x3e10, + 0x658: 0x3631, 0x659: 0x362b, 0x65a: 0x361f, 0x65b: 0x4300, 0x65d: 0x3ba4, + 0x65e: 0x3bab, 0x65f: 0x3bb2, 0x660: 0x36eb, 0x661: 0x36e5, 0x662: 0x3e68, 0x663: 0x44ec, + 0x664: 0x36cd, 0x665: 0x36d3, 0x666: 0x36f1, 0x667: 0x3e78, 0x668: 0x3661, 0x669: 0x365b, + 0x66a: 0x364f, 0x66b: 0x430c, 0x66c: 0x3649, 0x66d: 0x359b, 0x66e: 0x42e8, 0x66f: 0x0081, + 0x672: 0x3eb0, 0x673: 0x36f7, 0x674: 0x3eb8, + 0x676: 0x4888, 0x677: 0x3ed0, 0x678: 0x363d, 0x679: 0x4306, 0x67a: 0x366d, 0x67b: 0x4318, + 0x67c: 0x3679, 0x67d: 0x4256, 0x67e: 0xa100, + // Block 0x1a, offset 0x680 + 0x681: 0x3c06, 0x683: 0xa000, 0x684: 0x3c0d, 0x685: 0xa000, + 0x687: 0x3c14, 0x688: 0xa000, 0x689: 0x3c1b, + 0x68d: 0xa000, + 0x6a0: 0x2f65, 0x6a1: 0xa000, 0x6a2: 0x3c29, + 0x6a4: 0xa000, 0x6a5: 0xa000, + 0x6ad: 0x3c22, 0x6ae: 0x2f60, 0x6af: 0x2f6a, + 0x6b0: 0x3c30, 0x6b1: 0x3c37, 0x6b2: 0xa000, 0x6b3: 0xa000, 0x6b4: 0x3c3e, 0x6b5: 0x3c45, + 0x6b6: 0xa000, 0x6b7: 0xa000, 0x6b8: 0x3c4c, 0x6b9: 0x3c53, 0x6ba: 0xa000, 0x6bb: 0xa000, + 0x6bc: 0xa000, 0x6bd: 0xa000, + // Block 0x1b, offset 0x6c0 + 0x6c0: 0x3c5a, 0x6c1: 0x3c61, 0x6c2: 0xa000, 0x6c3: 0xa000, 0x6c4: 0x3c76, 0x6c5: 0x3c7d, + 0x6c6: 0xa000, 0x6c7: 0xa000, 0x6c8: 0x3c84, 0x6c9: 0x3c8b, + 0x6d1: 0xa000, + 0x6d2: 0xa000, + 0x6e2: 0xa000, + 0x6e8: 0xa000, 0x6e9: 0xa000, + 0x6eb: 0xa000, 0x6ec: 0x3ca0, 0x6ed: 0x3ca7, 0x6ee: 0x3cae, 0x6ef: 0x3cb5, + 0x6f2: 0xa000, 0x6f3: 0xa000, 0x6f4: 0xa000, 0x6f5: 0xa000, + // Block 0x1c, offset 0x700 + 0x706: 0xa000, 0x70b: 0xa000, + 0x70c: 0x3f08, 0x70d: 0xa000, 0x70e: 0x3f10, 0x70f: 0xa000, 0x710: 0x3f18, 0x711: 0xa000, + 0x712: 0x3f20, 0x713: 0xa000, 0x714: 0x3f28, 0x715: 0xa000, 0x716: 0x3f30, 0x717: 0xa000, + 0x718: 0x3f38, 0x719: 0xa000, 0x71a: 0x3f40, 0x71b: 0xa000, 0x71c: 0x3f48, 0x71d: 0xa000, + 0x71e: 0x3f50, 0x71f: 0xa000, 0x720: 0x3f58, 0x721: 0xa000, 0x722: 0x3f60, + 0x724: 0xa000, 0x725: 0x3f68, 0x726: 0xa000, 0x727: 0x3f70, 0x728: 0xa000, 0x729: 0x3f78, + 0x72f: 0xa000, + 0x730: 0x3f80, 0x731: 0x3f88, 0x732: 0xa000, 0x733: 0x3f90, 0x734: 0x3f98, 0x735: 0xa000, + 0x736: 0x3fa0, 0x737: 0x3fa8, 0x738: 0xa000, 0x739: 0x3fb0, 0x73a: 0x3fb8, 0x73b: 0xa000, + 0x73c: 0x3fc0, 0x73d: 0x3fc8, + // Block 0x1d, offset 0x740 + 0x754: 0x3f00, + 0x759: 0x9903, 0x75a: 0x9903, 0x75b: 0x8100, 0x75c: 0x8100, 0x75d: 0xa000, + 0x75e: 0x3fd0, + 0x766: 0xa000, + 0x76b: 0xa000, 0x76c: 0x3fe0, 0x76d: 0xa000, 0x76e: 0x3fe8, 0x76f: 0xa000, + 0x770: 0x3ff0, 0x771: 0xa000, 0x772: 0x3ff8, 0x773: 0xa000, 0x774: 0x4000, 0x775: 0xa000, + 0x776: 0x4008, 0x777: 0xa000, 0x778: 0x4010, 0x779: 0xa000, 0x77a: 0x4018, 0x77b: 0xa000, + 0x77c: 0x4020, 0x77d: 0xa000, 0x77e: 0x4028, 0x77f: 0xa000, + // Block 0x1e, offset 0x780 + 0x780: 0x4030, 0x781: 0xa000, 0x782: 0x4038, 0x784: 0xa000, 0x785: 0x4040, + 0x786: 0xa000, 0x787: 0x4048, 0x788: 0xa000, 0x789: 0x4050, + 0x78f: 0xa000, 0x790: 0x4058, 0x791: 0x4060, + 0x792: 0xa000, 0x793: 0x4068, 0x794: 0x4070, 0x795: 0xa000, 0x796: 0x4078, 0x797: 0x4080, + 0x798: 0xa000, 0x799: 0x4088, 0x79a: 0x4090, 0x79b: 0xa000, 0x79c: 0x4098, 0x79d: 0x40a0, + 0x7af: 0xa000, + 0x7b0: 0xa000, 0x7b1: 0xa000, 0x7b2: 0xa000, 0x7b4: 0x3fd8, + 0x7b7: 0x40a8, 0x7b8: 0x40b0, 0x7b9: 0x40b8, 0x7ba: 0x40c0, + 0x7bd: 0xa000, 0x7be: 0x40c8, + // Block 0x1f, offset 0x7c0 + 0x7c0: 0x1377, 0x7c1: 0x0cfb, 0x7c2: 0x13d3, 0x7c3: 0x139f, 0x7c4: 0x0e57, 0x7c5: 0x06eb, + 0x7c6: 0x08df, 0x7c7: 0x162b, 0x7c8: 0x162b, 0x7c9: 0x0a0b, 0x7ca: 0x145f, 0x7cb: 0x0943, + 0x7cc: 0x0a07, 0x7cd: 0x0bef, 0x7ce: 0x0fcf, 0x7cf: 0x115f, 0x7d0: 0x1297, 0x7d1: 0x12d3, + 0x7d2: 0x1307, 0x7d3: 0x141b, 0x7d4: 0x0d73, 0x7d5: 0x0dff, 0x7d6: 0x0eab, 0x7d7: 0x0f43, + 0x7d8: 0x125f, 0x7d9: 0x1447, 0x7da: 0x1573, 0x7db: 0x070f, 0x7dc: 0x08b3, 0x7dd: 0x0d87, + 0x7de: 0x0ecf, 0x7df: 0x1293, 0x7e0: 0x15c3, 0x7e1: 0x0ab3, 0x7e2: 0x0e77, 0x7e3: 0x1283, + 0x7e4: 0x1317, 0x7e5: 0x0c23, 0x7e6: 0x11bb, 0x7e7: 0x12df, 0x7e8: 0x0b1f, 0x7e9: 0x0d0f, + 0x7ea: 0x0e17, 0x7eb: 0x0f1b, 0x7ec: 0x1427, 0x7ed: 0x074f, 0x7ee: 0x07e7, 0x7ef: 0x0853, + 0x7f0: 0x0c8b, 0x7f1: 0x0d7f, 0x7f2: 0x0ecb, 0x7f3: 0x0fef, 0x7f4: 0x1177, 0x7f5: 0x128b, + 0x7f6: 0x12a3, 0x7f7: 0x13c7, 0x7f8: 0x14ef, 0x7f9: 0x15a3, 0x7fa: 0x15bf, 0x7fb: 0x102b, + 0x7fc: 0x106b, 0x7fd: 0x1123, 0x7fe: 0x1243, 0x7ff: 0x147b, + // Block 0x20, offset 0x800 + 0x800: 0x15cb, 0x801: 0x134b, 0x802: 0x09c7, 0x803: 0x0b3b, 0x804: 0x10db, 0x805: 0x119b, + 0x806: 0x0eff, 0x807: 0x1033, 0x808: 0x1397, 0x809: 0x14e7, 0x80a: 0x09c3, 0x80b: 0x0a8f, + 0x80c: 0x0d77, 0x80d: 0x0e2b, 0x80e: 0x0e5f, 0x80f: 0x1113, 0x810: 0x113b, 0x811: 0x14a7, + 0x812: 0x084f, 0x813: 0x11a7, 0x814: 0x07f3, 0x815: 0x07ef, 0x816: 0x1097, 0x817: 0x1127, + 0x818: 0x125b, 0x819: 0x14af, 0x81a: 0x1367, 0x81b: 0x0c27, 0x81c: 0x0d73, 0x81d: 0x1357, + 0x81e: 0x06f7, 0x81f: 0x0a63, 0x820: 0x0b93, 0x821: 0x0f2f, 0x822: 0x0faf, 0x823: 0x0873, + 0x824: 0x103b, 0x825: 0x075f, 0x826: 0x0b77, 0x827: 0x06d7, 0x828: 0x0deb, 0x829: 0x0ca3, + 0x82a: 0x110f, 0x82b: 0x08c7, 0x82c: 0x09b3, 0x82d: 0x0ffb, 0x82e: 0x1263, 0x82f: 0x133b, + 0x830: 0x0db7, 0x831: 0x13f7, 0x832: 0x0de3, 0x833: 0x0c37, 0x834: 0x121b, 0x835: 0x0c57, + 0x836: 0x0fab, 0x837: 0x072b, 0x838: 0x07a7, 0x839: 0x07eb, 0x83a: 0x0d53, 0x83b: 0x10fb, + 0x83c: 0x11f3, 0x83d: 0x1347, 0x83e: 0x145b, 0x83f: 0x085b, + // Block 0x21, offset 0x840 + 0x840: 0x090f, 0x841: 0x0a17, 0x842: 0x0b2f, 0x843: 0x0cbf, 0x844: 0x0e7b, 0x845: 0x103f, + 0x846: 0x1497, 0x847: 0x157b, 0x848: 0x15cf, 0x849: 0x15e7, 0x84a: 0x0837, 0x84b: 0x0cf3, + 0x84c: 0x0da3, 0x84d: 0x13eb, 0x84e: 0x0afb, 0x84f: 0x0bd7, 0x850: 0x0bf3, 0x851: 0x0c83, + 0x852: 0x0e6b, 0x853: 0x0eb7, 0x854: 0x0f67, 0x855: 0x108b, 0x856: 0x112f, 0x857: 0x1193, + 0x858: 0x13db, 0x859: 0x126b, 0x85a: 0x1403, 0x85b: 0x147f, 0x85c: 0x080f, 0x85d: 0x083b, + 0x85e: 0x0923, 0x85f: 0x0ea7, 0x860: 0x12f3, 0x861: 0x133b, 0x862: 0x0b1b, 0x863: 0x0b8b, + 0x864: 0x0c4f, 0x865: 0x0daf, 0x866: 0x10d7, 0x867: 0x0f23, 0x868: 0x073b, 0x869: 0x097f, + 0x86a: 0x0a63, 0x86b: 0x0ac7, 0x86c: 0x0b97, 0x86d: 0x0f3f, 0x86e: 0x0f5b, 0x86f: 0x116b, + 0x870: 0x118b, 0x871: 0x1463, 0x872: 0x14e3, 0x873: 0x14f3, 0x874: 0x152f, 0x875: 0x0753, + 0x876: 0x107f, 0x877: 0x144f, 0x878: 0x14cb, 0x879: 0x0baf, 0x87a: 0x0717, 0x87b: 0x0777, + 0x87c: 0x0a67, 0x87d: 0x0a87, 0x87e: 0x0caf, 0x87f: 0x0d73, + // Block 0x22, offset 0x880 + 0x880: 0x0ec3, 0x881: 0x0fcb, 0x882: 0x1277, 0x883: 0x1417, 0x884: 0x1623, 0x885: 0x0ce3, + 0x886: 0x14a3, 0x887: 0x0833, 0x888: 0x0d2f, 0x889: 0x0d3b, 0x88a: 0x0e0f, 0x88b: 0x0e47, + 0x88c: 0x0f4b, 0x88d: 0x0fa7, 0x88e: 0x1027, 0x88f: 0x110b, 0x890: 0x153b, 0x891: 0x07af, + 0x892: 0x0c03, 0x893: 0x14b3, 0x894: 0x0767, 0x895: 0x0aab, 0x896: 0x0e2f, 0x897: 0x13df, + 0x898: 0x0b67, 0x899: 0x0bb7, 0x89a: 0x0d43, 0x89b: 0x0f2f, 0x89c: 0x14bb, 0x89d: 0x0817, + 0x89e: 0x08ff, 0x89f: 0x0a97, 0x8a0: 0x0cd3, 0x8a1: 0x0d1f, 0x8a2: 0x0d5f, 0x8a3: 0x0df3, + 0x8a4: 0x0f47, 0x8a5: 0x0fbb, 0x8a6: 0x1157, 0x8a7: 0x12f7, 0x8a8: 0x1303, 0x8a9: 0x1457, + 0x8aa: 0x14d7, 0x8ab: 0x0883, 0x8ac: 0x0e4b, 0x8ad: 0x0903, 0x8ae: 0x0ec7, 0x8af: 0x0f6b, + 0x8b0: 0x1287, 0x8b1: 0x14bf, 0x8b2: 0x15ab, 0x8b3: 0x15d3, 0x8b4: 0x0d37, 0x8b5: 0x0e27, + 0x8b6: 0x11c3, 0x8b7: 0x10b7, 0x8b8: 0x10c3, 0x8b9: 0x10e7, 0x8ba: 0x0f17, 0x8bb: 0x0e9f, + 0x8bc: 0x1363, 0x8bd: 0x0733, 0x8be: 0x122b, 0x8bf: 0x081b, + // Block 0x23, offset 0x8c0 + 0x8c0: 0x080b, 0x8c1: 0x0b0b, 0x8c2: 0x0c2b, 0x8c3: 0x10f3, 0x8c4: 0x0a53, 0x8c5: 0x0e03, + 0x8c6: 0x0cef, 0x8c7: 0x13e7, 0x8c8: 0x12e7, 0x8c9: 0x14ab, 0x8ca: 0x1323, 0x8cb: 0x0b27, + 0x8cc: 0x0787, 0x8cd: 0x095b, 0x8d0: 0x09af, + 0x8d2: 0x0cdf, 0x8d5: 0x07f7, 0x8d6: 0x0f1f, 0x8d7: 0x0fe3, + 0x8d8: 0x1047, 0x8d9: 0x1063, 0x8da: 0x1067, 0x8db: 0x107b, 0x8dc: 0x14fb, 0x8dd: 0x10eb, + 0x8de: 0x116f, 0x8e0: 0x128f, 0x8e2: 0x1353, + 0x8e5: 0x1407, 0x8e6: 0x1433, + 0x8ea: 0x154f, 0x8eb: 0x1553, 0x8ec: 0x1557, 0x8ed: 0x15bb, 0x8ee: 0x142b, 0x8ef: 0x14c7, + 0x8f0: 0x0757, 0x8f1: 0x077b, 0x8f2: 0x078f, 0x8f3: 0x084b, 0x8f4: 0x0857, 0x8f5: 0x0897, + 0x8f6: 0x094b, 0x8f7: 0x0967, 0x8f8: 0x096f, 0x8f9: 0x09ab, 0x8fa: 0x09b7, 0x8fb: 0x0a93, + 0x8fc: 0x0a9b, 0x8fd: 0x0ba3, 0x8fe: 0x0bcb, 0x8ff: 0x0bd3, + // Block 0x24, offset 0x900 + 0x900: 0x0beb, 0x901: 0x0c97, 0x902: 0x0cc7, 0x903: 0x0ce7, 0x904: 0x0d57, 0x905: 0x0e1b, + 0x906: 0x0e37, 0x907: 0x0e67, 0x908: 0x0ebb, 0x909: 0x0edb, 0x90a: 0x0f4f, 0x90b: 0x102f, + 0x90c: 0x104b, 0x90d: 0x1053, 0x90e: 0x104f, 0x90f: 0x1057, 0x910: 0x105b, 0x911: 0x105f, + 0x912: 0x1073, 0x913: 0x1077, 0x914: 0x109b, 0x915: 0x10af, 0x916: 0x10cb, 0x917: 0x112f, + 0x918: 0x1137, 0x919: 0x113f, 0x91a: 0x1153, 0x91b: 0x117b, 0x91c: 0x11cb, 0x91d: 0x11ff, + 0x91e: 0x11ff, 0x91f: 0x1267, 0x920: 0x130f, 0x921: 0x1327, 0x922: 0x135b, 0x923: 0x135f, + 0x924: 0x13a3, 0x925: 0x13a7, 0x926: 0x13ff, 0x927: 0x1407, 0x928: 0x14db, 0x929: 0x151f, + 0x92a: 0x1537, 0x92b: 0x0b9b, 0x92c: 0x171e, 0x92d: 0x11e3, + 0x930: 0x06df, 0x931: 0x07e3, 0x932: 0x07a3, 0x933: 0x074b, 0x934: 0x078b, 0x935: 0x07b7, + 0x936: 0x0847, 0x937: 0x0863, 0x938: 0x094b, 0x939: 0x0937, 0x93a: 0x0947, 0x93b: 0x0963, + 0x93c: 0x09af, 0x93d: 0x09bf, 0x93e: 0x0a03, 0x93f: 0x0a0f, + // Block 0x25, offset 0x940 + 0x940: 0x0a2b, 0x941: 0x0a3b, 0x942: 0x0b23, 0x943: 0x0b2b, 0x944: 0x0b5b, 0x945: 0x0b7b, + 0x946: 0x0bab, 0x947: 0x0bc3, 0x948: 0x0bb3, 0x949: 0x0bd3, 0x94a: 0x0bc7, 0x94b: 0x0beb, + 0x94c: 0x0c07, 0x94d: 0x0c5f, 0x94e: 0x0c6b, 0x94f: 0x0c73, 0x950: 0x0c9b, 0x951: 0x0cdf, + 0x952: 0x0d0f, 0x953: 0x0d13, 0x954: 0x0d27, 0x955: 0x0da7, 0x956: 0x0db7, 0x957: 0x0e0f, + 0x958: 0x0e5b, 0x959: 0x0e53, 0x95a: 0x0e67, 0x95b: 0x0e83, 0x95c: 0x0ebb, 0x95d: 0x1013, + 0x95e: 0x0edf, 0x95f: 0x0f13, 0x960: 0x0f1f, 0x961: 0x0f5f, 0x962: 0x0f7b, 0x963: 0x0f9f, + 0x964: 0x0fc3, 0x965: 0x0fc7, 0x966: 0x0fe3, 0x967: 0x0fe7, 0x968: 0x0ff7, 0x969: 0x100b, + 0x96a: 0x1007, 0x96b: 0x1037, 0x96c: 0x10b3, 0x96d: 0x10cb, 0x96e: 0x10e3, 0x96f: 0x111b, + 0x970: 0x112f, 0x971: 0x114b, 0x972: 0x117b, 0x973: 0x122f, 0x974: 0x1257, 0x975: 0x12cb, + 0x976: 0x1313, 0x977: 0x131f, 0x978: 0x1327, 0x979: 0x133f, 0x97a: 0x1353, 0x97b: 0x1343, + 0x97c: 0x135b, 0x97d: 0x1357, 0x97e: 0x134f, 0x97f: 0x135f, + // Block 0x26, offset 0x980 + 0x980: 0x136b, 0x981: 0x13a7, 0x982: 0x13e3, 0x983: 0x1413, 0x984: 0x144b, 0x985: 0x146b, + 0x986: 0x14b7, 0x987: 0x14db, 0x988: 0x14fb, 0x989: 0x150f, 0x98a: 0x151f, 0x98b: 0x152b, + 0x98c: 0x1537, 0x98d: 0x158b, 0x98e: 0x162b, 0x98f: 0x16b5, 0x990: 0x16b0, 0x991: 0x16e2, + 0x992: 0x0607, 0x993: 0x062f, 0x994: 0x0633, 0x995: 0x1764, 0x996: 0x1791, 0x997: 0x1809, + 0x998: 0x1617, 0x999: 0x1627, + // Block 0x27, offset 0x9c0 + 0x9c0: 0x06fb, 0x9c1: 0x06f3, 0x9c2: 0x0703, 0x9c3: 0x1647, 0x9c4: 0x0747, 0x9c5: 0x0757, + 0x9c6: 0x075b, 0x9c7: 0x0763, 0x9c8: 0x076b, 0x9c9: 0x076f, 0x9ca: 0x077b, 0x9cb: 0x0773, + 0x9cc: 0x05b3, 0x9cd: 0x165b, 0x9ce: 0x078f, 0x9cf: 0x0793, 0x9d0: 0x0797, 0x9d1: 0x07b3, + 0x9d2: 0x164c, 0x9d3: 0x05b7, 0x9d4: 0x079f, 0x9d5: 0x07bf, 0x9d6: 0x1656, 0x9d7: 0x07cf, + 0x9d8: 0x07d7, 0x9d9: 0x0737, 0x9da: 0x07df, 0x9db: 0x07e3, 0x9dc: 0x1831, 0x9dd: 0x07ff, + 0x9de: 0x0807, 0x9df: 0x05bf, 0x9e0: 0x081f, 0x9e1: 0x0823, 0x9e2: 0x082b, 0x9e3: 0x082f, + 0x9e4: 0x05c3, 0x9e5: 0x0847, 0x9e6: 0x084b, 0x9e7: 0x0857, 0x9e8: 0x0863, 0x9e9: 0x0867, + 0x9ea: 0x086b, 0x9eb: 0x0873, 0x9ec: 0x0893, 0x9ed: 0x0897, 0x9ee: 0x089f, 0x9ef: 0x08af, + 0x9f0: 0x08b7, 0x9f1: 0x08bb, 0x9f2: 0x08bb, 0x9f3: 0x08bb, 0x9f4: 0x166a, 0x9f5: 0x0e93, + 0x9f6: 0x08cf, 0x9f7: 0x08d7, 0x9f8: 0x166f, 0x9f9: 0x08e3, 0x9fa: 0x08eb, 0x9fb: 0x08f3, + 0x9fc: 0x091b, 0x9fd: 0x0907, 0x9fe: 0x0913, 0x9ff: 0x0917, + // Block 0x28, offset 0xa00 + 0xa00: 0x091f, 0xa01: 0x0927, 0xa02: 0x092b, 0xa03: 0x0933, 0xa04: 0x093b, 0xa05: 0x093f, + 0xa06: 0x093f, 0xa07: 0x0947, 0xa08: 0x094f, 0xa09: 0x0953, 0xa0a: 0x095f, 0xa0b: 0x0983, + 0xa0c: 0x0967, 0xa0d: 0x0987, 0xa0e: 0x096b, 0xa0f: 0x0973, 0xa10: 0x080b, 0xa11: 0x09cf, + 0xa12: 0x0997, 0xa13: 0x099b, 0xa14: 0x099f, 0xa15: 0x0993, 0xa16: 0x09a7, 0xa17: 0x09a3, + 0xa18: 0x09bb, 0xa19: 0x1674, 0xa1a: 0x09d7, 0xa1b: 0x09db, 0xa1c: 0x09e3, 0xa1d: 0x09ef, + 0xa1e: 0x09f7, 0xa1f: 0x0a13, 0xa20: 0x1679, 0xa21: 0x167e, 0xa22: 0x0a1f, 0xa23: 0x0a23, + 0xa24: 0x0a27, 0xa25: 0x0a1b, 0xa26: 0x0a2f, 0xa27: 0x05c7, 0xa28: 0x05cb, 0xa29: 0x0a37, + 0xa2a: 0x0a3f, 0xa2b: 0x0a3f, 0xa2c: 0x1683, 0xa2d: 0x0a5b, 0xa2e: 0x0a5f, 0xa2f: 0x0a63, + 0xa30: 0x0a6b, 0xa31: 0x1688, 0xa32: 0x0a73, 0xa33: 0x0a77, 0xa34: 0x0b4f, 0xa35: 0x0a7f, + 0xa36: 0x05cf, 0xa37: 0x0a8b, 0xa38: 0x0a9b, 0xa39: 0x0aa7, 0xa3a: 0x0aa3, 0xa3b: 0x1692, + 0xa3c: 0x0aaf, 0xa3d: 0x1697, 0xa3e: 0x0abb, 0xa3f: 0x0ab7, + // Block 0x29, offset 0xa40 + 0xa40: 0x0abf, 0xa41: 0x0acf, 0xa42: 0x0ad3, 0xa43: 0x05d3, 0xa44: 0x0ae3, 0xa45: 0x0aeb, + 0xa46: 0x0aef, 0xa47: 0x0af3, 0xa48: 0x05d7, 0xa49: 0x169c, 0xa4a: 0x05db, 0xa4b: 0x0b0f, + 0xa4c: 0x0b13, 0xa4d: 0x0b17, 0xa4e: 0x0b1f, 0xa4f: 0x1863, 0xa50: 0x0b37, 0xa51: 0x16a6, + 0xa52: 0x16a6, 0xa53: 0x11d7, 0xa54: 0x0b47, 0xa55: 0x0b47, 0xa56: 0x05df, 0xa57: 0x16c9, + 0xa58: 0x179b, 0xa59: 0x0b57, 0xa5a: 0x0b5f, 0xa5b: 0x05e3, 0xa5c: 0x0b73, 0xa5d: 0x0b83, + 0xa5e: 0x0b87, 0xa5f: 0x0b8f, 0xa60: 0x0b9f, 0xa61: 0x05eb, 0xa62: 0x05e7, 0xa63: 0x0ba3, + 0xa64: 0x16ab, 0xa65: 0x0ba7, 0xa66: 0x0bbb, 0xa67: 0x0bbf, 0xa68: 0x0bc3, 0xa69: 0x0bbf, + 0xa6a: 0x0bcf, 0xa6b: 0x0bd3, 0xa6c: 0x0be3, 0xa6d: 0x0bdb, 0xa6e: 0x0bdf, 0xa6f: 0x0be7, + 0xa70: 0x0beb, 0xa71: 0x0bef, 0xa72: 0x0bfb, 0xa73: 0x0bff, 0xa74: 0x0c17, 0xa75: 0x0c1f, + 0xa76: 0x0c2f, 0xa77: 0x0c43, 0xa78: 0x16ba, 0xa79: 0x0c3f, 0xa7a: 0x0c33, 0xa7b: 0x0c4b, + 0xa7c: 0x0c53, 0xa7d: 0x0c67, 0xa7e: 0x16bf, 0xa7f: 0x0c6f, + // Block 0x2a, offset 0xa80 + 0xa80: 0x0c63, 0xa81: 0x0c5b, 0xa82: 0x05ef, 0xa83: 0x0c77, 0xa84: 0x0c7f, 0xa85: 0x0c87, + 0xa86: 0x0c7b, 0xa87: 0x05f3, 0xa88: 0x0c97, 0xa89: 0x0c9f, 0xa8a: 0x16c4, 0xa8b: 0x0ccb, + 0xa8c: 0x0cff, 0xa8d: 0x0cdb, 0xa8e: 0x05ff, 0xa8f: 0x0ce7, 0xa90: 0x05fb, 0xa91: 0x05f7, + 0xa92: 0x07c3, 0xa93: 0x07c7, 0xa94: 0x0d03, 0xa95: 0x0ceb, 0xa96: 0x11ab, 0xa97: 0x0663, + 0xa98: 0x0d0f, 0xa99: 0x0d13, 0xa9a: 0x0d17, 0xa9b: 0x0d2b, 0xa9c: 0x0d23, 0xa9d: 0x16dd, + 0xa9e: 0x0603, 0xa9f: 0x0d3f, 0xaa0: 0x0d33, 0xaa1: 0x0d4f, 0xaa2: 0x0d57, 0xaa3: 0x16e7, + 0xaa4: 0x0d5b, 0xaa5: 0x0d47, 0xaa6: 0x0d63, 0xaa7: 0x0607, 0xaa8: 0x0d67, 0xaa9: 0x0d6b, + 0xaaa: 0x0d6f, 0xaab: 0x0d7b, 0xaac: 0x16ec, 0xaad: 0x0d83, 0xaae: 0x060b, 0xaaf: 0x0d8f, + 0xab0: 0x16f1, 0xab1: 0x0d93, 0xab2: 0x060f, 0xab3: 0x0d9f, 0xab4: 0x0dab, 0xab5: 0x0db7, + 0xab6: 0x0dbb, 0xab7: 0x16f6, 0xab8: 0x168d, 0xab9: 0x16fb, 0xaba: 0x0ddb, 0xabb: 0x1700, + 0xabc: 0x0de7, 0xabd: 0x0def, 0xabe: 0x0ddf, 0xabf: 0x0dfb, + // Block 0x2b, offset 0xac0 + 0xac0: 0x0e0b, 0xac1: 0x0e1b, 0xac2: 0x0e0f, 0xac3: 0x0e13, 0xac4: 0x0e1f, 0xac5: 0x0e23, + 0xac6: 0x1705, 0xac7: 0x0e07, 0xac8: 0x0e3b, 0xac9: 0x0e3f, 0xaca: 0x0613, 0xacb: 0x0e53, + 0xacc: 0x0e4f, 0xacd: 0x170a, 0xace: 0x0e33, 0xacf: 0x0e6f, 0xad0: 0x170f, 0xad1: 0x1714, + 0xad2: 0x0e73, 0xad3: 0x0e87, 0xad4: 0x0e83, 0xad5: 0x0e7f, 0xad6: 0x0617, 0xad7: 0x0e8b, + 0xad8: 0x0e9b, 0xad9: 0x0e97, 0xada: 0x0ea3, 0xadb: 0x1651, 0xadc: 0x0eb3, 0xadd: 0x1719, + 0xade: 0x0ebf, 0xadf: 0x1723, 0xae0: 0x0ed3, 0xae1: 0x0edf, 0xae2: 0x0ef3, 0xae3: 0x1728, + 0xae4: 0x0f07, 0xae5: 0x0f0b, 0xae6: 0x172d, 0xae7: 0x1732, 0xae8: 0x0f27, 0xae9: 0x0f37, + 0xaea: 0x061b, 0xaeb: 0x0f3b, 0xaec: 0x061f, 0xaed: 0x061f, 0xaee: 0x0f53, 0xaef: 0x0f57, + 0xaf0: 0x0f5f, 0xaf1: 0x0f63, 0xaf2: 0x0f6f, 0xaf3: 0x0623, 0xaf4: 0x0f87, 0xaf5: 0x1737, + 0xaf6: 0x0fa3, 0xaf7: 0x173c, 0xaf8: 0x0faf, 0xaf9: 0x16a1, 0xafa: 0x0fbf, 0xafb: 0x1741, + 0xafc: 0x1746, 0xafd: 0x174b, 0xafe: 0x0627, 0xaff: 0x062b, + // Block 0x2c, offset 0xb00 + 0xb00: 0x0ff7, 0xb01: 0x1755, 0xb02: 0x1750, 0xb03: 0x175a, 0xb04: 0x175f, 0xb05: 0x0fff, + 0xb06: 0x1003, 0xb07: 0x1003, 0xb08: 0x100b, 0xb09: 0x0633, 0xb0a: 0x100f, 0xb0b: 0x0637, + 0xb0c: 0x063b, 0xb0d: 0x1769, 0xb0e: 0x1023, 0xb0f: 0x102b, 0xb10: 0x1037, 0xb11: 0x063f, + 0xb12: 0x176e, 0xb13: 0x105b, 0xb14: 0x1773, 0xb15: 0x1778, 0xb16: 0x107b, 0xb17: 0x1093, + 0xb18: 0x0643, 0xb19: 0x109b, 0xb1a: 0x109f, 0xb1b: 0x10a3, 0xb1c: 0x177d, 0xb1d: 0x1782, + 0xb1e: 0x1782, 0xb1f: 0x10bb, 0xb20: 0x0647, 0xb21: 0x1787, 0xb22: 0x10cf, 0xb23: 0x10d3, + 0xb24: 0x064b, 0xb25: 0x178c, 0xb26: 0x10ef, 0xb27: 0x064f, 0xb28: 0x10ff, 0xb29: 0x10f7, + 0xb2a: 0x1107, 0xb2b: 0x1796, 0xb2c: 0x111f, 0xb2d: 0x0653, 0xb2e: 0x112b, 0xb2f: 0x1133, + 0xb30: 0x1143, 0xb31: 0x0657, 0xb32: 0x17a0, 0xb33: 0x17a5, 0xb34: 0x065b, 0xb35: 0x17aa, + 0xb36: 0x115b, 0xb37: 0x17af, 0xb38: 0x1167, 0xb39: 0x1173, 0xb3a: 0x117b, 0xb3b: 0x17b4, + 0xb3c: 0x17b9, 0xb3d: 0x118f, 0xb3e: 0x17be, 0xb3f: 0x1197, + // Block 0x2d, offset 0xb40 + 0xb40: 0x16ce, 0xb41: 0x065f, 0xb42: 0x11af, 0xb43: 0x11b3, 0xb44: 0x0667, 0xb45: 0x11b7, + 0xb46: 0x0a33, 0xb47: 0x17c3, 0xb48: 0x17c8, 0xb49: 0x16d3, 0xb4a: 0x16d8, 0xb4b: 0x11d7, + 0xb4c: 0x11db, 0xb4d: 0x13f3, 0xb4e: 0x066b, 0xb4f: 0x1207, 0xb50: 0x1203, 0xb51: 0x120b, + 0xb52: 0x083f, 0xb53: 0x120f, 0xb54: 0x1213, 0xb55: 0x1217, 0xb56: 0x121f, 0xb57: 0x17cd, + 0xb58: 0x121b, 0xb59: 0x1223, 0xb5a: 0x1237, 0xb5b: 0x123b, 0xb5c: 0x1227, 0xb5d: 0x123f, + 0xb5e: 0x1253, 0xb5f: 0x1267, 0xb60: 0x1233, 0xb61: 0x1247, 0xb62: 0x124b, 0xb63: 0x124f, + 0xb64: 0x17d2, 0xb65: 0x17dc, 0xb66: 0x17d7, 0xb67: 0x066f, 0xb68: 0x126f, 0xb69: 0x1273, + 0xb6a: 0x127b, 0xb6b: 0x17f0, 0xb6c: 0x127f, 0xb6d: 0x17e1, 0xb6e: 0x0673, 0xb6f: 0x0677, + 0xb70: 0x17e6, 0xb71: 0x17eb, 0xb72: 0x067b, 0xb73: 0x129f, 0xb74: 0x12a3, 0xb75: 0x12a7, + 0xb76: 0x12ab, 0xb77: 0x12b7, 0xb78: 0x12b3, 0xb79: 0x12bf, 0xb7a: 0x12bb, 0xb7b: 0x12cb, + 0xb7c: 0x12c3, 0xb7d: 0x12c7, 0xb7e: 0x12cf, 0xb7f: 0x067f, + // Block 0x2e, offset 0xb80 + 0xb80: 0x12d7, 0xb81: 0x12db, 0xb82: 0x0683, 0xb83: 0x12eb, 0xb84: 0x12ef, 0xb85: 0x17f5, + 0xb86: 0x12fb, 0xb87: 0x12ff, 0xb88: 0x0687, 0xb89: 0x130b, 0xb8a: 0x05bb, 0xb8b: 0x17fa, + 0xb8c: 0x17ff, 0xb8d: 0x068b, 0xb8e: 0x068f, 0xb8f: 0x1337, 0xb90: 0x134f, 0xb91: 0x136b, + 0xb92: 0x137b, 0xb93: 0x1804, 0xb94: 0x138f, 0xb95: 0x1393, 0xb96: 0x13ab, 0xb97: 0x13b7, + 0xb98: 0x180e, 0xb99: 0x1660, 0xb9a: 0x13c3, 0xb9b: 0x13bf, 0xb9c: 0x13cb, 0xb9d: 0x1665, + 0xb9e: 0x13d7, 0xb9f: 0x13e3, 0xba0: 0x1813, 0xba1: 0x1818, 0xba2: 0x1423, 0xba3: 0x142f, + 0xba4: 0x1437, 0xba5: 0x181d, 0xba6: 0x143b, 0xba7: 0x1467, 0xba8: 0x1473, 0xba9: 0x1477, + 0xbaa: 0x146f, 0xbab: 0x1483, 0xbac: 0x1487, 0xbad: 0x1822, 0xbae: 0x1493, 0xbaf: 0x0693, + 0xbb0: 0x149b, 0xbb1: 0x1827, 0xbb2: 0x0697, 0xbb3: 0x14d3, 0xbb4: 0x0ac3, 0xbb5: 0x14eb, + 0xbb6: 0x182c, 0xbb7: 0x1836, 0xbb8: 0x069b, 0xbb9: 0x069f, 0xbba: 0x1513, 0xbbb: 0x183b, + 0xbbc: 0x06a3, 0xbbd: 0x1840, 0xbbe: 0x152b, 0xbbf: 0x152b, + // Block 0x2f, offset 0xbc0 + 0xbc0: 0x1533, 0xbc1: 0x1845, 0xbc2: 0x154b, 0xbc3: 0x06a7, 0xbc4: 0x155b, 0xbc5: 0x1567, + 0xbc6: 0x156f, 0xbc7: 0x1577, 0xbc8: 0x06ab, 0xbc9: 0x184a, 0xbca: 0x158b, 0xbcb: 0x15a7, + 0xbcc: 0x15b3, 0xbcd: 0x06af, 0xbce: 0x06b3, 0xbcf: 0x15b7, 0xbd0: 0x184f, 0xbd1: 0x06b7, + 0xbd2: 0x1854, 0xbd3: 0x1859, 0xbd4: 0x185e, 0xbd5: 0x15db, 0xbd6: 0x06bb, 0xbd7: 0x15ef, + 0xbd8: 0x15f7, 0xbd9: 0x15fb, 0xbda: 0x1603, 0xbdb: 0x160b, 0xbdc: 0x1613, 0xbdd: 0x1868, +} + +// nfcIndex: 22 blocks, 1408 entries, 1408 bytes +// Block 0 is the zero block. +var nfcIndex = [1408]uint8{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x2e, 0xc3: 0x01, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x2f, 0xc7: 0x04, + 0xc8: 0x05, 0xca: 0x30, 0xcb: 0x31, 0xcc: 0x06, 0xcd: 0x07, 0xce: 0x08, 0xcf: 0x32, + 0xd0: 0x09, 0xd1: 0x33, 0xd2: 0x34, 0xd3: 0x0a, 0xd6: 0x0b, 0xd7: 0x35, + 0xd8: 0x36, 0xd9: 0x0c, 0xdb: 0x37, 0xdc: 0x38, 0xdd: 0x39, 0xdf: 0x3a, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x08, 0xed: 0x09, 0xef: 0x0a, + 0xf0: 0x13, + // Block 0x4, offset 0x100 + 0x120: 0x3b, 0x121: 0x3c, 0x123: 0x0d, 0x124: 0x3d, 0x125: 0x3e, 0x126: 0x3f, 0x127: 0x40, + 0x128: 0x41, 0x129: 0x42, 0x12a: 0x43, 0x12b: 0x44, 0x12c: 0x3f, 0x12d: 0x45, 0x12e: 0x46, 0x12f: 0x47, + 0x131: 0x48, 0x132: 0x49, 0x133: 0x4a, 0x134: 0x4b, 0x135: 0x4c, 0x137: 0x4d, + 0x138: 0x4e, 0x139: 0x4f, 0x13a: 0x50, 0x13b: 0x51, 0x13c: 0x52, 0x13d: 0x53, 0x13e: 0x54, 0x13f: 0x55, + // Block 0x5, offset 0x140 + 0x140: 0x56, 0x142: 0x57, 0x144: 0x58, 0x145: 0x59, 0x146: 0x5a, 0x147: 0x5b, + 0x14d: 0x5c, + 0x15c: 0x5d, 0x15f: 0x5e, + 0x162: 0x5f, 0x164: 0x60, + 0x168: 0x61, 0x169: 0x62, 0x16a: 0x63, 0x16c: 0x0e, 0x16d: 0x64, 0x16e: 0x65, 0x16f: 0x66, + 0x170: 0x67, 0x173: 0x68, 0x177: 0x0f, + 0x178: 0x10, 0x179: 0x11, 0x17a: 0x12, 0x17b: 0x13, 0x17c: 0x14, 0x17d: 0x15, 0x17e: 0x16, 0x17f: 0x17, + // Block 0x6, offset 0x180 + 0x180: 0x69, 0x183: 0x6a, 0x184: 0x6b, 0x186: 0x6c, 0x187: 0x6d, + 0x188: 0x6e, 0x189: 0x18, 0x18a: 0x19, 0x18b: 0x6f, 0x18c: 0x70, + 0x1ab: 0x71, + 0x1b3: 0x72, 0x1b5: 0x73, 0x1b7: 0x74, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x75, 0x1c1: 0x1a, 0x1c2: 0x1b, 0x1c3: 0x1c, 0x1c4: 0x76, 0x1c5: 0x77, + 0x1c9: 0x78, 0x1cc: 0x79, 0x1cd: 0x7a, + // Block 0x8, offset 0x200 + 0x219: 0x7b, 0x21a: 0x7c, 0x21b: 0x7d, + 0x220: 0x7e, 0x223: 0x7f, 0x224: 0x80, 0x225: 0x81, 0x226: 0x82, 0x227: 0x83, + 0x22a: 0x84, 0x22b: 0x85, 0x22f: 0x86, + 0x230: 0x87, 0x231: 0x88, 0x232: 0x89, 0x233: 0x8a, 0x234: 0x8b, 0x235: 0x8c, 0x236: 0x8d, 0x237: 0x87, + 0x238: 0x88, 0x239: 0x89, 0x23a: 0x8a, 0x23b: 0x8b, 0x23c: 0x8c, 0x23d: 0x8d, 0x23e: 0x87, 0x23f: 0x88, + // Block 0x9, offset 0x240 + 0x240: 0x89, 0x241: 0x8a, 0x242: 0x8b, 0x243: 0x8c, 0x244: 0x8d, 0x245: 0x87, 0x246: 0x88, 0x247: 0x89, + 0x248: 0x8a, 0x249: 0x8b, 0x24a: 0x8c, 0x24b: 0x8d, 0x24c: 0x87, 0x24d: 0x88, 0x24e: 0x89, 0x24f: 0x8a, + 0x250: 0x8b, 0x251: 0x8c, 0x252: 0x8d, 0x253: 0x87, 0x254: 0x88, 0x255: 0x89, 0x256: 0x8a, 0x257: 0x8b, + 0x258: 0x8c, 0x259: 0x8d, 0x25a: 0x87, 0x25b: 0x88, 0x25c: 0x89, 0x25d: 0x8a, 0x25e: 0x8b, 0x25f: 0x8c, + 0x260: 0x8d, 0x261: 0x87, 0x262: 0x88, 0x263: 0x89, 0x264: 0x8a, 0x265: 0x8b, 0x266: 0x8c, 0x267: 0x8d, + 0x268: 0x87, 0x269: 0x88, 0x26a: 0x89, 0x26b: 0x8a, 0x26c: 0x8b, 0x26d: 0x8c, 0x26e: 0x8d, 0x26f: 0x87, + 0x270: 0x88, 0x271: 0x89, 0x272: 0x8a, 0x273: 0x8b, 0x274: 0x8c, 0x275: 0x8d, 0x276: 0x87, 0x277: 0x88, + 0x278: 0x89, 0x279: 0x8a, 0x27a: 0x8b, 0x27b: 0x8c, 0x27c: 0x8d, 0x27d: 0x87, 0x27e: 0x88, 0x27f: 0x89, + // Block 0xa, offset 0x280 + 0x280: 0x8a, 0x281: 0x8b, 0x282: 0x8c, 0x283: 0x8d, 0x284: 0x87, 0x285: 0x88, 0x286: 0x89, 0x287: 0x8a, + 0x288: 0x8b, 0x289: 0x8c, 0x28a: 0x8d, 0x28b: 0x87, 0x28c: 0x88, 0x28d: 0x89, 0x28e: 0x8a, 0x28f: 0x8b, + 0x290: 0x8c, 0x291: 0x8d, 0x292: 0x87, 0x293: 0x88, 0x294: 0x89, 0x295: 0x8a, 0x296: 0x8b, 0x297: 0x8c, + 0x298: 0x8d, 0x299: 0x87, 0x29a: 0x88, 0x29b: 0x89, 0x29c: 0x8a, 0x29d: 0x8b, 0x29e: 0x8c, 0x29f: 0x8d, + 0x2a0: 0x87, 0x2a1: 0x88, 0x2a2: 0x89, 0x2a3: 0x8a, 0x2a4: 0x8b, 0x2a5: 0x8c, 0x2a6: 0x8d, 0x2a7: 0x87, + 0x2a8: 0x88, 0x2a9: 0x89, 0x2aa: 0x8a, 0x2ab: 0x8b, 0x2ac: 0x8c, 0x2ad: 0x8d, 0x2ae: 0x87, 0x2af: 0x88, + 0x2b0: 0x89, 0x2b1: 0x8a, 0x2b2: 0x8b, 0x2b3: 0x8c, 0x2b4: 0x8d, 0x2b5: 0x87, 0x2b6: 0x88, 0x2b7: 0x89, + 0x2b8: 0x8a, 0x2b9: 0x8b, 0x2ba: 0x8c, 0x2bb: 0x8d, 0x2bc: 0x87, 0x2bd: 0x88, 0x2be: 0x89, 0x2bf: 0x8a, + // Block 0xb, offset 0x2c0 + 0x2c0: 0x8b, 0x2c1: 0x8c, 0x2c2: 0x8d, 0x2c3: 0x87, 0x2c4: 0x88, 0x2c5: 0x89, 0x2c6: 0x8a, 0x2c7: 0x8b, + 0x2c8: 0x8c, 0x2c9: 0x8d, 0x2ca: 0x87, 0x2cb: 0x88, 0x2cc: 0x89, 0x2cd: 0x8a, 0x2ce: 0x8b, 0x2cf: 0x8c, + 0x2d0: 0x8d, 0x2d1: 0x87, 0x2d2: 0x88, 0x2d3: 0x89, 0x2d4: 0x8a, 0x2d5: 0x8b, 0x2d6: 0x8c, 0x2d7: 0x8d, + 0x2d8: 0x87, 0x2d9: 0x88, 0x2da: 0x89, 0x2db: 0x8a, 0x2dc: 0x8b, 0x2dd: 0x8c, 0x2de: 0x8e, + // Block 0xc, offset 0x300 + 0x324: 0x1d, 0x325: 0x1e, 0x326: 0x1f, 0x327: 0x20, + 0x328: 0x21, 0x329: 0x22, 0x32a: 0x23, 0x32b: 0x24, 0x32c: 0x8f, 0x32d: 0x90, 0x32e: 0x91, + 0x331: 0x92, 0x332: 0x93, 0x333: 0x94, 0x334: 0x95, + 0x338: 0x96, 0x339: 0x97, 0x33a: 0x98, 0x33b: 0x99, 0x33e: 0x9a, 0x33f: 0x9b, + // Block 0xd, offset 0x340 + 0x347: 0x9c, + 0x34b: 0x9d, 0x34d: 0x9e, + 0x368: 0x9f, 0x36b: 0xa0, + 0x374: 0xa1, + 0x37d: 0xa2, + // Block 0xe, offset 0x380 + 0x381: 0xa3, 0x382: 0xa4, 0x384: 0xa5, 0x385: 0x82, 0x387: 0xa6, + 0x388: 0xa7, 0x38b: 0xa8, 0x38c: 0xa9, 0x38d: 0xaa, + 0x391: 0xab, 0x392: 0xac, 0x393: 0xad, 0x396: 0xae, 0x397: 0xaf, + 0x398: 0x73, 0x39a: 0xb0, 0x39c: 0xb1, + 0x3a0: 0xb2, + 0x3a8: 0xb3, 0x3a9: 0xb4, 0x3aa: 0xb5, + 0x3b0: 0x73, 0x3b5: 0xb6, 0x3b6: 0xb7, + // Block 0xf, offset 0x3c0 + 0x3eb: 0xb8, 0x3ec: 0xb9, + // Block 0x10, offset 0x400 + 0x432: 0xba, + // Block 0x11, offset 0x440 + 0x445: 0xbb, 0x446: 0xbc, 0x447: 0xbd, + 0x449: 0xbe, + // Block 0x12, offset 0x480 + 0x480: 0xbf, + 0x4a3: 0xc0, 0x4a5: 0xc1, + // Block 0x13, offset 0x4c0 + 0x4c8: 0xc2, + // Block 0x14, offset 0x500 + 0x520: 0x25, 0x521: 0x26, 0x522: 0x27, 0x523: 0x28, 0x524: 0x29, 0x525: 0x2a, 0x526: 0x2b, 0x527: 0x2c, + 0x528: 0x2d, + // Block 0x15, offset 0x540 + 0x550: 0x0b, 0x551: 0x0c, 0x556: 0x0d, + 0x55b: 0x0e, 0x55d: 0x0f, 0x55e: 0x10, 0x55f: 0x11, + 0x56f: 0x12, +} + +// nfcSparseOffset: 149 entries, 298 bytes +var nfcSparseOffset = []uint16{0x0, 0x5, 0x9, 0xb, 0xd, 0x18, 0x28, 0x2a, 0x2f, 0x3a, 0x49, 0x56, 0x5e, 0x63, 0x68, 0x6a, 0x72, 0x79, 0x7c, 0x84, 0x88, 0x8c, 0x8e, 0x90, 0x99, 0x9d, 0xa4, 0xa9, 0xac, 0xb6, 0xb9, 0xc0, 0xc8, 0xcb, 0xcd, 0xcf, 0xd1, 0xd6, 0xe7, 0xf3, 0xf5, 0xfb, 0xfd, 0xff, 0x101, 0x103, 0x105, 0x107, 0x10a, 0x10d, 0x10f, 0x112, 0x115, 0x119, 0x11e, 0x127, 0x129, 0x12c, 0x12e, 0x139, 0x13d, 0x14b, 0x14e, 0x154, 0x15a, 0x165, 0x169, 0x16b, 0x16d, 0x16f, 0x171, 0x173, 0x179, 0x17d, 0x17f, 0x181, 0x189, 0x18d, 0x190, 0x192, 0x194, 0x196, 0x199, 0x19b, 0x19d, 0x19f, 0x1a1, 0x1a7, 0x1aa, 0x1ac, 0x1b3, 0x1b9, 0x1bf, 0x1c7, 0x1cd, 0x1d3, 0x1d9, 0x1dd, 0x1eb, 0x1f4, 0x1f7, 0x1fa, 0x1fc, 0x1ff, 0x201, 0x205, 0x20a, 0x20c, 0x20e, 0x213, 0x219, 0x21b, 0x21d, 0x21f, 0x225, 0x228, 0x22a, 0x230, 0x233, 0x23b, 0x242, 0x245, 0x248, 0x24a, 0x24d, 0x255, 0x259, 0x260, 0x263, 0x269, 0x26b, 0x26e, 0x270, 0x273, 0x275, 0x277, 0x279, 0x27c, 0x27e, 0x280, 0x282, 0x284, 0x291, 0x29b, 0x29d, 0x29f, 0x2a5, 0x2a7, 0x2aa} + +// nfcSparseValues: 684 entries, 2736 bytes +var nfcSparseValues = [684]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0000, lo: 0x04}, + {value: 0xa100, lo: 0xa8, hi: 0xa8}, + {value: 0x8100, lo: 0xaf, hi: 0xaf}, + {value: 0x8100, lo: 0xb4, hi: 0xb4}, + {value: 0x8100, lo: 0xb8, hi: 0xb8}, + // Block 0x1, offset 0x5 + {value: 0x0091, lo: 0x03}, + {value: 0x46e2, lo: 0xa0, hi: 0xa1}, + {value: 0x4714, lo: 0xaf, hi: 0xb0}, + {value: 0xa000, lo: 0xb7, hi: 0xb7}, + // Block 0x2, offset 0x9 + {value: 0x0000, lo: 0x01}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + // Block 0x3, offset 0xb + {value: 0x0000, lo: 0x01}, + {value: 0x8100, lo: 0x98, hi: 0x9d}, + // Block 0x4, offset 0xd + {value: 0x0006, lo: 0x0a}, + {value: 0xa000, lo: 0x81, hi: 0x81}, + {value: 0xa000, lo: 0x85, hi: 0x85}, + {value: 0xa000, lo: 0x89, hi: 0x89}, + {value: 0x4840, lo: 0x8a, hi: 0x8a}, + {value: 0x485e, lo: 0x8b, hi: 0x8b}, + {value: 0x36c7, lo: 0x8c, hi: 0x8c}, + {value: 0x36df, lo: 0x8d, hi: 0x8d}, + {value: 0x4876, lo: 0x8e, hi: 0x8e}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0x36fd, lo: 0x93, hi: 0x94}, + // Block 0x5, offset 0x18 + {value: 0x0000, lo: 0x0f}, + {value: 0xa000, lo: 0x83, hi: 0x83}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0xa000, lo: 0x8b, hi: 0x8b}, + {value: 0xa000, lo: 0x8d, hi: 0x8d}, + {value: 0x37a5, lo: 0x90, hi: 0x90}, + {value: 0x37b1, lo: 0x91, hi: 0x91}, + {value: 0x379f, lo: 0x93, hi: 0x93}, + {value: 0xa000, lo: 0x96, hi: 0x96}, + {value: 0x3817, lo: 0x97, hi: 0x97}, + {value: 0x37e1, lo: 0x9c, hi: 0x9c}, + {value: 0x37c9, lo: 0x9d, hi: 0x9d}, + {value: 0x37f3, lo: 0x9e, hi: 0x9e}, + {value: 0xa000, lo: 0xb4, hi: 0xb5}, + {value: 0x381d, lo: 0xb6, hi: 0xb6}, + {value: 0x3823, lo: 0xb7, hi: 0xb7}, + // Block 0x6, offset 0x28 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0x83, hi: 0x87}, + // Block 0x7, offset 0x2a + {value: 0x0001, lo: 0x04}, + {value: 0x8113, lo: 0x81, hi: 0x82}, + {value: 0x8132, lo: 0x84, hi: 0x84}, + {value: 0x812d, lo: 0x85, hi: 0x85}, + {value: 0x810d, lo: 0x87, hi: 0x87}, + // Block 0x8, offset 0x2f + {value: 0x0000, lo: 0x0a}, + {value: 0x8132, lo: 0x90, hi: 0x97}, + {value: 0x8119, lo: 0x98, hi: 0x98}, + {value: 0x811a, lo: 0x99, hi: 0x99}, + {value: 0x811b, lo: 0x9a, hi: 0x9a}, + {value: 0x3841, lo: 0xa2, hi: 0xa2}, + {value: 0x3847, lo: 0xa3, hi: 0xa3}, + {value: 0x3853, lo: 0xa4, hi: 0xa4}, + {value: 0x384d, lo: 0xa5, hi: 0xa5}, + {value: 0x3859, lo: 0xa6, hi: 0xa6}, + {value: 0xa000, lo: 0xa7, hi: 0xa7}, + // Block 0x9, offset 0x3a + {value: 0x0000, lo: 0x0e}, + {value: 0x386b, lo: 0x80, hi: 0x80}, + {value: 0xa000, lo: 0x81, hi: 0x81}, + {value: 0x385f, lo: 0x82, hi: 0x82}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0x3865, lo: 0x93, hi: 0x93}, + {value: 0xa000, lo: 0x95, hi: 0x95}, + {value: 0x8132, lo: 0x96, hi: 0x9c}, + {value: 0x8132, lo: 0x9f, hi: 0xa2}, + {value: 0x812d, lo: 0xa3, hi: 0xa3}, + {value: 0x8132, lo: 0xa4, hi: 0xa4}, + {value: 0x8132, lo: 0xa7, hi: 0xa8}, + {value: 0x812d, lo: 0xaa, hi: 0xaa}, + {value: 0x8132, lo: 0xab, hi: 0xac}, + {value: 0x812d, lo: 0xad, hi: 0xad}, + // Block 0xa, offset 0x49 + {value: 0x0000, lo: 0x0c}, + {value: 0x811f, lo: 0x91, hi: 0x91}, + {value: 0x8132, lo: 0xb0, hi: 0xb0}, + {value: 0x812d, lo: 0xb1, hi: 0xb1}, + {value: 0x8132, lo: 0xb2, hi: 0xb3}, + {value: 0x812d, lo: 0xb4, hi: 0xb4}, + {value: 0x8132, lo: 0xb5, hi: 0xb6}, + {value: 0x812d, lo: 0xb7, hi: 0xb9}, + {value: 0x8132, lo: 0xba, hi: 0xba}, + {value: 0x812d, lo: 0xbb, hi: 0xbc}, + {value: 0x8132, lo: 0xbd, hi: 0xbd}, + {value: 0x812d, lo: 0xbe, hi: 0xbe}, + {value: 0x8132, lo: 0xbf, hi: 0xbf}, + // Block 0xb, offset 0x56 + {value: 0x0005, lo: 0x07}, + {value: 0x8132, lo: 0x80, hi: 0x80}, + {value: 0x8132, lo: 0x81, hi: 0x81}, + {value: 0x812d, lo: 0x82, hi: 0x83}, + {value: 0x812d, lo: 0x84, hi: 0x85}, + {value: 0x812d, lo: 0x86, hi: 0x87}, + {value: 0x812d, lo: 0x88, hi: 0x89}, + {value: 0x8132, lo: 0x8a, hi: 0x8a}, + // Block 0xc, offset 0x5e + {value: 0x0000, lo: 0x04}, + {value: 0x8132, lo: 0xab, hi: 0xb1}, + {value: 0x812d, lo: 0xb2, hi: 0xb2}, + {value: 0x8132, lo: 0xb3, hi: 0xb3}, + {value: 0x812d, lo: 0xbd, hi: 0xbd}, + // Block 0xd, offset 0x63 + {value: 0x0000, lo: 0x04}, + {value: 0x8132, lo: 0x96, hi: 0x99}, + {value: 0x8132, lo: 0x9b, hi: 0xa3}, + {value: 0x8132, lo: 0xa5, hi: 0xa7}, + {value: 0x8132, lo: 0xa9, hi: 0xad}, + // Block 0xe, offset 0x68 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x99, hi: 0x9b}, + // Block 0xf, offset 0x6a + {value: 0x0000, lo: 0x07}, + {value: 0xa000, lo: 0xa8, hi: 0xa8}, + {value: 0x3ed8, lo: 0xa9, hi: 0xa9}, + {value: 0xa000, lo: 0xb0, hi: 0xb0}, + {value: 0x3ee0, lo: 0xb1, hi: 0xb1}, + {value: 0xa000, lo: 0xb3, hi: 0xb3}, + {value: 0x3ee8, lo: 0xb4, hi: 0xb4}, + {value: 0x9902, lo: 0xbc, hi: 0xbc}, + // Block 0x10, offset 0x72 + {value: 0x0008, lo: 0x06}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x8132, lo: 0x91, hi: 0x91}, + {value: 0x812d, lo: 0x92, hi: 0x92}, + {value: 0x8132, lo: 0x93, hi: 0x93}, + {value: 0x8132, lo: 0x94, hi: 0x94}, + {value: 0x451c, lo: 0x98, hi: 0x9f}, + // Block 0x11, offset 0x79 + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x12, offset 0x7c + {value: 0x0008, lo: 0x07}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0x2c9e, lo: 0x8b, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + {value: 0x455c, lo: 0x9c, hi: 0x9d}, + {value: 0x456c, lo: 0x9f, hi: 0x9f}, + {value: 0x8132, lo: 0xbe, hi: 0xbe}, + // Block 0x13, offset 0x84 + {value: 0x0000, lo: 0x03}, + {value: 0x4594, lo: 0xb3, hi: 0xb3}, + {value: 0x459c, lo: 0xb6, hi: 0xb6}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + // Block 0x14, offset 0x88 + {value: 0x0008, lo: 0x03}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x4574, lo: 0x99, hi: 0x9b}, + {value: 0x458c, lo: 0x9e, hi: 0x9e}, + // Block 0x15, offset 0x8c + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + // Block 0x16, offset 0x8e + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + // Block 0x17, offset 0x90 + {value: 0x0000, lo: 0x08}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0x2cb6, lo: 0x88, hi: 0x88}, + {value: 0x2cae, lo: 0x8b, hi: 0x8b}, + {value: 0x2cbe, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x96, hi: 0x97}, + {value: 0x45a4, lo: 0x9c, hi: 0x9c}, + {value: 0x45ac, lo: 0x9d, hi: 0x9d}, + // Block 0x18, offset 0x99 + {value: 0x0000, lo: 0x03}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0x2cc6, lo: 0x94, hi: 0x94}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x19, offset 0x9d + {value: 0x0000, lo: 0x06}, + {value: 0xa000, lo: 0x86, hi: 0x87}, + {value: 0x2cce, lo: 0x8a, hi: 0x8a}, + {value: 0x2cde, lo: 0x8b, hi: 0x8b}, + {value: 0x2cd6, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + // Block 0x1a, offset 0xa4 + {value: 0x1801, lo: 0x04}, + {value: 0xa000, lo: 0x86, hi: 0x86}, + {value: 0x3ef0, lo: 0x88, hi: 0x88}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x8120, lo: 0x95, hi: 0x96}, + // Block 0x1b, offset 0xa9 + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + {value: 0xa000, lo: 0xbf, hi: 0xbf}, + // Block 0x1c, offset 0xac + {value: 0x0000, lo: 0x09}, + {value: 0x2ce6, lo: 0x80, hi: 0x80}, + {value: 0x9900, lo: 0x82, hi: 0x82}, + {value: 0xa000, lo: 0x86, hi: 0x86}, + {value: 0x2cee, lo: 0x87, hi: 0x87}, + {value: 0x2cf6, lo: 0x88, hi: 0x88}, + {value: 0x2f50, lo: 0x8a, hi: 0x8a}, + {value: 0x2dd8, lo: 0x8b, hi: 0x8b}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x95, hi: 0x96}, + // Block 0x1d, offset 0xb6 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xbb, hi: 0xbc}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x1e, offset 0xb9 + {value: 0x0000, lo: 0x06}, + {value: 0xa000, lo: 0x86, hi: 0x87}, + {value: 0x2cfe, lo: 0x8a, hi: 0x8a}, + {value: 0x2d0e, lo: 0x8b, hi: 0x8b}, + {value: 0x2d06, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + // Block 0x1f, offset 0xc0 + {value: 0x6bea, lo: 0x07}, + {value: 0x9904, lo: 0x8a, hi: 0x8a}, + {value: 0x9900, lo: 0x8f, hi: 0x8f}, + {value: 0xa000, lo: 0x99, hi: 0x99}, + {value: 0x3ef8, lo: 0x9a, hi: 0x9a}, + {value: 0x2f58, lo: 0x9c, hi: 0x9c}, + {value: 0x2de3, lo: 0x9d, hi: 0x9d}, + {value: 0x2d16, lo: 0x9e, hi: 0x9f}, + // Block 0x20, offset 0xc8 + {value: 0x0000, lo: 0x02}, + {value: 0x8122, lo: 0xb8, hi: 0xb9}, + {value: 0x8104, lo: 0xba, hi: 0xba}, + // Block 0x21, offset 0xcb + {value: 0x0000, lo: 0x01}, + {value: 0x8123, lo: 0x88, hi: 0x8b}, + // Block 0x22, offset 0xcd + {value: 0x0000, lo: 0x01}, + {value: 0x8124, lo: 0xb8, hi: 0xb9}, + // Block 0x23, offset 0xcf + {value: 0x0000, lo: 0x01}, + {value: 0x8125, lo: 0x88, hi: 0x8b}, + // Block 0x24, offset 0xd1 + {value: 0x0000, lo: 0x04}, + {value: 0x812d, lo: 0x98, hi: 0x99}, + {value: 0x812d, lo: 0xb5, hi: 0xb5}, + {value: 0x812d, lo: 0xb7, hi: 0xb7}, + {value: 0x812b, lo: 0xb9, hi: 0xb9}, + // Block 0x25, offset 0xd6 + {value: 0x0000, lo: 0x10}, + {value: 0x2644, lo: 0x83, hi: 0x83}, + {value: 0x264b, lo: 0x8d, hi: 0x8d}, + {value: 0x2652, lo: 0x92, hi: 0x92}, + {value: 0x2659, lo: 0x97, hi: 0x97}, + {value: 0x2660, lo: 0x9c, hi: 0x9c}, + {value: 0x263d, lo: 0xa9, hi: 0xa9}, + {value: 0x8126, lo: 0xb1, hi: 0xb1}, + {value: 0x8127, lo: 0xb2, hi: 0xb2}, + {value: 0x4a84, lo: 0xb3, hi: 0xb3}, + {value: 0x8128, lo: 0xb4, hi: 0xb4}, + {value: 0x4a8d, lo: 0xb5, hi: 0xb5}, + {value: 0x45b4, lo: 0xb6, hi: 0xb6}, + {value: 0x8200, lo: 0xb7, hi: 0xb7}, + {value: 0x45bc, lo: 0xb8, hi: 0xb8}, + {value: 0x8200, lo: 0xb9, hi: 0xb9}, + {value: 0x8127, lo: 0xba, hi: 0xbd}, + // Block 0x26, offset 0xe7 + {value: 0x0000, lo: 0x0b}, + {value: 0x8127, lo: 0x80, hi: 0x80}, + {value: 0x4a96, lo: 0x81, hi: 0x81}, + {value: 0x8132, lo: 0x82, hi: 0x83}, + {value: 0x8104, lo: 0x84, hi: 0x84}, + {value: 0x8132, lo: 0x86, hi: 0x87}, + {value: 0x266e, lo: 0x93, hi: 0x93}, + {value: 0x2675, lo: 0x9d, hi: 0x9d}, + {value: 0x267c, lo: 0xa2, hi: 0xa2}, + {value: 0x2683, lo: 0xa7, hi: 0xa7}, + {value: 0x268a, lo: 0xac, hi: 0xac}, + {value: 0x2667, lo: 0xb9, hi: 0xb9}, + // Block 0x27, offset 0xf3 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x86, hi: 0x86}, + // Block 0x28, offset 0xf5 + {value: 0x0000, lo: 0x05}, + {value: 0xa000, lo: 0xa5, hi: 0xa5}, + {value: 0x2d1e, lo: 0xa6, hi: 0xa6}, + {value: 0x9900, lo: 0xae, hi: 0xae}, + {value: 0x8102, lo: 0xb7, hi: 0xb7}, + {value: 0x8104, lo: 0xb9, hi: 0xba}, + // Block 0x29, offset 0xfb + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x8d, hi: 0x8d}, + // Block 0x2a, offset 0xfd + {value: 0x0000, lo: 0x01}, + {value: 0xa000, lo: 0x80, hi: 0x92}, + // Block 0x2b, offset 0xff + {value: 0x0000, lo: 0x01}, + {value: 0xb900, lo: 0xa1, hi: 0xb5}, + // Block 0x2c, offset 0x101 + {value: 0x0000, lo: 0x01}, + {value: 0x9900, lo: 0xa8, hi: 0xbf}, + // Block 0x2d, offset 0x103 + {value: 0x0000, lo: 0x01}, + {value: 0x9900, lo: 0x80, hi: 0x82}, + // Block 0x2e, offset 0x105 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0x9d, hi: 0x9f}, + // Block 0x2f, offset 0x107 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x94, hi: 0x94}, + {value: 0x8104, lo: 0xb4, hi: 0xb4}, + // Block 0x30, offset 0x10a + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x92, hi: 0x92}, + {value: 0x8132, lo: 0x9d, hi: 0x9d}, + // Block 0x31, offset 0x10d + {value: 0x0000, lo: 0x01}, + {value: 0x8131, lo: 0xa9, hi: 0xa9}, + // Block 0x32, offset 0x10f + {value: 0x0004, lo: 0x02}, + {value: 0x812e, lo: 0xb9, hi: 0xba}, + {value: 0x812d, lo: 0xbb, hi: 0xbb}, + // Block 0x33, offset 0x112 + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0x97, hi: 0x97}, + {value: 0x812d, lo: 0x98, hi: 0x98}, + // Block 0x34, offset 0x115 + {value: 0x0000, lo: 0x03}, + {value: 0x8104, lo: 0xa0, hi: 0xa0}, + {value: 0x8132, lo: 0xb5, hi: 0xbc}, + {value: 0x812d, lo: 0xbf, hi: 0xbf}, + // Block 0x35, offset 0x119 + {value: 0x0000, lo: 0x04}, + {value: 0x8132, lo: 0xb0, hi: 0xb4}, + {value: 0x812d, lo: 0xb5, hi: 0xba}, + {value: 0x8132, lo: 0xbb, hi: 0xbc}, + {value: 0x812d, lo: 0xbd, hi: 0xbd}, + // Block 0x36, offset 0x11e + {value: 0x0000, lo: 0x08}, + {value: 0x2d66, lo: 0x80, hi: 0x80}, + {value: 0x2d6e, lo: 0x81, hi: 0x81}, + {value: 0xa000, lo: 0x82, hi: 0x82}, + {value: 0x2d76, lo: 0x83, hi: 0x83}, + {value: 0x8104, lo: 0x84, hi: 0x84}, + {value: 0x8132, lo: 0xab, hi: 0xab}, + {value: 0x812d, lo: 0xac, hi: 0xac}, + {value: 0x8132, lo: 0xad, hi: 0xb3}, + // Block 0x37, offset 0x127 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xaa, hi: 0xab}, + // Block 0x38, offset 0x129 + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xa6, hi: 0xa6}, + {value: 0x8104, lo: 0xb2, hi: 0xb3}, + // Block 0x39, offset 0x12c + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0xb7, hi: 0xb7}, + // Block 0x3a, offset 0x12e + {value: 0x0000, lo: 0x0a}, + {value: 0x8132, lo: 0x90, hi: 0x92}, + {value: 0x8101, lo: 0x94, hi: 0x94}, + {value: 0x812d, lo: 0x95, hi: 0x99}, + {value: 0x8132, lo: 0x9a, hi: 0x9b}, + {value: 0x812d, lo: 0x9c, hi: 0x9f}, + {value: 0x8132, lo: 0xa0, hi: 0xa0}, + {value: 0x8101, lo: 0xa2, hi: 0xa8}, + {value: 0x812d, lo: 0xad, hi: 0xad}, + {value: 0x8132, lo: 0xb4, hi: 0xb4}, + {value: 0x8132, lo: 0xb8, hi: 0xb9}, + // Block 0x3b, offset 0x139 + {value: 0x0004, lo: 0x03}, + {value: 0x0433, lo: 0x80, hi: 0x81}, + {value: 0x8100, lo: 0x97, hi: 0x97}, + {value: 0x8100, lo: 0xbe, hi: 0xbe}, + // Block 0x3c, offset 0x13d + {value: 0x0000, lo: 0x0d}, + {value: 0x8132, lo: 0x90, hi: 0x91}, + {value: 0x8101, lo: 0x92, hi: 0x93}, + {value: 0x8132, lo: 0x94, hi: 0x97}, + {value: 0x8101, lo: 0x98, hi: 0x9a}, + {value: 0x8132, lo: 0x9b, hi: 0x9c}, + {value: 0x8132, lo: 0xa1, hi: 0xa1}, + {value: 0x8101, lo: 0xa5, hi: 0xa6}, + {value: 0x8132, lo: 0xa7, hi: 0xa7}, + {value: 0x812d, lo: 0xa8, hi: 0xa8}, + {value: 0x8132, lo: 0xa9, hi: 0xa9}, + {value: 0x8101, lo: 0xaa, hi: 0xab}, + {value: 0x812d, lo: 0xac, hi: 0xaf}, + {value: 0x8132, lo: 0xb0, hi: 0xb0}, + // Block 0x3d, offset 0x14b + {value: 0x427b, lo: 0x02}, + {value: 0x01b8, lo: 0xa6, hi: 0xa6}, + {value: 0x0057, lo: 0xaa, hi: 0xab}, + // Block 0x3e, offset 0x14e + {value: 0x0007, lo: 0x05}, + {value: 0xa000, lo: 0x90, hi: 0x90}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0xa000, lo: 0x94, hi: 0x94}, + {value: 0x3bb9, lo: 0x9a, hi: 0x9b}, + {value: 0x3bc7, lo: 0xae, hi: 0xae}, + // Block 0x3f, offset 0x154 + {value: 0x000e, lo: 0x05}, + {value: 0x3bce, lo: 0x8d, hi: 0x8e}, + {value: 0x3bd5, lo: 0x8f, hi: 0x8f}, + {value: 0xa000, lo: 0x90, hi: 0x90}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0xa000, lo: 0x94, hi: 0x94}, + // Block 0x40, offset 0x15a + {value: 0x6408, lo: 0x0a}, + {value: 0xa000, lo: 0x83, hi: 0x83}, + {value: 0x3be3, lo: 0x84, hi: 0x84}, + {value: 0xa000, lo: 0x88, hi: 0x88}, + {value: 0x3bea, lo: 0x89, hi: 0x89}, + {value: 0xa000, lo: 0x8b, hi: 0x8b}, + {value: 0x3bf1, lo: 0x8c, hi: 0x8c}, + {value: 0xa000, lo: 0xa3, hi: 0xa3}, + {value: 0x3bf8, lo: 0xa4, hi: 0xa5}, + {value: 0x3bff, lo: 0xa6, hi: 0xa6}, + {value: 0xa000, lo: 0xbc, hi: 0xbc}, + // Block 0x41, offset 0x165 + {value: 0x0007, lo: 0x03}, + {value: 0x3c68, lo: 0xa0, hi: 0xa1}, + {value: 0x3c92, lo: 0xa2, hi: 0xa3}, + {value: 0x3cbc, lo: 0xaa, hi: 0xad}, + // Block 0x42, offset 0x169 + {value: 0x0004, lo: 0x01}, + {value: 0x048b, lo: 0xa9, hi: 0xaa}, + // Block 0x43, offset 0x16b + {value: 0x0000, lo: 0x01}, + {value: 0x44dd, lo: 0x9c, hi: 0x9c}, + // Block 0x44, offset 0x16d + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xaf, hi: 0xb1}, + // Block 0x45, offset 0x16f + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x46, offset 0x171 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xa0, hi: 0xbf}, + // Block 0x47, offset 0x173 + {value: 0x0000, lo: 0x05}, + {value: 0x812c, lo: 0xaa, hi: 0xaa}, + {value: 0x8131, lo: 0xab, hi: 0xab}, + {value: 0x8133, lo: 0xac, hi: 0xac}, + {value: 0x812e, lo: 0xad, hi: 0xad}, + {value: 0x812f, lo: 0xae, hi: 0xaf}, + // Block 0x48, offset 0x179 + {value: 0x0000, lo: 0x03}, + {value: 0x4a9f, lo: 0xb3, hi: 0xb3}, + {value: 0x4a9f, lo: 0xb5, hi: 0xb6}, + {value: 0x4a9f, lo: 0xba, hi: 0xbf}, + // Block 0x49, offset 0x17d + {value: 0x0000, lo: 0x01}, + {value: 0x4a9f, lo: 0x8f, hi: 0xa3}, + // Block 0x4a, offset 0x17f + {value: 0x0000, lo: 0x01}, + {value: 0x8100, lo: 0xae, hi: 0xbe}, + // Block 0x4b, offset 0x181 + {value: 0x0000, lo: 0x07}, + {value: 0x8100, lo: 0x84, hi: 0x84}, + {value: 0x8100, lo: 0x87, hi: 0x87}, + {value: 0x8100, lo: 0x90, hi: 0x90}, + {value: 0x8100, lo: 0x9e, hi: 0x9e}, + {value: 0x8100, lo: 0xa1, hi: 0xa1}, + {value: 0x8100, lo: 0xb2, hi: 0xb2}, + {value: 0x8100, lo: 0xbb, hi: 0xbb}, + // Block 0x4c, offset 0x189 + {value: 0x0000, lo: 0x03}, + {value: 0x8100, lo: 0x80, hi: 0x80}, + {value: 0x8100, lo: 0x8b, hi: 0x8b}, + {value: 0x8100, lo: 0x8e, hi: 0x8e}, + // Block 0x4d, offset 0x18d + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0xaf, hi: 0xaf}, + {value: 0x8132, lo: 0xb4, hi: 0xbd}, + // Block 0x4e, offset 0x190 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0x9e, hi: 0x9f}, + // Block 0x4f, offset 0x192 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xb0, hi: 0xb1}, + // Block 0x50, offset 0x194 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x86, hi: 0x86}, + // Block 0x51, offset 0x196 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x84, hi: 0x84}, + {value: 0x8132, lo: 0xa0, hi: 0xb1}, + // Block 0x52, offset 0x199 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0xab, hi: 0xad}, + // Block 0x53, offset 0x19b + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x93, hi: 0x93}, + // Block 0x54, offset 0x19d + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0xb3, hi: 0xb3}, + // Block 0x55, offset 0x19f + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x80, hi: 0x80}, + // Block 0x56, offset 0x1a1 + {value: 0x0000, lo: 0x05}, + {value: 0x8132, lo: 0xb0, hi: 0xb0}, + {value: 0x8132, lo: 0xb2, hi: 0xb3}, + {value: 0x812d, lo: 0xb4, hi: 0xb4}, + {value: 0x8132, lo: 0xb7, hi: 0xb8}, + {value: 0x8132, lo: 0xbe, hi: 0xbf}, + // Block 0x57, offset 0x1a7 + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0x81, hi: 0x81}, + {value: 0x8104, lo: 0xb6, hi: 0xb6}, + // Block 0x58, offset 0x1aa + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xad, hi: 0xad}, + // Block 0x59, offset 0x1ac + {value: 0x0000, lo: 0x06}, + {value: 0xe500, lo: 0x80, hi: 0x80}, + {value: 0xc600, lo: 0x81, hi: 0x9b}, + {value: 0xe500, lo: 0x9c, hi: 0x9c}, + {value: 0xc600, lo: 0x9d, hi: 0xb7}, + {value: 0xe500, lo: 0xb8, hi: 0xb8}, + {value: 0xc600, lo: 0xb9, hi: 0xbf}, + // Block 0x5a, offset 0x1b3 + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x93}, + {value: 0xe500, lo: 0x94, hi: 0x94}, + {value: 0xc600, lo: 0x95, hi: 0xaf}, + {value: 0xe500, lo: 0xb0, hi: 0xb0}, + {value: 0xc600, lo: 0xb1, hi: 0xbf}, + // Block 0x5b, offset 0x1b9 + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x8b}, + {value: 0xe500, lo: 0x8c, hi: 0x8c}, + {value: 0xc600, lo: 0x8d, hi: 0xa7}, + {value: 0xe500, lo: 0xa8, hi: 0xa8}, + {value: 0xc600, lo: 0xa9, hi: 0xbf}, + // Block 0x5c, offset 0x1bf + {value: 0x0000, lo: 0x07}, + {value: 0xc600, lo: 0x80, hi: 0x83}, + {value: 0xe500, lo: 0x84, hi: 0x84}, + {value: 0xc600, lo: 0x85, hi: 0x9f}, + {value: 0xe500, lo: 0xa0, hi: 0xa0}, + {value: 0xc600, lo: 0xa1, hi: 0xbb}, + {value: 0xe500, lo: 0xbc, hi: 0xbc}, + {value: 0xc600, lo: 0xbd, hi: 0xbf}, + // Block 0x5d, offset 0x1c7 + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x97}, + {value: 0xe500, lo: 0x98, hi: 0x98}, + {value: 0xc600, lo: 0x99, hi: 0xb3}, + {value: 0xe500, lo: 0xb4, hi: 0xb4}, + {value: 0xc600, lo: 0xb5, hi: 0xbf}, + // Block 0x5e, offset 0x1cd + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x8f}, + {value: 0xe500, lo: 0x90, hi: 0x90}, + {value: 0xc600, lo: 0x91, hi: 0xab}, + {value: 0xe500, lo: 0xac, hi: 0xac}, + {value: 0xc600, lo: 0xad, hi: 0xbf}, + // Block 0x5f, offset 0x1d3 + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x87}, + {value: 0xe500, lo: 0x88, hi: 0x88}, + {value: 0xc600, lo: 0x89, hi: 0xa3}, + {value: 0xe500, lo: 0xa4, hi: 0xa4}, + {value: 0xc600, lo: 0xa5, hi: 0xbf}, + // Block 0x60, offset 0x1d9 + {value: 0x0000, lo: 0x03}, + {value: 0xc600, lo: 0x80, hi: 0x87}, + {value: 0xe500, lo: 0x88, hi: 0x88}, + {value: 0xc600, lo: 0x89, hi: 0xa3}, + // Block 0x61, offset 0x1dd + {value: 0x0006, lo: 0x0d}, + {value: 0x4390, lo: 0x9d, hi: 0x9d}, + {value: 0x8115, lo: 0x9e, hi: 0x9e}, + {value: 0x4402, lo: 0x9f, hi: 0x9f}, + {value: 0x43f0, lo: 0xaa, hi: 0xab}, + {value: 0x44f4, lo: 0xac, hi: 0xac}, + {value: 0x44fc, lo: 0xad, hi: 0xad}, + {value: 0x4348, lo: 0xae, hi: 0xb1}, + {value: 0x4366, lo: 0xb2, hi: 0xb4}, + {value: 0x437e, lo: 0xb5, hi: 0xb6}, + {value: 0x438a, lo: 0xb8, hi: 0xb8}, + {value: 0x4396, lo: 0xb9, hi: 0xbb}, + {value: 0x43ae, lo: 0xbc, hi: 0xbc}, + {value: 0x43b4, lo: 0xbe, hi: 0xbe}, + // Block 0x62, offset 0x1eb + {value: 0x0006, lo: 0x08}, + {value: 0x43ba, lo: 0x80, hi: 0x81}, + {value: 0x43c6, lo: 0x83, hi: 0x84}, + {value: 0x43d8, lo: 0x86, hi: 0x89}, + {value: 0x43fc, lo: 0x8a, hi: 0x8a}, + {value: 0x4378, lo: 0x8b, hi: 0x8b}, + {value: 0x4360, lo: 0x8c, hi: 0x8c}, + {value: 0x43a8, lo: 0x8d, hi: 0x8d}, + {value: 0x43d2, lo: 0x8e, hi: 0x8e}, + // Block 0x63, offset 0x1f4 + {value: 0x0000, lo: 0x02}, + {value: 0x8100, lo: 0xa4, hi: 0xa5}, + {value: 0x8100, lo: 0xb0, hi: 0xb1}, + // Block 0x64, offset 0x1f7 + {value: 0x0000, lo: 0x02}, + {value: 0x8100, lo: 0x9b, hi: 0x9d}, + {value: 0x8200, lo: 0x9e, hi: 0xa3}, + // Block 0x65, offset 0x1fa + {value: 0x0000, lo: 0x01}, + {value: 0x8100, lo: 0x90, hi: 0x90}, + // Block 0x66, offset 0x1fc + {value: 0x0000, lo: 0x02}, + {value: 0x8100, lo: 0x99, hi: 0x99}, + {value: 0x8200, lo: 0xb2, hi: 0xb4}, + // Block 0x67, offset 0x1ff + {value: 0x0000, lo: 0x01}, + {value: 0x8100, lo: 0xbc, hi: 0xbd}, + // Block 0x68, offset 0x201 + {value: 0x0000, lo: 0x03}, + {value: 0x8132, lo: 0xa0, hi: 0xa6}, + {value: 0x812d, lo: 0xa7, hi: 0xad}, + {value: 0x8132, lo: 0xae, hi: 0xaf}, + // Block 0x69, offset 0x205 + {value: 0x0000, lo: 0x04}, + {value: 0x8100, lo: 0x89, hi: 0x8c}, + {value: 0x8100, lo: 0xb0, hi: 0xb2}, + {value: 0x8100, lo: 0xb4, hi: 0xb4}, + {value: 0x8100, lo: 0xb6, hi: 0xbf}, + // Block 0x6a, offset 0x20a + {value: 0x0000, lo: 0x01}, + {value: 0x8100, lo: 0x81, hi: 0x8c}, + // Block 0x6b, offset 0x20c + {value: 0x0000, lo: 0x01}, + {value: 0x8100, lo: 0xb5, hi: 0xba}, + // Block 0x6c, offset 0x20e + {value: 0x0000, lo: 0x04}, + {value: 0x4a9f, lo: 0x9e, hi: 0x9f}, + {value: 0x4a9f, lo: 0xa3, hi: 0xa3}, + {value: 0x4a9f, lo: 0xa5, hi: 0xa6}, + {value: 0x4a9f, lo: 0xaa, hi: 0xaf}, + // Block 0x6d, offset 0x213 + {value: 0x0000, lo: 0x05}, + {value: 0x4a9f, lo: 0x82, hi: 0x87}, + {value: 0x4a9f, lo: 0x8a, hi: 0x8f}, + {value: 0x4a9f, lo: 0x92, hi: 0x97}, + {value: 0x4a9f, lo: 0x9a, hi: 0x9c}, + {value: 0x8100, lo: 0xa3, hi: 0xa3}, + // Block 0x6e, offset 0x219 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0xbd, hi: 0xbd}, + // Block 0x6f, offset 0x21b + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0xa0, hi: 0xa0}, + // Block 0x70, offset 0x21d + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xb6, hi: 0xba}, + // Block 0x71, offset 0x21f + {value: 0x002c, lo: 0x05}, + {value: 0x812d, lo: 0x8d, hi: 0x8d}, + {value: 0x8132, lo: 0x8f, hi: 0x8f}, + {value: 0x8132, lo: 0xb8, hi: 0xb8}, + {value: 0x8101, lo: 0xb9, hi: 0xba}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x72, offset 0x225 + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0xa5, hi: 0xa5}, + {value: 0x812d, lo: 0xa6, hi: 0xa6}, + // Block 0x73, offset 0x228 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xa4, hi: 0xa7}, + // Block 0x74, offset 0x22a + {value: 0x0000, lo: 0x05}, + {value: 0x812d, lo: 0x86, hi: 0x87}, + {value: 0x8132, lo: 0x88, hi: 0x8a}, + {value: 0x812d, lo: 0x8b, hi: 0x8b}, + {value: 0x8132, lo: 0x8c, hi: 0x8c}, + {value: 0x812d, lo: 0x8d, hi: 0x90}, + // Block 0x75, offset 0x230 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x86, hi: 0x86}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x76, offset 0x233 + {value: 0x17fe, lo: 0x07}, + {value: 0xa000, lo: 0x99, hi: 0x99}, + {value: 0x4238, lo: 0x9a, hi: 0x9a}, + {value: 0xa000, lo: 0x9b, hi: 0x9b}, + {value: 0x4242, lo: 0x9c, hi: 0x9c}, + {value: 0xa000, lo: 0xa5, hi: 0xa5}, + {value: 0x424c, lo: 0xab, hi: 0xab}, + {value: 0x8104, lo: 0xb9, hi: 0xba}, + // Block 0x77, offset 0x23b + {value: 0x0000, lo: 0x06}, + {value: 0x8132, lo: 0x80, hi: 0x82}, + {value: 0x9900, lo: 0xa7, hi: 0xa7}, + {value: 0x2d7e, lo: 0xae, hi: 0xae}, + {value: 0x2d88, lo: 0xaf, hi: 0xaf}, + {value: 0xa000, lo: 0xb1, hi: 0xb2}, + {value: 0x8104, lo: 0xb3, hi: 0xb4}, + // Block 0x78, offset 0x242 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x80, hi: 0x80}, + {value: 0x8102, lo: 0x8a, hi: 0x8a}, + // Block 0x79, offset 0x245 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xb5, hi: 0xb5}, + {value: 0x8102, lo: 0xb6, hi: 0xb6}, + // Block 0x7a, offset 0x248 + {value: 0x0002, lo: 0x01}, + {value: 0x8102, lo: 0xa9, hi: 0xaa}, + // Block 0x7b, offset 0x24a + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xbb, hi: 0xbc}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x7c, offset 0x24d + {value: 0x0000, lo: 0x07}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0x2d92, lo: 0x8b, hi: 0x8b}, + {value: 0x2d9c, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + {value: 0x8132, lo: 0xa6, hi: 0xac}, + {value: 0x8132, lo: 0xb0, hi: 0xb4}, + // Block 0x7d, offset 0x255 + {value: 0x0000, lo: 0x03}, + {value: 0x8104, lo: 0x82, hi: 0x82}, + {value: 0x8102, lo: 0x86, hi: 0x86}, + {value: 0x8132, lo: 0x9e, hi: 0x9e}, + // Block 0x7e, offset 0x259 + {value: 0x6b5a, lo: 0x06}, + {value: 0x9900, lo: 0xb0, hi: 0xb0}, + {value: 0xa000, lo: 0xb9, hi: 0xb9}, + {value: 0x9900, lo: 0xba, hi: 0xba}, + {value: 0x2db0, lo: 0xbb, hi: 0xbb}, + {value: 0x2da6, lo: 0xbc, hi: 0xbd}, + {value: 0x2dba, lo: 0xbe, hi: 0xbe}, + // Block 0x7f, offset 0x260 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x82, hi: 0x82}, + {value: 0x8102, lo: 0x83, hi: 0x83}, + // Block 0x80, offset 0x263 + {value: 0x0000, lo: 0x05}, + {value: 0x9900, lo: 0xaf, hi: 0xaf}, + {value: 0xa000, lo: 0xb8, hi: 0xb9}, + {value: 0x2dc4, lo: 0xba, hi: 0xba}, + {value: 0x2dce, lo: 0xbb, hi: 0xbb}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x81, offset 0x269 + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0x80, hi: 0x80}, + // Block 0x82, offset 0x26b + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xb6, hi: 0xb6}, + {value: 0x8102, lo: 0xb7, hi: 0xb7}, + // Block 0x83, offset 0x26e + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xab, hi: 0xab}, + // Block 0x84, offset 0x270 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xb9, hi: 0xb9}, + {value: 0x8102, lo: 0xba, hi: 0xba}, + // Block 0x85, offset 0x273 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xb4, hi: 0xb4}, + // Block 0x86, offset 0x275 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x87, hi: 0x87}, + // Block 0x87, offset 0x277 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x99, hi: 0x99}, + // Block 0x88, offset 0x279 + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0x82, hi: 0x82}, + {value: 0x8104, lo: 0x84, hi: 0x85}, + // Block 0x89, offset 0x27c + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x97, hi: 0x97}, + // Block 0x8a, offset 0x27e + {value: 0x0000, lo: 0x01}, + {value: 0x8101, lo: 0xb0, hi: 0xb4}, + // Block 0x8b, offset 0x280 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xb0, hi: 0xb6}, + // Block 0x8c, offset 0x282 + {value: 0x0000, lo: 0x01}, + {value: 0x8101, lo: 0x9e, hi: 0x9e}, + // Block 0x8d, offset 0x284 + {value: 0x0000, lo: 0x0c}, + {value: 0x45cc, lo: 0x9e, hi: 0x9e}, + {value: 0x45d6, lo: 0x9f, hi: 0x9f}, + {value: 0x460a, lo: 0xa0, hi: 0xa0}, + {value: 0x4618, lo: 0xa1, hi: 0xa1}, + {value: 0x4626, lo: 0xa2, hi: 0xa2}, + {value: 0x4634, lo: 0xa3, hi: 0xa3}, + {value: 0x4642, lo: 0xa4, hi: 0xa4}, + {value: 0x812b, lo: 0xa5, hi: 0xa6}, + {value: 0x8101, lo: 0xa7, hi: 0xa9}, + {value: 0x8130, lo: 0xad, hi: 0xad}, + {value: 0x812b, lo: 0xae, hi: 0xb2}, + {value: 0x812d, lo: 0xbb, hi: 0xbf}, + // Block 0x8e, offset 0x291 + {value: 0x0000, lo: 0x09}, + {value: 0x812d, lo: 0x80, hi: 0x82}, + {value: 0x8132, lo: 0x85, hi: 0x89}, + {value: 0x812d, lo: 0x8a, hi: 0x8b}, + {value: 0x8132, lo: 0xaa, hi: 0xad}, + {value: 0x45e0, lo: 0xbb, hi: 0xbb}, + {value: 0x45ea, lo: 0xbc, hi: 0xbc}, + {value: 0x4650, lo: 0xbd, hi: 0xbd}, + {value: 0x466c, lo: 0xbe, hi: 0xbe}, + {value: 0x465e, lo: 0xbf, hi: 0xbf}, + // Block 0x8f, offset 0x29b + {value: 0x0000, lo: 0x01}, + {value: 0x467a, lo: 0x80, hi: 0x80}, + // Block 0x90, offset 0x29d + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0x82, hi: 0x84}, + // Block 0x91, offset 0x29f + {value: 0x0000, lo: 0x05}, + {value: 0x8132, lo: 0x80, hi: 0x86}, + {value: 0x8132, lo: 0x88, hi: 0x98}, + {value: 0x8132, lo: 0x9b, hi: 0xa1}, + {value: 0x8132, lo: 0xa3, hi: 0xa4}, + {value: 0x8132, lo: 0xa6, hi: 0xaa}, + // Block 0x92, offset 0x2a5 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x90, hi: 0x96}, + // Block 0x93, offset 0x2a7 + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0x84, hi: 0x89}, + {value: 0x8102, lo: 0x8a, hi: 0x8a}, + // Block 0x94, offset 0x2aa + {value: 0x0000, lo: 0x01}, + {value: 0x8100, lo: 0x93, hi: 0x93}, +} + +// lookup returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *nfkcTrie) lookup(s []byte) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return nfkcValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := nfkcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := nfkcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfkcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := nfkcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfkcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = nfkcIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *nfkcTrie) lookupUnsafe(s []byte) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return nfkcValues[c0] + } + i := nfkcIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = nfkcIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = nfkcIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// lookupString returns the trie value for the first UTF-8 encoding in s and +// the width in bytes of this encoding. The size will be 0 if s does not +// hold enough bytes to complete the encoding. len(s) must be greater than 0. +func (t *nfkcTrie) lookupString(s string) (v uint16, sz int) { + c0 := s[0] + switch { + case c0 < 0x80: // is ASCII + return nfkcValues[c0], 1 + case c0 < 0xC2: + return 0, 1 // Illegal UTF-8: not a starter, not ASCII. + case c0 < 0xE0: // 2-byte UTF-8 + if len(s) < 2 { + return 0, 0 + } + i := nfkcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c1), 2 + case c0 < 0xF0: // 3-byte UTF-8 + if len(s) < 3 { + return 0, 0 + } + i := nfkcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfkcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c2), 3 + case c0 < 0xF8: // 4-byte UTF-8 + if len(s) < 4 { + return 0, 0 + } + i := nfkcIndex[c0] + c1 := s[1] + if c1 < 0x80 || 0xC0 <= c1 { + return 0, 1 // Illegal UTF-8: not a continuation byte. + } + o := uint32(i)<<6 + uint32(c1) + i = nfkcIndex[o] + c2 := s[2] + if c2 < 0x80 || 0xC0 <= c2 { + return 0, 2 // Illegal UTF-8: not a continuation byte. + } + o = uint32(i)<<6 + uint32(c2) + i = nfkcIndex[o] + c3 := s[3] + if c3 < 0x80 || 0xC0 <= c3 { + return 0, 3 // Illegal UTF-8: not a continuation byte. + } + return t.lookupValue(uint32(i), c3), 4 + } + // Illegal rune + return 0, 1 +} + +// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. +// s must start with a full and valid UTF-8 encoded rune. +func (t *nfkcTrie) lookupStringUnsafe(s string) uint16 { + c0 := s[0] + if c0 < 0x80 { // is ASCII + return nfkcValues[c0] + } + i := nfkcIndex[c0] + if c0 < 0xE0 { // 2-byte UTF-8 + return t.lookupValue(uint32(i), s[1]) + } + i = nfkcIndex[uint32(i)<<6+uint32(s[1])] + if c0 < 0xF0 { // 3-byte UTF-8 + return t.lookupValue(uint32(i), s[2]) + } + i = nfkcIndex[uint32(i)<<6+uint32(s[2])] + if c0 < 0xF8 { // 4-byte UTF-8 + return t.lookupValue(uint32(i), s[3]) + } + return 0 +} + +// nfkcTrie. Total size: 17248 bytes (16.84 KiB). Checksum: 4fb368372b6b1b27. +type nfkcTrie struct{} + +func newNfkcTrie(i int) *nfkcTrie { + return &nfkcTrie{} +} + +// lookupValue determines the type of block n and looks up the value for b. +func (t *nfkcTrie) lookupValue(n uint32, b byte) uint16 { + switch { + case n < 92: + return uint16(nfkcValues[n<<6+uint32(b)]) + default: + n -= 92 + return uint16(nfkcSparse.lookup(n, b)) + } +} + +// nfkcValues: 94 blocks, 6016 entries, 12032 bytes +// The third block is the zero block. +var nfkcValues = [6016]uint16{ + // Block 0x0, offset 0x0 + 0x3c: 0xa000, 0x3d: 0xa000, 0x3e: 0xa000, + // Block 0x1, offset 0x40 + 0x41: 0xa000, 0x42: 0xa000, 0x43: 0xa000, 0x44: 0xa000, 0x45: 0xa000, + 0x46: 0xa000, 0x47: 0xa000, 0x48: 0xa000, 0x49: 0xa000, 0x4a: 0xa000, 0x4b: 0xa000, + 0x4c: 0xa000, 0x4d: 0xa000, 0x4e: 0xa000, 0x4f: 0xa000, 0x50: 0xa000, + 0x52: 0xa000, 0x53: 0xa000, 0x54: 0xa000, 0x55: 0xa000, 0x56: 0xa000, 0x57: 0xa000, + 0x58: 0xa000, 0x59: 0xa000, 0x5a: 0xa000, + 0x61: 0xa000, 0x62: 0xa000, 0x63: 0xa000, + 0x64: 0xa000, 0x65: 0xa000, 0x66: 0xa000, 0x67: 0xa000, 0x68: 0xa000, 0x69: 0xa000, + 0x6a: 0xa000, 0x6b: 0xa000, 0x6c: 0xa000, 0x6d: 0xa000, 0x6e: 0xa000, 0x6f: 0xa000, + 0x70: 0xa000, 0x72: 0xa000, 0x73: 0xa000, 0x74: 0xa000, 0x75: 0xa000, + 0x76: 0xa000, 0x77: 0xa000, 0x78: 0xa000, 0x79: 0xa000, 0x7a: 0xa000, + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc0: 0x2f6f, 0xc1: 0x2f74, 0xc2: 0x4688, 0xc3: 0x2f79, 0xc4: 0x4697, 0xc5: 0x469c, + 0xc6: 0xa000, 0xc7: 0x46a6, 0xc8: 0x2fe2, 0xc9: 0x2fe7, 0xca: 0x46ab, 0xcb: 0x2ffb, + 0xcc: 0x306e, 0xcd: 0x3073, 0xce: 0x3078, 0xcf: 0x46bf, 0xd1: 0x3104, + 0xd2: 0x3127, 0xd3: 0x312c, 0xd4: 0x46c9, 0xd5: 0x46ce, 0xd6: 0x46dd, + 0xd8: 0xa000, 0xd9: 0x31b3, 0xda: 0x31b8, 0xdb: 0x31bd, 0xdc: 0x470f, 0xdd: 0x3235, + 0xe0: 0x327b, 0xe1: 0x3280, 0xe2: 0x4719, 0xe3: 0x3285, + 0xe4: 0x4728, 0xe5: 0x472d, 0xe6: 0xa000, 0xe7: 0x4737, 0xe8: 0x32ee, 0xe9: 0x32f3, + 0xea: 0x473c, 0xeb: 0x3307, 0xec: 0x337f, 0xed: 0x3384, 0xee: 0x3389, 0xef: 0x4750, + 0xf1: 0x3415, 0xf2: 0x3438, 0xf3: 0x343d, 0xf4: 0x475a, 0xf5: 0x475f, + 0xf6: 0x476e, 0xf8: 0xa000, 0xf9: 0x34c9, 0xfa: 0x34ce, 0xfb: 0x34d3, + 0xfc: 0x47a0, 0xfd: 0x3550, 0xff: 0x3569, + // Block 0x4, offset 0x100 + 0x100: 0x2f7e, 0x101: 0x328a, 0x102: 0x468d, 0x103: 0x471e, 0x104: 0x2f9c, 0x105: 0x32a8, + 0x106: 0x2fb0, 0x107: 0x32bc, 0x108: 0x2fb5, 0x109: 0x32c1, 0x10a: 0x2fba, 0x10b: 0x32c6, + 0x10c: 0x2fbf, 0x10d: 0x32cb, 0x10e: 0x2fc9, 0x10f: 0x32d5, + 0x112: 0x46b0, 0x113: 0x4741, 0x114: 0x2ff1, 0x115: 0x32fd, 0x116: 0x2ff6, 0x117: 0x3302, + 0x118: 0x3014, 0x119: 0x3320, 0x11a: 0x3005, 0x11b: 0x3311, 0x11c: 0x302d, 0x11d: 0x3339, + 0x11e: 0x3037, 0x11f: 0x3343, 0x120: 0x303c, 0x121: 0x3348, 0x122: 0x3046, 0x123: 0x3352, + 0x124: 0x304b, 0x125: 0x3357, 0x128: 0x307d, 0x129: 0x338e, + 0x12a: 0x3082, 0x12b: 0x3393, 0x12c: 0x3087, 0x12d: 0x3398, 0x12e: 0x30aa, 0x12f: 0x33b6, + 0x130: 0x308c, 0x132: 0x195d, 0x133: 0x19e7, 0x134: 0x30b4, 0x135: 0x33c0, + 0x136: 0x30c8, 0x137: 0x33d9, 0x139: 0x30d2, 0x13a: 0x33e3, 0x13b: 0x30dc, + 0x13c: 0x33ed, 0x13d: 0x30d7, 0x13e: 0x33e8, 0x13f: 0x1bac, + // Block 0x5, offset 0x140 + 0x140: 0x1c34, 0x143: 0x30ff, 0x144: 0x3410, 0x145: 0x3118, + 0x146: 0x3429, 0x147: 0x310e, 0x148: 0x341f, 0x149: 0x1c5c, + 0x14c: 0x46d3, 0x14d: 0x4764, 0x14e: 0x3131, 0x14f: 0x3442, 0x150: 0x313b, 0x151: 0x344c, + 0x154: 0x3159, 0x155: 0x346a, 0x156: 0x3172, 0x157: 0x3483, + 0x158: 0x3163, 0x159: 0x3474, 0x15a: 0x46f6, 0x15b: 0x4787, 0x15c: 0x317c, 0x15d: 0x348d, + 0x15e: 0x318b, 0x15f: 0x349c, 0x160: 0x46fb, 0x161: 0x478c, 0x162: 0x31a4, 0x163: 0x34ba, + 0x164: 0x3195, 0x165: 0x34ab, 0x168: 0x4705, 0x169: 0x4796, + 0x16a: 0x470a, 0x16b: 0x479b, 0x16c: 0x31c2, 0x16d: 0x34d8, 0x16e: 0x31cc, 0x16f: 0x34e2, + 0x170: 0x31d1, 0x171: 0x34e7, 0x172: 0x31ef, 0x173: 0x3505, 0x174: 0x3212, 0x175: 0x3528, + 0x176: 0x323a, 0x177: 0x3555, 0x178: 0x324e, 0x179: 0x325d, 0x17a: 0x357d, 0x17b: 0x3267, + 0x17c: 0x3587, 0x17d: 0x326c, 0x17e: 0x358c, 0x17f: 0x00a7, + // Block 0x6, offset 0x180 + 0x184: 0x2dee, 0x185: 0x2df4, + 0x186: 0x2dfa, 0x187: 0x1972, 0x188: 0x1975, 0x189: 0x1a08, 0x18a: 0x1987, 0x18b: 0x198a, + 0x18c: 0x1a3e, 0x18d: 0x2f88, 0x18e: 0x3294, 0x18f: 0x3096, 0x190: 0x33a2, 0x191: 0x3140, + 0x192: 0x3451, 0x193: 0x31d6, 0x194: 0x34ec, 0x195: 0x39cf, 0x196: 0x3b5e, 0x197: 0x39c8, + 0x198: 0x3b57, 0x199: 0x39d6, 0x19a: 0x3b65, 0x19b: 0x39c1, 0x19c: 0x3b50, + 0x19e: 0x38b0, 0x19f: 0x3a3f, 0x1a0: 0x38a9, 0x1a1: 0x3a38, 0x1a2: 0x35b3, 0x1a3: 0x35c5, + 0x1a6: 0x3041, 0x1a7: 0x334d, 0x1a8: 0x30be, 0x1a9: 0x33cf, + 0x1aa: 0x46ec, 0x1ab: 0x477d, 0x1ac: 0x3990, 0x1ad: 0x3b1f, 0x1ae: 0x35d7, 0x1af: 0x35dd, + 0x1b0: 0x33c5, 0x1b1: 0x1942, 0x1b2: 0x1945, 0x1b3: 0x19cf, 0x1b4: 0x3028, 0x1b5: 0x3334, + 0x1b8: 0x30fa, 0x1b9: 0x340b, 0x1ba: 0x38b7, 0x1bb: 0x3a46, + 0x1bc: 0x35ad, 0x1bd: 0x35bf, 0x1be: 0x35b9, 0x1bf: 0x35cb, + // Block 0x7, offset 0x1c0 + 0x1c0: 0x2f8d, 0x1c1: 0x3299, 0x1c2: 0x2f92, 0x1c3: 0x329e, 0x1c4: 0x300a, 0x1c5: 0x3316, + 0x1c6: 0x300f, 0x1c7: 0x331b, 0x1c8: 0x309b, 0x1c9: 0x33a7, 0x1ca: 0x30a0, 0x1cb: 0x33ac, + 0x1cc: 0x3145, 0x1cd: 0x3456, 0x1ce: 0x314a, 0x1cf: 0x345b, 0x1d0: 0x3168, 0x1d1: 0x3479, + 0x1d2: 0x316d, 0x1d3: 0x347e, 0x1d4: 0x31db, 0x1d5: 0x34f1, 0x1d6: 0x31e0, 0x1d7: 0x34f6, + 0x1d8: 0x3186, 0x1d9: 0x3497, 0x1da: 0x319f, 0x1db: 0x34b5, + 0x1de: 0x305a, 0x1df: 0x3366, + 0x1e6: 0x4692, 0x1e7: 0x4723, 0x1e8: 0x46ba, 0x1e9: 0x474b, + 0x1ea: 0x395f, 0x1eb: 0x3aee, 0x1ec: 0x393c, 0x1ed: 0x3acb, 0x1ee: 0x46d8, 0x1ef: 0x4769, + 0x1f0: 0x3958, 0x1f1: 0x3ae7, 0x1f2: 0x3244, 0x1f3: 0x355f, + // Block 0x8, offset 0x200 + 0x200: 0x9932, 0x201: 0x9932, 0x202: 0x9932, 0x203: 0x9932, 0x204: 0x9932, 0x205: 0x8132, + 0x206: 0x9932, 0x207: 0x9932, 0x208: 0x9932, 0x209: 0x9932, 0x20a: 0x9932, 0x20b: 0x9932, + 0x20c: 0x9932, 0x20d: 0x8132, 0x20e: 0x8132, 0x20f: 0x9932, 0x210: 0x8132, 0x211: 0x9932, + 0x212: 0x8132, 0x213: 0x9932, 0x214: 0x9932, 0x215: 0x8133, 0x216: 0x812d, 0x217: 0x812d, + 0x218: 0x812d, 0x219: 0x812d, 0x21a: 0x8133, 0x21b: 0x992b, 0x21c: 0x812d, 0x21d: 0x812d, + 0x21e: 0x812d, 0x21f: 0x812d, 0x220: 0x812d, 0x221: 0x8129, 0x222: 0x8129, 0x223: 0x992d, + 0x224: 0x992d, 0x225: 0x992d, 0x226: 0x992d, 0x227: 0x9929, 0x228: 0x9929, 0x229: 0x812d, + 0x22a: 0x812d, 0x22b: 0x812d, 0x22c: 0x812d, 0x22d: 0x992d, 0x22e: 0x992d, 0x22f: 0x812d, + 0x230: 0x992d, 0x231: 0x992d, 0x232: 0x812d, 0x233: 0x812d, 0x234: 0x8101, 0x235: 0x8101, + 0x236: 0x8101, 0x237: 0x8101, 0x238: 0x9901, 0x239: 0x812d, 0x23a: 0x812d, 0x23b: 0x812d, + 0x23c: 0x812d, 0x23d: 0x8132, 0x23e: 0x8132, 0x23f: 0x8132, + // Block 0x9, offset 0x240 + 0x240: 0x49ae, 0x241: 0x49b3, 0x242: 0x9932, 0x243: 0x49b8, 0x244: 0x4a71, 0x245: 0x9936, + 0x246: 0x8132, 0x247: 0x812d, 0x248: 0x812d, 0x249: 0x812d, 0x24a: 0x8132, 0x24b: 0x8132, + 0x24c: 0x8132, 0x24d: 0x812d, 0x24e: 0x812d, 0x250: 0x8132, 0x251: 0x8132, + 0x252: 0x8132, 0x253: 0x812d, 0x254: 0x812d, 0x255: 0x812d, 0x256: 0x812d, 0x257: 0x8132, + 0x258: 0x8133, 0x259: 0x812d, 0x25a: 0x812d, 0x25b: 0x8132, 0x25c: 0x8134, 0x25d: 0x8135, + 0x25e: 0x8135, 0x25f: 0x8134, 0x260: 0x8135, 0x261: 0x8135, 0x262: 0x8134, 0x263: 0x8132, + 0x264: 0x8132, 0x265: 0x8132, 0x266: 0x8132, 0x267: 0x8132, 0x268: 0x8132, 0x269: 0x8132, + 0x26a: 0x8132, 0x26b: 0x8132, 0x26c: 0x8132, 0x26d: 0x8132, 0x26e: 0x8132, 0x26f: 0x8132, + 0x274: 0x0170, + 0x27a: 0x42a5, + 0x27e: 0x0037, + // Block 0xa, offset 0x280 + 0x284: 0x425a, 0x285: 0x447b, + 0x286: 0x35e9, 0x287: 0x00ce, 0x288: 0x3607, 0x289: 0x3613, 0x28a: 0x3625, + 0x28c: 0x3643, 0x28e: 0x3655, 0x28f: 0x3673, 0x290: 0x3e08, 0x291: 0xa000, + 0x295: 0xa000, 0x297: 0xa000, + 0x299: 0xa000, + 0x29f: 0xa000, 0x2a1: 0xa000, + 0x2a5: 0xa000, 0x2a9: 0xa000, + 0x2aa: 0x3637, 0x2ab: 0x3667, 0x2ac: 0x47fe, 0x2ad: 0x3697, 0x2ae: 0x4828, 0x2af: 0x36a9, + 0x2b0: 0x3e70, 0x2b1: 0xa000, 0x2b5: 0xa000, + 0x2b7: 0xa000, 0x2b9: 0xa000, + 0x2bf: 0xa000, + // Block 0xb, offset 0x2c0 + 0x2c1: 0xa000, 0x2c5: 0xa000, + 0x2c9: 0xa000, 0x2ca: 0x4840, 0x2cb: 0x485e, + 0x2cc: 0x36c7, 0x2cd: 0x36df, 0x2ce: 0x4876, 0x2d0: 0x01be, 0x2d1: 0x01d0, + 0x2d2: 0x01ac, 0x2d3: 0x430c, 0x2d4: 0x4312, 0x2d5: 0x01fa, 0x2d6: 0x01e8, + 0x2f0: 0x01d6, 0x2f1: 0x01eb, 0x2f2: 0x01ee, 0x2f4: 0x0188, 0x2f5: 0x01c7, + 0x2f9: 0x01a6, + // Block 0xc, offset 0x300 + 0x300: 0x3721, 0x301: 0x372d, 0x303: 0x371b, + 0x306: 0xa000, 0x307: 0x3709, + 0x30c: 0x375d, 0x30d: 0x3745, 0x30e: 0x376f, 0x310: 0xa000, + 0x313: 0xa000, 0x315: 0xa000, 0x316: 0xa000, 0x317: 0xa000, + 0x318: 0xa000, 0x319: 0x3751, 0x31a: 0xa000, + 0x31e: 0xa000, 0x323: 0xa000, + 0x327: 0xa000, + 0x32b: 0xa000, 0x32d: 0xa000, + 0x330: 0xa000, 0x333: 0xa000, 0x335: 0xa000, + 0x336: 0xa000, 0x337: 0xa000, 0x338: 0xa000, 0x339: 0x37d5, 0x33a: 0xa000, + 0x33e: 0xa000, + // Block 0xd, offset 0x340 + 0x341: 0x3733, 0x342: 0x37b7, + 0x350: 0x370f, 0x351: 0x3793, + 0x352: 0x3715, 0x353: 0x3799, 0x356: 0x3727, 0x357: 0x37ab, + 0x358: 0xa000, 0x359: 0xa000, 0x35a: 0x3829, 0x35b: 0x382f, 0x35c: 0x3739, 0x35d: 0x37bd, + 0x35e: 0x373f, 0x35f: 0x37c3, 0x362: 0x374b, 0x363: 0x37cf, + 0x364: 0x3757, 0x365: 0x37db, 0x366: 0x3763, 0x367: 0x37e7, 0x368: 0xa000, 0x369: 0xa000, + 0x36a: 0x3835, 0x36b: 0x383b, 0x36c: 0x378d, 0x36d: 0x3811, 0x36e: 0x3769, 0x36f: 0x37ed, + 0x370: 0x3775, 0x371: 0x37f9, 0x372: 0x377b, 0x373: 0x37ff, 0x374: 0x3781, 0x375: 0x3805, + 0x378: 0x3787, 0x379: 0x380b, + // Block 0xe, offset 0x380 + 0x387: 0x1d61, + 0x391: 0x812d, + 0x392: 0x8132, 0x393: 0x8132, 0x394: 0x8132, 0x395: 0x8132, 0x396: 0x812d, 0x397: 0x8132, + 0x398: 0x8132, 0x399: 0x8132, 0x39a: 0x812e, 0x39b: 0x812d, 0x39c: 0x8132, 0x39d: 0x8132, + 0x39e: 0x8132, 0x39f: 0x8132, 0x3a0: 0x8132, 0x3a1: 0x8132, 0x3a2: 0x812d, 0x3a3: 0x812d, + 0x3a4: 0x812d, 0x3a5: 0x812d, 0x3a6: 0x812d, 0x3a7: 0x812d, 0x3a8: 0x8132, 0x3a9: 0x8132, + 0x3aa: 0x812d, 0x3ab: 0x8132, 0x3ac: 0x8132, 0x3ad: 0x812e, 0x3ae: 0x8131, 0x3af: 0x8132, + 0x3b0: 0x8105, 0x3b1: 0x8106, 0x3b2: 0x8107, 0x3b3: 0x8108, 0x3b4: 0x8109, 0x3b5: 0x810a, + 0x3b6: 0x810b, 0x3b7: 0x810c, 0x3b8: 0x810d, 0x3b9: 0x810e, 0x3ba: 0x810e, 0x3bb: 0x810f, + 0x3bc: 0x8110, 0x3bd: 0x8111, 0x3bf: 0x8112, + // Block 0xf, offset 0x3c0 + 0x3c8: 0xa000, 0x3ca: 0xa000, 0x3cb: 0x8116, + 0x3cc: 0x8117, 0x3cd: 0x8118, 0x3ce: 0x8119, 0x3cf: 0x811a, 0x3d0: 0x811b, 0x3d1: 0x811c, + 0x3d2: 0x811d, 0x3d3: 0x9932, 0x3d4: 0x9932, 0x3d5: 0x992d, 0x3d6: 0x812d, 0x3d7: 0x8132, + 0x3d8: 0x8132, 0x3d9: 0x8132, 0x3da: 0x8132, 0x3db: 0x8132, 0x3dc: 0x812d, 0x3dd: 0x8132, + 0x3de: 0x8132, 0x3df: 0x812d, + 0x3f0: 0x811e, 0x3f5: 0x1d84, + 0x3f6: 0x2013, 0x3f7: 0x204f, 0x3f8: 0x204a, + // Block 0x10, offset 0x400 + 0x413: 0x812d, 0x414: 0x8132, 0x415: 0x8132, 0x416: 0x8132, 0x417: 0x8132, + 0x418: 0x8132, 0x419: 0x8132, 0x41a: 0x8132, 0x41b: 0x8132, 0x41c: 0x8132, 0x41d: 0x8132, + 0x41e: 0x8132, 0x41f: 0x8132, 0x420: 0x8132, 0x421: 0x8132, 0x423: 0x812d, + 0x424: 0x8132, 0x425: 0x8132, 0x426: 0x812d, 0x427: 0x8132, 0x428: 0x8132, 0x429: 0x812d, + 0x42a: 0x8132, 0x42b: 0x8132, 0x42c: 0x8132, 0x42d: 0x812d, 0x42e: 0x812d, 0x42f: 0x812d, + 0x430: 0x8116, 0x431: 0x8117, 0x432: 0x8118, 0x433: 0x8132, 0x434: 0x8132, 0x435: 0x8132, + 0x436: 0x812d, 0x437: 0x8132, 0x438: 0x8132, 0x439: 0x812d, 0x43a: 0x812d, 0x43b: 0x8132, + 0x43c: 0x8132, 0x43d: 0x8132, 0x43e: 0x8132, 0x43f: 0x8132, + // Block 0x11, offset 0x440 + 0x445: 0xa000, + 0x446: 0x2d26, 0x447: 0xa000, 0x448: 0x2d2e, 0x449: 0xa000, 0x44a: 0x2d36, 0x44b: 0xa000, + 0x44c: 0x2d3e, 0x44d: 0xa000, 0x44e: 0x2d46, 0x451: 0xa000, + 0x452: 0x2d4e, + 0x474: 0x8102, 0x475: 0x9900, + 0x47a: 0xa000, 0x47b: 0x2d56, + 0x47c: 0xa000, 0x47d: 0x2d5e, 0x47e: 0xa000, 0x47f: 0xa000, + // Block 0x12, offset 0x480 + 0x480: 0x0069, 0x481: 0x006b, 0x482: 0x006f, 0x483: 0x0083, 0x484: 0x00f5, 0x485: 0x00f8, + 0x486: 0x0413, 0x487: 0x0085, 0x488: 0x0089, 0x489: 0x008b, 0x48a: 0x0104, 0x48b: 0x0107, + 0x48c: 0x010a, 0x48d: 0x008f, 0x48f: 0x0097, 0x490: 0x009b, 0x491: 0x00e0, + 0x492: 0x009f, 0x493: 0x00fe, 0x494: 0x0417, 0x495: 0x041b, 0x496: 0x00a1, 0x497: 0x00a9, + 0x498: 0x00ab, 0x499: 0x0423, 0x49a: 0x012b, 0x49b: 0x00ad, 0x49c: 0x0427, 0x49d: 0x01be, + 0x49e: 0x01c1, 0x49f: 0x01c4, 0x4a0: 0x01fa, 0x4a1: 0x01fd, 0x4a2: 0x0093, 0x4a3: 0x00a5, + 0x4a4: 0x00ab, 0x4a5: 0x00ad, 0x4a6: 0x01be, 0x4a7: 0x01c1, 0x4a8: 0x01eb, 0x4a9: 0x01fa, + 0x4aa: 0x01fd, + 0x4b8: 0x020c, + // Block 0x13, offset 0x4c0 + 0x4db: 0x00fb, 0x4dc: 0x0087, 0x4dd: 0x0101, + 0x4de: 0x00d4, 0x4df: 0x010a, 0x4e0: 0x008d, 0x4e1: 0x010d, 0x4e2: 0x0110, 0x4e3: 0x0116, + 0x4e4: 0x011c, 0x4e5: 0x011f, 0x4e6: 0x0122, 0x4e7: 0x042b, 0x4e8: 0x016a, 0x4e9: 0x0128, + 0x4ea: 0x042f, 0x4eb: 0x016d, 0x4ec: 0x0131, 0x4ed: 0x012e, 0x4ee: 0x0134, 0x4ef: 0x0137, + 0x4f0: 0x013a, 0x4f1: 0x013d, 0x4f2: 0x0140, 0x4f3: 0x014c, 0x4f4: 0x014f, 0x4f5: 0x00ec, + 0x4f6: 0x0152, 0x4f7: 0x0155, 0x4f8: 0x041f, 0x4f9: 0x0158, 0x4fa: 0x015b, 0x4fb: 0x00b5, + 0x4fc: 0x015e, 0x4fd: 0x0161, 0x4fe: 0x0164, 0x4ff: 0x01d0, + // Block 0x14, offset 0x500 + 0x500: 0x8132, 0x501: 0x8132, 0x502: 0x812d, 0x503: 0x8132, 0x504: 0x8132, 0x505: 0x8132, + 0x506: 0x8132, 0x507: 0x8132, 0x508: 0x8132, 0x509: 0x8132, 0x50a: 0x812d, 0x50b: 0x8132, + 0x50c: 0x8132, 0x50d: 0x8135, 0x50e: 0x812a, 0x50f: 0x812d, 0x510: 0x8129, 0x511: 0x8132, + 0x512: 0x8132, 0x513: 0x8132, 0x514: 0x8132, 0x515: 0x8132, 0x516: 0x8132, 0x517: 0x8132, + 0x518: 0x8132, 0x519: 0x8132, 0x51a: 0x8132, 0x51b: 0x8132, 0x51c: 0x8132, 0x51d: 0x8132, + 0x51e: 0x8132, 0x51f: 0x8132, 0x520: 0x8132, 0x521: 0x8132, 0x522: 0x8132, 0x523: 0x8132, + 0x524: 0x8132, 0x525: 0x8132, 0x526: 0x8132, 0x527: 0x8132, 0x528: 0x8132, 0x529: 0x8132, + 0x52a: 0x8132, 0x52b: 0x8132, 0x52c: 0x8132, 0x52d: 0x8132, 0x52e: 0x8132, 0x52f: 0x8132, + 0x530: 0x8132, 0x531: 0x8132, 0x532: 0x8132, 0x533: 0x8132, 0x534: 0x8132, 0x535: 0x8132, + 0x536: 0x8133, 0x537: 0x8131, 0x538: 0x8131, 0x539: 0x812d, 0x53b: 0x8132, + 0x53c: 0x8134, 0x53d: 0x812d, 0x53e: 0x8132, 0x53f: 0x812d, + // Block 0x15, offset 0x540 + 0x540: 0x2f97, 0x541: 0x32a3, 0x542: 0x2fa1, 0x543: 0x32ad, 0x544: 0x2fa6, 0x545: 0x32b2, + 0x546: 0x2fab, 0x547: 0x32b7, 0x548: 0x38cc, 0x549: 0x3a5b, 0x54a: 0x2fc4, 0x54b: 0x32d0, + 0x54c: 0x2fce, 0x54d: 0x32da, 0x54e: 0x2fdd, 0x54f: 0x32e9, 0x550: 0x2fd3, 0x551: 0x32df, + 0x552: 0x2fd8, 0x553: 0x32e4, 0x554: 0x38ef, 0x555: 0x3a7e, 0x556: 0x38f6, 0x557: 0x3a85, + 0x558: 0x3019, 0x559: 0x3325, 0x55a: 0x301e, 0x55b: 0x332a, 0x55c: 0x3904, 0x55d: 0x3a93, + 0x55e: 0x3023, 0x55f: 0x332f, 0x560: 0x3032, 0x561: 0x333e, 0x562: 0x3050, 0x563: 0x335c, + 0x564: 0x305f, 0x565: 0x336b, 0x566: 0x3055, 0x567: 0x3361, 0x568: 0x3064, 0x569: 0x3370, + 0x56a: 0x3069, 0x56b: 0x3375, 0x56c: 0x30af, 0x56d: 0x33bb, 0x56e: 0x390b, 0x56f: 0x3a9a, + 0x570: 0x30b9, 0x571: 0x33ca, 0x572: 0x30c3, 0x573: 0x33d4, 0x574: 0x30cd, 0x575: 0x33de, + 0x576: 0x46c4, 0x577: 0x4755, 0x578: 0x3912, 0x579: 0x3aa1, 0x57a: 0x30e6, 0x57b: 0x33f7, + 0x57c: 0x30e1, 0x57d: 0x33f2, 0x57e: 0x30eb, 0x57f: 0x33fc, + // Block 0x16, offset 0x580 + 0x580: 0x30f0, 0x581: 0x3401, 0x582: 0x30f5, 0x583: 0x3406, 0x584: 0x3109, 0x585: 0x341a, + 0x586: 0x3113, 0x587: 0x3424, 0x588: 0x3122, 0x589: 0x3433, 0x58a: 0x311d, 0x58b: 0x342e, + 0x58c: 0x3935, 0x58d: 0x3ac4, 0x58e: 0x3943, 0x58f: 0x3ad2, 0x590: 0x394a, 0x591: 0x3ad9, + 0x592: 0x3951, 0x593: 0x3ae0, 0x594: 0x314f, 0x595: 0x3460, 0x596: 0x3154, 0x597: 0x3465, + 0x598: 0x315e, 0x599: 0x346f, 0x59a: 0x46f1, 0x59b: 0x4782, 0x59c: 0x3997, 0x59d: 0x3b26, + 0x59e: 0x3177, 0x59f: 0x3488, 0x5a0: 0x3181, 0x5a1: 0x3492, 0x5a2: 0x4700, 0x5a3: 0x4791, + 0x5a4: 0x399e, 0x5a5: 0x3b2d, 0x5a6: 0x39a5, 0x5a7: 0x3b34, 0x5a8: 0x39ac, 0x5a9: 0x3b3b, + 0x5aa: 0x3190, 0x5ab: 0x34a1, 0x5ac: 0x319a, 0x5ad: 0x34b0, 0x5ae: 0x31ae, 0x5af: 0x34c4, + 0x5b0: 0x31a9, 0x5b1: 0x34bf, 0x5b2: 0x31ea, 0x5b3: 0x3500, 0x5b4: 0x31f9, 0x5b5: 0x350f, + 0x5b6: 0x31f4, 0x5b7: 0x350a, 0x5b8: 0x39b3, 0x5b9: 0x3b42, 0x5ba: 0x39ba, 0x5bb: 0x3b49, + 0x5bc: 0x31fe, 0x5bd: 0x3514, 0x5be: 0x3203, 0x5bf: 0x3519, + // Block 0x17, offset 0x5c0 + 0x5c0: 0x3208, 0x5c1: 0x351e, 0x5c2: 0x320d, 0x5c3: 0x3523, 0x5c4: 0x321c, 0x5c5: 0x3532, + 0x5c6: 0x3217, 0x5c7: 0x352d, 0x5c8: 0x3221, 0x5c9: 0x353c, 0x5ca: 0x3226, 0x5cb: 0x3541, + 0x5cc: 0x322b, 0x5cd: 0x3546, 0x5ce: 0x3249, 0x5cf: 0x3564, 0x5d0: 0x3262, 0x5d1: 0x3582, + 0x5d2: 0x3271, 0x5d3: 0x3591, 0x5d4: 0x3276, 0x5d5: 0x3596, 0x5d6: 0x337a, 0x5d7: 0x34a6, + 0x5d8: 0x3537, 0x5d9: 0x3573, 0x5da: 0x1be0, 0x5db: 0x42d7, + 0x5e0: 0x46a1, 0x5e1: 0x4732, 0x5e2: 0x2f83, 0x5e3: 0x328f, + 0x5e4: 0x3878, 0x5e5: 0x3a07, 0x5e6: 0x3871, 0x5e7: 0x3a00, 0x5e8: 0x3886, 0x5e9: 0x3a15, + 0x5ea: 0x387f, 0x5eb: 0x3a0e, 0x5ec: 0x38be, 0x5ed: 0x3a4d, 0x5ee: 0x3894, 0x5ef: 0x3a23, + 0x5f0: 0x388d, 0x5f1: 0x3a1c, 0x5f2: 0x38a2, 0x5f3: 0x3a31, 0x5f4: 0x389b, 0x5f5: 0x3a2a, + 0x5f6: 0x38c5, 0x5f7: 0x3a54, 0x5f8: 0x46b5, 0x5f9: 0x4746, 0x5fa: 0x3000, 0x5fb: 0x330c, + 0x5fc: 0x2fec, 0x5fd: 0x32f8, 0x5fe: 0x38da, 0x5ff: 0x3a69, + // Block 0x18, offset 0x600 + 0x600: 0x38d3, 0x601: 0x3a62, 0x602: 0x38e8, 0x603: 0x3a77, 0x604: 0x38e1, 0x605: 0x3a70, + 0x606: 0x38fd, 0x607: 0x3a8c, 0x608: 0x3091, 0x609: 0x339d, 0x60a: 0x30a5, 0x60b: 0x33b1, + 0x60c: 0x46e7, 0x60d: 0x4778, 0x60e: 0x3136, 0x60f: 0x3447, 0x610: 0x3920, 0x611: 0x3aaf, + 0x612: 0x3919, 0x613: 0x3aa8, 0x614: 0x392e, 0x615: 0x3abd, 0x616: 0x3927, 0x617: 0x3ab6, + 0x618: 0x3989, 0x619: 0x3b18, 0x61a: 0x396d, 0x61b: 0x3afc, 0x61c: 0x3966, 0x61d: 0x3af5, + 0x61e: 0x397b, 0x61f: 0x3b0a, 0x620: 0x3974, 0x621: 0x3b03, 0x622: 0x3982, 0x623: 0x3b11, + 0x624: 0x31e5, 0x625: 0x34fb, 0x626: 0x31c7, 0x627: 0x34dd, 0x628: 0x39e4, 0x629: 0x3b73, + 0x62a: 0x39dd, 0x62b: 0x3b6c, 0x62c: 0x39f2, 0x62d: 0x3b81, 0x62e: 0x39eb, 0x62f: 0x3b7a, + 0x630: 0x39f9, 0x631: 0x3b88, 0x632: 0x3230, 0x633: 0x354b, 0x634: 0x3258, 0x635: 0x3578, + 0x636: 0x3253, 0x637: 0x356e, 0x638: 0x323f, 0x639: 0x355a, + // Block 0x19, offset 0x640 + 0x640: 0x4804, 0x641: 0x480a, 0x642: 0x491e, 0x643: 0x4936, 0x644: 0x4926, 0x645: 0x493e, + 0x646: 0x492e, 0x647: 0x4946, 0x648: 0x47aa, 0x649: 0x47b0, 0x64a: 0x488e, 0x64b: 0x48a6, + 0x64c: 0x4896, 0x64d: 0x48ae, 0x64e: 0x489e, 0x64f: 0x48b6, 0x650: 0x4816, 0x651: 0x481c, + 0x652: 0x3db8, 0x653: 0x3dc8, 0x654: 0x3dc0, 0x655: 0x3dd0, + 0x658: 0x47b6, 0x659: 0x47bc, 0x65a: 0x3ce8, 0x65b: 0x3cf8, 0x65c: 0x3cf0, 0x65d: 0x3d00, + 0x660: 0x482e, 0x661: 0x4834, 0x662: 0x494e, 0x663: 0x4966, + 0x664: 0x4956, 0x665: 0x496e, 0x666: 0x495e, 0x667: 0x4976, 0x668: 0x47c2, 0x669: 0x47c8, + 0x66a: 0x48be, 0x66b: 0x48d6, 0x66c: 0x48c6, 0x66d: 0x48de, 0x66e: 0x48ce, 0x66f: 0x48e6, + 0x670: 0x4846, 0x671: 0x484c, 0x672: 0x3e18, 0x673: 0x3e30, 0x674: 0x3e20, 0x675: 0x3e38, + 0x676: 0x3e28, 0x677: 0x3e40, 0x678: 0x47ce, 0x679: 0x47d4, 0x67a: 0x3d18, 0x67b: 0x3d30, + 0x67c: 0x3d20, 0x67d: 0x3d38, 0x67e: 0x3d28, 0x67f: 0x3d40, + // Block 0x1a, offset 0x680 + 0x680: 0x4852, 0x681: 0x4858, 0x682: 0x3e48, 0x683: 0x3e58, 0x684: 0x3e50, 0x685: 0x3e60, + 0x688: 0x47da, 0x689: 0x47e0, 0x68a: 0x3d48, 0x68b: 0x3d58, + 0x68c: 0x3d50, 0x68d: 0x3d60, 0x690: 0x4864, 0x691: 0x486a, + 0x692: 0x3e80, 0x693: 0x3e98, 0x694: 0x3e88, 0x695: 0x3ea0, 0x696: 0x3e90, 0x697: 0x3ea8, + 0x699: 0x47e6, 0x69b: 0x3d68, 0x69d: 0x3d70, + 0x69f: 0x3d78, 0x6a0: 0x487c, 0x6a1: 0x4882, 0x6a2: 0x497e, 0x6a3: 0x4996, + 0x6a4: 0x4986, 0x6a5: 0x499e, 0x6a6: 0x498e, 0x6a7: 0x49a6, 0x6a8: 0x47ec, 0x6a9: 0x47f2, + 0x6aa: 0x48ee, 0x6ab: 0x4906, 0x6ac: 0x48f6, 0x6ad: 0x490e, 0x6ae: 0x48fe, 0x6af: 0x4916, + 0x6b0: 0x47f8, 0x6b1: 0x431e, 0x6b2: 0x3691, 0x6b3: 0x4324, 0x6b4: 0x4822, 0x6b5: 0x432a, + 0x6b6: 0x36a3, 0x6b7: 0x4330, 0x6b8: 0x36c1, 0x6b9: 0x4336, 0x6ba: 0x36d9, 0x6bb: 0x433c, + 0x6bc: 0x4870, 0x6bd: 0x4342, + // Block 0x1b, offset 0x6c0 + 0x6c0: 0x3da0, 0x6c1: 0x3da8, 0x6c2: 0x4184, 0x6c3: 0x41a2, 0x6c4: 0x418e, 0x6c5: 0x41ac, + 0x6c6: 0x4198, 0x6c7: 0x41b6, 0x6c8: 0x3cd8, 0x6c9: 0x3ce0, 0x6ca: 0x40d0, 0x6cb: 0x40ee, + 0x6cc: 0x40da, 0x6cd: 0x40f8, 0x6ce: 0x40e4, 0x6cf: 0x4102, 0x6d0: 0x3de8, 0x6d1: 0x3df0, + 0x6d2: 0x41c0, 0x6d3: 0x41de, 0x6d4: 0x41ca, 0x6d5: 0x41e8, 0x6d6: 0x41d4, 0x6d7: 0x41f2, + 0x6d8: 0x3d08, 0x6d9: 0x3d10, 0x6da: 0x410c, 0x6db: 0x412a, 0x6dc: 0x4116, 0x6dd: 0x4134, + 0x6de: 0x4120, 0x6df: 0x413e, 0x6e0: 0x3ec0, 0x6e1: 0x3ec8, 0x6e2: 0x41fc, 0x6e3: 0x421a, + 0x6e4: 0x4206, 0x6e5: 0x4224, 0x6e6: 0x4210, 0x6e7: 0x422e, 0x6e8: 0x3d80, 0x6e9: 0x3d88, + 0x6ea: 0x4148, 0x6eb: 0x4166, 0x6ec: 0x4152, 0x6ed: 0x4170, 0x6ee: 0x415c, 0x6ef: 0x417a, + 0x6f0: 0x3685, 0x6f1: 0x367f, 0x6f2: 0x3d90, 0x6f3: 0x368b, 0x6f4: 0x3d98, + 0x6f6: 0x4810, 0x6f7: 0x3db0, 0x6f8: 0x35f5, 0x6f9: 0x35ef, 0x6fa: 0x35e3, 0x6fb: 0x42ee, + 0x6fc: 0x35fb, 0x6fd: 0x4287, 0x6fe: 0x01d3, 0x6ff: 0x4287, + // Block 0x1c, offset 0x700 + 0x700: 0x42a0, 0x701: 0x4482, 0x702: 0x3dd8, 0x703: 0x369d, 0x704: 0x3de0, + 0x706: 0x483a, 0x707: 0x3df8, 0x708: 0x3601, 0x709: 0x42f4, 0x70a: 0x360d, 0x70b: 0x42fa, + 0x70c: 0x3619, 0x70d: 0x4489, 0x70e: 0x4490, 0x70f: 0x4497, 0x710: 0x36b5, 0x711: 0x36af, + 0x712: 0x3e00, 0x713: 0x44e4, 0x716: 0x36bb, 0x717: 0x3e10, + 0x718: 0x3631, 0x719: 0x362b, 0x71a: 0x361f, 0x71b: 0x4300, 0x71d: 0x449e, + 0x71e: 0x44a5, 0x71f: 0x44ac, 0x720: 0x36eb, 0x721: 0x36e5, 0x722: 0x3e68, 0x723: 0x44ec, + 0x724: 0x36cd, 0x725: 0x36d3, 0x726: 0x36f1, 0x727: 0x3e78, 0x728: 0x3661, 0x729: 0x365b, + 0x72a: 0x364f, 0x72b: 0x430c, 0x72c: 0x3649, 0x72d: 0x4474, 0x72e: 0x447b, 0x72f: 0x0081, + 0x732: 0x3eb0, 0x733: 0x36f7, 0x734: 0x3eb8, + 0x736: 0x4888, 0x737: 0x3ed0, 0x738: 0x363d, 0x739: 0x4306, 0x73a: 0x366d, 0x73b: 0x4318, + 0x73c: 0x3679, 0x73d: 0x425a, 0x73e: 0x428c, + // Block 0x1d, offset 0x740 + 0x740: 0x1bd8, 0x741: 0x1bdc, 0x742: 0x0047, 0x743: 0x1c54, 0x745: 0x1be8, + 0x746: 0x1bec, 0x747: 0x00e9, 0x749: 0x1c58, 0x74a: 0x008f, 0x74b: 0x0051, + 0x74c: 0x0051, 0x74d: 0x0051, 0x74e: 0x0091, 0x74f: 0x00da, 0x750: 0x0053, 0x751: 0x0053, + 0x752: 0x0059, 0x753: 0x0099, 0x755: 0x005d, 0x756: 0x198d, + 0x759: 0x0061, 0x75a: 0x0063, 0x75b: 0x0065, 0x75c: 0x0065, 0x75d: 0x0065, + 0x760: 0x199f, 0x761: 0x1bc8, 0x762: 0x19a8, + 0x764: 0x0075, 0x766: 0x01b8, 0x768: 0x0075, + 0x76a: 0x0057, 0x76b: 0x42d2, 0x76c: 0x0045, 0x76d: 0x0047, 0x76f: 0x008b, + 0x770: 0x004b, 0x771: 0x004d, 0x773: 0x005b, 0x774: 0x009f, 0x775: 0x0215, + 0x776: 0x0218, 0x777: 0x021b, 0x778: 0x021e, 0x779: 0x0093, 0x77b: 0x1b98, + 0x77c: 0x01e8, 0x77d: 0x01c1, 0x77e: 0x0179, 0x77f: 0x01a0, + // Block 0x1e, offset 0x780 + 0x780: 0x0463, 0x785: 0x0049, + 0x786: 0x0089, 0x787: 0x008b, 0x788: 0x0093, 0x789: 0x0095, + 0x790: 0x222e, 0x791: 0x223a, + 0x792: 0x22ee, 0x793: 0x2216, 0x794: 0x229a, 0x795: 0x2222, 0x796: 0x22a0, 0x797: 0x22b8, + 0x798: 0x22c4, 0x799: 0x2228, 0x79a: 0x22ca, 0x79b: 0x2234, 0x79c: 0x22be, 0x79d: 0x22d0, + 0x79e: 0x22d6, 0x79f: 0x1cbc, 0x7a0: 0x0053, 0x7a1: 0x195a, 0x7a2: 0x1ba4, 0x7a3: 0x1963, + 0x7a4: 0x006d, 0x7a5: 0x19ab, 0x7a6: 0x1bd0, 0x7a7: 0x1d48, 0x7a8: 0x1966, 0x7a9: 0x0071, + 0x7aa: 0x19b7, 0x7ab: 0x1bd4, 0x7ac: 0x0059, 0x7ad: 0x0047, 0x7ae: 0x0049, 0x7af: 0x005b, + 0x7b0: 0x0093, 0x7b1: 0x19e4, 0x7b2: 0x1c18, 0x7b3: 0x19ed, 0x7b4: 0x00ad, 0x7b5: 0x1a62, + 0x7b6: 0x1c4c, 0x7b7: 0x1d5c, 0x7b8: 0x19f0, 0x7b9: 0x00b1, 0x7ba: 0x1a65, 0x7bb: 0x1c50, + 0x7bc: 0x0099, 0x7bd: 0x0087, 0x7be: 0x0089, 0x7bf: 0x009b, + // Block 0x1f, offset 0x7c0 + 0x7c1: 0x3c06, 0x7c3: 0xa000, 0x7c4: 0x3c0d, 0x7c5: 0xa000, + 0x7c7: 0x3c14, 0x7c8: 0xa000, 0x7c9: 0x3c1b, + 0x7cd: 0xa000, + 0x7e0: 0x2f65, 0x7e1: 0xa000, 0x7e2: 0x3c29, + 0x7e4: 0xa000, 0x7e5: 0xa000, + 0x7ed: 0x3c22, 0x7ee: 0x2f60, 0x7ef: 0x2f6a, + 0x7f0: 0x3c30, 0x7f1: 0x3c37, 0x7f2: 0xa000, 0x7f3: 0xa000, 0x7f4: 0x3c3e, 0x7f5: 0x3c45, + 0x7f6: 0xa000, 0x7f7: 0xa000, 0x7f8: 0x3c4c, 0x7f9: 0x3c53, 0x7fa: 0xa000, 0x7fb: 0xa000, + 0x7fc: 0xa000, 0x7fd: 0xa000, + // Block 0x20, offset 0x800 + 0x800: 0x3c5a, 0x801: 0x3c61, 0x802: 0xa000, 0x803: 0xa000, 0x804: 0x3c76, 0x805: 0x3c7d, + 0x806: 0xa000, 0x807: 0xa000, 0x808: 0x3c84, 0x809: 0x3c8b, + 0x811: 0xa000, + 0x812: 0xa000, + 0x822: 0xa000, + 0x828: 0xa000, 0x829: 0xa000, + 0x82b: 0xa000, 0x82c: 0x3ca0, 0x82d: 0x3ca7, 0x82e: 0x3cae, 0x82f: 0x3cb5, + 0x832: 0xa000, 0x833: 0xa000, 0x834: 0xa000, 0x835: 0xa000, + // Block 0x21, offset 0x840 + 0x860: 0x0023, 0x861: 0x0025, 0x862: 0x0027, 0x863: 0x0029, + 0x864: 0x002b, 0x865: 0x002d, 0x866: 0x002f, 0x867: 0x0031, 0x868: 0x0033, 0x869: 0x1882, + 0x86a: 0x1885, 0x86b: 0x1888, 0x86c: 0x188b, 0x86d: 0x188e, 0x86e: 0x1891, 0x86f: 0x1894, + 0x870: 0x1897, 0x871: 0x189a, 0x872: 0x189d, 0x873: 0x18a6, 0x874: 0x1a68, 0x875: 0x1a6c, + 0x876: 0x1a70, 0x877: 0x1a74, 0x878: 0x1a78, 0x879: 0x1a7c, 0x87a: 0x1a80, 0x87b: 0x1a84, + 0x87c: 0x1a88, 0x87d: 0x1c80, 0x87e: 0x1c85, 0x87f: 0x1c8a, + // Block 0x22, offset 0x880 + 0x880: 0x1c8f, 0x881: 0x1c94, 0x882: 0x1c99, 0x883: 0x1c9e, 0x884: 0x1ca3, 0x885: 0x1ca8, + 0x886: 0x1cad, 0x887: 0x1cb2, 0x888: 0x187f, 0x889: 0x18a3, 0x88a: 0x18c7, 0x88b: 0x18eb, + 0x88c: 0x190f, 0x88d: 0x1918, 0x88e: 0x191e, 0x88f: 0x1924, 0x890: 0x192a, 0x891: 0x1b60, + 0x892: 0x1b64, 0x893: 0x1b68, 0x894: 0x1b6c, 0x895: 0x1b70, 0x896: 0x1b74, 0x897: 0x1b78, + 0x898: 0x1b7c, 0x899: 0x1b80, 0x89a: 0x1b84, 0x89b: 0x1b88, 0x89c: 0x1af4, 0x89d: 0x1af8, + 0x89e: 0x1afc, 0x89f: 0x1b00, 0x8a0: 0x1b04, 0x8a1: 0x1b08, 0x8a2: 0x1b0c, 0x8a3: 0x1b10, + 0x8a4: 0x1b14, 0x8a5: 0x1b18, 0x8a6: 0x1b1c, 0x8a7: 0x1b20, 0x8a8: 0x1b24, 0x8a9: 0x1b28, + 0x8aa: 0x1b2c, 0x8ab: 0x1b30, 0x8ac: 0x1b34, 0x8ad: 0x1b38, 0x8ae: 0x1b3c, 0x8af: 0x1b40, + 0x8b0: 0x1b44, 0x8b1: 0x1b48, 0x8b2: 0x1b4c, 0x8b3: 0x1b50, 0x8b4: 0x1b54, 0x8b5: 0x1b58, + 0x8b6: 0x0043, 0x8b7: 0x0045, 0x8b8: 0x0047, 0x8b9: 0x0049, 0x8ba: 0x004b, 0x8bb: 0x004d, + 0x8bc: 0x004f, 0x8bd: 0x0051, 0x8be: 0x0053, 0x8bf: 0x0055, + // Block 0x23, offset 0x8c0 + 0x8c0: 0x06bf, 0x8c1: 0x06e3, 0x8c2: 0x06ef, 0x8c3: 0x06ff, 0x8c4: 0x0707, 0x8c5: 0x0713, + 0x8c6: 0x071b, 0x8c7: 0x0723, 0x8c8: 0x072f, 0x8c9: 0x0783, 0x8ca: 0x079b, 0x8cb: 0x07ab, + 0x8cc: 0x07bb, 0x8cd: 0x07cb, 0x8ce: 0x07db, 0x8cf: 0x07fb, 0x8d0: 0x07ff, 0x8d1: 0x0803, + 0x8d2: 0x0837, 0x8d3: 0x085f, 0x8d4: 0x086f, 0x8d5: 0x0877, 0x8d6: 0x087b, 0x8d7: 0x0887, + 0x8d8: 0x08a3, 0x8d9: 0x08a7, 0x8da: 0x08bf, 0x8db: 0x08c3, 0x8dc: 0x08cb, 0x8dd: 0x08db, + 0x8de: 0x0977, 0x8df: 0x098b, 0x8e0: 0x09cb, 0x8e1: 0x09df, 0x8e2: 0x09e7, 0x8e3: 0x09eb, + 0x8e4: 0x09fb, 0x8e5: 0x0a17, 0x8e6: 0x0a43, 0x8e7: 0x0a4f, 0x8e8: 0x0a6f, 0x8e9: 0x0a7b, + 0x8ea: 0x0a7f, 0x8eb: 0x0a83, 0x8ec: 0x0a9b, 0x8ed: 0x0a9f, 0x8ee: 0x0acb, 0x8ef: 0x0ad7, + 0x8f0: 0x0adf, 0x8f1: 0x0ae7, 0x8f2: 0x0af7, 0x8f3: 0x0aff, 0x8f4: 0x0b07, 0x8f5: 0x0b33, + 0x8f6: 0x0b37, 0x8f7: 0x0b3f, 0x8f8: 0x0b43, 0x8f9: 0x0b4b, 0x8fa: 0x0b53, 0x8fb: 0x0b63, + 0x8fc: 0x0b7f, 0x8fd: 0x0bf7, 0x8fe: 0x0c0b, 0x8ff: 0x0c0f, + // Block 0x24, offset 0x900 + 0x900: 0x0c8f, 0x901: 0x0c93, 0x902: 0x0ca7, 0x903: 0x0cab, 0x904: 0x0cb3, 0x905: 0x0cbb, + 0x906: 0x0cc3, 0x907: 0x0ccf, 0x908: 0x0cf7, 0x909: 0x0d07, 0x90a: 0x0d1b, 0x90b: 0x0d8b, + 0x90c: 0x0d97, 0x90d: 0x0da7, 0x90e: 0x0db3, 0x90f: 0x0dbf, 0x910: 0x0dc7, 0x911: 0x0dcb, + 0x912: 0x0dcf, 0x913: 0x0dd3, 0x914: 0x0dd7, 0x915: 0x0e8f, 0x916: 0x0ed7, 0x917: 0x0ee3, + 0x918: 0x0ee7, 0x919: 0x0eeb, 0x91a: 0x0eef, 0x91b: 0x0ef7, 0x91c: 0x0efb, 0x91d: 0x0f0f, + 0x91e: 0x0f2b, 0x91f: 0x0f33, 0x920: 0x0f73, 0x921: 0x0f77, 0x922: 0x0f7f, 0x923: 0x0f83, + 0x924: 0x0f8b, 0x925: 0x0f8f, 0x926: 0x0fb3, 0x927: 0x0fb7, 0x928: 0x0fd3, 0x929: 0x0fd7, + 0x92a: 0x0fdb, 0x92b: 0x0fdf, 0x92c: 0x0ff3, 0x92d: 0x1017, 0x92e: 0x101b, 0x92f: 0x101f, + 0x930: 0x1043, 0x931: 0x1083, 0x932: 0x1087, 0x933: 0x10a7, 0x934: 0x10b7, 0x935: 0x10bf, + 0x936: 0x10df, 0x937: 0x1103, 0x938: 0x1147, 0x939: 0x114f, 0x93a: 0x1163, 0x93b: 0x116f, + 0x93c: 0x1177, 0x93d: 0x117f, 0x93e: 0x1183, 0x93f: 0x1187, + // Block 0x25, offset 0x940 + 0x940: 0x119f, 0x941: 0x11a3, 0x942: 0x11bf, 0x943: 0x11c7, 0x944: 0x11cf, 0x945: 0x11d3, + 0x946: 0x11df, 0x947: 0x11e7, 0x948: 0x11eb, 0x949: 0x11ef, 0x94a: 0x11f7, 0x94b: 0x11fb, + 0x94c: 0x129b, 0x94d: 0x12af, 0x94e: 0x12e3, 0x94f: 0x12e7, 0x950: 0x12ef, 0x951: 0x131b, + 0x952: 0x1323, 0x953: 0x132b, 0x954: 0x1333, 0x955: 0x136f, 0x956: 0x1373, 0x957: 0x137b, + 0x958: 0x137f, 0x959: 0x1383, 0x95a: 0x13af, 0x95b: 0x13b3, 0x95c: 0x13bb, 0x95d: 0x13cf, + 0x95e: 0x13d3, 0x95f: 0x13ef, 0x960: 0x13f7, 0x961: 0x13fb, 0x962: 0x141f, 0x963: 0x143f, + 0x964: 0x1453, 0x965: 0x1457, 0x966: 0x145f, 0x967: 0x148b, 0x968: 0x148f, 0x969: 0x149f, + 0x96a: 0x14c3, 0x96b: 0x14cf, 0x96c: 0x14df, 0x96d: 0x14f7, 0x96e: 0x14ff, 0x96f: 0x1503, + 0x970: 0x1507, 0x971: 0x150b, 0x972: 0x1517, 0x973: 0x151b, 0x974: 0x1523, 0x975: 0x153f, + 0x976: 0x1543, 0x977: 0x1547, 0x978: 0x155f, 0x979: 0x1563, 0x97a: 0x156b, 0x97b: 0x157f, + 0x97c: 0x1583, 0x97d: 0x1587, 0x97e: 0x158f, 0x97f: 0x1593, + // Block 0x26, offset 0x980 + 0x986: 0xa000, 0x98b: 0xa000, + 0x98c: 0x3f08, 0x98d: 0xa000, 0x98e: 0x3f10, 0x98f: 0xa000, 0x990: 0x3f18, 0x991: 0xa000, + 0x992: 0x3f20, 0x993: 0xa000, 0x994: 0x3f28, 0x995: 0xa000, 0x996: 0x3f30, 0x997: 0xa000, + 0x998: 0x3f38, 0x999: 0xa000, 0x99a: 0x3f40, 0x99b: 0xa000, 0x99c: 0x3f48, 0x99d: 0xa000, + 0x99e: 0x3f50, 0x99f: 0xa000, 0x9a0: 0x3f58, 0x9a1: 0xa000, 0x9a2: 0x3f60, + 0x9a4: 0xa000, 0x9a5: 0x3f68, 0x9a6: 0xa000, 0x9a7: 0x3f70, 0x9a8: 0xa000, 0x9a9: 0x3f78, + 0x9af: 0xa000, + 0x9b0: 0x3f80, 0x9b1: 0x3f88, 0x9b2: 0xa000, 0x9b3: 0x3f90, 0x9b4: 0x3f98, 0x9b5: 0xa000, + 0x9b6: 0x3fa0, 0x9b7: 0x3fa8, 0x9b8: 0xa000, 0x9b9: 0x3fb0, 0x9ba: 0x3fb8, 0x9bb: 0xa000, + 0x9bc: 0x3fc0, 0x9bd: 0x3fc8, + // Block 0x27, offset 0x9c0 + 0x9d4: 0x3f00, + 0x9d9: 0x9903, 0x9da: 0x9903, 0x9db: 0x42dc, 0x9dc: 0x42e2, 0x9dd: 0xa000, + 0x9de: 0x3fd0, 0x9df: 0x26b4, + 0x9e6: 0xa000, + 0x9eb: 0xa000, 0x9ec: 0x3fe0, 0x9ed: 0xa000, 0x9ee: 0x3fe8, 0x9ef: 0xa000, + 0x9f0: 0x3ff0, 0x9f1: 0xa000, 0x9f2: 0x3ff8, 0x9f3: 0xa000, 0x9f4: 0x4000, 0x9f5: 0xa000, + 0x9f6: 0x4008, 0x9f7: 0xa000, 0x9f8: 0x4010, 0x9f9: 0xa000, 0x9fa: 0x4018, 0x9fb: 0xa000, + 0x9fc: 0x4020, 0x9fd: 0xa000, 0x9fe: 0x4028, 0x9ff: 0xa000, + // Block 0x28, offset 0xa00 + 0xa00: 0x4030, 0xa01: 0xa000, 0xa02: 0x4038, 0xa04: 0xa000, 0xa05: 0x4040, + 0xa06: 0xa000, 0xa07: 0x4048, 0xa08: 0xa000, 0xa09: 0x4050, + 0xa0f: 0xa000, 0xa10: 0x4058, 0xa11: 0x4060, + 0xa12: 0xa000, 0xa13: 0x4068, 0xa14: 0x4070, 0xa15: 0xa000, 0xa16: 0x4078, 0xa17: 0x4080, + 0xa18: 0xa000, 0xa19: 0x4088, 0xa1a: 0x4090, 0xa1b: 0xa000, 0xa1c: 0x4098, 0xa1d: 0x40a0, + 0xa2f: 0xa000, + 0xa30: 0xa000, 0xa31: 0xa000, 0xa32: 0xa000, 0xa34: 0x3fd8, + 0xa37: 0x40a8, 0xa38: 0x40b0, 0xa39: 0x40b8, 0xa3a: 0x40c0, + 0xa3d: 0xa000, 0xa3e: 0x40c8, 0xa3f: 0x26c9, + // Block 0x29, offset 0xa40 + 0xa40: 0x0367, 0xa41: 0x032b, 0xa42: 0x032f, 0xa43: 0x0333, 0xa44: 0x037b, 0xa45: 0x0337, + 0xa46: 0x033b, 0xa47: 0x033f, 0xa48: 0x0343, 0xa49: 0x0347, 0xa4a: 0x034b, 0xa4b: 0x034f, + 0xa4c: 0x0353, 0xa4d: 0x0357, 0xa4e: 0x035b, 0xa4f: 0x49bd, 0xa50: 0x49c3, 0xa51: 0x49c9, + 0xa52: 0x49cf, 0xa53: 0x49d5, 0xa54: 0x49db, 0xa55: 0x49e1, 0xa56: 0x49e7, 0xa57: 0x49ed, + 0xa58: 0x49f3, 0xa59: 0x49f9, 0xa5a: 0x49ff, 0xa5b: 0x4a05, 0xa5c: 0x4a0b, 0xa5d: 0x4a11, + 0xa5e: 0x4a17, 0xa5f: 0x4a1d, 0xa60: 0x4a23, 0xa61: 0x4a29, 0xa62: 0x4a2f, 0xa63: 0x4a35, + 0xa64: 0x03c3, 0xa65: 0x035f, 0xa66: 0x0363, 0xa67: 0x03e7, 0xa68: 0x03eb, 0xa69: 0x03ef, + 0xa6a: 0x03f3, 0xa6b: 0x03f7, 0xa6c: 0x03fb, 0xa6d: 0x03ff, 0xa6e: 0x036b, 0xa6f: 0x0403, + 0xa70: 0x0407, 0xa71: 0x036f, 0xa72: 0x0373, 0xa73: 0x0377, 0xa74: 0x037f, 0xa75: 0x0383, + 0xa76: 0x0387, 0xa77: 0x038b, 0xa78: 0x038f, 0xa79: 0x0393, 0xa7a: 0x0397, 0xa7b: 0x039b, + 0xa7c: 0x039f, 0xa7d: 0x03a3, 0xa7e: 0x03a7, 0xa7f: 0x03ab, + // Block 0x2a, offset 0xa80 + 0xa80: 0x03af, 0xa81: 0x03b3, 0xa82: 0x040b, 0xa83: 0x040f, 0xa84: 0x03b7, 0xa85: 0x03bb, + 0xa86: 0x03bf, 0xa87: 0x03c7, 0xa88: 0x03cb, 0xa89: 0x03cf, 0xa8a: 0x03d3, 0xa8b: 0x03d7, + 0xa8c: 0x03db, 0xa8d: 0x03df, 0xa8e: 0x03e3, + 0xa92: 0x06bf, 0xa93: 0x071b, 0xa94: 0x06cb, 0xa95: 0x097b, 0xa96: 0x06cf, 0xa97: 0x06e7, + 0xa98: 0x06d3, 0xa99: 0x0f93, 0xa9a: 0x0707, 0xa9b: 0x06db, 0xa9c: 0x06c3, 0xa9d: 0x09ff, + 0xa9e: 0x098f, 0xa9f: 0x072f, + // Block 0x2b, offset 0xac0 + 0xac0: 0x2054, 0xac1: 0x205a, 0xac2: 0x2060, 0xac3: 0x2066, 0xac4: 0x206c, 0xac5: 0x2072, + 0xac6: 0x2078, 0xac7: 0x207e, 0xac8: 0x2084, 0xac9: 0x208a, 0xaca: 0x2090, 0xacb: 0x2096, + 0xacc: 0x209c, 0xacd: 0x20a2, 0xace: 0x2726, 0xacf: 0x272f, 0xad0: 0x2738, 0xad1: 0x2741, + 0xad2: 0x274a, 0xad3: 0x2753, 0xad4: 0x275c, 0xad5: 0x2765, 0xad6: 0x276e, 0xad7: 0x2780, + 0xad8: 0x2789, 0xad9: 0x2792, 0xada: 0x279b, 0xadb: 0x27a4, 0xadc: 0x2777, 0xadd: 0x2bac, + 0xade: 0x2aed, 0xae0: 0x20a8, 0xae1: 0x20c0, 0xae2: 0x20b4, 0xae3: 0x2108, + 0xae4: 0x20c6, 0xae5: 0x20e4, 0xae6: 0x20ae, 0xae7: 0x20de, 0xae8: 0x20ba, 0xae9: 0x20f0, + 0xaea: 0x2120, 0xaeb: 0x213e, 0xaec: 0x2138, 0xaed: 0x212c, 0xaee: 0x217a, 0xaef: 0x210e, + 0xaf0: 0x211a, 0xaf1: 0x2132, 0xaf2: 0x2126, 0xaf3: 0x2150, 0xaf4: 0x20fc, 0xaf5: 0x2144, + 0xaf6: 0x216e, 0xaf7: 0x2156, 0xaf8: 0x20ea, 0xaf9: 0x20cc, 0xafa: 0x2102, 0xafb: 0x2114, + 0xafc: 0x214a, 0xafd: 0x20d2, 0xafe: 0x2174, 0xaff: 0x20f6, + // Block 0x2c, offset 0xb00 + 0xb00: 0x215c, 0xb01: 0x20d8, 0xb02: 0x2162, 0xb03: 0x2168, 0xb04: 0x092f, 0xb05: 0x0b03, + 0xb06: 0x0ca7, 0xb07: 0x10c7, + 0xb10: 0x1bc4, 0xb11: 0x18a9, + 0xb12: 0x18ac, 0xb13: 0x18af, 0xb14: 0x18b2, 0xb15: 0x18b5, 0xb16: 0x18b8, 0xb17: 0x18bb, + 0xb18: 0x18be, 0xb19: 0x18c1, 0xb1a: 0x18ca, 0xb1b: 0x18cd, 0xb1c: 0x18d0, 0xb1d: 0x18d3, + 0xb1e: 0x18d6, 0xb1f: 0x18d9, 0xb20: 0x0313, 0xb21: 0x031b, 0xb22: 0x031f, 0xb23: 0x0327, + 0xb24: 0x032b, 0xb25: 0x032f, 0xb26: 0x0337, 0xb27: 0x033f, 0xb28: 0x0343, 0xb29: 0x034b, + 0xb2a: 0x034f, 0xb2b: 0x0353, 0xb2c: 0x0357, 0xb2d: 0x035b, 0xb2e: 0x2e18, 0xb2f: 0x2e20, + 0xb30: 0x2e28, 0xb31: 0x2e30, 0xb32: 0x2e38, 0xb33: 0x2e40, 0xb34: 0x2e48, 0xb35: 0x2e50, + 0xb36: 0x2e60, 0xb37: 0x2e68, 0xb38: 0x2e70, 0xb39: 0x2e78, 0xb3a: 0x2e80, 0xb3b: 0x2e88, + 0xb3c: 0x2ed3, 0xb3d: 0x2e9b, 0xb3e: 0x2e58, + // Block 0x2d, offset 0xb40 + 0xb40: 0x06bf, 0xb41: 0x071b, 0xb42: 0x06cb, 0xb43: 0x097b, 0xb44: 0x071f, 0xb45: 0x07af, + 0xb46: 0x06c7, 0xb47: 0x07ab, 0xb48: 0x070b, 0xb49: 0x0887, 0xb4a: 0x0d07, 0xb4b: 0x0e8f, + 0xb4c: 0x0dd7, 0xb4d: 0x0d1b, 0xb4e: 0x145f, 0xb4f: 0x098b, 0xb50: 0x0ccf, 0xb51: 0x0d4b, + 0xb52: 0x0d0b, 0xb53: 0x104b, 0xb54: 0x08fb, 0xb55: 0x0f03, 0xb56: 0x1387, 0xb57: 0x105f, + 0xb58: 0x0843, 0xb59: 0x108f, 0xb5a: 0x0f9b, 0xb5b: 0x0a17, 0xb5c: 0x140f, 0xb5d: 0x077f, + 0xb5e: 0x08ab, 0xb5f: 0x0df7, 0xb60: 0x1527, 0xb61: 0x0743, 0xb62: 0x07d3, 0xb63: 0x0d9b, + 0xb64: 0x06cf, 0xb65: 0x06e7, 0xb66: 0x06d3, 0xb67: 0x0adb, 0xb68: 0x08ef, 0xb69: 0x087f, + 0xb6a: 0x0a57, 0xb6b: 0x0a4b, 0xb6c: 0x0feb, 0xb6d: 0x073f, 0xb6e: 0x139b, 0xb6f: 0x089b, + 0xb70: 0x09f3, 0xb71: 0x18dc, 0xb72: 0x18df, 0xb73: 0x18e2, 0xb74: 0x18e5, 0xb75: 0x18ee, + 0xb76: 0x18f1, 0xb77: 0x18f4, 0xb78: 0x18f7, 0xb79: 0x18fa, 0xb7a: 0x18fd, 0xb7b: 0x1900, + 0xb7c: 0x1903, 0xb7d: 0x1906, 0xb7e: 0x1909, 0xb7f: 0x1912, + // Block 0x2e, offset 0xb80 + 0xb80: 0x1cc6, 0xb81: 0x1cd5, 0xb82: 0x1ce4, 0xb83: 0x1cf3, 0xb84: 0x1d02, 0xb85: 0x1d11, + 0xb86: 0x1d20, 0xb87: 0x1d2f, 0xb88: 0x1d3e, 0xb89: 0x218c, 0xb8a: 0x219e, 0xb8b: 0x21b0, + 0xb8c: 0x1954, 0xb8d: 0x1c04, 0xb8e: 0x19d2, 0xb8f: 0x1ba8, 0xb90: 0x04cb, 0xb91: 0x04d3, + 0xb92: 0x04db, 0xb93: 0x04e3, 0xb94: 0x04eb, 0xb95: 0x04ef, 0xb96: 0x04f3, 0xb97: 0x04f7, + 0xb98: 0x04fb, 0xb99: 0x04ff, 0xb9a: 0x0503, 0xb9b: 0x0507, 0xb9c: 0x050b, 0xb9d: 0x050f, + 0xb9e: 0x0513, 0xb9f: 0x0517, 0xba0: 0x051b, 0xba1: 0x0523, 0xba2: 0x0527, 0xba3: 0x052b, + 0xba4: 0x052f, 0xba5: 0x0533, 0xba6: 0x0537, 0xba7: 0x053b, 0xba8: 0x053f, 0xba9: 0x0543, + 0xbaa: 0x0547, 0xbab: 0x054b, 0xbac: 0x054f, 0xbad: 0x0553, 0xbae: 0x0557, 0xbaf: 0x055b, + 0xbb0: 0x055f, 0xbb1: 0x0563, 0xbb2: 0x0567, 0xbb3: 0x056f, 0xbb4: 0x0577, 0xbb5: 0x057f, + 0xbb6: 0x0583, 0xbb7: 0x0587, 0xbb8: 0x058b, 0xbb9: 0x058f, 0xbba: 0x0593, 0xbbb: 0x0597, + 0xbbc: 0x059b, 0xbbd: 0x059f, 0xbbe: 0x05a3, + // Block 0x2f, offset 0xbc0 + 0xbc0: 0x2b0c, 0xbc1: 0x29a8, 0xbc2: 0x2b1c, 0xbc3: 0x2880, 0xbc4: 0x2ee4, 0xbc5: 0x288a, + 0xbc6: 0x2894, 0xbc7: 0x2f28, 0xbc8: 0x29b5, 0xbc9: 0x289e, 0xbca: 0x28a8, 0xbcb: 0x28b2, + 0xbcc: 0x29dc, 0xbcd: 0x29e9, 0xbce: 0x29c2, 0xbcf: 0x29cf, 0xbd0: 0x2ea9, 0xbd1: 0x29f6, + 0xbd2: 0x2a03, 0xbd3: 0x2bbe, 0xbd4: 0x26bb, 0xbd5: 0x2bd1, 0xbd6: 0x2be4, 0xbd7: 0x2b2c, + 0xbd8: 0x2a10, 0xbd9: 0x2bf7, 0xbda: 0x2c0a, 0xbdb: 0x2a1d, 0xbdc: 0x28bc, 0xbdd: 0x28c6, + 0xbde: 0x2eb7, 0xbdf: 0x2a2a, 0xbe0: 0x2b3c, 0xbe1: 0x2ef5, 0xbe2: 0x28d0, 0xbe3: 0x28da, + 0xbe4: 0x2a37, 0xbe5: 0x28e4, 0xbe6: 0x28ee, 0xbe7: 0x26d0, 0xbe8: 0x26d7, 0xbe9: 0x28f8, + 0xbea: 0x2902, 0xbeb: 0x2c1d, 0xbec: 0x2a44, 0xbed: 0x2b4c, 0xbee: 0x2c30, 0xbef: 0x2a51, + 0xbf0: 0x2916, 0xbf1: 0x290c, 0xbf2: 0x2f3c, 0xbf3: 0x2a5e, 0xbf4: 0x2c43, 0xbf5: 0x2920, + 0xbf6: 0x2b5c, 0xbf7: 0x292a, 0xbf8: 0x2a78, 0xbf9: 0x2934, 0xbfa: 0x2a85, 0xbfb: 0x2f06, + 0xbfc: 0x2a6b, 0xbfd: 0x2b6c, 0xbfe: 0x2a92, 0xbff: 0x26de, + // Block 0x30, offset 0xc00 + 0xc00: 0x2f17, 0xc01: 0x293e, 0xc02: 0x2948, 0xc03: 0x2a9f, 0xc04: 0x2952, 0xc05: 0x295c, + 0xc06: 0x2966, 0xc07: 0x2b7c, 0xc08: 0x2aac, 0xc09: 0x26e5, 0xc0a: 0x2c56, 0xc0b: 0x2e90, + 0xc0c: 0x2b8c, 0xc0d: 0x2ab9, 0xc0e: 0x2ec5, 0xc0f: 0x2970, 0xc10: 0x297a, 0xc11: 0x2ac6, + 0xc12: 0x26ec, 0xc13: 0x2ad3, 0xc14: 0x2b9c, 0xc15: 0x26f3, 0xc16: 0x2c69, 0xc17: 0x2984, + 0xc18: 0x1cb7, 0xc19: 0x1ccb, 0xc1a: 0x1cda, 0xc1b: 0x1ce9, 0xc1c: 0x1cf8, 0xc1d: 0x1d07, + 0xc1e: 0x1d16, 0xc1f: 0x1d25, 0xc20: 0x1d34, 0xc21: 0x1d43, 0xc22: 0x2192, 0xc23: 0x21a4, + 0xc24: 0x21b6, 0xc25: 0x21c2, 0xc26: 0x21ce, 0xc27: 0x21da, 0xc28: 0x21e6, 0xc29: 0x21f2, + 0xc2a: 0x21fe, 0xc2b: 0x220a, 0xc2c: 0x2246, 0xc2d: 0x2252, 0xc2e: 0x225e, 0xc2f: 0x226a, + 0xc30: 0x2276, 0xc31: 0x1c14, 0xc32: 0x19c6, 0xc33: 0x1936, 0xc34: 0x1be4, 0xc35: 0x1a47, + 0xc36: 0x1a56, 0xc37: 0x19cc, 0xc38: 0x1bfc, 0xc39: 0x1c00, 0xc3a: 0x1960, 0xc3b: 0x2701, + 0xc3c: 0x270f, 0xc3d: 0x26fa, 0xc3e: 0x2708, 0xc3f: 0x2ae0, + // Block 0x31, offset 0xc40 + 0xc40: 0x1a4a, 0xc41: 0x1a32, 0xc42: 0x1c60, 0xc43: 0x1a1a, 0xc44: 0x19f3, 0xc45: 0x1969, + 0xc46: 0x1978, 0xc47: 0x1948, 0xc48: 0x1bf0, 0xc49: 0x1d52, 0xc4a: 0x1a4d, 0xc4b: 0x1a35, + 0xc4c: 0x1c64, 0xc4d: 0x1c70, 0xc4e: 0x1a26, 0xc4f: 0x19fc, 0xc50: 0x1957, 0xc51: 0x1c1c, + 0xc52: 0x1bb0, 0xc53: 0x1b9c, 0xc54: 0x1bcc, 0xc55: 0x1c74, 0xc56: 0x1a29, 0xc57: 0x19c9, + 0xc58: 0x19ff, 0xc59: 0x19de, 0xc5a: 0x1a41, 0xc5b: 0x1c78, 0xc5c: 0x1a2c, 0xc5d: 0x19c0, + 0xc5e: 0x1a02, 0xc5f: 0x1c3c, 0xc60: 0x1bf4, 0xc61: 0x1a14, 0xc62: 0x1c24, 0xc63: 0x1c40, + 0xc64: 0x1bf8, 0xc65: 0x1a17, 0xc66: 0x1c28, 0xc67: 0x22e8, 0xc68: 0x22fc, 0xc69: 0x1996, + 0xc6a: 0x1c20, 0xc6b: 0x1bb4, 0xc6c: 0x1ba0, 0xc6d: 0x1c48, 0xc6e: 0x2716, 0xc6f: 0x27ad, + 0xc70: 0x1a59, 0xc71: 0x1a44, 0xc72: 0x1c7c, 0xc73: 0x1a2f, 0xc74: 0x1a50, 0xc75: 0x1a38, + 0xc76: 0x1c68, 0xc77: 0x1a1d, 0xc78: 0x19f6, 0xc79: 0x1981, 0xc7a: 0x1a53, 0xc7b: 0x1a3b, + 0xc7c: 0x1c6c, 0xc7d: 0x1a20, 0xc7e: 0x19f9, 0xc7f: 0x1984, + // Block 0x32, offset 0xc80 + 0xc80: 0x1c2c, 0xc81: 0x1bb8, 0xc82: 0x1d4d, 0xc83: 0x1939, 0xc84: 0x19ba, 0xc85: 0x19bd, + 0xc86: 0x22f5, 0xc87: 0x1b94, 0xc88: 0x19c3, 0xc89: 0x194b, 0xc8a: 0x19e1, 0xc8b: 0x194e, + 0xc8c: 0x19ea, 0xc8d: 0x196c, 0xc8e: 0x196f, 0xc8f: 0x1a05, 0xc90: 0x1a0b, 0xc91: 0x1a0e, + 0xc92: 0x1c30, 0xc93: 0x1a11, 0xc94: 0x1a23, 0xc95: 0x1c38, 0xc96: 0x1c44, 0xc97: 0x1990, + 0xc98: 0x1d57, 0xc99: 0x1bbc, 0xc9a: 0x1993, 0xc9b: 0x1a5c, 0xc9c: 0x19a5, 0xc9d: 0x19b4, + 0xc9e: 0x22e2, 0xc9f: 0x22dc, 0xca0: 0x1cc1, 0xca1: 0x1cd0, 0xca2: 0x1cdf, 0xca3: 0x1cee, + 0xca4: 0x1cfd, 0xca5: 0x1d0c, 0xca6: 0x1d1b, 0xca7: 0x1d2a, 0xca8: 0x1d39, 0xca9: 0x2186, + 0xcaa: 0x2198, 0xcab: 0x21aa, 0xcac: 0x21bc, 0xcad: 0x21c8, 0xcae: 0x21d4, 0xcaf: 0x21e0, + 0xcb0: 0x21ec, 0xcb1: 0x21f8, 0xcb2: 0x2204, 0xcb3: 0x2240, 0xcb4: 0x224c, 0xcb5: 0x2258, + 0xcb6: 0x2264, 0xcb7: 0x2270, 0xcb8: 0x227c, 0xcb9: 0x2282, 0xcba: 0x2288, 0xcbb: 0x228e, + 0xcbc: 0x2294, 0xcbd: 0x22a6, 0xcbe: 0x22ac, 0xcbf: 0x1c10, + // Block 0x33, offset 0xcc0 + 0xcc0: 0x1377, 0xcc1: 0x0cfb, 0xcc2: 0x13d3, 0xcc3: 0x139f, 0xcc4: 0x0e57, 0xcc5: 0x06eb, + 0xcc6: 0x08df, 0xcc7: 0x162b, 0xcc8: 0x162b, 0xcc9: 0x0a0b, 0xcca: 0x145f, 0xccb: 0x0943, + 0xccc: 0x0a07, 0xccd: 0x0bef, 0xcce: 0x0fcf, 0xccf: 0x115f, 0xcd0: 0x1297, 0xcd1: 0x12d3, + 0xcd2: 0x1307, 0xcd3: 0x141b, 0xcd4: 0x0d73, 0xcd5: 0x0dff, 0xcd6: 0x0eab, 0xcd7: 0x0f43, + 0xcd8: 0x125f, 0xcd9: 0x1447, 0xcda: 0x1573, 0xcdb: 0x070f, 0xcdc: 0x08b3, 0xcdd: 0x0d87, + 0xcde: 0x0ecf, 0xcdf: 0x1293, 0xce0: 0x15c3, 0xce1: 0x0ab3, 0xce2: 0x0e77, 0xce3: 0x1283, + 0xce4: 0x1317, 0xce5: 0x0c23, 0xce6: 0x11bb, 0xce7: 0x12df, 0xce8: 0x0b1f, 0xce9: 0x0d0f, + 0xcea: 0x0e17, 0xceb: 0x0f1b, 0xcec: 0x1427, 0xced: 0x074f, 0xcee: 0x07e7, 0xcef: 0x0853, + 0xcf0: 0x0c8b, 0xcf1: 0x0d7f, 0xcf2: 0x0ecb, 0xcf3: 0x0fef, 0xcf4: 0x1177, 0xcf5: 0x128b, + 0xcf6: 0x12a3, 0xcf7: 0x13c7, 0xcf8: 0x14ef, 0xcf9: 0x15a3, 0xcfa: 0x15bf, 0xcfb: 0x102b, + 0xcfc: 0x106b, 0xcfd: 0x1123, 0xcfe: 0x1243, 0xcff: 0x147b, + // Block 0x34, offset 0xd00 + 0xd00: 0x15cb, 0xd01: 0x134b, 0xd02: 0x09c7, 0xd03: 0x0b3b, 0xd04: 0x10db, 0xd05: 0x119b, + 0xd06: 0x0eff, 0xd07: 0x1033, 0xd08: 0x1397, 0xd09: 0x14e7, 0xd0a: 0x09c3, 0xd0b: 0x0a8f, + 0xd0c: 0x0d77, 0xd0d: 0x0e2b, 0xd0e: 0x0e5f, 0xd0f: 0x1113, 0xd10: 0x113b, 0xd11: 0x14a7, + 0xd12: 0x084f, 0xd13: 0x11a7, 0xd14: 0x07f3, 0xd15: 0x07ef, 0xd16: 0x1097, 0xd17: 0x1127, + 0xd18: 0x125b, 0xd19: 0x14af, 0xd1a: 0x1367, 0xd1b: 0x0c27, 0xd1c: 0x0d73, 0xd1d: 0x1357, + 0xd1e: 0x06f7, 0xd1f: 0x0a63, 0xd20: 0x0b93, 0xd21: 0x0f2f, 0xd22: 0x0faf, 0xd23: 0x0873, + 0xd24: 0x103b, 0xd25: 0x075f, 0xd26: 0x0b77, 0xd27: 0x06d7, 0xd28: 0x0deb, 0xd29: 0x0ca3, + 0xd2a: 0x110f, 0xd2b: 0x08c7, 0xd2c: 0x09b3, 0xd2d: 0x0ffb, 0xd2e: 0x1263, 0xd2f: 0x133b, + 0xd30: 0x0db7, 0xd31: 0x13f7, 0xd32: 0x0de3, 0xd33: 0x0c37, 0xd34: 0x121b, 0xd35: 0x0c57, + 0xd36: 0x0fab, 0xd37: 0x072b, 0xd38: 0x07a7, 0xd39: 0x07eb, 0xd3a: 0x0d53, 0xd3b: 0x10fb, + 0xd3c: 0x11f3, 0xd3d: 0x1347, 0xd3e: 0x145b, 0xd3f: 0x085b, + // Block 0x35, offset 0xd40 + 0xd40: 0x090f, 0xd41: 0x0a17, 0xd42: 0x0b2f, 0xd43: 0x0cbf, 0xd44: 0x0e7b, 0xd45: 0x103f, + 0xd46: 0x1497, 0xd47: 0x157b, 0xd48: 0x15cf, 0xd49: 0x15e7, 0xd4a: 0x0837, 0xd4b: 0x0cf3, + 0xd4c: 0x0da3, 0xd4d: 0x13eb, 0xd4e: 0x0afb, 0xd4f: 0x0bd7, 0xd50: 0x0bf3, 0xd51: 0x0c83, + 0xd52: 0x0e6b, 0xd53: 0x0eb7, 0xd54: 0x0f67, 0xd55: 0x108b, 0xd56: 0x112f, 0xd57: 0x1193, + 0xd58: 0x13db, 0xd59: 0x126b, 0xd5a: 0x1403, 0xd5b: 0x147f, 0xd5c: 0x080f, 0xd5d: 0x083b, + 0xd5e: 0x0923, 0xd5f: 0x0ea7, 0xd60: 0x12f3, 0xd61: 0x133b, 0xd62: 0x0b1b, 0xd63: 0x0b8b, + 0xd64: 0x0c4f, 0xd65: 0x0daf, 0xd66: 0x10d7, 0xd67: 0x0f23, 0xd68: 0x073b, 0xd69: 0x097f, + 0xd6a: 0x0a63, 0xd6b: 0x0ac7, 0xd6c: 0x0b97, 0xd6d: 0x0f3f, 0xd6e: 0x0f5b, 0xd6f: 0x116b, + 0xd70: 0x118b, 0xd71: 0x1463, 0xd72: 0x14e3, 0xd73: 0x14f3, 0xd74: 0x152f, 0xd75: 0x0753, + 0xd76: 0x107f, 0xd77: 0x144f, 0xd78: 0x14cb, 0xd79: 0x0baf, 0xd7a: 0x0717, 0xd7b: 0x0777, + 0xd7c: 0x0a67, 0xd7d: 0x0a87, 0xd7e: 0x0caf, 0xd7f: 0x0d73, + // Block 0x36, offset 0xd80 + 0xd80: 0x0ec3, 0xd81: 0x0fcb, 0xd82: 0x1277, 0xd83: 0x1417, 0xd84: 0x1623, 0xd85: 0x0ce3, + 0xd86: 0x14a3, 0xd87: 0x0833, 0xd88: 0x0d2f, 0xd89: 0x0d3b, 0xd8a: 0x0e0f, 0xd8b: 0x0e47, + 0xd8c: 0x0f4b, 0xd8d: 0x0fa7, 0xd8e: 0x1027, 0xd8f: 0x110b, 0xd90: 0x153b, 0xd91: 0x07af, + 0xd92: 0x0c03, 0xd93: 0x14b3, 0xd94: 0x0767, 0xd95: 0x0aab, 0xd96: 0x0e2f, 0xd97: 0x13df, + 0xd98: 0x0b67, 0xd99: 0x0bb7, 0xd9a: 0x0d43, 0xd9b: 0x0f2f, 0xd9c: 0x14bb, 0xd9d: 0x0817, + 0xd9e: 0x08ff, 0xd9f: 0x0a97, 0xda0: 0x0cd3, 0xda1: 0x0d1f, 0xda2: 0x0d5f, 0xda3: 0x0df3, + 0xda4: 0x0f47, 0xda5: 0x0fbb, 0xda6: 0x1157, 0xda7: 0x12f7, 0xda8: 0x1303, 0xda9: 0x1457, + 0xdaa: 0x14d7, 0xdab: 0x0883, 0xdac: 0x0e4b, 0xdad: 0x0903, 0xdae: 0x0ec7, 0xdaf: 0x0f6b, + 0xdb0: 0x1287, 0xdb1: 0x14bf, 0xdb2: 0x15ab, 0xdb3: 0x15d3, 0xdb4: 0x0d37, 0xdb5: 0x0e27, + 0xdb6: 0x11c3, 0xdb7: 0x10b7, 0xdb8: 0x10c3, 0xdb9: 0x10e7, 0xdba: 0x0f17, 0xdbb: 0x0e9f, + 0xdbc: 0x1363, 0xdbd: 0x0733, 0xdbe: 0x122b, 0xdbf: 0x081b, + // Block 0x37, offset 0xdc0 + 0xdc0: 0x080b, 0xdc1: 0x0b0b, 0xdc2: 0x0c2b, 0xdc3: 0x10f3, 0xdc4: 0x0a53, 0xdc5: 0x0e03, + 0xdc6: 0x0cef, 0xdc7: 0x13e7, 0xdc8: 0x12e7, 0xdc9: 0x14ab, 0xdca: 0x1323, 0xdcb: 0x0b27, + 0xdcc: 0x0787, 0xdcd: 0x095b, 0xdd0: 0x09af, + 0xdd2: 0x0cdf, 0xdd5: 0x07f7, 0xdd6: 0x0f1f, 0xdd7: 0x0fe3, + 0xdd8: 0x1047, 0xdd9: 0x1063, 0xdda: 0x1067, 0xddb: 0x107b, 0xddc: 0x14fb, 0xddd: 0x10eb, + 0xdde: 0x116f, 0xde0: 0x128f, 0xde2: 0x1353, + 0xde5: 0x1407, 0xde6: 0x1433, + 0xdea: 0x154f, 0xdeb: 0x1553, 0xdec: 0x1557, 0xded: 0x15bb, 0xdee: 0x142b, 0xdef: 0x14c7, + 0xdf0: 0x0757, 0xdf1: 0x077b, 0xdf2: 0x078f, 0xdf3: 0x084b, 0xdf4: 0x0857, 0xdf5: 0x0897, + 0xdf6: 0x094b, 0xdf7: 0x0967, 0xdf8: 0x096f, 0xdf9: 0x09ab, 0xdfa: 0x09b7, 0xdfb: 0x0a93, + 0xdfc: 0x0a9b, 0xdfd: 0x0ba3, 0xdfe: 0x0bcb, 0xdff: 0x0bd3, + // Block 0x38, offset 0xe00 + 0xe00: 0x0beb, 0xe01: 0x0c97, 0xe02: 0x0cc7, 0xe03: 0x0ce7, 0xe04: 0x0d57, 0xe05: 0x0e1b, + 0xe06: 0x0e37, 0xe07: 0x0e67, 0xe08: 0x0ebb, 0xe09: 0x0edb, 0xe0a: 0x0f4f, 0xe0b: 0x102f, + 0xe0c: 0x104b, 0xe0d: 0x1053, 0xe0e: 0x104f, 0xe0f: 0x1057, 0xe10: 0x105b, 0xe11: 0x105f, + 0xe12: 0x1073, 0xe13: 0x1077, 0xe14: 0x109b, 0xe15: 0x10af, 0xe16: 0x10cb, 0xe17: 0x112f, + 0xe18: 0x1137, 0xe19: 0x113f, 0xe1a: 0x1153, 0xe1b: 0x117b, 0xe1c: 0x11cb, 0xe1d: 0x11ff, + 0xe1e: 0x11ff, 0xe1f: 0x1267, 0xe20: 0x130f, 0xe21: 0x1327, 0xe22: 0x135b, 0xe23: 0x135f, + 0xe24: 0x13a3, 0xe25: 0x13a7, 0xe26: 0x13ff, 0xe27: 0x1407, 0xe28: 0x14db, 0xe29: 0x151f, + 0xe2a: 0x1537, 0xe2b: 0x0b9b, 0xe2c: 0x171e, 0xe2d: 0x11e3, + 0xe30: 0x06df, 0xe31: 0x07e3, 0xe32: 0x07a3, 0xe33: 0x074b, 0xe34: 0x078b, 0xe35: 0x07b7, + 0xe36: 0x0847, 0xe37: 0x0863, 0xe38: 0x094b, 0xe39: 0x0937, 0xe3a: 0x0947, 0xe3b: 0x0963, + 0xe3c: 0x09af, 0xe3d: 0x09bf, 0xe3e: 0x0a03, 0xe3f: 0x0a0f, + // Block 0x39, offset 0xe40 + 0xe40: 0x0a2b, 0xe41: 0x0a3b, 0xe42: 0x0b23, 0xe43: 0x0b2b, 0xe44: 0x0b5b, 0xe45: 0x0b7b, + 0xe46: 0x0bab, 0xe47: 0x0bc3, 0xe48: 0x0bb3, 0xe49: 0x0bd3, 0xe4a: 0x0bc7, 0xe4b: 0x0beb, + 0xe4c: 0x0c07, 0xe4d: 0x0c5f, 0xe4e: 0x0c6b, 0xe4f: 0x0c73, 0xe50: 0x0c9b, 0xe51: 0x0cdf, + 0xe52: 0x0d0f, 0xe53: 0x0d13, 0xe54: 0x0d27, 0xe55: 0x0da7, 0xe56: 0x0db7, 0xe57: 0x0e0f, + 0xe58: 0x0e5b, 0xe59: 0x0e53, 0xe5a: 0x0e67, 0xe5b: 0x0e83, 0xe5c: 0x0ebb, 0xe5d: 0x1013, + 0xe5e: 0x0edf, 0xe5f: 0x0f13, 0xe60: 0x0f1f, 0xe61: 0x0f5f, 0xe62: 0x0f7b, 0xe63: 0x0f9f, + 0xe64: 0x0fc3, 0xe65: 0x0fc7, 0xe66: 0x0fe3, 0xe67: 0x0fe7, 0xe68: 0x0ff7, 0xe69: 0x100b, + 0xe6a: 0x1007, 0xe6b: 0x1037, 0xe6c: 0x10b3, 0xe6d: 0x10cb, 0xe6e: 0x10e3, 0xe6f: 0x111b, + 0xe70: 0x112f, 0xe71: 0x114b, 0xe72: 0x117b, 0xe73: 0x122f, 0xe74: 0x1257, 0xe75: 0x12cb, + 0xe76: 0x1313, 0xe77: 0x131f, 0xe78: 0x1327, 0xe79: 0x133f, 0xe7a: 0x1353, 0xe7b: 0x1343, + 0xe7c: 0x135b, 0xe7d: 0x1357, 0xe7e: 0x134f, 0xe7f: 0x135f, + // Block 0x3a, offset 0xe80 + 0xe80: 0x136b, 0xe81: 0x13a7, 0xe82: 0x13e3, 0xe83: 0x1413, 0xe84: 0x144b, 0xe85: 0x146b, + 0xe86: 0x14b7, 0xe87: 0x14db, 0xe88: 0x14fb, 0xe89: 0x150f, 0xe8a: 0x151f, 0xe8b: 0x152b, + 0xe8c: 0x1537, 0xe8d: 0x158b, 0xe8e: 0x162b, 0xe8f: 0x16b5, 0xe90: 0x16b0, 0xe91: 0x16e2, + 0xe92: 0x0607, 0xe93: 0x062f, 0xe94: 0x0633, 0xe95: 0x1764, 0xe96: 0x1791, 0xe97: 0x1809, + 0xe98: 0x1617, 0xe99: 0x1627, + // Block 0x3b, offset 0xec0 + 0xec0: 0x19d5, 0xec1: 0x19d8, 0xec2: 0x19db, 0xec3: 0x1c08, 0xec4: 0x1c0c, 0xec5: 0x1a5f, + 0xec6: 0x1a5f, + 0xed3: 0x1d75, 0xed4: 0x1d66, 0xed5: 0x1d6b, 0xed6: 0x1d7a, 0xed7: 0x1d70, + 0xedd: 0x4390, + 0xede: 0x8115, 0xedf: 0x4402, 0xee0: 0x022d, 0xee1: 0x0215, 0xee2: 0x021e, 0xee3: 0x0221, + 0xee4: 0x0224, 0xee5: 0x0227, 0xee6: 0x022a, 0xee7: 0x0230, 0xee8: 0x0233, 0xee9: 0x0017, + 0xeea: 0x43f0, 0xeeb: 0x43f6, 0xeec: 0x44f4, 0xeed: 0x44fc, 0xeee: 0x4348, 0xeef: 0x434e, + 0xef0: 0x4354, 0xef1: 0x435a, 0xef2: 0x4366, 0xef3: 0x436c, 0xef4: 0x4372, 0xef5: 0x437e, + 0xef6: 0x4384, 0xef8: 0x438a, 0xef9: 0x4396, 0xefa: 0x439c, 0xefb: 0x43a2, + 0xefc: 0x43ae, 0xefe: 0x43b4, + // Block 0x3c, offset 0xf00 + 0xf00: 0x43ba, 0xf01: 0x43c0, 0xf03: 0x43c6, 0xf04: 0x43cc, + 0xf06: 0x43d8, 0xf07: 0x43de, 0xf08: 0x43e4, 0xf09: 0x43ea, 0xf0a: 0x43fc, 0xf0b: 0x4378, + 0xf0c: 0x4360, 0xf0d: 0x43a8, 0xf0e: 0x43d2, 0xf0f: 0x1d7f, 0xf10: 0x0299, 0xf11: 0x0299, + 0xf12: 0x02a2, 0xf13: 0x02a2, 0xf14: 0x02a2, 0xf15: 0x02a2, 0xf16: 0x02a5, 0xf17: 0x02a5, + 0xf18: 0x02a5, 0xf19: 0x02a5, 0xf1a: 0x02ab, 0xf1b: 0x02ab, 0xf1c: 0x02ab, 0xf1d: 0x02ab, + 0xf1e: 0x029f, 0xf1f: 0x029f, 0xf20: 0x029f, 0xf21: 0x029f, 0xf22: 0x02a8, 0xf23: 0x02a8, + 0xf24: 0x02a8, 0xf25: 0x02a8, 0xf26: 0x029c, 0xf27: 0x029c, 0xf28: 0x029c, 0xf29: 0x029c, + 0xf2a: 0x02cf, 0xf2b: 0x02cf, 0xf2c: 0x02cf, 0xf2d: 0x02cf, 0xf2e: 0x02d2, 0xf2f: 0x02d2, + 0xf30: 0x02d2, 0xf31: 0x02d2, 0xf32: 0x02b1, 0xf33: 0x02b1, 0xf34: 0x02b1, 0xf35: 0x02b1, + 0xf36: 0x02ae, 0xf37: 0x02ae, 0xf38: 0x02ae, 0xf39: 0x02ae, 0xf3a: 0x02b4, 0xf3b: 0x02b4, + 0xf3c: 0x02b4, 0xf3d: 0x02b4, 0xf3e: 0x02b7, 0xf3f: 0x02b7, + // Block 0x3d, offset 0xf40 + 0xf40: 0x02b7, 0xf41: 0x02b7, 0xf42: 0x02c0, 0xf43: 0x02c0, 0xf44: 0x02bd, 0xf45: 0x02bd, + 0xf46: 0x02c3, 0xf47: 0x02c3, 0xf48: 0x02ba, 0xf49: 0x02ba, 0xf4a: 0x02c9, 0xf4b: 0x02c9, + 0xf4c: 0x02c6, 0xf4d: 0x02c6, 0xf4e: 0x02d5, 0xf4f: 0x02d5, 0xf50: 0x02d5, 0xf51: 0x02d5, + 0xf52: 0x02db, 0xf53: 0x02db, 0xf54: 0x02db, 0xf55: 0x02db, 0xf56: 0x02e1, 0xf57: 0x02e1, + 0xf58: 0x02e1, 0xf59: 0x02e1, 0xf5a: 0x02de, 0xf5b: 0x02de, 0xf5c: 0x02de, 0xf5d: 0x02de, + 0xf5e: 0x02e4, 0xf5f: 0x02e4, 0xf60: 0x02e7, 0xf61: 0x02e7, 0xf62: 0x02e7, 0xf63: 0x02e7, + 0xf64: 0x446e, 0xf65: 0x446e, 0xf66: 0x02ed, 0xf67: 0x02ed, 0xf68: 0x02ed, 0xf69: 0x02ed, + 0xf6a: 0x02ea, 0xf6b: 0x02ea, 0xf6c: 0x02ea, 0xf6d: 0x02ea, 0xf6e: 0x0308, 0xf6f: 0x0308, + 0xf70: 0x4468, 0xf71: 0x4468, + // Block 0x3e, offset 0xf80 + 0xf93: 0x02d8, 0xf94: 0x02d8, 0xf95: 0x02d8, 0xf96: 0x02d8, 0xf97: 0x02f6, + 0xf98: 0x02f6, 0xf99: 0x02f3, 0xf9a: 0x02f3, 0xf9b: 0x02f9, 0xf9c: 0x02f9, 0xf9d: 0x204f, + 0xf9e: 0x02ff, 0xf9f: 0x02ff, 0xfa0: 0x02f0, 0xfa1: 0x02f0, 0xfa2: 0x02fc, 0xfa3: 0x02fc, + 0xfa4: 0x0305, 0xfa5: 0x0305, 0xfa6: 0x0305, 0xfa7: 0x0305, 0xfa8: 0x028d, 0xfa9: 0x028d, + 0xfaa: 0x25aa, 0xfab: 0x25aa, 0xfac: 0x261a, 0xfad: 0x261a, 0xfae: 0x25e9, 0xfaf: 0x25e9, + 0xfb0: 0x2605, 0xfb1: 0x2605, 0xfb2: 0x25fe, 0xfb3: 0x25fe, 0xfb4: 0x260c, 0xfb5: 0x260c, + 0xfb6: 0x2613, 0xfb7: 0x2613, 0xfb8: 0x2613, 0xfb9: 0x25f0, 0xfba: 0x25f0, 0xfbb: 0x25f0, + 0xfbc: 0x0302, 0xfbd: 0x0302, 0xfbe: 0x0302, 0xfbf: 0x0302, + // Block 0x3f, offset 0xfc0 + 0xfc0: 0x25b1, 0xfc1: 0x25b8, 0xfc2: 0x25d4, 0xfc3: 0x25f0, 0xfc4: 0x25f7, 0xfc5: 0x1d89, + 0xfc6: 0x1d8e, 0xfc7: 0x1d93, 0xfc8: 0x1da2, 0xfc9: 0x1db1, 0xfca: 0x1db6, 0xfcb: 0x1dbb, + 0xfcc: 0x1dc0, 0xfcd: 0x1dc5, 0xfce: 0x1dd4, 0xfcf: 0x1de3, 0xfd0: 0x1de8, 0xfd1: 0x1ded, + 0xfd2: 0x1dfc, 0xfd3: 0x1e0b, 0xfd4: 0x1e10, 0xfd5: 0x1e15, 0xfd6: 0x1e1a, 0xfd7: 0x1e29, + 0xfd8: 0x1e2e, 0xfd9: 0x1e3d, 0xfda: 0x1e42, 0xfdb: 0x1e47, 0xfdc: 0x1e56, 0xfdd: 0x1e5b, + 0xfde: 0x1e60, 0xfdf: 0x1e6a, 0xfe0: 0x1ea6, 0xfe1: 0x1eb5, 0xfe2: 0x1ec4, 0xfe3: 0x1ec9, + 0xfe4: 0x1ece, 0xfe5: 0x1ed8, 0xfe6: 0x1ee7, 0xfe7: 0x1eec, 0xfe8: 0x1efb, 0xfe9: 0x1f00, + 0xfea: 0x1f05, 0xfeb: 0x1f14, 0xfec: 0x1f19, 0xfed: 0x1f28, 0xfee: 0x1f2d, 0xfef: 0x1f32, + 0xff0: 0x1f37, 0xff1: 0x1f3c, 0xff2: 0x1f41, 0xff3: 0x1f46, 0xff4: 0x1f4b, 0xff5: 0x1f50, + 0xff6: 0x1f55, 0xff7: 0x1f5a, 0xff8: 0x1f5f, 0xff9: 0x1f64, 0xffa: 0x1f69, 0xffb: 0x1f6e, + 0xffc: 0x1f73, 0xffd: 0x1f78, 0xffe: 0x1f7d, 0xfff: 0x1f87, + // Block 0x40, offset 0x1000 + 0x1000: 0x1f8c, 0x1001: 0x1f91, 0x1002: 0x1f96, 0x1003: 0x1fa0, 0x1004: 0x1fa5, 0x1005: 0x1faf, + 0x1006: 0x1fb4, 0x1007: 0x1fb9, 0x1008: 0x1fbe, 0x1009: 0x1fc3, 0x100a: 0x1fc8, 0x100b: 0x1fcd, + 0x100c: 0x1fd2, 0x100d: 0x1fd7, 0x100e: 0x1fe6, 0x100f: 0x1ff5, 0x1010: 0x1ffa, 0x1011: 0x1fff, + 0x1012: 0x2004, 0x1013: 0x2009, 0x1014: 0x200e, 0x1015: 0x2018, 0x1016: 0x201d, 0x1017: 0x2022, + 0x1018: 0x2031, 0x1019: 0x2040, 0x101a: 0x2045, 0x101b: 0x4420, 0x101c: 0x4426, 0x101d: 0x445c, + 0x101e: 0x44b3, 0x101f: 0x44ba, 0x1020: 0x44c1, 0x1021: 0x44c8, 0x1022: 0x44cf, 0x1023: 0x44d6, + 0x1024: 0x25c6, 0x1025: 0x25cd, 0x1026: 0x25d4, 0x1027: 0x25db, 0x1028: 0x25f0, 0x1029: 0x25f7, + 0x102a: 0x1d98, 0x102b: 0x1d9d, 0x102c: 0x1da2, 0x102d: 0x1da7, 0x102e: 0x1db1, 0x102f: 0x1db6, + 0x1030: 0x1dca, 0x1031: 0x1dcf, 0x1032: 0x1dd4, 0x1033: 0x1dd9, 0x1034: 0x1de3, 0x1035: 0x1de8, + 0x1036: 0x1df2, 0x1037: 0x1df7, 0x1038: 0x1dfc, 0x1039: 0x1e01, 0x103a: 0x1e0b, 0x103b: 0x1e10, + 0x103c: 0x1f3c, 0x103d: 0x1f41, 0x103e: 0x1f50, 0x103f: 0x1f55, + // Block 0x41, offset 0x1040 + 0x1040: 0x1f5a, 0x1041: 0x1f6e, 0x1042: 0x1f73, 0x1043: 0x1f78, 0x1044: 0x1f7d, 0x1045: 0x1f96, + 0x1046: 0x1fa0, 0x1047: 0x1fa5, 0x1048: 0x1faa, 0x1049: 0x1fbe, 0x104a: 0x1fdc, 0x104b: 0x1fe1, + 0x104c: 0x1fe6, 0x104d: 0x1feb, 0x104e: 0x1ff5, 0x104f: 0x1ffa, 0x1050: 0x445c, 0x1051: 0x2027, + 0x1052: 0x202c, 0x1053: 0x2031, 0x1054: 0x2036, 0x1055: 0x2040, 0x1056: 0x2045, 0x1057: 0x25b1, + 0x1058: 0x25b8, 0x1059: 0x25bf, 0x105a: 0x25d4, 0x105b: 0x25e2, 0x105c: 0x1d89, 0x105d: 0x1d8e, + 0x105e: 0x1d93, 0x105f: 0x1da2, 0x1060: 0x1dac, 0x1061: 0x1dbb, 0x1062: 0x1dc0, 0x1063: 0x1dc5, + 0x1064: 0x1dd4, 0x1065: 0x1dde, 0x1066: 0x1dfc, 0x1067: 0x1e15, 0x1068: 0x1e1a, 0x1069: 0x1e29, + 0x106a: 0x1e2e, 0x106b: 0x1e3d, 0x106c: 0x1e47, 0x106d: 0x1e56, 0x106e: 0x1e5b, 0x106f: 0x1e60, + 0x1070: 0x1e6a, 0x1071: 0x1ea6, 0x1072: 0x1eab, 0x1073: 0x1eb5, 0x1074: 0x1ec4, 0x1075: 0x1ec9, + 0x1076: 0x1ece, 0x1077: 0x1ed8, 0x1078: 0x1ee7, 0x1079: 0x1efb, 0x107a: 0x1f00, 0x107b: 0x1f05, + 0x107c: 0x1f14, 0x107d: 0x1f19, 0x107e: 0x1f28, 0x107f: 0x1f2d, + // Block 0x42, offset 0x1080 + 0x1080: 0x1f32, 0x1081: 0x1f37, 0x1082: 0x1f46, 0x1083: 0x1f4b, 0x1084: 0x1f5f, 0x1085: 0x1f64, + 0x1086: 0x1f69, 0x1087: 0x1f6e, 0x1088: 0x1f73, 0x1089: 0x1f87, 0x108a: 0x1f8c, 0x108b: 0x1f91, + 0x108c: 0x1f96, 0x108d: 0x1f9b, 0x108e: 0x1faf, 0x108f: 0x1fb4, 0x1090: 0x1fb9, 0x1091: 0x1fbe, + 0x1092: 0x1fcd, 0x1093: 0x1fd2, 0x1094: 0x1fd7, 0x1095: 0x1fe6, 0x1096: 0x1ff0, 0x1097: 0x1fff, + 0x1098: 0x2004, 0x1099: 0x4450, 0x109a: 0x2018, 0x109b: 0x201d, 0x109c: 0x2022, 0x109d: 0x2031, + 0x109e: 0x203b, 0x109f: 0x25d4, 0x10a0: 0x25e2, 0x10a1: 0x1da2, 0x10a2: 0x1dac, 0x10a3: 0x1dd4, + 0x10a4: 0x1dde, 0x10a5: 0x1dfc, 0x10a6: 0x1e06, 0x10a7: 0x1e6a, 0x10a8: 0x1e6f, 0x10a9: 0x1e92, + 0x10aa: 0x1e97, 0x10ab: 0x1f6e, 0x10ac: 0x1f73, 0x10ad: 0x1f96, 0x10ae: 0x1fe6, 0x10af: 0x1ff0, + 0x10b0: 0x2031, 0x10b1: 0x203b, 0x10b2: 0x4504, 0x10b3: 0x450c, 0x10b4: 0x4514, 0x10b5: 0x1ef1, + 0x10b6: 0x1ef6, 0x10b7: 0x1f0a, 0x10b8: 0x1f0f, 0x10b9: 0x1f1e, 0x10ba: 0x1f23, 0x10bb: 0x1e74, + 0x10bc: 0x1e79, 0x10bd: 0x1e9c, 0x10be: 0x1ea1, 0x10bf: 0x1e33, + // Block 0x43, offset 0x10c0 + 0x10c0: 0x1e38, 0x10c1: 0x1e1f, 0x10c2: 0x1e24, 0x10c3: 0x1e4c, 0x10c4: 0x1e51, 0x10c5: 0x1eba, + 0x10c6: 0x1ebf, 0x10c7: 0x1edd, 0x10c8: 0x1ee2, 0x10c9: 0x1e7e, 0x10ca: 0x1e83, 0x10cb: 0x1e88, + 0x10cc: 0x1e92, 0x10cd: 0x1e8d, 0x10ce: 0x1e65, 0x10cf: 0x1eb0, 0x10d0: 0x1ed3, 0x10d1: 0x1ef1, + 0x10d2: 0x1ef6, 0x10d3: 0x1f0a, 0x10d4: 0x1f0f, 0x10d5: 0x1f1e, 0x10d6: 0x1f23, 0x10d7: 0x1e74, + 0x10d8: 0x1e79, 0x10d9: 0x1e9c, 0x10da: 0x1ea1, 0x10db: 0x1e33, 0x10dc: 0x1e38, 0x10dd: 0x1e1f, + 0x10de: 0x1e24, 0x10df: 0x1e4c, 0x10e0: 0x1e51, 0x10e1: 0x1eba, 0x10e2: 0x1ebf, 0x10e3: 0x1edd, + 0x10e4: 0x1ee2, 0x10e5: 0x1e7e, 0x10e6: 0x1e83, 0x10e7: 0x1e88, 0x10e8: 0x1e92, 0x10e9: 0x1e8d, + 0x10ea: 0x1e65, 0x10eb: 0x1eb0, 0x10ec: 0x1ed3, 0x10ed: 0x1e7e, 0x10ee: 0x1e83, 0x10ef: 0x1e88, + 0x10f0: 0x1e92, 0x10f1: 0x1e6f, 0x10f2: 0x1e97, 0x10f3: 0x1eec, 0x10f4: 0x1e56, 0x10f5: 0x1e5b, + 0x10f6: 0x1e60, 0x10f7: 0x1e7e, 0x10f8: 0x1e83, 0x10f9: 0x1e88, 0x10fa: 0x1eec, 0x10fb: 0x1efb, + 0x10fc: 0x4408, 0x10fd: 0x4408, + // Block 0x44, offset 0x1100 + 0x1110: 0x2311, 0x1111: 0x2326, + 0x1112: 0x2326, 0x1113: 0x232d, 0x1114: 0x2334, 0x1115: 0x2349, 0x1116: 0x2350, 0x1117: 0x2357, + 0x1118: 0x237a, 0x1119: 0x237a, 0x111a: 0x239d, 0x111b: 0x2396, 0x111c: 0x23b2, 0x111d: 0x23a4, + 0x111e: 0x23ab, 0x111f: 0x23ce, 0x1120: 0x23ce, 0x1121: 0x23c7, 0x1122: 0x23d5, 0x1123: 0x23d5, + 0x1124: 0x23ff, 0x1125: 0x23ff, 0x1126: 0x241b, 0x1127: 0x23e3, 0x1128: 0x23e3, 0x1129: 0x23dc, + 0x112a: 0x23f1, 0x112b: 0x23f1, 0x112c: 0x23f8, 0x112d: 0x23f8, 0x112e: 0x2422, 0x112f: 0x2430, + 0x1130: 0x2430, 0x1131: 0x2437, 0x1132: 0x2437, 0x1133: 0x243e, 0x1134: 0x2445, 0x1135: 0x244c, + 0x1136: 0x2453, 0x1137: 0x2453, 0x1138: 0x245a, 0x1139: 0x2468, 0x113a: 0x2476, 0x113b: 0x246f, + 0x113c: 0x247d, 0x113d: 0x247d, 0x113e: 0x2492, 0x113f: 0x2499, + // Block 0x45, offset 0x1140 + 0x1140: 0x24ca, 0x1141: 0x24d8, 0x1142: 0x24d1, 0x1143: 0x24b5, 0x1144: 0x24b5, 0x1145: 0x24df, + 0x1146: 0x24df, 0x1147: 0x24e6, 0x1148: 0x24e6, 0x1149: 0x2510, 0x114a: 0x2517, 0x114b: 0x251e, + 0x114c: 0x24f4, 0x114d: 0x2502, 0x114e: 0x2525, 0x114f: 0x252c, + 0x1152: 0x24fb, 0x1153: 0x2580, 0x1154: 0x2587, 0x1155: 0x255d, 0x1156: 0x2564, 0x1157: 0x2548, + 0x1158: 0x2548, 0x1159: 0x254f, 0x115a: 0x2579, 0x115b: 0x2572, 0x115c: 0x259c, 0x115d: 0x259c, + 0x115e: 0x230a, 0x115f: 0x231f, 0x1160: 0x2318, 0x1161: 0x2342, 0x1162: 0x233b, 0x1163: 0x2365, + 0x1164: 0x235e, 0x1165: 0x2388, 0x1166: 0x236c, 0x1167: 0x2381, 0x1168: 0x23b9, 0x1169: 0x2406, + 0x116a: 0x23ea, 0x116b: 0x2429, 0x116c: 0x24c3, 0x116d: 0x24ed, 0x116e: 0x2595, 0x116f: 0x258e, + 0x1170: 0x25a3, 0x1171: 0x253a, 0x1172: 0x24a0, 0x1173: 0x256b, 0x1174: 0x2492, 0x1175: 0x24ca, + 0x1176: 0x2461, 0x1177: 0x24ae, 0x1178: 0x2541, 0x1179: 0x2533, 0x117a: 0x24bc, 0x117b: 0x24a7, + 0x117c: 0x24bc, 0x117d: 0x2541, 0x117e: 0x2373, 0x117f: 0x238f, + // Block 0x46, offset 0x1180 + 0x1180: 0x2509, 0x1181: 0x2484, 0x1182: 0x2303, 0x1183: 0x24a7, 0x1184: 0x244c, 0x1185: 0x241b, + 0x1186: 0x23c0, 0x1187: 0x2556, + 0x11b0: 0x2414, 0x11b1: 0x248b, 0x11b2: 0x27bf, 0x11b3: 0x27b6, 0x11b4: 0x27ec, 0x11b5: 0x27da, + 0x11b6: 0x27c8, 0x11b7: 0x27e3, 0x11b8: 0x27f5, 0x11b9: 0x240d, 0x11ba: 0x2c7c, 0x11bb: 0x2afc, + 0x11bc: 0x27d1, + // Block 0x47, offset 0x11c0 + 0x11d0: 0x0019, 0x11d1: 0x0483, + 0x11d2: 0x0487, 0x11d3: 0x0035, 0x11d4: 0x0037, 0x11d5: 0x0003, 0x11d6: 0x003f, 0x11d7: 0x04bf, + 0x11d8: 0x04c3, 0x11d9: 0x1b5c, + 0x11e0: 0x8132, 0x11e1: 0x8132, 0x11e2: 0x8132, 0x11e3: 0x8132, + 0x11e4: 0x8132, 0x11e5: 0x8132, 0x11e6: 0x8132, 0x11e7: 0x812d, 0x11e8: 0x812d, 0x11e9: 0x812d, + 0x11ea: 0x812d, 0x11eb: 0x812d, 0x11ec: 0x812d, 0x11ed: 0x812d, 0x11ee: 0x8132, 0x11ef: 0x8132, + 0x11f0: 0x1873, 0x11f1: 0x0443, 0x11f2: 0x043f, 0x11f3: 0x007f, 0x11f4: 0x007f, 0x11f5: 0x0011, + 0x11f6: 0x0013, 0x11f7: 0x00b7, 0x11f8: 0x00bb, 0x11f9: 0x04b7, 0x11fa: 0x04bb, 0x11fb: 0x04ab, + 0x11fc: 0x04af, 0x11fd: 0x0493, 0x11fe: 0x0497, 0x11ff: 0x048b, + // Block 0x48, offset 0x1200 + 0x1200: 0x048f, 0x1201: 0x049b, 0x1202: 0x049f, 0x1203: 0x04a3, 0x1204: 0x04a7, + 0x1207: 0x0077, 0x1208: 0x007b, 0x1209: 0x4269, 0x120a: 0x4269, 0x120b: 0x4269, + 0x120c: 0x4269, 0x120d: 0x007f, 0x120e: 0x007f, 0x120f: 0x007f, 0x1210: 0x0019, 0x1211: 0x0483, + 0x1212: 0x001d, 0x1214: 0x0037, 0x1215: 0x0035, 0x1216: 0x003f, 0x1217: 0x0003, + 0x1218: 0x0443, 0x1219: 0x0011, 0x121a: 0x0013, 0x121b: 0x00b7, 0x121c: 0x00bb, 0x121d: 0x04b7, + 0x121e: 0x04bb, 0x121f: 0x0007, 0x1220: 0x000d, 0x1221: 0x0015, 0x1222: 0x0017, 0x1223: 0x001b, + 0x1224: 0x0039, 0x1225: 0x003d, 0x1226: 0x003b, 0x1228: 0x0079, 0x1229: 0x0009, + 0x122a: 0x000b, 0x122b: 0x0041, + 0x1230: 0x42aa, 0x1231: 0x442c, 0x1232: 0x42af, 0x1234: 0x42b4, + 0x1236: 0x42b9, 0x1237: 0x4432, 0x1238: 0x42be, 0x1239: 0x4438, 0x123a: 0x42c3, 0x123b: 0x443e, + 0x123c: 0x42c8, 0x123d: 0x4444, 0x123e: 0x42cd, 0x123f: 0x444a, + // Block 0x49, offset 0x1240 + 0x1240: 0x0236, 0x1241: 0x440e, 0x1242: 0x440e, 0x1243: 0x4414, 0x1244: 0x4414, 0x1245: 0x4456, + 0x1246: 0x4456, 0x1247: 0x441a, 0x1248: 0x441a, 0x1249: 0x4462, 0x124a: 0x4462, 0x124b: 0x4462, + 0x124c: 0x4462, 0x124d: 0x0239, 0x124e: 0x0239, 0x124f: 0x023c, 0x1250: 0x023c, 0x1251: 0x023c, + 0x1252: 0x023c, 0x1253: 0x023f, 0x1254: 0x023f, 0x1255: 0x0242, 0x1256: 0x0242, 0x1257: 0x0242, + 0x1258: 0x0242, 0x1259: 0x0245, 0x125a: 0x0245, 0x125b: 0x0245, 0x125c: 0x0245, 0x125d: 0x0248, + 0x125e: 0x0248, 0x125f: 0x0248, 0x1260: 0x0248, 0x1261: 0x024b, 0x1262: 0x024b, 0x1263: 0x024b, + 0x1264: 0x024b, 0x1265: 0x024e, 0x1266: 0x024e, 0x1267: 0x024e, 0x1268: 0x024e, 0x1269: 0x0251, + 0x126a: 0x0251, 0x126b: 0x0254, 0x126c: 0x0254, 0x126d: 0x0257, 0x126e: 0x0257, 0x126f: 0x025a, + 0x1270: 0x025a, 0x1271: 0x025d, 0x1272: 0x025d, 0x1273: 0x025d, 0x1274: 0x025d, 0x1275: 0x0260, + 0x1276: 0x0260, 0x1277: 0x0260, 0x1278: 0x0260, 0x1279: 0x0263, 0x127a: 0x0263, 0x127b: 0x0263, + 0x127c: 0x0263, 0x127d: 0x0266, 0x127e: 0x0266, 0x127f: 0x0266, + // Block 0x4a, offset 0x1280 + 0x1280: 0x0266, 0x1281: 0x0269, 0x1282: 0x0269, 0x1283: 0x0269, 0x1284: 0x0269, 0x1285: 0x026c, + 0x1286: 0x026c, 0x1287: 0x026c, 0x1288: 0x026c, 0x1289: 0x026f, 0x128a: 0x026f, 0x128b: 0x026f, + 0x128c: 0x026f, 0x128d: 0x0272, 0x128e: 0x0272, 0x128f: 0x0272, 0x1290: 0x0272, 0x1291: 0x0275, + 0x1292: 0x0275, 0x1293: 0x0275, 0x1294: 0x0275, 0x1295: 0x0278, 0x1296: 0x0278, 0x1297: 0x0278, + 0x1298: 0x0278, 0x1299: 0x027b, 0x129a: 0x027b, 0x129b: 0x027b, 0x129c: 0x027b, 0x129d: 0x027e, + 0x129e: 0x027e, 0x129f: 0x027e, 0x12a0: 0x027e, 0x12a1: 0x0281, 0x12a2: 0x0281, 0x12a3: 0x0281, + 0x12a4: 0x0281, 0x12a5: 0x0284, 0x12a6: 0x0284, 0x12a7: 0x0284, 0x12a8: 0x0284, 0x12a9: 0x0287, + 0x12aa: 0x0287, 0x12ab: 0x0287, 0x12ac: 0x0287, 0x12ad: 0x028a, 0x12ae: 0x028a, 0x12af: 0x028d, + 0x12b0: 0x028d, 0x12b1: 0x0290, 0x12b2: 0x0290, 0x12b3: 0x0290, 0x12b4: 0x0290, 0x12b5: 0x2e00, + 0x12b6: 0x2e00, 0x12b7: 0x2e08, 0x12b8: 0x2e08, 0x12b9: 0x2e10, 0x12ba: 0x2e10, 0x12bb: 0x1f82, + 0x12bc: 0x1f82, + // Block 0x4b, offset 0x12c0 + 0x12c0: 0x0081, 0x12c1: 0x0083, 0x12c2: 0x0085, 0x12c3: 0x0087, 0x12c4: 0x0089, 0x12c5: 0x008b, + 0x12c6: 0x008d, 0x12c7: 0x008f, 0x12c8: 0x0091, 0x12c9: 0x0093, 0x12ca: 0x0095, 0x12cb: 0x0097, + 0x12cc: 0x0099, 0x12cd: 0x009b, 0x12ce: 0x009d, 0x12cf: 0x009f, 0x12d0: 0x00a1, 0x12d1: 0x00a3, + 0x12d2: 0x00a5, 0x12d3: 0x00a7, 0x12d4: 0x00a9, 0x12d5: 0x00ab, 0x12d6: 0x00ad, 0x12d7: 0x00af, + 0x12d8: 0x00b1, 0x12d9: 0x00b3, 0x12da: 0x00b5, 0x12db: 0x00b7, 0x12dc: 0x00b9, 0x12dd: 0x00bb, + 0x12de: 0x00bd, 0x12df: 0x0477, 0x12e0: 0x047b, 0x12e1: 0x0487, 0x12e2: 0x049b, 0x12e3: 0x049f, + 0x12e4: 0x0483, 0x12e5: 0x05ab, 0x12e6: 0x05a3, 0x12e7: 0x04c7, 0x12e8: 0x04cf, 0x12e9: 0x04d7, + 0x12ea: 0x04df, 0x12eb: 0x04e7, 0x12ec: 0x056b, 0x12ed: 0x0573, 0x12ee: 0x057b, 0x12ef: 0x051f, + 0x12f0: 0x05af, 0x12f1: 0x04cb, 0x12f2: 0x04d3, 0x12f3: 0x04db, 0x12f4: 0x04e3, 0x12f5: 0x04eb, + 0x12f6: 0x04ef, 0x12f7: 0x04f3, 0x12f8: 0x04f7, 0x12f9: 0x04fb, 0x12fa: 0x04ff, 0x12fb: 0x0503, + 0x12fc: 0x0507, 0x12fd: 0x050b, 0x12fe: 0x050f, 0x12ff: 0x0513, + // Block 0x4c, offset 0x1300 + 0x1300: 0x0517, 0x1301: 0x051b, 0x1302: 0x0523, 0x1303: 0x0527, 0x1304: 0x052b, 0x1305: 0x052f, + 0x1306: 0x0533, 0x1307: 0x0537, 0x1308: 0x053b, 0x1309: 0x053f, 0x130a: 0x0543, 0x130b: 0x0547, + 0x130c: 0x054b, 0x130d: 0x054f, 0x130e: 0x0553, 0x130f: 0x0557, 0x1310: 0x055b, 0x1311: 0x055f, + 0x1312: 0x0563, 0x1313: 0x0567, 0x1314: 0x056f, 0x1315: 0x0577, 0x1316: 0x057f, 0x1317: 0x0583, + 0x1318: 0x0587, 0x1319: 0x058b, 0x131a: 0x058f, 0x131b: 0x0593, 0x131c: 0x0597, 0x131d: 0x05a7, + 0x131e: 0x4a78, 0x131f: 0x4a7e, 0x1320: 0x03c3, 0x1321: 0x0313, 0x1322: 0x0317, 0x1323: 0x4a3b, + 0x1324: 0x031b, 0x1325: 0x4a41, 0x1326: 0x4a47, 0x1327: 0x031f, 0x1328: 0x0323, 0x1329: 0x0327, + 0x132a: 0x4a4d, 0x132b: 0x4a53, 0x132c: 0x4a59, 0x132d: 0x4a5f, 0x132e: 0x4a65, 0x132f: 0x4a6b, + 0x1330: 0x0367, 0x1331: 0x032b, 0x1332: 0x032f, 0x1333: 0x0333, 0x1334: 0x037b, 0x1335: 0x0337, + 0x1336: 0x033b, 0x1337: 0x033f, 0x1338: 0x0343, 0x1339: 0x0347, 0x133a: 0x034b, 0x133b: 0x034f, + 0x133c: 0x0353, 0x133d: 0x0357, 0x133e: 0x035b, + // Block 0x4d, offset 0x1340 + 0x1342: 0x49bd, 0x1343: 0x49c3, 0x1344: 0x49c9, 0x1345: 0x49cf, + 0x1346: 0x49d5, 0x1347: 0x49db, 0x134a: 0x49e1, 0x134b: 0x49e7, + 0x134c: 0x49ed, 0x134d: 0x49f3, 0x134e: 0x49f9, 0x134f: 0x49ff, + 0x1352: 0x4a05, 0x1353: 0x4a0b, 0x1354: 0x4a11, 0x1355: 0x4a17, 0x1356: 0x4a1d, 0x1357: 0x4a23, + 0x135a: 0x4a29, 0x135b: 0x4a2f, 0x135c: 0x4a35, + 0x1360: 0x00bf, 0x1361: 0x00c2, 0x1362: 0x00cb, 0x1363: 0x4264, + 0x1364: 0x00c8, 0x1365: 0x00c5, 0x1366: 0x0447, 0x1368: 0x046b, 0x1369: 0x044b, + 0x136a: 0x044f, 0x136b: 0x0453, 0x136c: 0x0457, 0x136d: 0x046f, 0x136e: 0x0473, + // Block 0x4e, offset 0x1380 + 0x1380: 0x0063, 0x1381: 0x0065, 0x1382: 0x0067, 0x1383: 0x0069, 0x1384: 0x006b, 0x1385: 0x006d, + 0x1386: 0x006f, 0x1387: 0x0071, 0x1388: 0x0073, 0x1389: 0x0075, 0x138a: 0x0083, 0x138b: 0x0085, + 0x138c: 0x0087, 0x138d: 0x0089, 0x138e: 0x008b, 0x138f: 0x008d, 0x1390: 0x008f, 0x1391: 0x0091, + 0x1392: 0x0093, 0x1393: 0x0095, 0x1394: 0x0097, 0x1395: 0x0099, 0x1396: 0x009b, 0x1397: 0x009d, + 0x1398: 0x009f, 0x1399: 0x00a1, 0x139a: 0x00a3, 0x139b: 0x00a5, 0x139c: 0x00a7, 0x139d: 0x00a9, + 0x139e: 0x00ab, 0x139f: 0x00ad, 0x13a0: 0x00af, 0x13a1: 0x00b1, 0x13a2: 0x00b3, 0x13a3: 0x00b5, + 0x13a4: 0x00dd, 0x13a5: 0x00f2, 0x13a8: 0x0173, 0x13a9: 0x0176, + 0x13aa: 0x0179, 0x13ab: 0x017c, 0x13ac: 0x017f, 0x13ad: 0x0182, 0x13ae: 0x0185, 0x13af: 0x0188, + 0x13b0: 0x018b, 0x13b1: 0x018e, 0x13b2: 0x0191, 0x13b3: 0x0194, 0x13b4: 0x0197, 0x13b5: 0x019a, + 0x13b6: 0x019d, 0x13b7: 0x01a0, 0x13b8: 0x01a3, 0x13b9: 0x0188, 0x13ba: 0x01a6, 0x13bb: 0x01a9, + 0x13bc: 0x01ac, 0x13bd: 0x01af, 0x13be: 0x01b2, 0x13bf: 0x01b5, + // Block 0x4f, offset 0x13c0 + 0x13c0: 0x01fd, 0x13c1: 0x0200, 0x13c2: 0x0203, 0x13c3: 0x045b, 0x13c4: 0x01c7, 0x13c5: 0x01d0, + 0x13c6: 0x01d6, 0x13c7: 0x01fa, 0x13c8: 0x01eb, 0x13c9: 0x01e8, 0x13ca: 0x0206, 0x13cb: 0x0209, + 0x13ce: 0x0021, 0x13cf: 0x0023, 0x13d0: 0x0025, 0x13d1: 0x0027, + 0x13d2: 0x0029, 0x13d3: 0x002b, 0x13d4: 0x002d, 0x13d5: 0x002f, 0x13d6: 0x0031, 0x13d7: 0x0033, + 0x13d8: 0x0021, 0x13d9: 0x0023, 0x13da: 0x0025, 0x13db: 0x0027, 0x13dc: 0x0029, 0x13dd: 0x002b, + 0x13de: 0x002d, 0x13df: 0x002f, 0x13e0: 0x0031, 0x13e1: 0x0033, 0x13e2: 0x0021, 0x13e3: 0x0023, + 0x13e4: 0x0025, 0x13e5: 0x0027, 0x13e6: 0x0029, 0x13e7: 0x002b, 0x13e8: 0x002d, 0x13e9: 0x002f, + 0x13ea: 0x0031, 0x13eb: 0x0033, 0x13ec: 0x0021, 0x13ed: 0x0023, 0x13ee: 0x0025, 0x13ef: 0x0027, + 0x13f0: 0x0029, 0x13f1: 0x002b, 0x13f2: 0x002d, 0x13f3: 0x002f, 0x13f4: 0x0031, 0x13f5: 0x0033, + 0x13f6: 0x0021, 0x13f7: 0x0023, 0x13f8: 0x0025, 0x13f9: 0x0027, 0x13fa: 0x0029, 0x13fb: 0x002b, + 0x13fc: 0x002d, 0x13fd: 0x002f, 0x13fe: 0x0031, 0x13ff: 0x0033, + // Block 0x50, offset 0x1400 + 0x1400: 0x0239, 0x1401: 0x023c, 0x1402: 0x0248, 0x1403: 0x0251, 0x1405: 0x028a, + 0x1406: 0x025a, 0x1407: 0x024b, 0x1408: 0x0269, 0x1409: 0x0290, 0x140a: 0x027b, 0x140b: 0x027e, + 0x140c: 0x0281, 0x140d: 0x0284, 0x140e: 0x025d, 0x140f: 0x026f, 0x1410: 0x0275, 0x1411: 0x0263, + 0x1412: 0x0278, 0x1413: 0x0257, 0x1414: 0x0260, 0x1415: 0x0242, 0x1416: 0x0245, 0x1417: 0x024e, + 0x1418: 0x0254, 0x1419: 0x0266, 0x141a: 0x026c, 0x141b: 0x0272, 0x141c: 0x0293, 0x141d: 0x02e4, + 0x141e: 0x02cc, 0x141f: 0x0296, 0x1421: 0x023c, 0x1422: 0x0248, + 0x1424: 0x0287, 0x1427: 0x024b, 0x1429: 0x0290, + 0x142a: 0x027b, 0x142b: 0x027e, 0x142c: 0x0281, 0x142d: 0x0284, 0x142e: 0x025d, 0x142f: 0x026f, + 0x1430: 0x0275, 0x1431: 0x0263, 0x1432: 0x0278, 0x1434: 0x0260, 0x1435: 0x0242, + 0x1436: 0x0245, 0x1437: 0x024e, 0x1439: 0x0266, 0x143b: 0x0272, + // Block 0x51, offset 0x1440 + 0x1442: 0x0248, + 0x1447: 0x024b, 0x1449: 0x0290, 0x144b: 0x027e, + 0x144d: 0x0284, 0x144e: 0x025d, 0x144f: 0x026f, 0x1451: 0x0263, + 0x1452: 0x0278, 0x1454: 0x0260, 0x1457: 0x024e, + 0x1459: 0x0266, 0x145b: 0x0272, 0x145d: 0x02e4, + 0x145f: 0x0296, 0x1461: 0x023c, 0x1462: 0x0248, + 0x1464: 0x0287, 0x1467: 0x024b, 0x1468: 0x0269, 0x1469: 0x0290, + 0x146a: 0x027b, 0x146c: 0x0281, 0x146d: 0x0284, 0x146e: 0x025d, 0x146f: 0x026f, + 0x1470: 0x0275, 0x1471: 0x0263, 0x1472: 0x0278, 0x1474: 0x0260, 0x1475: 0x0242, + 0x1476: 0x0245, 0x1477: 0x024e, 0x1479: 0x0266, 0x147a: 0x026c, 0x147b: 0x0272, + 0x147c: 0x0293, 0x147e: 0x02cc, + // Block 0x52, offset 0x1480 + 0x1480: 0x0239, 0x1481: 0x023c, 0x1482: 0x0248, 0x1483: 0x0251, 0x1484: 0x0287, 0x1485: 0x028a, + 0x1486: 0x025a, 0x1487: 0x024b, 0x1488: 0x0269, 0x1489: 0x0290, 0x148b: 0x027e, + 0x148c: 0x0281, 0x148d: 0x0284, 0x148e: 0x025d, 0x148f: 0x026f, 0x1490: 0x0275, 0x1491: 0x0263, + 0x1492: 0x0278, 0x1493: 0x0257, 0x1494: 0x0260, 0x1495: 0x0242, 0x1496: 0x0245, 0x1497: 0x024e, + 0x1498: 0x0254, 0x1499: 0x0266, 0x149a: 0x026c, 0x149b: 0x0272, + 0x14a1: 0x023c, 0x14a2: 0x0248, 0x14a3: 0x0251, + 0x14a5: 0x028a, 0x14a6: 0x025a, 0x14a7: 0x024b, 0x14a8: 0x0269, 0x14a9: 0x0290, + 0x14ab: 0x027e, 0x14ac: 0x0281, 0x14ad: 0x0284, 0x14ae: 0x025d, 0x14af: 0x026f, + 0x14b0: 0x0275, 0x14b1: 0x0263, 0x14b2: 0x0278, 0x14b3: 0x0257, 0x14b4: 0x0260, 0x14b5: 0x0242, + 0x14b6: 0x0245, 0x14b7: 0x024e, 0x14b8: 0x0254, 0x14b9: 0x0266, 0x14ba: 0x026c, 0x14bb: 0x0272, + // Block 0x53, offset 0x14c0 + 0x14c0: 0x1879, 0x14c1: 0x1876, 0x14c2: 0x187c, 0x14c3: 0x18a0, 0x14c4: 0x18c4, 0x14c5: 0x18e8, + 0x14c6: 0x190c, 0x14c7: 0x1915, 0x14c8: 0x191b, 0x14c9: 0x1921, 0x14ca: 0x1927, + 0x14d0: 0x1a8c, 0x14d1: 0x1a90, + 0x14d2: 0x1a94, 0x14d3: 0x1a98, 0x14d4: 0x1a9c, 0x14d5: 0x1aa0, 0x14d6: 0x1aa4, 0x14d7: 0x1aa8, + 0x14d8: 0x1aac, 0x14d9: 0x1ab0, 0x14da: 0x1ab4, 0x14db: 0x1ab8, 0x14dc: 0x1abc, 0x14dd: 0x1ac0, + 0x14de: 0x1ac4, 0x14df: 0x1ac8, 0x14e0: 0x1acc, 0x14e1: 0x1ad0, 0x14e2: 0x1ad4, 0x14e3: 0x1ad8, + 0x14e4: 0x1adc, 0x14e5: 0x1ae0, 0x14e6: 0x1ae4, 0x14e7: 0x1ae8, 0x14e8: 0x1aec, 0x14e9: 0x1af0, + 0x14ea: 0x271e, 0x14eb: 0x0047, 0x14ec: 0x0065, 0x14ed: 0x193c, 0x14ee: 0x19b1, + 0x14f0: 0x0043, 0x14f1: 0x0045, 0x14f2: 0x0047, 0x14f3: 0x0049, 0x14f4: 0x004b, 0x14f5: 0x004d, + 0x14f6: 0x004f, 0x14f7: 0x0051, 0x14f8: 0x0053, 0x14f9: 0x0055, 0x14fa: 0x0057, 0x14fb: 0x0059, + 0x14fc: 0x005b, 0x14fd: 0x005d, 0x14fe: 0x005f, 0x14ff: 0x0061, + // Block 0x54, offset 0x1500 + 0x1500: 0x26ad, 0x1501: 0x26c2, 0x1502: 0x0503, + 0x1510: 0x0c0f, 0x1511: 0x0a47, + 0x1512: 0x08d3, 0x1513: 0x45c4, 0x1514: 0x071b, 0x1515: 0x09ef, 0x1516: 0x132f, 0x1517: 0x09ff, + 0x1518: 0x0727, 0x1519: 0x0cd7, 0x151a: 0x0eaf, 0x151b: 0x0caf, 0x151c: 0x0827, 0x151d: 0x0b6b, + 0x151e: 0x07bf, 0x151f: 0x0cb7, 0x1520: 0x0813, 0x1521: 0x1117, 0x1522: 0x0f83, 0x1523: 0x138b, + 0x1524: 0x09d3, 0x1525: 0x090b, 0x1526: 0x0e63, 0x1527: 0x0c1b, 0x1528: 0x0c47, 0x1529: 0x06bf, + 0x152a: 0x06cb, 0x152b: 0x140b, 0x152c: 0x0adb, 0x152d: 0x06e7, 0x152e: 0x08ef, 0x152f: 0x0c3b, + 0x1530: 0x13b3, 0x1531: 0x0c13, 0x1532: 0x106f, 0x1533: 0x10ab, 0x1534: 0x08f7, 0x1535: 0x0e43, + 0x1536: 0x0d0b, 0x1537: 0x0d07, 0x1538: 0x0f97, 0x1539: 0x082b, 0x153a: 0x0957, 0x153b: 0x1443, + // Block 0x55, offset 0x1540 + 0x1540: 0x06fb, 0x1541: 0x06f3, 0x1542: 0x0703, 0x1543: 0x1647, 0x1544: 0x0747, 0x1545: 0x0757, + 0x1546: 0x075b, 0x1547: 0x0763, 0x1548: 0x076b, 0x1549: 0x076f, 0x154a: 0x077b, 0x154b: 0x0773, + 0x154c: 0x05b3, 0x154d: 0x165b, 0x154e: 0x078f, 0x154f: 0x0793, 0x1550: 0x0797, 0x1551: 0x07b3, + 0x1552: 0x164c, 0x1553: 0x05b7, 0x1554: 0x079f, 0x1555: 0x07bf, 0x1556: 0x1656, 0x1557: 0x07cf, + 0x1558: 0x07d7, 0x1559: 0x0737, 0x155a: 0x07df, 0x155b: 0x07e3, 0x155c: 0x1831, 0x155d: 0x07ff, + 0x155e: 0x0807, 0x155f: 0x05bf, 0x1560: 0x081f, 0x1561: 0x0823, 0x1562: 0x082b, 0x1563: 0x082f, + 0x1564: 0x05c3, 0x1565: 0x0847, 0x1566: 0x084b, 0x1567: 0x0857, 0x1568: 0x0863, 0x1569: 0x0867, + 0x156a: 0x086b, 0x156b: 0x0873, 0x156c: 0x0893, 0x156d: 0x0897, 0x156e: 0x089f, 0x156f: 0x08af, + 0x1570: 0x08b7, 0x1571: 0x08bb, 0x1572: 0x08bb, 0x1573: 0x08bb, 0x1574: 0x166a, 0x1575: 0x0e93, + 0x1576: 0x08cf, 0x1577: 0x08d7, 0x1578: 0x166f, 0x1579: 0x08e3, 0x157a: 0x08eb, 0x157b: 0x08f3, + 0x157c: 0x091b, 0x157d: 0x0907, 0x157e: 0x0913, 0x157f: 0x0917, + // Block 0x56, offset 0x1580 + 0x1580: 0x091f, 0x1581: 0x0927, 0x1582: 0x092b, 0x1583: 0x0933, 0x1584: 0x093b, 0x1585: 0x093f, + 0x1586: 0x093f, 0x1587: 0x0947, 0x1588: 0x094f, 0x1589: 0x0953, 0x158a: 0x095f, 0x158b: 0x0983, + 0x158c: 0x0967, 0x158d: 0x0987, 0x158e: 0x096b, 0x158f: 0x0973, 0x1590: 0x080b, 0x1591: 0x09cf, + 0x1592: 0x0997, 0x1593: 0x099b, 0x1594: 0x099f, 0x1595: 0x0993, 0x1596: 0x09a7, 0x1597: 0x09a3, + 0x1598: 0x09bb, 0x1599: 0x1674, 0x159a: 0x09d7, 0x159b: 0x09db, 0x159c: 0x09e3, 0x159d: 0x09ef, + 0x159e: 0x09f7, 0x159f: 0x0a13, 0x15a0: 0x1679, 0x15a1: 0x167e, 0x15a2: 0x0a1f, 0x15a3: 0x0a23, + 0x15a4: 0x0a27, 0x15a5: 0x0a1b, 0x15a6: 0x0a2f, 0x15a7: 0x05c7, 0x15a8: 0x05cb, 0x15a9: 0x0a37, + 0x15aa: 0x0a3f, 0x15ab: 0x0a3f, 0x15ac: 0x1683, 0x15ad: 0x0a5b, 0x15ae: 0x0a5f, 0x15af: 0x0a63, + 0x15b0: 0x0a6b, 0x15b1: 0x1688, 0x15b2: 0x0a73, 0x15b3: 0x0a77, 0x15b4: 0x0b4f, 0x15b5: 0x0a7f, + 0x15b6: 0x05cf, 0x15b7: 0x0a8b, 0x15b8: 0x0a9b, 0x15b9: 0x0aa7, 0x15ba: 0x0aa3, 0x15bb: 0x1692, + 0x15bc: 0x0aaf, 0x15bd: 0x1697, 0x15be: 0x0abb, 0x15bf: 0x0ab7, + // Block 0x57, offset 0x15c0 + 0x15c0: 0x0abf, 0x15c1: 0x0acf, 0x15c2: 0x0ad3, 0x15c3: 0x05d3, 0x15c4: 0x0ae3, 0x15c5: 0x0aeb, + 0x15c6: 0x0aef, 0x15c7: 0x0af3, 0x15c8: 0x05d7, 0x15c9: 0x169c, 0x15ca: 0x05db, 0x15cb: 0x0b0f, + 0x15cc: 0x0b13, 0x15cd: 0x0b17, 0x15ce: 0x0b1f, 0x15cf: 0x1863, 0x15d0: 0x0b37, 0x15d1: 0x16a6, + 0x15d2: 0x16a6, 0x15d3: 0x11d7, 0x15d4: 0x0b47, 0x15d5: 0x0b47, 0x15d6: 0x05df, 0x15d7: 0x16c9, + 0x15d8: 0x179b, 0x15d9: 0x0b57, 0x15da: 0x0b5f, 0x15db: 0x05e3, 0x15dc: 0x0b73, 0x15dd: 0x0b83, + 0x15de: 0x0b87, 0x15df: 0x0b8f, 0x15e0: 0x0b9f, 0x15e1: 0x05eb, 0x15e2: 0x05e7, 0x15e3: 0x0ba3, + 0x15e4: 0x16ab, 0x15e5: 0x0ba7, 0x15e6: 0x0bbb, 0x15e7: 0x0bbf, 0x15e8: 0x0bc3, 0x15e9: 0x0bbf, + 0x15ea: 0x0bcf, 0x15eb: 0x0bd3, 0x15ec: 0x0be3, 0x15ed: 0x0bdb, 0x15ee: 0x0bdf, 0x15ef: 0x0be7, + 0x15f0: 0x0beb, 0x15f1: 0x0bef, 0x15f2: 0x0bfb, 0x15f3: 0x0bff, 0x15f4: 0x0c17, 0x15f5: 0x0c1f, + 0x15f6: 0x0c2f, 0x15f7: 0x0c43, 0x15f8: 0x16ba, 0x15f9: 0x0c3f, 0x15fa: 0x0c33, 0x15fb: 0x0c4b, + 0x15fc: 0x0c53, 0x15fd: 0x0c67, 0x15fe: 0x16bf, 0x15ff: 0x0c6f, + // Block 0x58, offset 0x1600 + 0x1600: 0x0c63, 0x1601: 0x0c5b, 0x1602: 0x05ef, 0x1603: 0x0c77, 0x1604: 0x0c7f, 0x1605: 0x0c87, + 0x1606: 0x0c7b, 0x1607: 0x05f3, 0x1608: 0x0c97, 0x1609: 0x0c9f, 0x160a: 0x16c4, 0x160b: 0x0ccb, + 0x160c: 0x0cff, 0x160d: 0x0cdb, 0x160e: 0x05ff, 0x160f: 0x0ce7, 0x1610: 0x05fb, 0x1611: 0x05f7, + 0x1612: 0x07c3, 0x1613: 0x07c7, 0x1614: 0x0d03, 0x1615: 0x0ceb, 0x1616: 0x11ab, 0x1617: 0x0663, + 0x1618: 0x0d0f, 0x1619: 0x0d13, 0x161a: 0x0d17, 0x161b: 0x0d2b, 0x161c: 0x0d23, 0x161d: 0x16dd, + 0x161e: 0x0603, 0x161f: 0x0d3f, 0x1620: 0x0d33, 0x1621: 0x0d4f, 0x1622: 0x0d57, 0x1623: 0x16e7, + 0x1624: 0x0d5b, 0x1625: 0x0d47, 0x1626: 0x0d63, 0x1627: 0x0607, 0x1628: 0x0d67, 0x1629: 0x0d6b, + 0x162a: 0x0d6f, 0x162b: 0x0d7b, 0x162c: 0x16ec, 0x162d: 0x0d83, 0x162e: 0x060b, 0x162f: 0x0d8f, + 0x1630: 0x16f1, 0x1631: 0x0d93, 0x1632: 0x060f, 0x1633: 0x0d9f, 0x1634: 0x0dab, 0x1635: 0x0db7, + 0x1636: 0x0dbb, 0x1637: 0x16f6, 0x1638: 0x168d, 0x1639: 0x16fb, 0x163a: 0x0ddb, 0x163b: 0x1700, + 0x163c: 0x0de7, 0x163d: 0x0def, 0x163e: 0x0ddf, 0x163f: 0x0dfb, + // Block 0x59, offset 0x1640 + 0x1640: 0x0e0b, 0x1641: 0x0e1b, 0x1642: 0x0e0f, 0x1643: 0x0e13, 0x1644: 0x0e1f, 0x1645: 0x0e23, + 0x1646: 0x1705, 0x1647: 0x0e07, 0x1648: 0x0e3b, 0x1649: 0x0e3f, 0x164a: 0x0613, 0x164b: 0x0e53, + 0x164c: 0x0e4f, 0x164d: 0x170a, 0x164e: 0x0e33, 0x164f: 0x0e6f, 0x1650: 0x170f, 0x1651: 0x1714, + 0x1652: 0x0e73, 0x1653: 0x0e87, 0x1654: 0x0e83, 0x1655: 0x0e7f, 0x1656: 0x0617, 0x1657: 0x0e8b, + 0x1658: 0x0e9b, 0x1659: 0x0e97, 0x165a: 0x0ea3, 0x165b: 0x1651, 0x165c: 0x0eb3, 0x165d: 0x1719, + 0x165e: 0x0ebf, 0x165f: 0x1723, 0x1660: 0x0ed3, 0x1661: 0x0edf, 0x1662: 0x0ef3, 0x1663: 0x1728, + 0x1664: 0x0f07, 0x1665: 0x0f0b, 0x1666: 0x172d, 0x1667: 0x1732, 0x1668: 0x0f27, 0x1669: 0x0f37, + 0x166a: 0x061b, 0x166b: 0x0f3b, 0x166c: 0x061f, 0x166d: 0x061f, 0x166e: 0x0f53, 0x166f: 0x0f57, + 0x1670: 0x0f5f, 0x1671: 0x0f63, 0x1672: 0x0f6f, 0x1673: 0x0623, 0x1674: 0x0f87, 0x1675: 0x1737, + 0x1676: 0x0fa3, 0x1677: 0x173c, 0x1678: 0x0faf, 0x1679: 0x16a1, 0x167a: 0x0fbf, 0x167b: 0x1741, + 0x167c: 0x1746, 0x167d: 0x174b, 0x167e: 0x0627, 0x167f: 0x062b, + // Block 0x5a, offset 0x1680 + 0x1680: 0x0ff7, 0x1681: 0x1755, 0x1682: 0x1750, 0x1683: 0x175a, 0x1684: 0x175f, 0x1685: 0x0fff, + 0x1686: 0x1003, 0x1687: 0x1003, 0x1688: 0x100b, 0x1689: 0x0633, 0x168a: 0x100f, 0x168b: 0x0637, + 0x168c: 0x063b, 0x168d: 0x1769, 0x168e: 0x1023, 0x168f: 0x102b, 0x1690: 0x1037, 0x1691: 0x063f, + 0x1692: 0x176e, 0x1693: 0x105b, 0x1694: 0x1773, 0x1695: 0x1778, 0x1696: 0x107b, 0x1697: 0x1093, + 0x1698: 0x0643, 0x1699: 0x109b, 0x169a: 0x109f, 0x169b: 0x10a3, 0x169c: 0x177d, 0x169d: 0x1782, + 0x169e: 0x1782, 0x169f: 0x10bb, 0x16a0: 0x0647, 0x16a1: 0x1787, 0x16a2: 0x10cf, 0x16a3: 0x10d3, + 0x16a4: 0x064b, 0x16a5: 0x178c, 0x16a6: 0x10ef, 0x16a7: 0x064f, 0x16a8: 0x10ff, 0x16a9: 0x10f7, + 0x16aa: 0x1107, 0x16ab: 0x1796, 0x16ac: 0x111f, 0x16ad: 0x0653, 0x16ae: 0x112b, 0x16af: 0x1133, + 0x16b0: 0x1143, 0x16b1: 0x0657, 0x16b2: 0x17a0, 0x16b3: 0x17a5, 0x16b4: 0x065b, 0x16b5: 0x17aa, + 0x16b6: 0x115b, 0x16b7: 0x17af, 0x16b8: 0x1167, 0x16b9: 0x1173, 0x16ba: 0x117b, 0x16bb: 0x17b4, + 0x16bc: 0x17b9, 0x16bd: 0x118f, 0x16be: 0x17be, 0x16bf: 0x1197, + // Block 0x5b, offset 0x16c0 + 0x16c0: 0x16ce, 0x16c1: 0x065f, 0x16c2: 0x11af, 0x16c3: 0x11b3, 0x16c4: 0x0667, 0x16c5: 0x11b7, + 0x16c6: 0x0a33, 0x16c7: 0x17c3, 0x16c8: 0x17c8, 0x16c9: 0x16d3, 0x16ca: 0x16d8, 0x16cb: 0x11d7, + 0x16cc: 0x11db, 0x16cd: 0x13f3, 0x16ce: 0x066b, 0x16cf: 0x1207, 0x16d0: 0x1203, 0x16d1: 0x120b, + 0x16d2: 0x083f, 0x16d3: 0x120f, 0x16d4: 0x1213, 0x16d5: 0x1217, 0x16d6: 0x121f, 0x16d7: 0x17cd, + 0x16d8: 0x121b, 0x16d9: 0x1223, 0x16da: 0x1237, 0x16db: 0x123b, 0x16dc: 0x1227, 0x16dd: 0x123f, + 0x16de: 0x1253, 0x16df: 0x1267, 0x16e0: 0x1233, 0x16e1: 0x1247, 0x16e2: 0x124b, 0x16e3: 0x124f, + 0x16e4: 0x17d2, 0x16e5: 0x17dc, 0x16e6: 0x17d7, 0x16e7: 0x066f, 0x16e8: 0x126f, 0x16e9: 0x1273, + 0x16ea: 0x127b, 0x16eb: 0x17f0, 0x16ec: 0x127f, 0x16ed: 0x17e1, 0x16ee: 0x0673, 0x16ef: 0x0677, + 0x16f0: 0x17e6, 0x16f1: 0x17eb, 0x16f2: 0x067b, 0x16f3: 0x129f, 0x16f4: 0x12a3, 0x16f5: 0x12a7, + 0x16f6: 0x12ab, 0x16f7: 0x12b7, 0x16f8: 0x12b3, 0x16f9: 0x12bf, 0x16fa: 0x12bb, 0x16fb: 0x12cb, + 0x16fc: 0x12c3, 0x16fd: 0x12c7, 0x16fe: 0x12cf, 0x16ff: 0x067f, + // Block 0x5c, offset 0x1700 + 0x1700: 0x12d7, 0x1701: 0x12db, 0x1702: 0x0683, 0x1703: 0x12eb, 0x1704: 0x12ef, 0x1705: 0x17f5, + 0x1706: 0x12fb, 0x1707: 0x12ff, 0x1708: 0x0687, 0x1709: 0x130b, 0x170a: 0x05bb, 0x170b: 0x17fa, + 0x170c: 0x17ff, 0x170d: 0x068b, 0x170e: 0x068f, 0x170f: 0x1337, 0x1710: 0x134f, 0x1711: 0x136b, + 0x1712: 0x137b, 0x1713: 0x1804, 0x1714: 0x138f, 0x1715: 0x1393, 0x1716: 0x13ab, 0x1717: 0x13b7, + 0x1718: 0x180e, 0x1719: 0x1660, 0x171a: 0x13c3, 0x171b: 0x13bf, 0x171c: 0x13cb, 0x171d: 0x1665, + 0x171e: 0x13d7, 0x171f: 0x13e3, 0x1720: 0x1813, 0x1721: 0x1818, 0x1722: 0x1423, 0x1723: 0x142f, + 0x1724: 0x1437, 0x1725: 0x181d, 0x1726: 0x143b, 0x1727: 0x1467, 0x1728: 0x1473, 0x1729: 0x1477, + 0x172a: 0x146f, 0x172b: 0x1483, 0x172c: 0x1487, 0x172d: 0x1822, 0x172e: 0x1493, 0x172f: 0x0693, + 0x1730: 0x149b, 0x1731: 0x1827, 0x1732: 0x0697, 0x1733: 0x14d3, 0x1734: 0x0ac3, 0x1735: 0x14eb, + 0x1736: 0x182c, 0x1737: 0x1836, 0x1738: 0x069b, 0x1739: 0x069f, 0x173a: 0x1513, 0x173b: 0x183b, + 0x173c: 0x06a3, 0x173d: 0x1840, 0x173e: 0x152b, 0x173f: 0x152b, + // Block 0x5d, offset 0x1740 + 0x1740: 0x1533, 0x1741: 0x1845, 0x1742: 0x154b, 0x1743: 0x06a7, 0x1744: 0x155b, 0x1745: 0x1567, + 0x1746: 0x156f, 0x1747: 0x1577, 0x1748: 0x06ab, 0x1749: 0x184a, 0x174a: 0x158b, 0x174b: 0x15a7, + 0x174c: 0x15b3, 0x174d: 0x06af, 0x174e: 0x06b3, 0x174f: 0x15b7, 0x1750: 0x184f, 0x1751: 0x06b7, + 0x1752: 0x1854, 0x1753: 0x1859, 0x1754: 0x185e, 0x1755: 0x15db, 0x1756: 0x06bb, 0x1757: 0x15ef, + 0x1758: 0x15f7, 0x1759: 0x15fb, 0x175a: 0x1603, 0x175b: 0x160b, 0x175c: 0x1613, 0x175d: 0x1868, +} + +// nfkcIndex: 22 blocks, 1408 entries, 1408 bytes +// Block 0 is the zero block. +var nfkcIndex = [1408]uint8{ + // Block 0x0, offset 0x0 + // Block 0x1, offset 0x40 + // Block 0x2, offset 0x80 + // Block 0x3, offset 0xc0 + 0xc2: 0x5c, 0xc3: 0x01, 0xc4: 0x02, 0xc5: 0x03, 0xc6: 0x5d, 0xc7: 0x04, + 0xc8: 0x05, 0xca: 0x5e, 0xcb: 0x5f, 0xcc: 0x06, 0xcd: 0x07, 0xce: 0x08, 0xcf: 0x09, + 0xd0: 0x0a, 0xd1: 0x60, 0xd2: 0x61, 0xd3: 0x0b, 0xd6: 0x0c, 0xd7: 0x62, + 0xd8: 0x63, 0xd9: 0x0d, 0xdb: 0x64, 0xdc: 0x65, 0xdd: 0x66, 0xdf: 0x67, + 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, + 0xea: 0x06, 0xeb: 0x07, 0xec: 0x08, 0xed: 0x09, 0xef: 0x0a, + 0xf0: 0x13, + // Block 0x4, offset 0x100 + 0x120: 0x68, 0x121: 0x69, 0x123: 0x0e, 0x124: 0x6a, 0x125: 0x6b, 0x126: 0x6c, 0x127: 0x6d, + 0x128: 0x6e, 0x129: 0x6f, 0x12a: 0x70, 0x12b: 0x71, 0x12c: 0x6c, 0x12d: 0x72, 0x12e: 0x73, 0x12f: 0x74, + 0x131: 0x75, 0x132: 0x76, 0x133: 0x77, 0x134: 0x78, 0x135: 0x79, 0x137: 0x7a, + 0x138: 0x7b, 0x139: 0x7c, 0x13a: 0x7d, 0x13b: 0x7e, 0x13c: 0x7f, 0x13d: 0x80, 0x13e: 0x81, 0x13f: 0x82, + // Block 0x5, offset 0x140 + 0x140: 0x83, 0x142: 0x84, 0x143: 0x85, 0x144: 0x86, 0x145: 0x87, 0x146: 0x88, 0x147: 0x89, + 0x14d: 0x8a, + 0x15c: 0x8b, 0x15f: 0x8c, + 0x162: 0x8d, 0x164: 0x8e, + 0x168: 0x8f, 0x169: 0x90, 0x16a: 0x91, 0x16c: 0x0f, 0x16d: 0x92, 0x16e: 0x93, 0x16f: 0x94, + 0x170: 0x95, 0x173: 0x96, 0x174: 0x97, 0x175: 0x10, 0x176: 0x11, 0x177: 0x12, + 0x178: 0x13, 0x179: 0x14, 0x17a: 0x15, 0x17b: 0x16, 0x17c: 0x17, 0x17d: 0x18, 0x17e: 0x19, 0x17f: 0x1a, + // Block 0x6, offset 0x180 + 0x180: 0x98, 0x181: 0x99, 0x182: 0x9a, 0x183: 0x9b, 0x184: 0x1b, 0x185: 0x1c, 0x186: 0x9c, 0x187: 0x9d, + 0x188: 0x9e, 0x189: 0x1d, 0x18a: 0x1e, 0x18b: 0x9f, 0x18c: 0xa0, + 0x191: 0x1f, 0x192: 0x20, 0x193: 0xa1, + 0x1a8: 0xa2, 0x1a9: 0xa3, 0x1ab: 0xa4, + 0x1b1: 0xa5, 0x1b3: 0xa6, 0x1b5: 0xa7, 0x1b7: 0xa8, + 0x1ba: 0xa9, 0x1bb: 0xaa, 0x1bc: 0x21, 0x1bd: 0x22, 0x1be: 0x23, 0x1bf: 0xab, + // Block 0x7, offset 0x1c0 + 0x1c0: 0xac, 0x1c1: 0x24, 0x1c2: 0x25, 0x1c3: 0x26, 0x1c4: 0xad, 0x1c5: 0x27, 0x1c6: 0x28, + 0x1c8: 0x29, 0x1c9: 0x2a, 0x1ca: 0x2b, 0x1cb: 0x2c, 0x1cc: 0x2d, 0x1cd: 0x2e, 0x1ce: 0x2f, 0x1cf: 0x30, + // Block 0x8, offset 0x200 + 0x219: 0xae, 0x21a: 0xaf, 0x21b: 0xb0, 0x21d: 0xb1, 0x21f: 0xb2, + 0x220: 0xb3, 0x223: 0xb4, 0x224: 0xb5, 0x225: 0xb6, 0x226: 0xb7, 0x227: 0xb8, + 0x22a: 0xb9, 0x22b: 0xba, 0x22d: 0xbb, 0x22f: 0xbc, + 0x230: 0xbd, 0x231: 0xbe, 0x232: 0xbf, 0x233: 0xc0, 0x234: 0xc1, 0x235: 0xc2, 0x236: 0xc3, 0x237: 0xbd, + 0x238: 0xbe, 0x239: 0xbf, 0x23a: 0xc0, 0x23b: 0xc1, 0x23c: 0xc2, 0x23d: 0xc3, 0x23e: 0xbd, 0x23f: 0xbe, + // Block 0x9, offset 0x240 + 0x240: 0xbf, 0x241: 0xc0, 0x242: 0xc1, 0x243: 0xc2, 0x244: 0xc3, 0x245: 0xbd, 0x246: 0xbe, 0x247: 0xbf, + 0x248: 0xc0, 0x249: 0xc1, 0x24a: 0xc2, 0x24b: 0xc3, 0x24c: 0xbd, 0x24d: 0xbe, 0x24e: 0xbf, 0x24f: 0xc0, + 0x250: 0xc1, 0x251: 0xc2, 0x252: 0xc3, 0x253: 0xbd, 0x254: 0xbe, 0x255: 0xbf, 0x256: 0xc0, 0x257: 0xc1, + 0x258: 0xc2, 0x259: 0xc3, 0x25a: 0xbd, 0x25b: 0xbe, 0x25c: 0xbf, 0x25d: 0xc0, 0x25e: 0xc1, 0x25f: 0xc2, + 0x260: 0xc3, 0x261: 0xbd, 0x262: 0xbe, 0x263: 0xbf, 0x264: 0xc0, 0x265: 0xc1, 0x266: 0xc2, 0x267: 0xc3, + 0x268: 0xbd, 0x269: 0xbe, 0x26a: 0xbf, 0x26b: 0xc0, 0x26c: 0xc1, 0x26d: 0xc2, 0x26e: 0xc3, 0x26f: 0xbd, + 0x270: 0xbe, 0x271: 0xbf, 0x272: 0xc0, 0x273: 0xc1, 0x274: 0xc2, 0x275: 0xc3, 0x276: 0xbd, 0x277: 0xbe, + 0x278: 0xbf, 0x279: 0xc0, 0x27a: 0xc1, 0x27b: 0xc2, 0x27c: 0xc3, 0x27d: 0xbd, 0x27e: 0xbe, 0x27f: 0xbf, + // Block 0xa, offset 0x280 + 0x280: 0xc0, 0x281: 0xc1, 0x282: 0xc2, 0x283: 0xc3, 0x284: 0xbd, 0x285: 0xbe, 0x286: 0xbf, 0x287: 0xc0, + 0x288: 0xc1, 0x289: 0xc2, 0x28a: 0xc3, 0x28b: 0xbd, 0x28c: 0xbe, 0x28d: 0xbf, 0x28e: 0xc0, 0x28f: 0xc1, + 0x290: 0xc2, 0x291: 0xc3, 0x292: 0xbd, 0x293: 0xbe, 0x294: 0xbf, 0x295: 0xc0, 0x296: 0xc1, 0x297: 0xc2, + 0x298: 0xc3, 0x299: 0xbd, 0x29a: 0xbe, 0x29b: 0xbf, 0x29c: 0xc0, 0x29d: 0xc1, 0x29e: 0xc2, 0x29f: 0xc3, + 0x2a0: 0xbd, 0x2a1: 0xbe, 0x2a2: 0xbf, 0x2a3: 0xc0, 0x2a4: 0xc1, 0x2a5: 0xc2, 0x2a6: 0xc3, 0x2a7: 0xbd, + 0x2a8: 0xbe, 0x2a9: 0xbf, 0x2aa: 0xc0, 0x2ab: 0xc1, 0x2ac: 0xc2, 0x2ad: 0xc3, 0x2ae: 0xbd, 0x2af: 0xbe, + 0x2b0: 0xbf, 0x2b1: 0xc0, 0x2b2: 0xc1, 0x2b3: 0xc2, 0x2b4: 0xc3, 0x2b5: 0xbd, 0x2b6: 0xbe, 0x2b7: 0xbf, + 0x2b8: 0xc0, 0x2b9: 0xc1, 0x2ba: 0xc2, 0x2bb: 0xc3, 0x2bc: 0xbd, 0x2bd: 0xbe, 0x2be: 0xbf, 0x2bf: 0xc0, + // Block 0xb, offset 0x2c0 + 0x2c0: 0xc1, 0x2c1: 0xc2, 0x2c2: 0xc3, 0x2c3: 0xbd, 0x2c4: 0xbe, 0x2c5: 0xbf, 0x2c6: 0xc0, 0x2c7: 0xc1, + 0x2c8: 0xc2, 0x2c9: 0xc3, 0x2ca: 0xbd, 0x2cb: 0xbe, 0x2cc: 0xbf, 0x2cd: 0xc0, 0x2ce: 0xc1, 0x2cf: 0xc2, + 0x2d0: 0xc3, 0x2d1: 0xbd, 0x2d2: 0xbe, 0x2d3: 0xbf, 0x2d4: 0xc0, 0x2d5: 0xc1, 0x2d6: 0xc2, 0x2d7: 0xc3, + 0x2d8: 0xbd, 0x2d9: 0xbe, 0x2da: 0xbf, 0x2db: 0xc0, 0x2dc: 0xc1, 0x2dd: 0xc2, 0x2de: 0xc4, + // Block 0xc, offset 0x300 + 0x324: 0x31, 0x325: 0x32, 0x326: 0x33, 0x327: 0x34, + 0x328: 0x35, 0x329: 0x36, 0x32a: 0x37, 0x32b: 0x38, 0x32c: 0x39, 0x32d: 0x3a, 0x32e: 0x3b, 0x32f: 0x3c, + 0x330: 0x3d, 0x331: 0x3e, 0x332: 0x3f, 0x333: 0x40, 0x334: 0x41, 0x335: 0x42, 0x336: 0x43, 0x337: 0x44, + 0x338: 0x45, 0x339: 0x46, 0x33a: 0x47, 0x33b: 0x48, 0x33c: 0xc5, 0x33d: 0x49, 0x33e: 0x4a, 0x33f: 0x4b, + // Block 0xd, offset 0x340 + 0x347: 0xc6, + 0x34b: 0xc7, 0x34d: 0xc8, + 0x368: 0xc9, 0x36b: 0xca, + 0x374: 0xcb, + 0x37d: 0xcc, + // Block 0xe, offset 0x380 + 0x381: 0xcd, 0x382: 0xce, 0x384: 0xcf, 0x385: 0xb7, 0x387: 0xd0, + 0x388: 0xd1, 0x38b: 0xd2, 0x38c: 0xd3, 0x38d: 0xd4, + 0x391: 0xd5, 0x392: 0xd6, 0x393: 0xd7, 0x396: 0xd8, 0x397: 0xd9, + 0x398: 0xda, 0x39a: 0xdb, 0x39c: 0xdc, + 0x3a0: 0xdd, + 0x3a8: 0xde, 0x3a9: 0xdf, 0x3aa: 0xe0, + 0x3b0: 0xda, 0x3b5: 0xe1, 0x3b6: 0xe2, + // Block 0xf, offset 0x3c0 + 0x3eb: 0xe3, 0x3ec: 0xe4, + // Block 0x10, offset 0x400 + 0x432: 0xe5, + // Block 0x11, offset 0x440 + 0x445: 0xe6, 0x446: 0xe7, 0x447: 0xe8, + 0x449: 0xe9, + 0x450: 0xea, 0x451: 0xeb, 0x452: 0xec, 0x453: 0xed, 0x454: 0xee, 0x455: 0xef, 0x456: 0xf0, 0x457: 0xf1, + 0x458: 0xf2, 0x459: 0xf3, 0x45a: 0x4c, 0x45b: 0xf4, 0x45c: 0xf5, 0x45d: 0xf6, 0x45e: 0xf7, 0x45f: 0x4d, + // Block 0x12, offset 0x480 + 0x480: 0xf8, + 0x4a3: 0xf9, 0x4a5: 0xfa, + 0x4b8: 0x4e, 0x4b9: 0x4f, 0x4ba: 0x50, + // Block 0x13, offset 0x4c0 + 0x4c4: 0x51, 0x4c5: 0xfb, 0x4c6: 0xfc, + 0x4c8: 0x52, 0x4c9: 0xfd, + // Block 0x14, offset 0x500 + 0x520: 0x53, 0x521: 0x54, 0x522: 0x55, 0x523: 0x56, 0x524: 0x57, 0x525: 0x58, 0x526: 0x59, 0x527: 0x5a, + 0x528: 0x5b, + // Block 0x15, offset 0x540 + 0x550: 0x0b, 0x551: 0x0c, 0x556: 0x0d, + 0x55b: 0x0e, 0x55d: 0x0f, 0x55e: 0x10, 0x55f: 0x11, + 0x56f: 0x12, +} + +// nfkcSparseOffset: 162 entries, 324 bytes +var nfkcSparseOffset = []uint16{0x0, 0xe, 0x12, 0x1b, 0x25, 0x35, 0x37, 0x3c, 0x47, 0x56, 0x63, 0x6b, 0x70, 0x75, 0x77, 0x7f, 0x86, 0x89, 0x91, 0x95, 0x99, 0x9b, 0x9d, 0xa6, 0xaa, 0xb1, 0xb6, 0xb9, 0xc3, 0xc6, 0xcd, 0xd5, 0xd9, 0xdb, 0xde, 0xe2, 0xe8, 0xf9, 0x105, 0x107, 0x10d, 0x10f, 0x111, 0x113, 0x115, 0x117, 0x119, 0x11b, 0x11e, 0x121, 0x123, 0x126, 0x129, 0x12d, 0x132, 0x13b, 0x13d, 0x140, 0x142, 0x14d, 0x158, 0x166, 0x174, 0x184, 0x192, 0x199, 0x19f, 0x1ae, 0x1b2, 0x1b4, 0x1b8, 0x1ba, 0x1bd, 0x1bf, 0x1c2, 0x1c4, 0x1c7, 0x1c9, 0x1cb, 0x1cd, 0x1d9, 0x1e3, 0x1ed, 0x1f0, 0x1f4, 0x1f6, 0x1f8, 0x1fa, 0x1fc, 0x1ff, 0x201, 0x203, 0x205, 0x207, 0x20d, 0x210, 0x214, 0x216, 0x21d, 0x223, 0x229, 0x231, 0x237, 0x23d, 0x243, 0x247, 0x249, 0x24b, 0x24d, 0x24f, 0x255, 0x258, 0x25a, 0x260, 0x263, 0x26b, 0x272, 0x275, 0x278, 0x27a, 0x27d, 0x285, 0x289, 0x290, 0x293, 0x299, 0x29b, 0x29d, 0x2a0, 0x2a2, 0x2a5, 0x2a7, 0x2a9, 0x2ab, 0x2ae, 0x2b0, 0x2b2, 0x2b4, 0x2b6, 0x2c3, 0x2cd, 0x2cf, 0x2d1, 0x2d5, 0x2da, 0x2e6, 0x2eb, 0x2f4, 0x2fa, 0x2ff, 0x303, 0x308, 0x30c, 0x31c, 0x32a, 0x338, 0x346, 0x34c, 0x34e, 0x351, 0x35b, 0x35d} + +// nfkcSparseValues: 871 entries, 3484 bytes +var nfkcSparseValues = [871]valueRange{ + // Block 0x0, offset 0x0 + {value: 0x0002, lo: 0x0d}, + {value: 0x0001, lo: 0xa0, hi: 0xa0}, + {value: 0x4278, lo: 0xa8, hi: 0xa8}, + {value: 0x0083, lo: 0xaa, hi: 0xaa}, + {value: 0x4264, lo: 0xaf, hi: 0xaf}, + {value: 0x0025, lo: 0xb2, hi: 0xb3}, + {value: 0x425a, lo: 0xb4, hi: 0xb4}, + {value: 0x01dc, lo: 0xb5, hi: 0xb5}, + {value: 0x4291, lo: 0xb8, hi: 0xb8}, + {value: 0x0023, lo: 0xb9, hi: 0xb9}, + {value: 0x009f, lo: 0xba, hi: 0xba}, + {value: 0x221c, lo: 0xbc, hi: 0xbc}, + {value: 0x2210, lo: 0xbd, hi: 0xbd}, + {value: 0x22b2, lo: 0xbe, hi: 0xbe}, + // Block 0x1, offset 0xe + {value: 0x0091, lo: 0x03}, + {value: 0x46e2, lo: 0xa0, hi: 0xa1}, + {value: 0x4714, lo: 0xaf, hi: 0xb0}, + {value: 0xa000, lo: 0xb7, hi: 0xb7}, + // Block 0x2, offset 0x12 + {value: 0x0003, lo: 0x08}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0x0091, lo: 0xb0, hi: 0xb0}, + {value: 0x0119, lo: 0xb1, hi: 0xb1}, + {value: 0x0095, lo: 0xb2, hi: 0xb2}, + {value: 0x00a5, lo: 0xb3, hi: 0xb3}, + {value: 0x0143, lo: 0xb4, hi: 0xb6}, + {value: 0x00af, lo: 0xb7, hi: 0xb7}, + {value: 0x00b3, lo: 0xb8, hi: 0xb8}, + // Block 0x3, offset 0x1b + {value: 0x000a, lo: 0x09}, + {value: 0x426e, lo: 0x98, hi: 0x98}, + {value: 0x4273, lo: 0x99, hi: 0x9a}, + {value: 0x4296, lo: 0x9b, hi: 0x9b}, + {value: 0x425f, lo: 0x9c, hi: 0x9c}, + {value: 0x4282, lo: 0x9d, hi: 0x9d}, + {value: 0x0113, lo: 0xa0, hi: 0xa0}, + {value: 0x0099, lo: 0xa1, hi: 0xa1}, + {value: 0x00a7, lo: 0xa2, hi: 0xa3}, + {value: 0x0167, lo: 0xa4, hi: 0xa4}, + // Block 0x4, offset 0x25 + {value: 0x0000, lo: 0x0f}, + {value: 0xa000, lo: 0x83, hi: 0x83}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0xa000, lo: 0x8b, hi: 0x8b}, + {value: 0xa000, lo: 0x8d, hi: 0x8d}, + {value: 0x37a5, lo: 0x90, hi: 0x90}, + {value: 0x37b1, lo: 0x91, hi: 0x91}, + {value: 0x379f, lo: 0x93, hi: 0x93}, + {value: 0xa000, lo: 0x96, hi: 0x96}, + {value: 0x3817, lo: 0x97, hi: 0x97}, + {value: 0x37e1, lo: 0x9c, hi: 0x9c}, + {value: 0x37c9, lo: 0x9d, hi: 0x9d}, + {value: 0x37f3, lo: 0x9e, hi: 0x9e}, + {value: 0xa000, lo: 0xb4, hi: 0xb5}, + {value: 0x381d, lo: 0xb6, hi: 0xb6}, + {value: 0x3823, lo: 0xb7, hi: 0xb7}, + // Block 0x5, offset 0x35 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0x83, hi: 0x87}, + // Block 0x6, offset 0x37 + {value: 0x0001, lo: 0x04}, + {value: 0x8113, lo: 0x81, hi: 0x82}, + {value: 0x8132, lo: 0x84, hi: 0x84}, + {value: 0x812d, lo: 0x85, hi: 0x85}, + {value: 0x810d, lo: 0x87, hi: 0x87}, + // Block 0x7, offset 0x3c + {value: 0x0000, lo: 0x0a}, + {value: 0x8132, lo: 0x90, hi: 0x97}, + {value: 0x8119, lo: 0x98, hi: 0x98}, + {value: 0x811a, lo: 0x99, hi: 0x99}, + {value: 0x811b, lo: 0x9a, hi: 0x9a}, + {value: 0x3841, lo: 0xa2, hi: 0xa2}, + {value: 0x3847, lo: 0xa3, hi: 0xa3}, + {value: 0x3853, lo: 0xa4, hi: 0xa4}, + {value: 0x384d, lo: 0xa5, hi: 0xa5}, + {value: 0x3859, lo: 0xa6, hi: 0xa6}, + {value: 0xa000, lo: 0xa7, hi: 0xa7}, + // Block 0x8, offset 0x47 + {value: 0x0000, lo: 0x0e}, + {value: 0x386b, lo: 0x80, hi: 0x80}, + {value: 0xa000, lo: 0x81, hi: 0x81}, + {value: 0x385f, lo: 0x82, hi: 0x82}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0x3865, lo: 0x93, hi: 0x93}, + {value: 0xa000, lo: 0x95, hi: 0x95}, + {value: 0x8132, lo: 0x96, hi: 0x9c}, + {value: 0x8132, lo: 0x9f, hi: 0xa2}, + {value: 0x812d, lo: 0xa3, hi: 0xa3}, + {value: 0x8132, lo: 0xa4, hi: 0xa4}, + {value: 0x8132, lo: 0xa7, hi: 0xa8}, + {value: 0x812d, lo: 0xaa, hi: 0xaa}, + {value: 0x8132, lo: 0xab, hi: 0xac}, + {value: 0x812d, lo: 0xad, hi: 0xad}, + // Block 0x9, offset 0x56 + {value: 0x0000, lo: 0x0c}, + {value: 0x811f, lo: 0x91, hi: 0x91}, + {value: 0x8132, lo: 0xb0, hi: 0xb0}, + {value: 0x812d, lo: 0xb1, hi: 0xb1}, + {value: 0x8132, lo: 0xb2, hi: 0xb3}, + {value: 0x812d, lo: 0xb4, hi: 0xb4}, + {value: 0x8132, lo: 0xb5, hi: 0xb6}, + {value: 0x812d, lo: 0xb7, hi: 0xb9}, + {value: 0x8132, lo: 0xba, hi: 0xba}, + {value: 0x812d, lo: 0xbb, hi: 0xbc}, + {value: 0x8132, lo: 0xbd, hi: 0xbd}, + {value: 0x812d, lo: 0xbe, hi: 0xbe}, + {value: 0x8132, lo: 0xbf, hi: 0xbf}, + // Block 0xa, offset 0x63 + {value: 0x0005, lo: 0x07}, + {value: 0x8132, lo: 0x80, hi: 0x80}, + {value: 0x8132, lo: 0x81, hi: 0x81}, + {value: 0x812d, lo: 0x82, hi: 0x83}, + {value: 0x812d, lo: 0x84, hi: 0x85}, + {value: 0x812d, lo: 0x86, hi: 0x87}, + {value: 0x812d, lo: 0x88, hi: 0x89}, + {value: 0x8132, lo: 0x8a, hi: 0x8a}, + // Block 0xb, offset 0x6b + {value: 0x0000, lo: 0x04}, + {value: 0x8132, lo: 0xab, hi: 0xb1}, + {value: 0x812d, lo: 0xb2, hi: 0xb2}, + {value: 0x8132, lo: 0xb3, hi: 0xb3}, + {value: 0x812d, lo: 0xbd, hi: 0xbd}, + // Block 0xc, offset 0x70 + {value: 0x0000, lo: 0x04}, + {value: 0x8132, lo: 0x96, hi: 0x99}, + {value: 0x8132, lo: 0x9b, hi: 0xa3}, + {value: 0x8132, lo: 0xa5, hi: 0xa7}, + {value: 0x8132, lo: 0xa9, hi: 0xad}, + // Block 0xd, offset 0x75 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x99, hi: 0x9b}, + // Block 0xe, offset 0x77 + {value: 0x0000, lo: 0x07}, + {value: 0xa000, lo: 0xa8, hi: 0xa8}, + {value: 0x3ed8, lo: 0xa9, hi: 0xa9}, + {value: 0xa000, lo: 0xb0, hi: 0xb0}, + {value: 0x3ee0, lo: 0xb1, hi: 0xb1}, + {value: 0xa000, lo: 0xb3, hi: 0xb3}, + {value: 0x3ee8, lo: 0xb4, hi: 0xb4}, + {value: 0x9902, lo: 0xbc, hi: 0xbc}, + // Block 0xf, offset 0x7f + {value: 0x0008, lo: 0x06}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x8132, lo: 0x91, hi: 0x91}, + {value: 0x812d, lo: 0x92, hi: 0x92}, + {value: 0x8132, lo: 0x93, hi: 0x93}, + {value: 0x8132, lo: 0x94, hi: 0x94}, + {value: 0x451c, lo: 0x98, hi: 0x9f}, + // Block 0x10, offset 0x86 + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x11, offset 0x89 + {value: 0x0008, lo: 0x07}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0x2c9e, lo: 0x8b, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + {value: 0x455c, lo: 0x9c, hi: 0x9d}, + {value: 0x456c, lo: 0x9f, hi: 0x9f}, + {value: 0x8132, lo: 0xbe, hi: 0xbe}, + // Block 0x12, offset 0x91 + {value: 0x0000, lo: 0x03}, + {value: 0x4594, lo: 0xb3, hi: 0xb3}, + {value: 0x459c, lo: 0xb6, hi: 0xb6}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + // Block 0x13, offset 0x95 + {value: 0x0008, lo: 0x03}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x4574, lo: 0x99, hi: 0x9b}, + {value: 0x458c, lo: 0x9e, hi: 0x9e}, + // Block 0x14, offset 0x99 + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + // Block 0x15, offset 0x9b + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + // Block 0x16, offset 0x9d + {value: 0x0000, lo: 0x08}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0x2cb6, lo: 0x88, hi: 0x88}, + {value: 0x2cae, lo: 0x8b, hi: 0x8b}, + {value: 0x2cbe, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x96, hi: 0x97}, + {value: 0x45a4, lo: 0x9c, hi: 0x9c}, + {value: 0x45ac, lo: 0x9d, hi: 0x9d}, + // Block 0x17, offset 0xa6 + {value: 0x0000, lo: 0x03}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0x2cc6, lo: 0x94, hi: 0x94}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x18, offset 0xaa + {value: 0x0000, lo: 0x06}, + {value: 0xa000, lo: 0x86, hi: 0x87}, + {value: 0x2cce, lo: 0x8a, hi: 0x8a}, + {value: 0x2cde, lo: 0x8b, hi: 0x8b}, + {value: 0x2cd6, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + // Block 0x19, offset 0xb1 + {value: 0x1801, lo: 0x04}, + {value: 0xa000, lo: 0x86, hi: 0x86}, + {value: 0x3ef0, lo: 0x88, hi: 0x88}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x8120, lo: 0x95, hi: 0x96}, + // Block 0x1a, offset 0xb6 + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xbc, hi: 0xbc}, + {value: 0xa000, lo: 0xbf, hi: 0xbf}, + // Block 0x1b, offset 0xb9 + {value: 0x0000, lo: 0x09}, + {value: 0x2ce6, lo: 0x80, hi: 0x80}, + {value: 0x9900, lo: 0x82, hi: 0x82}, + {value: 0xa000, lo: 0x86, hi: 0x86}, + {value: 0x2cee, lo: 0x87, hi: 0x87}, + {value: 0x2cf6, lo: 0x88, hi: 0x88}, + {value: 0x2f50, lo: 0x8a, hi: 0x8a}, + {value: 0x2dd8, lo: 0x8b, hi: 0x8b}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x95, hi: 0x96}, + // Block 0x1c, offset 0xc3 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xbb, hi: 0xbc}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x1d, offset 0xc6 + {value: 0x0000, lo: 0x06}, + {value: 0xa000, lo: 0x86, hi: 0x87}, + {value: 0x2cfe, lo: 0x8a, hi: 0x8a}, + {value: 0x2d0e, lo: 0x8b, hi: 0x8b}, + {value: 0x2d06, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + // Block 0x1e, offset 0xcd + {value: 0x6bea, lo: 0x07}, + {value: 0x9904, lo: 0x8a, hi: 0x8a}, + {value: 0x9900, lo: 0x8f, hi: 0x8f}, + {value: 0xa000, lo: 0x99, hi: 0x99}, + {value: 0x3ef8, lo: 0x9a, hi: 0x9a}, + {value: 0x2f58, lo: 0x9c, hi: 0x9c}, + {value: 0x2de3, lo: 0x9d, hi: 0x9d}, + {value: 0x2d16, lo: 0x9e, hi: 0x9f}, + // Block 0x1f, offset 0xd5 + {value: 0x0000, lo: 0x03}, + {value: 0x2621, lo: 0xb3, hi: 0xb3}, + {value: 0x8122, lo: 0xb8, hi: 0xb9}, + {value: 0x8104, lo: 0xba, hi: 0xba}, + // Block 0x20, offset 0xd9 + {value: 0x0000, lo: 0x01}, + {value: 0x8123, lo: 0x88, hi: 0x8b}, + // Block 0x21, offset 0xdb + {value: 0x0000, lo: 0x02}, + {value: 0x2636, lo: 0xb3, hi: 0xb3}, + {value: 0x8124, lo: 0xb8, hi: 0xb9}, + // Block 0x22, offset 0xde + {value: 0x0000, lo: 0x03}, + {value: 0x8125, lo: 0x88, hi: 0x8b}, + {value: 0x2628, lo: 0x9c, hi: 0x9c}, + {value: 0x262f, lo: 0x9d, hi: 0x9d}, + // Block 0x23, offset 0xe2 + {value: 0x0000, lo: 0x05}, + {value: 0x030b, lo: 0x8c, hi: 0x8c}, + {value: 0x812d, lo: 0x98, hi: 0x99}, + {value: 0x812d, lo: 0xb5, hi: 0xb5}, + {value: 0x812d, lo: 0xb7, hi: 0xb7}, + {value: 0x812b, lo: 0xb9, hi: 0xb9}, + // Block 0x24, offset 0xe8 + {value: 0x0000, lo: 0x10}, + {value: 0x2644, lo: 0x83, hi: 0x83}, + {value: 0x264b, lo: 0x8d, hi: 0x8d}, + {value: 0x2652, lo: 0x92, hi: 0x92}, + {value: 0x2659, lo: 0x97, hi: 0x97}, + {value: 0x2660, lo: 0x9c, hi: 0x9c}, + {value: 0x263d, lo: 0xa9, hi: 0xa9}, + {value: 0x8126, lo: 0xb1, hi: 0xb1}, + {value: 0x8127, lo: 0xb2, hi: 0xb2}, + {value: 0x4a84, lo: 0xb3, hi: 0xb3}, + {value: 0x8128, lo: 0xb4, hi: 0xb4}, + {value: 0x4a8d, lo: 0xb5, hi: 0xb5}, + {value: 0x45b4, lo: 0xb6, hi: 0xb6}, + {value: 0x45f4, lo: 0xb7, hi: 0xb7}, + {value: 0x45bc, lo: 0xb8, hi: 0xb8}, + {value: 0x45ff, lo: 0xb9, hi: 0xb9}, + {value: 0x8127, lo: 0xba, hi: 0xbd}, + // Block 0x25, offset 0xf9 + {value: 0x0000, lo: 0x0b}, + {value: 0x8127, lo: 0x80, hi: 0x80}, + {value: 0x4a96, lo: 0x81, hi: 0x81}, + {value: 0x8132, lo: 0x82, hi: 0x83}, + {value: 0x8104, lo: 0x84, hi: 0x84}, + {value: 0x8132, lo: 0x86, hi: 0x87}, + {value: 0x266e, lo: 0x93, hi: 0x93}, + {value: 0x2675, lo: 0x9d, hi: 0x9d}, + {value: 0x267c, lo: 0xa2, hi: 0xa2}, + {value: 0x2683, lo: 0xa7, hi: 0xa7}, + {value: 0x268a, lo: 0xac, hi: 0xac}, + {value: 0x2667, lo: 0xb9, hi: 0xb9}, + // Block 0x26, offset 0x105 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x86, hi: 0x86}, + // Block 0x27, offset 0x107 + {value: 0x0000, lo: 0x05}, + {value: 0xa000, lo: 0xa5, hi: 0xa5}, + {value: 0x2d1e, lo: 0xa6, hi: 0xa6}, + {value: 0x9900, lo: 0xae, hi: 0xae}, + {value: 0x8102, lo: 0xb7, hi: 0xb7}, + {value: 0x8104, lo: 0xb9, hi: 0xba}, + // Block 0x28, offset 0x10d + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x8d, hi: 0x8d}, + // Block 0x29, offset 0x10f + {value: 0x0000, lo: 0x01}, + {value: 0x030f, lo: 0xbc, hi: 0xbc}, + // Block 0x2a, offset 0x111 + {value: 0x0000, lo: 0x01}, + {value: 0xa000, lo: 0x80, hi: 0x92}, + // Block 0x2b, offset 0x113 + {value: 0x0000, lo: 0x01}, + {value: 0xb900, lo: 0xa1, hi: 0xb5}, + // Block 0x2c, offset 0x115 + {value: 0x0000, lo: 0x01}, + {value: 0x9900, lo: 0xa8, hi: 0xbf}, + // Block 0x2d, offset 0x117 + {value: 0x0000, lo: 0x01}, + {value: 0x9900, lo: 0x80, hi: 0x82}, + // Block 0x2e, offset 0x119 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0x9d, hi: 0x9f}, + // Block 0x2f, offset 0x11b + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x94, hi: 0x94}, + {value: 0x8104, lo: 0xb4, hi: 0xb4}, + // Block 0x30, offset 0x11e + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x92, hi: 0x92}, + {value: 0x8132, lo: 0x9d, hi: 0x9d}, + // Block 0x31, offset 0x121 + {value: 0x0000, lo: 0x01}, + {value: 0x8131, lo: 0xa9, hi: 0xa9}, + // Block 0x32, offset 0x123 + {value: 0x0004, lo: 0x02}, + {value: 0x812e, lo: 0xb9, hi: 0xba}, + {value: 0x812d, lo: 0xbb, hi: 0xbb}, + // Block 0x33, offset 0x126 + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0x97, hi: 0x97}, + {value: 0x812d, lo: 0x98, hi: 0x98}, + // Block 0x34, offset 0x129 + {value: 0x0000, lo: 0x03}, + {value: 0x8104, lo: 0xa0, hi: 0xa0}, + {value: 0x8132, lo: 0xb5, hi: 0xbc}, + {value: 0x812d, lo: 0xbf, hi: 0xbf}, + // Block 0x35, offset 0x12d + {value: 0x0000, lo: 0x04}, + {value: 0x8132, lo: 0xb0, hi: 0xb4}, + {value: 0x812d, lo: 0xb5, hi: 0xba}, + {value: 0x8132, lo: 0xbb, hi: 0xbc}, + {value: 0x812d, lo: 0xbd, hi: 0xbd}, + // Block 0x36, offset 0x132 + {value: 0x0000, lo: 0x08}, + {value: 0x2d66, lo: 0x80, hi: 0x80}, + {value: 0x2d6e, lo: 0x81, hi: 0x81}, + {value: 0xa000, lo: 0x82, hi: 0x82}, + {value: 0x2d76, lo: 0x83, hi: 0x83}, + {value: 0x8104, lo: 0x84, hi: 0x84}, + {value: 0x8132, lo: 0xab, hi: 0xab}, + {value: 0x812d, lo: 0xac, hi: 0xac}, + {value: 0x8132, lo: 0xad, hi: 0xb3}, + // Block 0x37, offset 0x13b + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xaa, hi: 0xab}, + // Block 0x38, offset 0x13d + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xa6, hi: 0xa6}, + {value: 0x8104, lo: 0xb2, hi: 0xb3}, + // Block 0x39, offset 0x140 + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0xb7, hi: 0xb7}, + // Block 0x3a, offset 0x142 + {value: 0x0000, lo: 0x0a}, + {value: 0x8132, lo: 0x90, hi: 0x92}, + {value: 0x8101, lo: 0x94, hi: 0x94}, + {value: 0x812d, lo: 0x95, hi: 0x99}, + {value: 0x8132, lo: 0x9a, hi: 0x9b}, + {value: 0x812d, lo: 0x9c, hi: 0x9f}, + {value: 0x8132, lo: 0xa0, hi: 0xa0}, + {value: 0x8101, lo: 0xa2, hi: 0xa8}, + {value: 0x812d, lo: 0xad, hi: 0xad}, + {value: 0x8132, lo: 0xb4, hi: 0xb4}, + {value: 0x8132, lo: 0xb8, hi: 0xb9}, + // Block 0x3b, offset 0x14d + {value: 0x0002, lo: 0x0a}, + {value: 0x0043, lo: 0xac, hi: 0xac}, + {value: 0x00d1, lo: 0xad, hi: 0xad}, + {value: 0x0045, lo: 0xae, hi: 0xae}, + {value: 0x0049, lo: 0xb0, hi: 0xb1}, + {value: 0x00e6, lo: 0xb2, hi: 0xb2}, + {value: 0x004f, lo: 0xb3, hi: 0xba}, + {value: 0x005f, lo: 0xbc, hi: 0xbc}, + {value: 0x00ef, lo: 0xbd, hi: 0xbd}, + {value: 0x0061, lo: 0xbe, hi: 0xbe}, + {value: 0x0065, lo: 0xbf, hi: 0xbf}, + // Block 0x3c, offset 0x158 + {value: 0x0000, lo: 0x0d}, + {value: 0x0001, lo: 0x80, hi: 0x8a}, + {value: 0x043b, lo: 0x91, hi: 0x91}, + {value: 0x429b, lo: 0x97, hi: 0x97}, + {value: 0x001d, lo: 0xa4, hi: 0xa4}, + {value: 0x1873, lo: 0xa5, hi: 0xa5}, + {value: 0x1b5c, lo: 0xa6, hi: 0xa6}, + {value: 0x0001, lo: 0xaf, hi: 0xaf}, + {value: 0x2691, lo: 0xb3, hi: 0xb3}, + {value: 0x27fe, lo: 0xb4, hi: 0xb4}, + {value: 0x2698, lo: 0xb6, hi: 0xb6}, + {value: 0x2808, lo: 0xb7, hi: 0xb7}, + {value: 0x186d, lo: 0xbc, hi: 0xbc}, + {value: 0x4269, lo: 0xbe, hi: 0xbe}, + // Block 0x3d, offset 0x166 + {value: 0x0002, lo: 0x0d}, + {value: 0x1933, lo: 0x87, hi: 0x87}, + {value: 0x1930, lo: 0x88, hi: 0x88}, + {value: 0x1870, lo: 0x89, hi: 0x89}, + {value: 0x298e, lo: 0x97, hi: 0x97}, + {value: 0x0001, lo: 0x9f, hi: 0x9f}, + {value: 0x0021, lo: 0xb0, hi: 0xb0}, + {value: 0x0093, lo: 0xb1, hi: 0xb1}, + {value: 0x0029, lo: 0xb4, hi: 0xb9}, + {value: 0x0017, lo: 0xba, hi: 0xba}, + {value: 0x0467, lo: 0xbb, hi: 0xbb}, + {value: 0x003b, lo: 0xbc, hi: 0xbc}, + {value: 0x0011, lo: 0xbd, hi: 0xbe}, + {value: 0x009d, lo: 0xbf, hi: 0xbf}, + // Block 0x3e, offset 0x174 + {value: 0x0002, lo: 0x0f}, + {value: 0x0021, lo: 0x80, hi: 0x89}, + {value: 0x0017, lo: 0x8a, hi: 0x8a}, + {value: 0x0467, lo: 0x8b, hi: 0x8b}, + {value: 0x003b, lo: 0x8c, hi: 0x8c}, + {value: 0x0011, lo: 0x8d, hi: 0x8e}, + {value: 0x0083, lo: 0x90, hi: 0x90}, + {value: 0x008b, lo: 0x91, hi: 0x91}, + {value: 0x009f, lo: 0x92, hi: 0x92}, + {value: 0x00b1, lo: 0x93, hi: 0x93}, + {value: 0x0104, lo: 0x94, hi: 0x94}, + {value: 0x0091, lo: 0x95, hi: 0x95}, + {value: 0x0097, lo: 0x96, hi: 0x99}, + {value: 0x00a1, lo: 0x9a, hi: 0x9a}, + {value: 0x00a7, lo: 0x9b, hi: 0x9c}, + {value: 0x1999, lo: 0xa8, hi: 0xa8}, + // Block 0x3f, offset 0x184 + {value: 0x0000, lo: 0x0d}, + {value: 0x8132, lo: 0x90, hi: 0x91}, + {value: 0x8101, lo: 0x92, hi: 0x93}, + {value: 0x8132, lo: 0x94, hi: 0x97}, + {value: 0x8101, lo: 0x98, hi: 0x9a}, + {value: 0x8132, lo: 0x9b, hi: 0x9c}, + {value: 0x8132, lo: 0xa1, hi: 0xa1}, + {value: 0x8101, lo: 0xa5, hi: 0xa6}, + {value: 0x8132, lo: 0xa7, hi: 0xa7}, + {value: 0x812d, lo: 0xa8, hi: 0xa8}, + {value: 0x8132, lo: 0xa9, hi: 0xa9}, + {value: 0x8101, lo: 0xaa, hi: 0xab}, + {value: 0x812d, lo: 0xac, hi: 0xaf}, + {value: 0x8132, lo: 0xb0, hi: 0xb0}, + // Block 0x40, offset 0x192 + {value: 0x0007, lo: 0x06}, + {value: 0x2180, lo: 0x89, hi: 0x89}, + {value: 0xa000, lo: 0x90, hi: 0x90}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0xa000, lo: 0x94, hi: 0x94}, + {value: 0x3bb9, lo: 0x9a, hi: 0x9b}, + {value: 0x3bc7, lo: 0xae, hi: 0xae}, + // Block 0x41, offset 0x199 + {value: 0x000e, lo: 0x05}, + {value: 0x3bce, lo: 0x8d, hi: 0x8e}, + {value: 0x3bd5, lo: 0x8f, hi: 0x8f}, + {value: 0xa000, lo: 0x90, hi: 0x90}, + {value: 0xa000, lo: 0x92, hi: 0x92}, + {value: 0xa000, lo: 0x94, hi: 0x94}, + // Block 0x42, offset 0x19f + {value: 0x0173, lo: 0x0e}, + {value: 0xa000, lo: 0x83, hi: 0x83}, + {value: 0x3be3, lo: 0x84, hi: 0x84}, + {value: 0xa000, lo: 0x88, hi: 0x88}, + {value: 0x3bea, lo: 0x89, hi: 0x89}, + {value: 0xa000, lo: 0x8b, hi: 0x8b}, + {value: 0x3bf1, lo: 0x8c, hi: 0x8c}, + {value: 0xa000, lo: 0xa3, hi: 0xa3}, + {value: 0x3bf8, lo: 0xa4, hi: 0xa4}, + {value: 0xa000, lo: 0xa5, hi: 0xa5}, + {value: 0x3bff, lo: 0xa6, hi: 0xa6}, + {value: 0x269f, lo: 0xac, hi: 0xad}, + {value: 0x26a6, lo: 0xaf, hi: 0xaf}, + {value: 0x281c, lo: 0xb0, hi: 0xb0}, + {value: 0xa000, lo: 0xbc, hi: 0xbc}, + // Block 0x43, offset 0x1ae + {value: 0x0007, lo: 0x03}, + {value: 0x3c68, lo: 0xa0, hi: 0xa1}, + {value: 0x3c92, lo: 0xa2, hi: 0xa3}, + {value: 0x3cbc, lo: 0xaa, hi: 0xad}, + // Block 0x44, offset 0x1b2 + {value: 0x0004, lo: 0x01}, + {value: 0x048b, lo: 0xa9, hi: 0xaa}, + // Block 0x45, offset 0x1b4 + {value: 0x0002, lo: 0x03}, + {value: 0x0057, lo: 0x80, hi: 0x8f}, + {value: 0x0083, lo: 0x90, hi: 0xa9}, + {value: 0x0021, lo: 0xaa, hi: 0xaa}, + // Block 0x46, offset 0x1b8 + {value: 0x0000, lo: 0x01}, + {value: 0x299b, lo: 0x8c, hi: 0x8c}, + // Block 0x47, offset 0x1ba + {value: 0x0263, lo: 0x02}, + {value: 0x1b8c, lo: 0xb4, hi: 0xb4}, + {value: 0x192d, lo: 0xb5, hi: 0xb6}, + // Block 0x48, offset 0x1bd + {value: 0x0000, lo: 0x01}, + {value: 0x44dd, lo: 0x9c, hi: 0x9c}, + // Block 0x49, offset 0x1bf + {value: 0x0000, lo: 0x02}, + {value: 0x0095, lo: 0xbc, hi: 0xbc}, + {value: 0x006d, lo: 0xbd, hi: 0xbd}, + // Block 0x4a, offset 0x1c2 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xaf, hi: 0xb1}, + // Block 0x4b, offset 0x1c4 + {value: 0x0000, lo: 0x02}, + {value: 0x047f, lo: 0xaf, hi: 0xaf}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x4c, offset 0x1c7 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xa0, hi: 0xbf}, + // Block 0x4d, offset 0x1c9 + {value: 0x0000, lo: 0x01}, + {value: 0x0dc3, lo: 0x9f, hi: 0x9f}, + // Block 0x4e, offset 0x1cb + {value: 0x0000, lo: 0x01}, + {value: 0x162f, lo: 0xb3, hi: 0xb3}, + // Block 0x4f, offset 0x1cd + {value: 0x0004, lo: 0x0b}, + {value: 0x1597, lo: 0x80, hi: 0x82}, + {value: 0x15af, lo: 0x83, hi: 0x83}, + {value: 0x15c7, lo: 0x84, hi: 0x85}, + {value: 0x15d7, lo: 0x86, hi: 0x89}, + {value: 0x15eb, lo: 0x8a, hi: 0x8c}, + {value: 0x15ff, lo: 0x8d, hi: 0x8d}, + {value: 0x1607, lo: 0x8e, hi: 0x8e}, + {value: 0x160f, lo: 0x8f, hi: 0x90}, + {value: 0x161b, lo: 0x91, hi: 0x93}, + {value: 0x162b, lo: 0x94, hi: 0x94}, + {value: 0x1633, lo: 0x95, hi: 0x95}, + // Block 0x50, offset 0x1d9 + {value: 0x0004, lo: 0x09}, + {value: 0x0001, lo: 0x80, hi: 0x80}, + {value: 0x812c, lo: 0xaa, hi: 0xaa}, + {value: 0x8131, lo: 0xab, hi: 0xab}, + {value: 0x8133, lo: 0xac, hi: 0xac}, + {value: 0x812e, lo: 0xad, hi: 0xad}, + {value: 0x812f, lo: 0xae, hi: 0xae}, + {value: 0x812f, lo: 0xaf, hi: 0xaf}, + {value: 0x04b3, lo: 0xb6, hi: 0xb6}, + {value: 0x0887, lo: 0xb8, hi: 0xba}, + // Block 0x51, offset 0x1e3 + {value: 0x0006, lo: 0x09}, + {value: 0x0313, lo: 0xb1, hi: 0xb1}, + {value: 0x0317, lo: 0xb2, hi: 0xb2}, + {value: 0x4a3b, lo: 0xb3, hi: 0xb3}, + {value: 0x031b, lo: 0xb4, hi: 0xb4}, + {value: 0x4a41, lo: 0xb5, hi: 0xb6}, + {value: 0x031f, lo: 0xb7, hi: 0xb7}, + {value: 0x0323, lo: 0xb8, hi: 0xb8}, + {value: 0x0327, lo: 0xb9, hi: 0xb9}, + {value: 0x4a4d, lo: 0xba, hi: 0xbf}, + // Block 0x52, offset 0x1ed + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0xaf, hi: 0xaf}, + {value: 0x8132, lo: 0xb4, hi: 0xbd}, + // Block 0x53, offset 0x1f0 + {value: 0x0000, lo: 0x03}, + {value: 0x020f, lo: 0x9c, hi: 0x9c}, + {value: 0x0212, lo: 0x9d, hi: 0x9d}, + {value: 0x8132, lo: 0x9e, hi: 0x9f}, + // Block 0x54, offset 0x1f4 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xb0, hi: 0xb1}, + // Block 0x55, offset 0x1f6 + {value: 0x0000, lo: 0x01}, + {value: 0x163b, lo: 0xb0, hi: 0xb0}, + // Block 0x56, offset 0x1f8 + {value: 0x000c, lo: 0x01}, + {value: 0x00d7, lo: 0xb8, hi: 0xb9}, + // Block 0x57, offset 0x1fa + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x86, hi: 0x86}, + // Block 0x58, offset 0x1fc + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x84, hi: 0x84}, + {value: 0x8132, lo: 0xa0, hi: 0xb1}, + // Block 0x59, offset 0x1ff + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0xab, hi: 0xad}, + // Block 0x5a, offset 0x201 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x93, hi: 0x93}, + // Block 0x5b, offset 0x203 + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0xb3, hi: 0xb3}, + // Block 0x5c, offset 0x205 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x80, hi: 0x80}, + // Block 0x5d, offset 0x207 + {value: 0x0000, lo: 0x05}, + {value: 0x8132, lo: 0xb0, hi: 0xb0}, + {value: 0x8132, lo: 0xb2, hi: 0xb3}, + {value: 0x812d, lo: 0xb4, hi: 0xb4}, + {value: 0x8132, lo: 0xb7, hi: 0xb8}, + {value: 0x8132, lo: 0xbe, hi: 0xbf}, + // Block 0x5e, offset 0x20d + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0x81, hi: 0x81}, + {value: 0x8104, lo: 0xb6, hi: 0xb6}, + // Block 0x5f, offset 0x210 + {value: 0x0008, lo: 0x03}, + {value: 0x1637, lo: 0x9c, hi: 0x9d}, + {value: 0x0125, lo: 0x9e, hi: 0x9e}, + {value: 0x1643, lo: 0x9f, hi: 0x9f}, + // Block 0x60, offset 0x214 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xad, hi: 0xad}, + // Block 0x61, offset 0x216 + {value: 0x0000, lo: 0x06}, + {value: 0xe500, lo: 0x80, hi: 0x80}, + {value: 0xc600, lo: 0x81, hi: 0x9b}, + {value: 0xe500, lo: 0x9c, hi: 0x9c}, + {value: 0xc600, lo: 0x9d, hi: 0xb7}, + {value: 0xe500, lo: 0xb8, hi: 0xb8}, + {value: 0xc600, lo: 0xb9, hi: 0xbf}, + // Block 0x62, offset 0x21d + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x93}, + {value: 0xe500, lo: 0x94, hi: 0x94}, + {value: 0xc600, lo: 0x95, hi: 0xaf}, + {value: 0xe500, lo: 0xb0, hi: 0xb0}, + {value: 0xc600, lo: 0xb1, hi: 0xbf}, + // Block 0x63, offset 0x223 + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x8b}, + {value: 0xe500, lo: 0x8c, hi: 0x8c}, + {value: 0xc600, lo: 0x8d, hi: 0xa7}, + {value: 0xe500, lo: 0xa8, hi: 0xa8}, + {value: 0xc600, lo: 0xa9, hi: 0xbf}, + // Block 0x64, offset 0x229 + {value: 0x0000, lo: 0x07}, + {value: 0xc600, lo: 0x80, hi: 0x83}, + {value: 0xe500, lo: 0x84, hi: 0x84}, + {value: 0xc600, lo: 0x85, hi: 0x9f}, + {value: 0xe500, lo: 0xa0, hi: 0xa0}, + {value: 0xc600, lo: 0xa1, hi: 0xbb}, + {value: 0xe500, lo: 0xbc, hi: 0xbc}, + {value: 0xc600, lo: 0xbd, hi: 0xbf}, + // Block 0x65, offset 0x231 + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x97}, + {value: 0xe500, lo: 0x98, hi: 0x98}, + {value: 0xc600, lo: 0x99, hi: 0xb3}, + {value: 0xe500, lo: 0xb4, hi: 0xb4}, + {value: 0xc600, lo: 0xb5, hi: 0xbf}, + // Block 0x66, offset 0x237 + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x8f}, + {value: 0xe500, lo: 0x90, hi: 0x90}, + {value: 0xc600, lo: 0x91, hi: 0xab}, + {value: 0xe500, lo: 0xac, hi: 0xac}, + {value: 0xc600, lo: 0xad, hi: 0xbf}, + // Block 0x67, offset 0x23d + {value: 0x0000, lo: 0x05}, + {value: 0xc600, lo: 0x80, hi: 0x87}, + {value: 0xe500, lo: 0x88, hi: 0x88}, + {value: 0xc600, lo: 0x89, hi: 0xa3}, + {value: 0xe500, lo: 0xa4, hi: 0xa4}, + {value: 0xc600, lo: 0xa5, hi: 0xbf}, + // Block 0x68, offset 0x243 + {value: 0x0000, lo: 0x03}, + {value: 0xc600, lo: 0x80, hi: 0x87}, + {value: 0xe500, lo: 0x88, hi: 0x88}, + {value: 0xc600, lo: 0x89, hi: 0xa3}, + // Block 0x69, offset 0x247 + {value: 0x0002, lo: 0x01}, + {value: 0x0003, lo: 0x81, hi: 0xbf}, + // Block 0x6a, offset 0x249 + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0xbd, hi: 0xbd}, + // Block 0x6b, offset 0x24b + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0xa0, hi: 0xa0}, + // Block 0x6c, offset 0x24d + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xb6, hi: 0xba}, + // Block 0x6d, offset 0x24f + {value: 0x002c, lo: 0x05}, + {value: 0x812d, lo: 0x8d, hi: 0x8d}, + {value: 0x8132, lo: 0x8f, hi: 0x8f}, + {value: 0x8132, lo: 0xb8, hi: 0xb8}, + {value: 0x8101, lo: 0xb9, hi: 0xba}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x6e, offset 0x255 + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0xa5, hi: 0xa5}, + {value: 0x812d, lo: 0xa6, hi: 0xa6}, + // Block 0x6f, offset 0x258 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xa4, hi: 0xa7}, + // Block 0x70, offset 0x25a + {value: 0x0000, lo: 0x05}, + {value: 0x812d, lo: 0x86, hi: 0x87}, + {value: 0x8132, lo: 0x88, hi: 0x8a}, + {value: 0x812d, lo: 0x8b, hi: 0x8b}, + {value: 0x8132, lo: 0x8c, hi: 0x8c}, + {value: 0x812d, lo: 0x8d, hi: 0x90}, + // Block 0x71, offset 0x260 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x86, hi: 0x86}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x72, offset 0x263 + {value: 0x17fe, lo: 0x07}, + {value: 0xa000, lo: 0x99, hi: 0x99}, + {value: 0x4238, lo: 0x9a, hi: 0x9a}, + {value: 0xa000, lo: 0x9b, hi: 0x9b}, + {value: 0x4242, lo: 0x9c, hi: 0x9c}, + {value: 0xa000, lo: 0xa5, hi: 0xa5}, + {value: 0x424c, lo: 0xab, hi: 0xab}, + {value: 0x8104, lo: 0xb9, hi: 0xba}, + // Block 0x73, offset 0x26b + {value: 0x0000, lo: 0x06}, + {value: 0x8132, lo: 0x80, hi: 0x82}, + {value: 0x9900, lo: 0xa7, hi: 0xa7}, + {value: 0x2d7e, lo: 0xae, hi: 0xae}, + {value: 0x2d88, lo: 0xaf, hi: 0xaf}, + {value: 0xa000, lo: 0xb1, hi: 0xb2}, + {value: 0x8104, lo: 0xb3, hi: 0xb4}, + // Block 0x74, offset 0x272 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x80, hi: 0x80}, + {value: 0x8102, lo: 0x8a, hi: 0x8a}, + // Block 0x75, offset 0x275 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xb5, hi: 0xb5}, + {value: 0x8102, lo: 0xb6, hi: 0xb6}, + // Block 0x76, offset 0x278 + {value: 0x0002, lo: 0x01}, + {value: 0x8102, lo: 0xa9, hi: 0xaa}, + // Block 0x77, offset 0x27a + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0xbb, hi: 0xbc}, + {value: 0x9900, lo: 0xbe, hi: 0xbe}, + // Block 0x78, offset 0x27d + {value: 0x0000, lo: 0x07}, + {value: 0xa000, lo: 0x87, hi: 0x87}, + {value: 0x2d92, lo: 0x8b, hi: 0x8b}, + {value: 0x2d9c, lo: 0x8c, hi: 0x8c}, + {value: 0x8104, lo: 0x8d, hi: 0x8d}, + {value: 0x9900, lo: 0x97, hi: 0x97}, + {value: 0x8132, lo: 0xa6, hi: 0xac}, + {value: 0x8132, lo: 0xb0, hi: 0xb4}, + // Block 0x79, offset 0x285 + {value: 0x0000, lo: 0x03}, + {value: 0x8104, lo: 0x82, hi: 0x82}, + {value: 0x8102, lo: 0x86, hi: 0x86}, + {value: 0x8132, lo: 0x9e, hi: 0x9e}, + // Block 0x7a, offset 0x289 + {value: 0x6b5a, lo: 0x06}, + {value: 0x9900, lo: 0xb0, hi: 0xb0}, + {value: 0xa000, lo: 0xb9, hi: 0xb9}, + {value: 0x9900, lo: 0xba, hi: 0xba}, + {value: 0x2db0, lo: 0xbb, hi: 0xbb}, + {value: 0x2da6, lo: 0xbc, hi: 0xbd}, + {value: 0x2dba, lo: 0xbe, hi: 0xbe}, + // Block 0x7b, offset 0x290 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0x82, hi: 0x82}, + {value: 0x8102, lo: 0x83, hi: 0x83}, + // Block 0x7c, offset 0x293 + {value: 0x0000, lo: 0x05}, + {value: 0x9900, lo: 0xaf, hi: 0xaf}, + {value: 0xa000, lo: 0xb8, hi: 0xb9}, + {value: 0x2dc4, lo: 0xba, hi: 0xba}, + {value: 0x2dce, lo: 0xbb, hi: 0xbb}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x7d, offset 0x299 + {value: 0x0000, lo: 0x01}, + {value: 0x8102, lo: 0x80, hi: 0x80}, + // Block 0x7e, offset 0x29b + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xbf, hi: 0xbf}, + // Block 0x7f, offset 0x29d + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xb6, hi: 0xb6}, + {value: 0x8102, lo: 0xb7, hi: 0xb7}, + // Block 0x80, offset 0x2a0 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xab, hi: 0xab}, + // Block 0x81, offset 0x2a2 + {value: 0x0000, lo: 0x02}, + {value: 0x8104, lo: 0xb9, hi: 0xb9}, + {value: 0x8102, lo: 0xba, hi: 0xba}, + // Block 0x82, offset 0x2a5 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0xb4, hi: 0xb4}, + // Block 0x83, offset 0x2a7 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x87, hi: 0x87}, + // Block 0x84, offset 0x2a9 + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x99, hi: 0x99}, + // Block 0x85, offset 0x2ab + {value: 0x0000, lo: 0x02}, + {value: 0x8102, lo: 0x82, hi: 0x82}, + {value: 0x8104, lo: 0x84, hi: 0x85}, + // Block 0x86, offset 0x2ae + {value: 0x0000, lo: 0x01}, + {value: 0x8104, lo: 0x97, hi: 0x97}, + // Block 0x87, offset 0x2b0 + {value: 0x0000, lo: 0x01}, + {value: 0x8101, lo: 0xb0, hi: 0xb4}, + // Block 0x88, offset 0x2b2 + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0xb0, hi: 0xb6}, + // Block 0x89, offset 0x2b4 + {value: 0x0000, lo: 0x01}, + {value: 0x8101, lo: 0x9e, hi: 0x9e}, + // Block 0x8a, offset 0x2b6 + {value: 0x0000, lo: 0x0c}, + {value: 0x45cc, lo: 0x9e, hi: 0x9e}, + {value: 0x45d6, lo: 0x9f, hi: 0x9f}, + {value: 0x460a, lo: 0xa0, hi: 0xa0}, + {value: 0x4618, lo: 0xa1, hi: 0xa1}, + {value: 0x4626, lo: 0xa2, hi: 0xa2}, + {value: 0x4634, lo: 0xa3, hi: 0xa3}, + {value: 0x4642, lo: 0xa4, hi: 0xa4}, + {value: 0x812b, lo: 0xa5, hi: 0xa6}, + {value: 0x8101, lo: 0xa7, hi: 0xa9}, + {value: 0x8130, lo: 0xad, hi: 0xad}, + {value: 0x812b, lo: 0xae, hi: 0xb2}, + {value: 0x812d, lo: 0xbb, hi: 0xbf}, + // Block 0x8b, offset 0x2c3 + {value: 0x0000, lo: 0x09}, + {value: 0x812d, lo: 0x80, hi: 0x82}, + {value: 0x8132, lo: 0x85, hi: 0x89}, + {value: 0x812d, lo: 0x8a, hi: 0x8b}, + {value: 0x8132, lo: 0xaa, hi: 0xad}, + {value: 0x45e0, lo: 0xbb, hi: 0xbb}, + {value: 0x45ea, lo: 0xbc, hi: 0xbc}, + {value: 0x4650, lo: 0xbd, hi: 0xbd}, + {value: 0x466c, lo: 0xbe, hi: 0xbe}, + {value: 0x465e, lo: 0xbf, hi: 0xbf}, + // Block 0x8c, offset 0x2cd + {value: 0x0000, lo: 0x01}, + {value: 0x467a, lo: 0x80, hi: 0x80}, + // Block 0x8d, offset 0x2cf + {value: 0x0000, lo: 0x01}, + {value: 0x8132, lo: 0x82, hi: 0x84}, + // Block 0x8e, offset 0x2d1 + {value: 0x0002, lo: 0x03}, + {value: 0x0043, lo: 0x80, hi: 0x99}, + {value: 0x0083, lo: 0x9a, hi: 0xb3}, + {value: 0x0043, lo: 0xb4, hi: 0xbf}, + // Block 0x8f, offset 0x2d5 + {value: 0x0002, lo: 0x04}, + {value: 0x005b, lo: 0x80, hi: 0x8d}, + {value: 0x0083, lo: 0x8e, hi: 0x94}, + {value: 0x0093, lo: 0x96, hi: 0xa7}, + {value: 0x0043, lo: 0xa8, hi: 0xbf}, + // Block 0x90, offset 0x2da + {value: 0x0002, lo: 0x0b}, + {value: 0x0073, lo: 0x80, hi: 0x81}, + {value: 0x0083, lo: 0x82, hi: 0x9b}, + {value: 0x0043, lo: 0x9c, hi: 0x9c}, + {value: 0x0047, lo: 0x9e, hi: 0x9f}, + {value: 0x004f, lo: 0xa2, hi: 0xa2}, + {value: 0x0055, lo: 0xa5, hi: 0xa6}, + {value: 0x005d, lo: 0xa9, hi: 0xac}, + {value: 0x0067, lo: 0xae, hi: 0xb5}, + {value: 0x0083, lo: 0xb6, hi: 0xb9}, + {value: 0x008d, lo: 0xbb, hi: 0xbb}, + {value: 0x0091, lo: 0xbd, hi: 0xbf}, + // Block 0x91, offset 0x2e6 + {value: 0x0002, lo: 0x04}, + {value: 0x0097, lo: 0x80, hi: 0x83}, + {value: 0x00a1, lo: 0x85, hi: 0x8f}, + {value: 0x0043, lo: 0x90, hi: 0xa9}, + {value: 0x0083, lo: 0xaa, hi: 0xbf}, + // Block 0x92, offset 0x2eb + {value: 0x0002, lo: 0x08}, + {value: 0x00af, lo: 0x80, hi: 0x83}, + {value: 0x0043, lo: 0x84, hi: 0x85}, + {value: 0x0049, lo: 0x87, hi: 0x8a}, + {value: 0x0055, lo: 0x8d, hi: 0x94}, + {value: 0x0067, lo: 0x96, hi: 0x9c}, + {value: 0x0083, lo: 0x9e, hi: 0xb7}, + {value: 0x0043, lo: 0xb8, hi: 0xb9}, + {value: 0x0049, lo: 0xbb, hi: 0xbe}, + // Block 0x93, offset 0x2f4 + {value: 0x0002, lo: 0x05}, + {value: 0x0053, lo: 0x80, hi: 0x84}, + {value: 0x005f, lo: 0x86, hi: 0x86}, + {value: 0x0067, lo: 0x8a, hi: 0x90}, + {value: 0x0083, lo: 0x92, hi: 0xab}, + {value: 0x0043, lo: 0xac, hi: 0xbf}, + // Block 0x94, offset 0x2fa + {value: 0x0002, lo: 0x04}, + {value: 0x006b, lo: 0x80, hi: 0x85}, + {value: 0x0083, lo: 0x86, hi: 0x9f}, + {value: 0x0043, lo: 0xa0, hi: 0xb9}, + {value: 0x0083, lo: 0xba, hi: 0xbf}, + // Block 0x95, offset 0x2ff + {value: 0x0002, lo: 0x03}, + {value: 0x008f, lo: 0x80, hi: 0x93}, + {value: 0x0043, lo: 0x94, hi: 0xad}, + {value: 0x0083, lo: 0xae, hi: 0xbf}, + // Block 0x96, offset 0x303 + {value: 0x0002, lo: 0x04}, + {value: 0x00a7, lo: 0x80, hi: 0x87}, + {value: 0x0043, lo: 0x88, hi: 0xa1}, + {value: 0x0083, lo: 0xa2, hi: 0xbb}, + {value: 0x0043, lo: 0xbc, hi: 0xbf}, + // Block 0x97, offset 0x308 + {value: 0x0002, lo: 0x03}, + {value: 0x004b, lo: 0x80, hi: 0x95}, + {value: 0x0083, lo: 0x96, hi: 0xaf}, + {value: 0x0043, lo: 0xb0, hi: 0xbf}, + // Block 0x98, offset 0x30c + {value: 0x0003, lo: 0x0f}, + {value: 0x01b8, lo: 0x80, hi: 0x80}, + {value: 0x045f, lo: 0x81, hi: 0x81}, + {value: 0x01bb, lo: 0x82, hi: 0x9a}, + {value: 0x045b, lo: 0x9b, hi: 0x9b}, + {value: 0x01c7, lo: 0x9c, hi: 0x9c}, + {value: 0x01d0, lo: 0x9d, hi: 0x9d}, + {value: 0x01d6, lo: 0x9e, hi: 0x9e}, + {value: 0x01fa, lo: 0x9f, hi: 0x9f}, + {value: 0x01eb, lo: 0xa0, hi: 0xa0}, + {value: 0x01e8, lo: 0xa1, hi: 0xa1}, + {value: 0x0173, lo: 0xa2, hi: 0xb2}, + {value: 0x0188, lo: 0xb3, hi: 0xb3}, + {value: 0x01a6, lo: 0xb4, hi: 0xba}, + {value: 0x045f, lo: 0xbb, hi: 0xbb}, + {value: 0x01bb, lo: 0xbc, hi: 0xbf}, + // Block 0x99, offset 0x31c + {value: 0x0003, lo: 0x0d}, + {value: 0x01c7, lo: 0x80, hi: 0x94}, + {value: 0x045b, lo: 0x95, hi: 0x95}, + {value: 0x01c7, lo: 0x96, hi: 0x96}, + {value: 0x01d0, lo: 0x97, hi: 0x97}, + {value: 0x01d6, lo: 0x98, hi: 0x98}, + {value: 0x01fa, lo: 0x99, hi: 0x99}, + {value: 0x01eb, lo: 0x9a, hi: 0x9a}, + {value: 0x01e8, lo: 0x9b, hi: 0x9b}, + {value: 0x0173, lo: 0x9c, hi: 0xac}, + {value: 0x0188, lo: 0xad, hi: 0xad}, + {value: 0x01a6, lo: 0xae, hi: 0xb4}, + {value: 0x045f, lo: 0xb5, hi: 0xb5}, + {value: 0x01bb, lo: 0xb6, hi: 0xbf}, + // Block 0x9a, offset 0x32a + {value: 0x0003, lo: 0x0d}, + {value: 0x01d9, lo: 0x80, hi: 0x8e}, + {value: 0x045b, lo: 0x8f, hi: 0x8f}, + {value: 0x01c7, lo: 0x90, hi: 0x90}, + {value: 0x01d0, lo: 0x91, hi: 0x91}, + {value: 0x01d6, lo: 0x92, hi: 0x92}, + {value: 0x01fa, lo: 0x93, hi: 0x93}, + {value: 0x01eb, lo: 0x94, hi: 0x94}, + {value: 0x01e8, lo: 0x95, hi: 0x95}, + {value: 0x0173, lo: 0x96, hi: 0xa6}, + {value: 0x0188, lo: 0xa7, hi: 0xa7}, + {value: 0x01a6, lo: 0xa8, hi: 0xae}, + {value: 0x045f, lo: 0xaf, hi: 0xaf}, + {value: 0x01bb, lo: 0xb0, hi: 0xbf}, + // Block 0x9b, offset 0x338 + {value: 0x0003, lo: 0x0d}, + {value: 0x01eb, lo: 0x80, hi: 0x88}, + {value: 0x045b, lo: 0x89, hi: 0x89}, + {value: 0x01c7, lo: 0x8a, hi: 0x8a}, + {value: 0x01d0, lo: 0x8b, hi: 0x8b}, + {value: 0x01d6, lo: 0x8c, hi: 0x8c}, + {value: 0x01fa, lo: 0x8d, hi: 0x8d}, + {value: 0x01eb, lo: 0x8e, hi: 0x8e}, + {value: 0x01e8, lo: 0x8f, hi: 0x8f}, + {value: 0x0173, lo: 0x90, hi: 0xa0}, + {value: 0x0188, lo: 0xa1, hi: 0xa1}, + {value: 0x01a6, lo: 0xa2, hi: 0xa8}, + {value: 0x045f, lo: 0xa9, hi: 0xa9}, + {value: 0x01bb, lo: 0xaa, hi: 0xbf}, + // Block 0x9c, offset 0x346 + {value: 0x0000, lo: 0x05}, + {value: 0x8132, lo: 0x80, hi: 0x86}, + {value: 0x8132, lo: 0x88, hi: 0x98}, + {value: 0x8132, lo: 0x9b, hi: 0xa1}, + {value: 0x8132, lo: 0xa3, hi: 0xa4}, + {value: 0x8132, lo: 0xa6, hi: 0xaa}, + // Block 0x9d, offset 0x34c + {value: 0x0000, lo: 0x01}, + {value: 0x812d, lo: 0x90, hi: 0x96}, + // Block 0x9e, offset 0x34e + {value: 0x0000, lo: 0x02}, + {value: 0x8132, lo: 0x84, hi: 0x89}, + {value: 0x8102, lo: 0x8a, hi: 0x8a}, + // Block 0x9f, offset 0x351 + {value: 0x0002, lo: 0x09}, + {value: 0x0063, lo: 0x80, hi: 0x89}, + {value: 0x1951, lo: 0x8a, hi: 0x8a}, + {value: 0x1981, lo: 0x8b, hi: 0x8b}, + {value: 0x199c, lo: 0x8c, hi: 0x8c}, + {value: 0x19a2, lo: 0x8d, hi: 0x8d}, + {value: 0x1bc0, lo: 0x8e, hi: 0x8e}, + {value: 0x19ae, lo: 0x8f, hi: 0x8f}, + {value: 0x197b, lo: 0xaa, hi: 0xaa}, + {value: 0x197e, lo: 0xab, hi: 0xab}, + // Block 0xa0, offset 0x35b + {value: 0x0000, lo: 0x01}, + {value: 0x193f, lo: 0x90, hi: 0x90}, + // Block 0xa1, offset 0x35d + {value: 0x0028, lo: 0x09}, + {value: 0x2862, lo: 0x80, hi: 0x80}, + {value: 0x2826, lo: 0x81, hi: 0x81}, + {value: 0x2830, lo: 0x82, hi: 0x82}, + {value: 0x2844, lo: 0x83, hi: 0x84}, + {value: 0x284e, lo: 0x85, hi: 0x86}, + {value: 0x283a, lo: 0x87, hi: 0x87}, + {value: 0x2858, lo: 0x88, hi: 0x88}, + {value: 0x0b6f, lo: 0x90, hi: 0x90}, + {value: 0x08e7, lo: 0x91, hi: 0x91}, +} + +// recompMap: 7520 bytes (entries only) +var recompMap map[uint32]rune +var recompMapOnce sync.Once + +const recompMapPacked = "" + + "\x00A\x03\x00\x00\x00\x00\xc0" + // 0x00410300: 0x000000C0 + "\x00A\x03\x01\x00\x00\x00\xc1" + // 0x00410301: 0x000000C1 + "\x00A\x03\x02\x00\x00\x00\xc2" + // 0x00410302: 0x000000C2 + "\x00A\x03\x03\x00\x00\x00\xc3" + // 0x00410303: 0x000000C3 + "\x00A\x03\b\x00\x00\x00\xc4" + // 0x00410308: 0x000000C4 + "\x00A\x03\n\x00\x00\x00\xc5" + // 0x0041030A: 0x000000C5 + "\x00C\x03'\x00\x00\x00\xc7" + // 0x00430327: 0x000000C7 + "\x00E\x03\x00\x00\x00\x00\xc8" + // 0x00450300: 0x000000C8 + "\x00E\x03\x01\x00\x00\x00\xc9" + // 0x00450301: 0x000000C9 + "\x00E\x03\x02\x00\x00\x00\xca" + // 0x00450302: 0x000000CA + "\x00E\x03\b\x00\x00\x00\xcb" + // 0x00450308: 0x000000CB + "\x00I\x03\x00\x00\x00\x00\xcc" + // 0x00490300: 0x000000CC + "\x00I\x03\x01\x00\x00\x00\xcd" + // 0x00490301: 0x000000CD + "\x00I\x03\x02\x00\x00\x00\xce" + // 0x00490302: 0x000000CE + "\x00I\x03\b\x00\x00\x00\xcf" + // 0x00490308: 0x000000CF + "\x00N\x03\x03\x00\x00\x00\xd1" + // 0x004E0303: 0x000000D1 + "\x00O\x03\x00\x00\x00\x00\xd2" + // 0x004F0300: 0x000000D2 + "\x00O\x03\x01\x00\x00\x00\xd3" + // 0x004F0301: 0x000000D3 + "\x00O\x03\x02\x00\x00\x00\xd4" + // 0x004F0302: 0x000000D4 + "\x00O\x03\x03\x00\x00\x00\xd5" + // 0x004F0303: 0x000000D5 + "\x00O\x03\b\x00\x00\x00\xd6" + // 0x004F0308: 0x000000D6 + "\x00U\x03\x00\x00\x00\x00\xd9" + // 0x00550300: 0x000000D9 + "\x00U\x03\x01\x00\x00\x00\xda" + // 0x00550301: 0x000000DA + "\x00U\x03\x02\x00\x00\x00\xdb" + // 0x00550302: 0x000000DB + "\x00U\x03\b\x00\x00\x00\xdc" + // 0x00550308: 0x000000DC + "\x00Y\x03\x01\x00\x00\x00\xdd" + // 0x00590301: 0x000000DD + "\x00a\x03\x00\x00\x00\x00\xe0" + // 0x00610300: 0x000000E0 + "\x00a\x03\x01\x00\x00\x00\xe1" + // 0x00610301: 0x000000E1 + "\x00a\x03\x02\x00\x00\x00\xe2" + // 0x00610302: 0x000000E2 + "\x00a\x03\x03\x00\x00\x00\xe3" + // 0x00610303: 0x000000E3 + "\x00a\x03\b\x00\x00\x00\xe4" + // 0x00610308: 0x000000E4 + "\x00a\x03\n\x00\x00\x00\xe5" + // 0x0061030A: 0x000000E5 + "\x00c\x03'\x00\x00\x00\xe7" + // 0x00630327: 0x000000E7 + "\x00e\x03\x00\x00\x00\x00\xe8" + // 0x00650300: 0x000000E8 + "\x00e\x03\x01\x00\x00\x00\xe9" + // 0x00650301: 0x000000E9 + "\x00e\x03\x02\x00\x00\x00\xea" + // 0x00650302: 0x000000EA + "\x00e\x03\b\x00\x00\x00\xeb" + // 0x00650308: 0x000000EB + "\x00i\x03\x00\x00\x00\x00\xec" + // 0x00690300: 0x000000EC + "\x00i\x03\x01\x00\x00\x00\xed" + // 0x00690301: 0x000000ED + "\x00i\x03\x02\x00\x00\x00\xee" + // 0x00690302: 0x000000EE + "\x00i\x03\b\x00\x00\x00\xef" + // 0x00690308: 0x000000EF + "\x00n\x03\x03\x00\x00\x00\xf1" + // 0x006E0303: 0x000000F1 + "\x00o\x03\x00\x00\x00\x00\xf2" + // 0x006F0300: 0x000000F2 + "\x00o\x03\x01\x00\x00\x00\xf3" + // 0x006F0301: 0x000000F3 + "\x00o\x03\x02\x00\x00\x00\xf4" + // 0x006F0302: 0x000000F4 + "\x00o\x03\x03\x00\x00\x00\xf5" + // 0x006F0303: 0x000000F5 + "\x00o\x03\b\x00\x00\x00\xf6" + // 0x006F0308: 0x000000F6 + "\x00u\x03\x00\x00\x00\x00\xf9" + // 0x00750300: 0x000000F9 + "\x00u\x03\x01\x00\x00\x00\xfa" + // 0x00750301: 0x000000FA + "\x00u\x03\x02\x00\x00\x00\xfb" + // 0x00750302: 0x000000FB + "\x00u\x03\b\x00\x00\x00\xfc" + // 0x00750308: 0x000000FC + "\x00y\x03\x01\x00\x00\x00\xfd" + // 0x00790301: 0x000000FD + "\x00y\x03\b\x00\x00\x00\xff" + // 0x00790308: 0x000000FF + "\x00A\x03\x04\x00\x00\x01\x00" + // 0x00410304: 0x00000100 + "\x00a\x03\x04\x00\x00\x01\x01" + // 0x00610304: 0x00000101 + "\x00A\x03\x06\x00\x00\x01\x02" + // 0x00410306: 0x00000102 + "\x00a\x03\x06\x00\x00\x01\x03" + // 0x00610306: 0x00000103 + "\x00A\x03(\x00\x00\x01\x04" + // 0x00410328: 0x00000104 + "\x00a\x03(\x00\x00\x01\x05" + // 0x00610328: 0x00000105 + "\x00C\x03\x01\x00\x00\x01\x06" + // 0x00430301: 0x00000106 + "\x00c\x03\x01\x00\x00\x01\a" + // 0x00630301: 0x00000107 + "\x00C\x03\x02\x00\x00\x01\b" + // 0x00430302: 0x00000108 + "\x00c\x03\x02\x00\x00\x01\t" + // 0x00630302: 0x00000109 + "\x00C\x03\a\x00\x00\x01\n" + // 0x00430307: 0x0000010A + "\x00c\x03\a\x00\x00\x01\v" + // 0x00630307: 0x0000010B + "\x00C\x03\f\x00\x00\x01\f" + // 0x0043030C: 0x0000010C + "\x00c\x03\f\x00\x00\x01\r" + // 0x0063030C: 0x0000010D + "\x00D\x03\f\x00\x00\x01\x0e" + // 0x0044030C: 0x0000010E + "\x00d\x03\f\x00\x00\x01\x0f" + // 0x0064030C: 0x0000010F + "\x00E\x03\x04\x00\x00\x01\x12" + // 0x00450304: 0x00000112 + "\x00e\x03\x04\x00\x00\x01\x13" + // 0x00650304: 0x00000113 + "\x00E\x03\x06\x00\x00\x01\x14" + // 0x00450306: 0x00000114 + "\x00e\x03\x06\x00\x00\x01\x15" + // 0x00650306: 0x00000115 + "\x00E\x03\a\x00\x00\x01\x16" + // 0x00450307: 0x00000116 + "\x00e\x03\a\x00\x00\x01\x17" + // 0x00650307: 0x00000117 + "\x00E\x03(\x00\x00\x01\x18" + // 0x00450328: 0x00000118 + "\x00e\x03(\x00\x00\x01\x19" + // 0x00650328: 0x00000119 + "\x00E\x03\f\x00\x00\x01\x1a" + // 0x0045030C: 0x0000011A + "\x00e\x03\f\x00\x00\x01\x1b" + // 0x0065030C: 0x0000011B + "\x00G\x03\x02\x00\x00\x01\x1c" + // 0x00470302: 0x0000011C + "\x00g\x03\x02\x00\x00\x01\x1d" + // 0x00670302: 0x0000011D + "\x00G\x03\x06\x00\x00\x01\x1e" + // 0x00470306: 0x0000011E + "\x00g\x03\x06\x00\x00\x01\x1f" + // 0x00670306: 0x0000011F + "\x00G\x03\a\x00\x00\x01 " + // 0x00470307: 0x00000120 + "\x00g\x03\a\x00\x00\x01!" + // 0x00670307: 0x00000121 + "\x00G\x03'\x00\x00\x01\"" + // 0x00470327: 0x00000122 + "\x00g\x03'\x00\x00\x01#" + // 0x00670327: 0x00000123 + "\x00H\x03\x02\x00\x00\x01$" + // 0x00480302: 0x00000124 + "\x00h\x03\x02\x00\x00\x01%" + // 0x00680302: 0x00000125 + "\x00I\x03\x03\x00\x00\x01(" + // 0x00490303: 0x00000128 + "\x00i\x03\x03\x00\x00\x01)" + // 0x00690303: 0x00000129 + "\x00I\x03\x04\x00\x00\x01*" + // 0x00490304: 0x0000012A + "\x00i\x03\x04\x00\x00\x01+" + // 0x00690304: 0x0000012B + "\x00I\x03\x06\x00\x00\x01," + // 0x00490306: 0x0000012C + "\x00i\x03\x06\x00\x00\x01-" + // 0x00690306: 0x0000012D + "\x00I\x03(\x00\x00\x01." + // 0x00490328: 0x0000012E + "\x00i\x03(\x00\x00\x01/" + // 0x00690328: 0x0000012F + "\x00I\x03\a\x00\x00\x010" + // 0x00490307: 0x00000130 + "\x00J\x03\x02\x00\x00\x014" + // 0x004A0302: 0x00000134 + "\x00j\x03\x02\x00\x00\x015" + // 0x006A0302: 0x00000135 + "\x00K\x03'\x00\x00\x016" + // 0x004B0327: 0x00000136 + "\x00k\x03'\x00\x00\x017" + // 0x006B0327: 0x00000137 + "\x00L\x03\x01\x00\x00\x019" + // 0x004C0301: 0x00000139 + "\x00l\x03\x01\x00\x00\x01:" + // 0x006C0301: 0x0000013A + "\x00L\x03'\x00\x00\x01;" + // 0x004C0327: 0x0000013B + "\x00l\x03'\x00\x00\x01<" + // 0x006C0327: 0x0000013C + "\x00L\x03\f\x00\x00\x01=" + // 0x004C030C: 0x0000013D + "\x00l\x03\f\x00\x00\x01>" + // 0x006C030C: 0x0000013E + "\x00N\x03\x01\x00\x00\x01C" + // 0x004E0301: 0x00000143 + "\x00n\x03\x01\x00\x00\x01D" + // 0x006E0301: 0x00000144 + "\x00N\x03'\x00\x00\x01E" + // 0x004E0327: 0x00000145 + "\x00n\x03'\x00\x00\x01F" + // 0x006E0327: 0x00000146 + "\x00N\x03\f\x00\x00\x01G" + // 0x004E030C: 0x00000147 + "\x00n\x03\f\x00\x00\x01H" + // 0x006E030C: 0x00000148 + "\x00O\x03\x04\x00\x00\x01L" + // 0x004F0304: 0x0000014C + "\x00o\x03\x04\x00\x00\x01M" + // 0x006F0304: 0x0000014D + "\x00O\x03\x06\x00\x00\x01N" + // 0x004F0306: 0x0000014E + "\x00o\x03\x06\x00\x00\x01O" + // 0x006F0306: 0x0000014F + "\x00O\x03\v\x00\x00\x01P" + // 0x004F030B: 0x00000150 + "\x00o\x03\v\x00\x00\x01Q" + // 0x006F030B: 0x00000151 + "\x00R\x03\x01\x00\x00\x01T" + // 0x00520301: 0x00000154 + "\x00r\x03\x01\x00\x00\x01U" + // 0x00720301: 0x00000155 + "\x00R\x03'\x00\x00\x01V" + // 0x00520327: 0x00000156 + "\x00r\x03'\x00\x00\x01W" + // 0x00720327: 0x00000157 + "\x00R\x03\f\x00\x00\x01X" + // 0x0052030C: 0x00000158 + "\x00r\x03\f\x00\x00\x01Y" + // 0x0072030C: 0x00000159 + "\x00S\x03\x01\x00\x00\x01Z" + // 0x00530301: 0x0000015A + "\x00s\x03\x01\x00\x00\x01[" + // 0x00730301: 0x0000015B + "\x00S\x03\x02\x00\x00\x01\\" + // 0x00530302: 0x0000015C + "\x00s\x03\x02\x00\x00\x01]" + // 0x00730302: 0x0000015D + "\x00S\x03'\x00\x00\x01^" + // 0x00530327: 0x0000015E + "\x00s\x03'\x00\x00\x01_" + // 0x00730327: 0x0000015F + "\x00S\x03\f\x00\x00\x01`" + // 0x0053030C: 0x00000160 + "\x00s\x03\f\x00\x00\x01a" + // 0x0073030C: 0x00000161 + "\x00T\x03'\x00\x00\x01b" + // 0x00540327: 0x00000162 + "\x00t\x03'\x00\x00\x01c" + // 0x00740327: 0x00000163 + "\x00T\x03\f\x00\x00\x01d" + // 0x0054030C: 0x00000164 + "\x00t\x03\f\x00\x00\x01e" + // 0x0074030C: 0x00000165 + "\x00U\x03\x03\x00\x00\x01h" + // 0x00550303: 0x00000168 + "\x00u\x03\x03\x00\x00\x01i" + // 0x00750303: 0x00000169 + "\x00U\x03\x04\x00\x00\x01j" + // 0x00550304: 0x0000016A + "\x00u\x03\x04\x00\x00\x01k" + // 0x00750304: 0x0000016B + "\x00U\x03\x06\x00\x00\x01l" + // 0x00550306: 0x0000016C + "\x00u\x03\x06\x00\x00\x01m" + // 0x00750306: 0x0000016D + "\x00U\x03\n\x00\x00\x01n" + // 0x0055030A: 0x0000016E + "\x00u\x03\n\x00\x00\x01o" + // 0x0075030A: 0x0000016F + "\x00U\x03\v\x00\x00\x01p" + // 0x0055030B: 0x00000170 + "\x00u\x03\v\x00\x00\x01q" + // 0x0075030B: 0x00000171 + "\x00U\x03(\x00\x00\x01r" + // 0x00550328: 0x00000172 + "\x00u\x03(\x00\x00\x01s" + // 0x00750328: 0x00000173 + "\x00W\x03\x02\x00\x00\x01t" + // 0x00570302: 0x00000174 + "\x00w\x03\x02\x00\x00\x01u" + // 0x00770302: 0x00000175 + "\x00Y\x03\x02\x00\x00\x01v" + // 0x00590302: 0x00000176 + "\x00y\x03\x02\x00\x00\x01w" + // 0x00790302: 0x00000177 + "\x00Y\x03\b\x00\x00\x01x" + // 0x00590308: 0x00000178 + "\x00Z\x03\x01\x00\x00\x01y" + // 0x005A0301: 0x00000179 + "\x00z\x03\x01\x00\x00\x01z" + // 0x007A0301: 0x0000017A + "\x00Z\x03\a\x00\x00\x01{" + // 0x005A0307: 0x0000017B + "\x00z\x03\a\x00\x00\x01|" + // 0x007A0307: 0x0000017C + "\x00Z\x03\f\x00\x00\x01}" + // 0x005A030C: 0x0000017D + "\x00z\x03\f\x00\x00\x01~" + // 0x007A030C: 0x0000017E + "\x00O\x03\x1b\x00\x00\x01\xa0" + // 0x004F031B: 0x000001A0 + "\x00o\x03\x1b\x00\x00\x01\xa1" + // 0x006F031B: 0x000001A1 + "\x00U\x03\x1b\x00\x00\x01\xaf" + // 0x0055031B: 0x000001AF + "\x00u\x03\x1b\x00\x00\x01\xb0" + // 0x0075031B: 0x000001B0 + "\x00A\x03\f\x00\x00\x01\xcd" + // 0x0041030C: 0x000001CD + "\x00a\x03\f\x00\x00\x01\xce" + // 0x0061030C: 0x000001CE + "\x00I\x03\f\x00\x00\x01\xcf" + // 0x0049030C: 0x000001CF + "\x00i\x03\f\x00\x00\x01\xd0" + // 0x0069030C: 0x000001D0 + "\x00O\x03\f\x00\x00\x01\xd1" + // 0x004F030C: 0x000001D1 + "\x00o\x03\f\x00\x00\x01\xd2" + // 0x006F030C: 0x000001D2 + "\x00U\x03\f\x00\x00\x01\xd3" + // 0x0055030C: 0x000001D3 + "\x00u\x03\f\x00\x00\x01\xd4" + // 0x0075030C: 0x000001D4 + "\x00\xdc\x03\x04\x00\x00\x01\xd5" + // 0x00DC0304: 0x000001D5 + "\x00\xfc\x03\x04\x00\x00\x01\xd6" + // 0x00FC0304: 0x000001D6 + "\x00\xdc\x03\x01\x00\x00\x01\xd7" + // 0x00DC0301: 0x000001D7 + "\x00\xfc\x03\x01\x00\x00\x01\xd8" + // 0x00FC0301: 0x000001D8 + "\x00\xdc\x03\f\x00\x00\x01\xd9" + // 0x00DC030C: 0x000001D9 + "\x00\xfc\x03\f\x00\x00\x01\xda" + // 0x00FC030C: 0x000001DA + "\x00\xdc\x03\x00\x00\x00\x01\xdb" + // 0x00DC0300: 0x000001DB + "\x00\xfc\x03\x00\x00\x00\x01\xdc" + // 0x00FC0300: 0x000001DC + "\x00\xc4\x03\x04\x00\x00\x01\xde" + // 0x00C40304: 0x000001DE + "\x00\xe4\x03\x04\x00\x00\x01\xdf" + // 0x00E40304: 0x000001DF + "\x02&\x03\x04\x00\x00\x01\xe0" + // 0x02260304: 0x000001E0 + "\x02'\x03\x04\x00\x00\x01\xe1" + // 0x02270304: 0x000001E1 + "\x00\xc6\x03\x04\x00\x00\x01\xe2" + // 0x00C60304: 0x000001E2 + "\x00\xe6\x03\x04\x00\x00\x01\xe3" + // 0x00E60304: 0x000001E3 + "\x00G\x03\f\x00\x00\x01\xe6" + // 0x0047030C: 0x000001E6 + "\x00g\x03\f\x00\x00\x01\xe7" + // 0x0067030C: 0x000001E7 + "\x00K\x03\f\x00\x00\x01\xe8" + // 0x004B030C: 0x000001E8 + "\x00k\x03\f\x00\x00\x01\xe9" + // 0x006B030C: 0x000001E9 + "\x00O\x03(\x00\x00\x01\xea" + // 0x004F0328: 0x000001EA + "\x00o\x03(\x00\x00\x01\xeb" + // 0x006F0328: 0x000001EB + "\x01\xea\x03\x04\x00\x00\x01\xec" + // 0x01EA0304: 0x000001EC + "\x01\xeb\x03\x04\x00\x00\x01\xed" + // 0x01EB0304: 0x000001ED + "\x01\xb7\x03\f\x00\x00\x01\xee" + // 0x01B7030C: 0x000001EE + "\x02\x92\x03\f\x00\x00\x01\xef" + // 0x0292030C: 0x000001EF + "\x00j\x03\f\x00\x00\x01\xf0" + // 0x006A030C: 0x000001F0 + "\x00G\x03\x01\x00\x00\x01\xf4" + // 0x00470301: 0x000001F4 + "\x00g\x03\x01\x00\x00\x01\xf5" + // 0x00670301: 0x000001F5 + "\x00N\x03\x00\x00\x00\x01\xf8" + // 0x004E0300: 0x000001F8 + "\x00n\x03\x00\x00\x00\x01\xf9" + // 0x006E0300: 0x000001F9 + "\x00\xc5\x03\x01\x00\x00\x01\xfa" + // 0x00C50301: 0x000001FA + "\x00\xe5\x03\x01\x00\x00\x01\xfb" + // 0x00E50301: 0x000001FB + "\x00\xc6\x03\x01\x00\x00\x01\xfc" + // 0x00C60301: 0x000001FC + "\x00\xe6\x03\x01\x00\x00\x01\xfd" + // 0x00E60301: 0x000001FD + "\x00\xd8\x03\x01\x00\x00\x01\xfe" + // 0x00D80301: 0x000001FE + "\x00\xf8\x03\x01\x00\x00\x01\xff" + // 0x00F80301: 0x000001FF + "\x00A\x03\x0f\x00\x00\x02\x00" + // 0x0041030F: 0x00000200 + "\x00a\x03\x0f\x00\x00\x02\x01" + // 0x0061030F: 0x00000201 + "\x00A\x03\x11\x00\x00\x02\x02" + // 0x00410311: 0x00000202 + "\x00a\x03\x11\x00\x00\x02\x03" + // 0x00610311: 0x00000203 + "\x00E\x03\x0f\x00\x00\x02\x04" + // 0x0045030F: 0x00000204 + "\x00e\x03\x0f\x00\x00\x02\x05" + // 0x0065030F: 0x00000205 + "\x00E\x03\x11\x00\x00\x02\x06" + // 0x00450311: 0x00000206 + "\x00e\x03\x11\x00\x00\x02\a" + // 0x00650311: 0x00000207 + "\x00I\x03\x0f\x00\x00\x02\b" + // 0x0049030F: 0x00000208 + "\x00i\x03\x0f\x00\x00\x02\t" + // 0x0069030F: 0x00000209 + "\x00I\x03\x11\x00\x00\x02\n" + // 0x00490311: 0x0000020A + "\x00i\x03\x11\x00\x00\x02\v" + // 0x00690311: 0x0000020B + "\x00O\x03\x0f\x00\x00\x02\f" + // 0x004F030F: 0x0000020C + "\x00o\x03\x0f\x00\x00\x02\r" + // 0x006F030F: 0x0000020D + "\x00O\x03\x11\x00\x00\x02\x0e" + // 0x004F0311: 0x0000020E + "\x00o\x03\x11\x00\x00\x02\x0f" + // 0x006F0311: 0x0000020F + "\x00R\x03\x0f\x00\x00\x02\x10" + // 0x0052030F: 0x00000210 + "\x00r\x03\x0f\x00\x00\x02\x11" + // 0x0072030F: 0x00000211 + "\x00R\x03\x11\x00\x00\x02\x12" + // 0x00520311: 0x00000212 + "\x00r\x03\x11\x00\x00\x02\x13" + // 0x00720311: 0x00000213 + "\x00U\x03\x0f\x00\x00\x02\x14" + // 0x0055030F: 0x00000214 + "\x00u\x03\x0f\x00\x00\x02\x15" + // 0x0075030F: 0x00000215 + "\x00U\x03\x11\x00\x00\x02\x16" + // 0x00550311: 0x00000216 + "\x00u\x03\x11\x00\x00\x02\x17" + // 0x00750311: 0x00000217 + "\x00S\x03&\x00\x00\x02\x18" + // 0x00530326: 0x00000218 + "\x00s\x03&\x00\x00\x02\x19" + // 0x00730326: 0x00000219 + "\x00T\x03&\x00\x00\x02\x1a" + // 0x00540326: 0x0000021A + "\x00t\x03&\x00\x00\x02\x1b" + // 0x00740326: 0x0000021B + "\x00H\x03\f\x00\x00\x02\x1e" + // 0x0048030C: 0x0000021E + "\x00h\x03\f\x00\x00\x02\x1f" + // 0x0068030C: 0x0000021F + "\x00A\x03\a\x00\x00\x02&" + // 0x00410307: 0x00000226 + "\x00a\x03\a\x00\x00\x02'" + // 0x00610307: 0x00000227 + "\x00E\x03'\x00\x00\x02(" + // 0x00450327: 0x00000228 + "\x00e\x03'\x00\x00\x02)" + // 0x00650327: 0x00000229 + "\x00\xd6\x03\x04\x00\x00\x02*" + // 0x00D60304: 0x0000022A + "\x00\xf6\x03\x04\x00\x00\x02+" + // 0x00F60304: 0x0000022B + "\x00\xd5\x03\x04\x00\x00\x02," + // 0x00D50304: 0x0000022C + "\x00\xf5\x03\x04\x00\x00\x02-" + // 0x00F50304: 0x0000022D + "\x00O\x03\a\x00\x00\x02." + // 0x004F0307: 0x0000022E + "\x00o\x03\a\x00\x00\x02/" + // 0x006F0307: 0x0000022F + "\x02.\x03\x04\x00\x00\x020" + // 0x022E0304: 0x00000230 + "\x02/\x03\x04\x00\x00\x021" + // 0x022F0304: 0x00000231 + "\x00Y\x03\x04\x00\x00\x022" + // 0x00590304: 0x00000232 + "\x00y\x03\x04\x00\x00\x023" + // 0x00790304: 0x00000233 + "\x00\xa8\x03\x01\x00\x00\x03\x85" + // 0x00A80301: 0x00000385 + "\x03\x91\x03\x01\x00\x00\x03\x86" + // 0x03910301: 0x00000386 + "\x03\x95\x03\x01\x00\x00\x03\x88" + // 0x03950301: 0x00000388 + "\x03\x97\x03\x01\x00\x00\x03\x89" + // 0x03970301: 0x00000389 + "\x03\x99\x03\x01\x00\x00\x03\x8a" + // 0x03990301: 0x0000038A + "\x03\x9f\x03\x01\x00\x00\x03\x8c" + // 0x039F0301: 0x0000038C + "\x03\xa5\x03\x01\x00\x00\x03\x8e" + // 0x03A50301: 0x0000038E + "\x03\xa9\x03\x01\x00\x00\x03\x8f" + // 0x03A90301: 0x0000038F + "\x03\xca\x03\x01\x00\x00\x03\x90" + // 0x03CA0301: 0x00000390 + "\x03\x99\x03\b\x00\x00\x03\xaa" + // 0x03990308: 0x000003AA + "\x03\xa5\x03\b\x00\x00\x03\xab" + // 0x03A50308: 0x000003AB + "\x03\xb1\x03\x01\x00\x00\x03\xac" + // 0x03B10301: 0x000003AC + "\x03\xb5\x03\x01\x00\x00\x03\xad" + // 0x03B50301: 0x000003AD + "\x03\xb7\x03\x01\x00\x00\x03\xae" + // 0x03B70301: 0x000003AE + "\x03\xb9\x03\x01\x00\x00\x03\xaf" + // 0x03B90301: 0x000003AF + "\x03\xcb\x03\x01\x00\x00\x03\xb0" + // 0x03CB0301: 0x000003B0 + "\x03\xb9\x03\b\x00\x00\x03\xca" + // 0x03B90308: 0x000003CA + "\x03\xc5\x03\b\x00\x00\x03\xcb" + // 0x03C50308: 0x000003CB + "\x03\xbf\x03\x01\x00\x00\x03\xcc" + // 0x03BF0301: 0x000003CC + "\x03\xc5\x03\x01\x00\x00\x03\xcd" + // 0x03C50301: 0x000003CD + "\x03\xc9\x03\x01\x00\x00\x03\xce" + // 0x03C90301: 0x000003CE + "\x03\xd2\x03\x01\x00\x00\x03\xd3" + // 0x03D20301: 0x000003D3 + "\x03\xd2\x03\b\x00\x00\x03\xd4" + // 0x03D20308: 0x000003D4 + "\x04\x15\x03\x00\x00\x00\x04\x00" + // 0x04150300: 0x00000400 + "\x04\x15\x03\b\x00\x00\x04\x01" + // 0x04150308: 0x00000401 + "\x04\x13\x03\x01\x00\x00\x04\x03" + // 0x04130301: 0x00000403 + "\x04\x06\x03\b\x00\x00\x04\a" + // 0x04060308: 0x00000407 + "\x04\x1a\x03\x01\x00\x00\x04\f" + // 0x041A0301: 0x0000040C + "\x04\x18\x03\x00\x00\x00\x04\r" + // 0x04180300: 0x0000040D + "\x04#\x03\x06\x00\x00\x04\x0e" + // 0x04230306: 0x0000040E + "\x04\x18\x03\x06\x00\x00\x04\x19" + // 0x04180306: 0x00000419 + "\x048\x03\x06\x00\x00\x049" + // 0x04380306: 0x00000439 + "\x045\x03\x00\x00\x00\x04P" + // 0x04350300: 0x00000450 + "\x045\x03\b\x00\x00\x04Q" + // 0x04350308: 0x00000451 + "\x043\x03\x01\x00\x00\x04S" + // 0x04330301: 0x00000453 + "\x04V\x03\b\x00\x00\x04W" + // 0x04560308: 0x00000457 + "\x04:\x03\x01\x00\x00\x04\\" + // 0x043A0301: 0x0000045C + "\x048\x03\x00\x00\x00\x04]" + // 0x04380300: 0x0000045D + "\x04C\x03\x06\x00\x00\x04^" + // 0x04430306: 0x0000045E + "\x04t\x03\x0f\x00\x00\x04v" + // 0x0474030F: 0x00000476 + "\x04u\x03\x0f\x00\x00\x04w" + // 0x0475030F: 0x00000477 + "\x04\x16\x03\x06\x00\x00\x04\xc1" + // 0x04160306: 0x000004C1 + "\x046\x03\x06\x00\x00\x04\xc2" + // 0x04360306: 0x000004C2 + "\x04\x10\x03\x06\x00\x00\x04\xd0" + // 0x04100306: 0x000004D0 + "\x040\x03\x06\x00\x00\x04\xd1" + // 0x04300306: 0x000004D1 + "\x04\x10\x03\b\x00\x00\x04\xd2" + // 0x04100308: 0x000004D2 + "\x040\x03\b\x00\x00\x04\xd3" + // 0x04300308: 0x000004D3 + "\x04\x15\x03\x06\x00\x00\x04\xd6" + // 0x04150306: 0x000004D6 + "\x045\x03\x06\x00\x00\x04\xd7" + // 0x04350306: 0x000004D7 + "\x04\xd8\x03\b\x00\x00\x04\xda" + // 0x04D80308: 0x000004DA + "\x04\xd9\x03\b\x00\x00\x04\xdb" + // 0x04D90308: 0x000004DB + "\x04\x16\x03\b\x00\x00\x04\xdc" + // 0x04160308: 0x000004DC + "\x046\x03\b\x00\x00\x04\xdd" + // 0x04360308: 0x000004DD + "\x04\x17\x03\b\x00\x00\x04\xde" + // 0x04170308: 0x000004DE + "\x047\x03\b\x00\x00\x04\xdf" + // 0x04370308: 0x000004DF + "\x04\x18\x03\x04\x00\x00\x04\xe2" + // 0x04180304: 0x000004E2 + "\x048\x03\x04\x00\x00\x04\xe3" + // 0x04380304: 0x000004E3 + "\x04\x18\x03\b\x00\x00\x04\xe4" + // 0x04180308: 0x000004E4 + "\x048\x03\b\x00\x00\x04\xe5" + // 0x04380308: 0x000004E5 + "\x04\x1e\x03\b\x00\x00\x04\xe6" + // 0x041E0308: 0x000004E6 + "\x04>\x03\b\x00\x00\x04\xe7" + // 0x043E0308: 0x000004E7 + "\x04\xe8\x03\b\x00\x00\x04\xea" + // 0x04E80308: 0x000004EA + "\x04\xe9\x03\b\x00\x00\x04\xeb" + // 0x04E90308: 0x000004EB + "\x04-\x03\b\x00\x00\x04\xec" + // 0x042D0308: 0x000004EC + "\x04M\x03\b\x00\x00\x04\xed" + // 0x044D0308: 0x000004ED + "\x04#\x03\x04\x00\x00\x04\xee" + // 0x04230304: 0x000004EE + "\x04C\x03\x04\x00\x00\x04\xef" + // 0x04430304: 0x000004EF + "\x04#\x03\b\x00\x00\x04\xf0" + // 0x04230308: 0x000004F0 + "\x04C\x03\b\x00\x00\x04\xf1" + // 0x04430308: 0x000004F1 + "\x04#\x03\v\x00\x00\x04\xf2" + // 0x0423030B: 0x000004F2 + "\x04C\x03\v\x00\x00\x04\xf3" + // 0x0443030B: 0x000004F3 + "\x04'\x03\b\x00\x00\x04\xf4" + // 0x04270308: 0x000004F4 + "\x04G\x03\b\x00\x00\x04\xf5" + // 0x04470308: 0x000004F5 + "\x04+\x03\b\x00\x00\x04\xf8" + // 0x042B0308: 0x000004F8 + "\x04K\x03\b\x00\x00\x04\xf9" + // 0x044B0308: 0x000004F9 + "\x06'\x06S\x00\x00\x06\"" + // 0x06270653: 0x00000622 + "\x06'\x06T\x00\x00\x06#" + // 0x06270654: 0x00000623 + "\x06H\x06T\x00\x00\x06$" + // 0x06480654: 0x00000624 + "\x06'\x06U\x00\x00\x06%" + // 0x06270655: 0x00000625 + "\x06J\x06T\x00\x00\x06&" + // 0x064A0654: 0x00000626 + "\x06\xd5\x06T\x00\x00\x06\xc0" + // 0x06D50654: 0x000006C0 + "\x06\xc1\x06T\x00\x00\x06\xc2" + // 0x06C10654: 0x000006C2 + "\x06\xd2\x06T\x00\x00\x06\xd3" + // 0x06D20654: 0x000006D3 + "\t(\t<\x00\x00\t)" + // 0x0928093C: 0x00000929 + "\t0\t<\x00\x00\t1" + // 0x0930093C: 0x00000931 + "\t3\t<\x00\x00\t4" + // 0x0933093C: 0x00000934 + "\t\xc7\t\xbe\x00\x00\t\xcb" + // 0x09C709BE: 0x000009CB + "\t\xc7\t\xd7\x00\x00\t\xcc" + // 0x09C709D7: 0x000009CC + "\vG\vV\x00\x00\vH" + // 0x0B470B56: 0x00000B48 + "\vG\v>\x00\x00\vK" + // 0x0B470B3E: 0x00000B4B + "\vG\vW\x00\x00\vL" + // 0x0B470B57: 0x00000B4C + "\v\x92\v\xd7\x00\x00\v\x94" + // 0x0B920BD7: 0x00000B94 + "\v\xc6\v\xbe\x00\x00\v\xca" + // 0x0BC60BBE: 0x00000BCA + "\v\xc7\v\xbe\x00\x00\v\xcb" + // 0x0BC70BBE: 0x00000BCB + "\v\xc6\v\xd7\x00\x00\v\xcc" + // 0x0BC60BD7: 0x00000BCC + "\fF\fV\x00\x00\fH" + // 0x0C460C56: 0x00000C48 + "\f\xbf\f\xd5\x00\x00\f\xc0" + // 0x0CBF0CD5: 0x00000CC0 + "\f\xc6\f\xd5\x00\x00\f\xc7" + // 0x0CC60CD5: 0x00000CC7 + "\f\xc6\f\xd6\x00\x00\f\xc8" + // 0x0CC60CD6: 0x00000CC8 + "\f\xc6\f\xc2\x00\x00\f\xca" + // 0x0CC60CC2: 0x00000CCA + "\f\xca\f\xd5\x00\x00\f\xcb" + // 0x0CCA0CD5: 0x00000CCB + "\rF\r>\x00\x00\rJ" + // 0x0D460D3E: 0x00000D4A + "\rG\r>\x00\x00\rK" + // 0x0D470D3E: 0x00000D4B + "\rF\rW\x00\x00\rL" + // 0x0D460D57: 0x00000D4C + "\r\xd9\r\xca\x00\x00\r\xda" + // 0x0DD90DCA: 0x00000DDA + "\r\xd9\r\xcf\x00\x00\r\xdc" + // 0x0DD90DCF: 0x00000DDC + "\r\xdc\r\xca\x00\x00\r\xdd" + // 0x0DDC0DCA: 0x00000DDD + "\r\xd9\r\xdf\x00\x00\r\xde" + // 0x0DD90DDF: 0x00000DDE + "\x10%\x10.\x00\x00\x10&" + // 0x1025102E: 0x00001026 + "\x1b\x05\x1b5\x00\x00\x1b\x06" + // 0x1B051B35: 0x00001B06 + "\x1b\a\x1b5\x00\x00\x1b\b" + // 0x1B071B35: 0x00001B08 + "\x1b\t\x1b5\x00\x00\x1b\n" + // 0x1B091B35: 0x00001B0A + "\x1b\v\x1b5\x00\x00\x1b\f" + // 0x1B0B1B35: 0x00001B0C + "\x1b\r\x1b5\x00\x00\x1b\x0e" + // 0x1B0D1B35: 0x00001B0E + "\x1b\x11\x1b5\x00\x00\x1b\x12" + // 0x1B111B35: 0x00001B12 + "\x1b:\x1b5\x00\x00\x1b;" + // 0x1B3A1B35: 0x00001B3B + "\x1b<\x1b5\x00\x00\x1b=" + // 0x1B3C1B35: 0x00001B3D + "\x1b>\x1b5\x00\x00\x1b@" + // 0x1B3E1B35: 0x00001B40 + "\x1b?\x1b5\x00\x00\x1bA" + // 0x1B3F1B35: 0x00001B41 + "\x1bB\x1b5\x00\x00\x1bC" + // 0x1B421B35: 0x00001B43 + "\x00A\x03%\x00\x00\x1e\x00" + // 0x00410325: 0x00001E00 + "\x00a\x03%\x00\x00\x1e\x01" + // 0x00610325: 0x00001E01 + "\x00B\x03\a\x00\x00\x1e\x02" + // 0x00420307: 0x00001E02 + "\x00b\x03\a\x00\x00\x1e\x03" + // 0x00620307: 0x00001E03 + "\x00B\x03#\x00\x00\x1e\x04" + // 0x00420323: 0x00001E04 + "\x00b\x03#\x00\x00\x1e\x05" + // 0x00620323: 0x00001E05 + "\x00B\x031\x00\x00\x1e\x06" + // 0x00420331: 0x00001E06 + "\x00b\x031\x00\x00\x1e\a" + // 0x00620331: 0x00001E07 + "\x00\xc7\x03\x01\x00\x00\x1e\b" + // 0x00C70301: 0x00001E08 + "\x00\xe7\x03\x01\x00\x00\x1e\t" + // 0x00E70301: 0x00001E09 + "\x00D\x03\a\x00\x00\x1e\n" + // 0x00440307: 0x00001E0A + "\x00d\x03\a\x00\x00\x1e\v" + // 0x00640307: 0x00001E0B + "\x00D\x03#\x00\x00\x1e\f" + // 0x00440323: 0x00001E0C + "\x00d\x03#\x00\x00\x1e\r" + // 0x00640323: 0x00001E0D + "\x00D\x031\x00\x00\x1e\x0e" + // 0x00440331: 0x00001E0E + "\x00d\x031\x00\x00\x1e\x0f" + // 0x00640331: 0x00001E0F + "\x00D\x03'\x00\x00\x1e\x10" + // 0x00440327: 0x00001E10 + "\x00d\x03'\x00\x00\x1e\x11" + // 0x00640327: 0x00001E11 + "\x00D\x03-\x00\x00\x1e\x12" + // 0x0044032D: 0x00001E12 + "\x00d\x03-\x00\x00\x1e\x13" + // 0x0064032D: 0x00001E13 + "\x01\x12\x03\x00\x00\x00\x1e\x14" + // 0x01120300: 0x00001E14 + "\x01\x13\x03\x00\x00\x00\x1e\x15" + // 0x01130300: 0x00001E15 + "\x01\x12\x03\x01\x00\x00\x1e\x16" + // 0x01120301: 0x00001E16 + "\x01\x13\x03\x01\x00\x00\x1e\x17" + // 0x01130301: 0x00001E17 + "\x00E\x03-\x00\x00\x1e\x18" + // 0x0045032D: 0x00001E18 + "\x00e\x03-\x00\x00\x1e\x19" + // 0x0065032D: 0x00001E19 + "\x00E\x030\x00\x00\x1e\x1a" + // 0x00450330: 0x00001E1A + "\x00e\x030\x00\x00\x1e\x1b" + // 0x00650330: 0x00001E1B + "\x02(\x03\x06\x00\x00\x1e\x1c" + // 0x02280306: 0x00001E1C + "\x02)\x03\x06\x00\x00\x1e\x1d" + // 0x02290306: 0x00001E1D + "\x00F\x03\a\x00\x00\x1e\x1e" + // 0x00460307: 0x00001E1E + "\x00f\x03\a\x00\x00\x1e\x1f" + // 0x00660307: 0x00001E1F + "\x00G\x03\x04\x00\x00\x1e " + // 0x00470304: 0x00001E20 + "\x00g\x03\x04\x00\x00\x1e!" + // 0x00670304: 0x00001E21 + "\x00H\x03\a\x00\x00\x1e\"" + // 0x00480307: 0x00001E22 + "\x00h\x03\a\x00\x00\x1e#" + // 0x00680307: 0x00001E23 + "\x00H\x03#\x00\x00\x1e$" + // 0x00480323: 0x00001E24 + "\x00h\x03#\x00\x00\x1e%" + // 0x00680323: 0x00001E25 + "\x00H\x03\b\x00\x00\x1e&" + // 0x00480308: 0x00001E26 + "\x00h\x03\b\x00\x00\x1e'" + // 0x00680308: 0x00001E27 + "\x00H\x03'\x00\x00\x1e(" + // 0x00480327: 0x00001E28 + "\x00h\x03'\x00\x00\x1e)" + // 0x00680327: 0x00001E29 + "\x00H\x03.\x00\x00\x1e*" + // 0x0048032E: 0x00001E2A + "\x00h\x03.\x00\x00\x1e+" + // 0x0068032E: 0x00001E2B + "\x00I\x030\x00\x00\x1e," + // 0x00490330: 0x00001E2C + "\x00i\x030\x00\x00\x1e-" + // 0x00690330: 0x00001E2D + "\x00\xcf\x03\x01\x00\x00\x1e." + // 0x00CF0301: 0x00001E2E + "\x00\xef\x03\x01\x00\x00\x1e/" + // 0x00EF0301: 0x00001E2F + "\x00K\x03\x01\x00\x00\x1e0" + // 0x004B0301: 0x00001E30 + "\x00k\x03\x01\x00\x00\x1e1" + // 0x006B0301: 0x00001E31 + "\x00K\x03#\x00\x00\x1e2" + // 0x004B0323: 0x00001E32 + "\x00k\x03#\x00\x00\x1e3" + // 0x006B0323: 0x00001E33 + "\x00K\x031\x00\x00\x1e4" + // 0x004B0331: 0x00001E34 + "\x00k\x031\x00\x00\x1e5" + // 0x006B0331: 0x00001E35 + "\x00L\x03#\x00\x00\x1e6" + // 0x004C0323: 0x00001E36 + "\x00l\x03#\x00\x00\x1e7" + // 0x006C0323: 0x00001E37 + "\x1e6\x03\x04\x00\x00\x1e8" + // 0x1E360304: 0x00001E38 + "\x1e7\x03\x04\x00\x00\x1e9" + // 0x1E370304: 0x00001E39 + "\x00L\x031\x00\x00\x1e:" + // 0x004C0331: 0x00001E3A + "\x00l\x031\x00\x00\x1e;" + // 0x006C0331: 0x00001E3B + "\x00L\x03-\x00\x00\x1e<" + // 0x004C032D: 0x00001E3C + "\x00l\x03-\x00\x00\x1e=" + // 0x006C032D: 0x00001E3D + "\x00M\x03\x01\x00\x00\x1e>" + // 0x004D0301: 0x00001E3E + "\x00m\x03\x01\x00\x00\x1e?" + // 0x006D0301: 0x00001E3F + "\x00M\x03\a\x00\x00\x1e@" + // 0x004D0307: 0x00001E40 + "\x00m\x03\a\x00\x00\x1eA" + // 0x006D0307: 0x00001E41 + "\x00M\x03#\x00\x00\x1eB" + // 0x004D0323: 0x00001E42 + "\x00m\x03#\x00\x00\x1eC" + // 0x006D0323: 0x00001E43 + "\x00N\x03\a\x00\x00\x1eD" + // 0x004E0307: 0x00001E44 + "\x00n\x03\a\x00\x00\x1eE" + // 0x006E0307: 0x00001E45 + "\x00N\x03#\x00\x00\x1eF" + // 0x004E0323: 0x00001E46 + "\x00n\x03#\x00\x00\x1eG" + // 0x006E0323: 0x00001E47 + "\x00N\x031\x00\x00\x1eH" + // 0x004E0331: 0x00001E48 + "\x00n\x031\x00\x00\x1eI" + // 0x006E0331: 0x00001E49 + "\x00N\x03-\x00\x00\x1eJ" + // 0x004E032D: 0x00001E4A + "\x00n\x03-\x00\x00\x1eK" + // 0x006E032D: 0x00001E4B + "\x00\xd5\x03\x01\x00\x00\x1eL" + // 0x00D50301: 0x00001E4C + "\x00\xf5\x03\x01\x00\x00\x1eM" + // 0x00F50301: 0x00001E4D + "\x00\xd5\x03\b\x00\x00\x1eN" + // 0x00D50308: 0x00001E4E + "\x00\xf5\x03\b\x00\x00\x1eO" + // 0x00F50308: 0x00001E4F + "\x01L\x03\x00\x00\x00\x1eP" + // 0x014C0300: 0x00001E50 + "\x01M\x03\x00\x00\x00\x1eQ" + // 0x014D0300: 0x00001E51 + "\x01L\x03\x01\x00\x00\x1eR" + // 0x014C0301: 0x00001E52 + "\x01M\x03\x01\x00\x00\x1eS" + // 0x014D0301: 0x00001E53 + "\x00P\x03\x01\x00\x00\x1eT" + // 0x00500301: 0x00001E54 + "\x00p\x03\x01\x00\x00\x1eU" + // 0x00700301: 0x00001E55 + "\x00P\x03\a\x00\x00\x1eV" + // 0x00500307: 0x00001E56 + "\x00p\x03\a\x00\x00\x1eW" + // 0x00700307: 0x00001E57 + "\x00R\x03\a\x00\x00\x1eX" + // 0x00520307: 0x00001E58 + "\x00r\x03\a\x00\x00\x1eY" + // 0x00720307: 0x00001E59 + "\x00R\x03#\x00\x00\x1eZ" + // 0x00520323: 0x00001E5A + "\x00r\x03#\x00\x00\x1e[" + // 0x00720323: 0x00001E5B + "\x1eZ\x03\x04\x00\x00\x1e\\" + // 0x1E5A0304: 0x00001E5C + "\x1e[\x03\x04\x00\x00\x1e]" + // 0x1E5B0304: 0x00001E5D + "\x00R\x031\x00\x00\x1e^" + // 0x00520331: 0x00001E5E + "\x00r\x031\x00\x00\x1e_" + // 0x00720331: 0x00001E5F + "\x00S\x03\a\x00\x00\x1e`" + // 0x00530307: 0x00001E60 + "\x00s\x03\a\x00\x00\x1ea" + // 0x00730307: 0x00001E61 + "\x00S\x03#\x00\x00\x1eb" + // 0x00530323: 0x00001E62 + "\x00s\x03#\x00\x00\x1ec" + // 0x00730323: 0x00001E63 + "\x01Z\x03\a\x00\x00\x1ed" + // 0x015A0307: 0x00001E64 + "\x01[\x03\a\x00\x00\x1ee" + // 0x015B0307: 0x00001E65 + "\x01`\x03\a\x00\x00\x1ef" + // 0x01600307: 0x00001E66 + "\x01a\x03\a\x00\x00\x1eg" + // 0x01610307: 0x00001E67 + "\x1eb\x03\a\x00\x00\x1eh" + // 0x1E620307: 0x00001E68 + "\x1ec\x03\a\x00\x00\x1ei" + // 0x1E630307: 0x00001E69 + "\x00T\x03\a\x00\x00\x1ej" + // 0x00540307: 0x00001E6A + "\x00t\x03\a\x00\x00\x1ek" + // 0x00740307: 0x00001E6B + "\x00T\x03#\x00\x00\x1el" + // 0x00540323: 0x00001E6C + "\x00t\x03#\x00\x00\x1em" + // 0x00740323: 0x00001E6D + "\x00T\x031\x00\x00\x1en" + // 0x00540331: 0x00001E6E + "\x00t\x031\x00\x00\x1eo" + // 0x00740331: 0x00001E6F + "\x00T\x03-\x00\x00\x1ep" + // 0x0054032D: 0x00001E70 + "\x00t\x03-\x00\x00\x1eq" + // 0x0074032D: 0x00001E71 + "\x00U\x03$\x00\x00\x1er" + // 0x00550324: 0x00001E72 + "\x00u\x03$\x00\x00\x1es" + // 0x00750324: 0x00001E73 + "\x00U\x030\x00\x00\x1et" + // 0x00550330: 0x00001E74 + "\x00u\x030\x00\x00\x1eu" + // 0x00750330: 0x00001E75 + "\x00U\x03-\x00\x00\x1ev" + // 0x0055032D: 0x00001E76 + "\x00u\x03-\x00\x00\x1ew" + // 0x0075032D: 0x00001E77 + "\x01h\x03\x01\x00\x00\x1ex" + // 0x01680301: 0x00001E78 + "\x01i\x03\x01\x00\x00\x1ey" + // 0x01690301: 0x00001E79 + "\x01j\x03\b\x00\x00\x1ez" + // 0x016A0308: 0x00001E7A + "\x01k\x03\b\x00\x00\x1e{" + // 0x016B0308: 0x00001E7B + "\x00V\x03\x03\x00\x00\x1e|" + // 0x00560303: 0x00001E7C + "\x00v\x03\x03\x00\x00\x1e}" + // 0x00760303: 0x00001E7D + "\x00V\x03#\x00\x00\x1e~" + // 0x00560323: 0x00001E7E + "\x00v\x03#\x00\x00\x1e\u007f" + // 0x00760323: 0x00001E7F + "\x00W\x03\x00\x00\x00\x1e\x80" + // 0x00570300: 0x00001E80 + "\x00w\x03\x00\x00\x00\x1e\x81" + // 0x00770300: 0x00001E81 + "\x00W\x03\x01\x00\x00\x1e\x82" + // 0x00570301: 0x00001E82 + "\x00w\x03\x01\x00\x00\x1e\x83" + // 0x00770301: 0x00001E83 + "\x00W\x03\b\x00\x00\x1e\x84" + // 0x00570308: 0x00001E84 + "\x00w\x03\b\x00\x00\x1e\x85" + // 0x00770308: 0x00001E85 + "\x00W\x03\a\x00\x00\x1e\x86" + // 0x00570307: 0x00001E86 + "\x00w\x03\a\x00\x00\x1e\x87" + // 0x00770307: 0x00001E87 + "\x00W\x03#\x00\x00\x1e\x88" + // 0x00570323: 0x00001E88 + "\x00w\x03#\x00\x00\x1e\x89" + // 0x00770323: 0x00001E89 + "\x00X\x03\a\x00\x00\x1e\x8a" + // 0x00580307: 0x00001E8A + "\x00x\x03\a\x00\x00\x1e\x8b" + // 0x00780307: 0x00001E8B + "\x00X\x03\b\x00\x00\x1e\x8c" + // 0x00580308: 0x00001E8C + "\x00x\x03\b\x00\x00\x1e\x8d" + // 0x00780308: 0x00001E8D + "\x00Y\x03\a\x00\x00\x1e\x8e" + // 0x00590307: 0x00001E8E + "\x00y\x03\a\x00\x00\x1e\x8f" + // 0x00790307: 0x00001E8F + "\x00Z\x03\x02\x00\x00\x1e\x90" + // 0x005A0302: 0x00001E90 + "\x00z\x03\x02\x00\x00\x1e\x91" + // 0x007A0302: 0x00001E91 + "\x00Z\x03#\x00\x00\x1e\x92" + // 0x005A0323: 0x00001E92 + "\x00z\x03#\x00\x00\x1e\x93" + // 0x007A0323: 0x00001E93 + "\x00Z\x031\x00\x00\x1e\x94" + // 0x005A0331: 0x00001E94 + "\x00z\x031\x00\x00\x1e\x95" + // 0x007A0331: 0x00001E95 + "\x00h\x031\x00\x00\x1e\x96" + // 0x00680331: 0x00001E96 + "\x00t\x03\b\x00\x00\x1e\x97" + // 0x00740308: 0x00001E97 + "\x00w\x03\n\x00\x00\x1e\x98" + // 0x0077030A: 0x00001E98 + "\x00y\x03\n\x00\x00\x1e\x99" + // 0x0079030A: 0x00001E99 + "\x01\u007f\x03\a\x00\x00\x1e\x9b" + // 0x017F0307: 0x00001E9B + "\x00A\x03#\x00\x00\x1e\xa0" + // 0x00410323: 0x00001EA0 + "\x00a\x03#\x00\x00\x1e\xa1" + // 0x00610323: 0x00001EA1 + "\x00A\x03\t\x00\x00\x1e\xa2" + // 0x00410309: 0x00001EA2 + "\x00a\x03\t\x00\x00\x1e\xa3" + // 0x00610309: 0x00001EA3 + "\x00\xc2\x03\x01\x00\x00\x1e\xa4" + // 0x00C20301: 0x00001EA4 + "\x00\xe2\x03\x01\x00\x00\x1e\xa5" + // 0x00E20301: 0x00001EA5 + "\x00\xc2\x03\x00\x00\x00\x1e\xa6" + // 0x00C20300: 0x00001EA6 + "\x00\xe2\x03\x00\x00\x00\x1e\xa7" + // 0x00E20300: 0x00001EA7 + "\x00\xc2\x03\t\x00\x00\x1e\xa8" + // 0x00C20309: 0x00001EA8 + "\x00\xe2\x03\t\x00\x00\x1e\xa9" + // 0x00E20309: 0x00001EA9 + "\x00\xc2\x03\x03\x00\x00\x1e\xaa" + // 0x00C20303: 0x00001EAA + "\x00\xe2\x03\x03\x00\x00\x1e\xab" + // 0x00E20303: 0x00001EAB + "\x1e\xa0\x03\x02\x00\x00\x1e\xac" + // 0x1EA00302: 0x00001EAC + "\x1e\xa1\x03\x02\x00\x00\x1e\xad" + // 0x1EA10302: 0x00001EAD + "\x01\x02\x03\x01\x00\x00\x1e\xae" + // 0x01020301: 0x00001EAE + "\x01\x03\x03\x01\x00\x00\x1e\xaf" + // 0x01030301: 0x00001EAF + "\x01\x02\x03\x00\x00\x00\x1e\xb0" + // 0x01020300: 0x00001EB0 + "\x01\x03\x03\x00\x00\x00\x1e\xb1" + // 0x01030300: 0x00001EB1 + "\x01\x02\x03\t\x00\x00\x1e\xb2" + // 0x01020309: 0x00001EB2 + "\x01\x03\x03\t\x00\x00\x1e\xb3" + // 0x01030309: 0x00001EB3 + "\x01\x02\x03\x03\x00\x00\x1e\xb4" + // 0x01020303: 0x00001EB4 + "\x01\x03\x03\x03\x00\x00\x1e\xb5" + // 0x01030303: 0x00001EB5 + "\x1e\xa0\x03\x06\x00\x00\x1e\xb6" + // 0x1EA00306: 0x00001EB6 + "\x1e\xa1\x03\x06\x00\x00\x1e\xb7" + // 0x1EA10306: 0x00001EB7 + "\x00E\x03#\x00\x00\x1e\xb8" + // 0x00450323: 0x00001EB8 + "\x00e\x03#\x00\x00\x1e\xb9" + // 0x00650323: 0x00001EB9 + "\x00E\x03\t\x00\x00\x1e\xba" + // 0x00450309: 0x00001EBA + "\x00e\x03\t\x00\x00\x1e\xbb" + // 0x00650309: 0x00001EBB + "\x00E\x03\x03\x00\x00\x1e\xbc" + // 0x00450303: 0x00001EBC + "\x00e\x03\x03\x00\x00\x1e\xbd" + // 0x00650303: 0x00001EBD + "\x00\xca\x03\x01\x00\x00\x1e\xbe" + // 0x00CA0301: 0x00001EBE + "\x00\xea\x03\x01\x00\x00\x1e\xbf" + // 0x00EA0301: 0x00001EBF + "\x00\xca\x03\x00\x00\x00\x1e\xc0" + // 0x00CA0300: 0x00001EC0 + "\x00\xea\x03\x00\x00\x00\x1e\xc1" + // 0x00EA0300: 0x00001EC1 + "\x00\xca\x03\t\x00\x00\x1e\xc2" + // 0x00CA0309: 0x00001EC2 + "\x00\xea\x03\t\x00\x00\x1e\xc3" + // 0x00EA0309: 0x00001EC3 + "\x00\xca\x03\x03\x00\x00\x1e\xc4" + // 0x00CA0303: 0x00001EC4 + "\x00\xea\x03\x03\x00\x00\x1e\xc5" + // 0x00EA0303: 0x00001EC5 + "\x1e\xb8\x03\x02\x00\x00\x1e\xc6" + // 0x1EB80302: 0x00001EC6 + "\x1e\xb9\x03\x02\x00\x00\x1e\xc7" + // 0x1EB90302: 0x00001EC7 + "\x00I\x03\t\x00\x00\x1e\xc8" + // 0x00490309: 0x00001EC8 + "\x00i\x03\t\x00\x00\x1e\xc9" + // 0x00690309: 0x00001EC9 + "\x00I\x03#\x00\x00\x1e\xca" + // 0x00490323: 0x00001ECA + "\x00i\x03#\x00\x00\x1e\xcb" + // 0x00690323: 0x00001ECB + "\x00O\x03#\x00\x00\x1e\xcc" + // 0x004F0323: 0x00001ECC + "\x00o\x03#\x00\x00\x1e\xcd" + // 0x006F0323: 0x00001ECD + "\x00O\x03\t\x00\x00\x1e\xce" + // 0x004F0309: 0x00001ECE + "\x00o\x03\t\x00\x00\x1e\xcf" + // 0x006F0309: 0x00001ECF + "\x00\xd4\x03\x01\x00\x00\x1e\xd0" + // 0x00D40301: 0x00001ED0 + "\x00\xf4\x03\x01\x00\x00\x1e\xd1" + // 0x00F40301: 0x00001ED1 + "\x00\xd4\x03\x00\x00\x00\x1e\xd2" + // 0x00D40300: 0x00001ED2 + "\x00\xf4\x03\x00\x00\x00\x1e\xd3" + // 0x00F40300: 0x00001ED3 + "\x00\xd4\x03\t\x00\x00\x1e\xd4" + // 0x00D40309: 0x00001ED4 + "\x00\xf4\x03\t\x00\x00\x1e\xd5" + // 0x00F40309: 0x00001ED5 + "\x00\xd4\x03\x03\x00\x00\x1e\xd6" + // 0x00D40303: 0x00001ED6 + "\x00\xf4\x03\x03\x00\x00\x1e\xd7" + // 0x00F40303: 0x00001ED7 + "\x1e\xcc\x03\x02\x00\x00\x1e\xd8" + // 0x1ECC0302: 0x00001ED8 + "\x1e\xcd\x03\x02\x00\x00\x1e\xd9" + // 0x1ECD0302: 0x00001ED9 + "\x01\xa0\x03\x01\x00\x00\x1e\xda" + // 0x01A00301: 0x00001EDA + "\x01\xa1\x03\x01\x00\x00\x1e\xdb" + // 0x01A10301: 0x00001EDB + "\x01\xa0\x03\x00\x00\x00\x1e\xdc" + // 0x01A00300: 0x00001EDC + "\x01\xa1\x03\x00\x00\x00\x1e\xdd" + // 0x01A10300: 0x00001EDD + "\x01\xa0\x03\t\x00\x00\x1e\xde" + // 0x01A00309: 0x00001EDE + "\x01\xa1\x03\t\x00\x00\x1e\xdf" + // 0x01A10309: 0x00001EDF + "\x01\xa0\x03\x03\x00\x00\x1e\xe0" + // 0x01A00303: 0x00001EE0 + "\x01\xa1\x03\x03\x00\x00\x1e\xe1" + // 0x01A10303: 0x00001EE1 + "\x01\xa0\x03#\x00\x00\x1e\xe2" + // 0x01A00323: 0x00001EE2 + "\x01\xa1\x03#\x00\x00\x1e\xe3" + // 0x01A10323: 0x00001EE3 + "\x00U\x03#\x00\x00\x1e\xe4" + // 0x00550323: 0x00001EE4 + "\x00u\x03#\x00\x00\x1e\xe5" + // 0x00750323: 0x00001EE5 + "\x00U\x03\t\x00\x00\x1e\xe6" + // 0x00550309: 0x00001EE6 + "\x00u\x03\t\x00\x00\x1e\xe7" + // 0x00750309: 0x00001EE7 + "\x01\xaf\x03\x01\x00\x00\x1e\xe8" + // 0x01AF0301: 0x00001EE8 + "\x01\xb0\x03\x01\x00\x00\x1e\xe9" + // 0x01B00301: 0x00001EE9 + "\x01\xaf\x03\x00\x00\x00\x1e\xea" + // 0x01AF0300: 0x00001EEA + "\x01\xb0\x03\x00\x00\x00\x1e\xeb" + // 0x01B00300: 0x00001EEB + "\x01\xaf\x03\t\x00\x00\x1e\xec" + // 0x01AF0309: 0x00001EEC + "\x01\xb0\x03\t\x00\x00\x1e\xed" + // 0x01B00309: 0x00001EED + "\x01\xaf\x03\x03\x00\x00\x1e\xee" + // 0x01AF0303: 0x00001EEE + "\x01\xb0\x03\x03\x00\x00\x1e\xef" + // 0x01B00303: 0x00001EEF + "\x01\xaf\x03#\x00\x00\x1e\xf0" + // 0x01AF0323: 0x00001EF0 + "\x01\xb0\x03#\x00\x00\x1e\xf1" + // 0x01B00323: 0x00001EF1 + "\x00Y\x03\x00\x00\x00\x1e\xf2" + // 0x00590300: 0x00001EF2 + "\x00y\x03\x00\x00\x00\x1e\xf3" + // 0x00790300: 0x00001EF3 + "\x00Y\x03#\x00\x00\x1e\xf4" + // 0x00590323: 0x00001EF4 + "\x00y\x03#\x00\x00\x1e\xf5" + // 0x00790323: 0x00001EF5 + "\x00Y\x03\t\x00\x00\x1e\xf6" + // 0x00590309: 0x00001EF6 + "\x00y\x03\t\x00\x00\x1e\xf7" + // 0x00790309: 0x00001EF7 + "\x00Y\x03\x03\x00\x00\x1e\xf8" + // 0x00590303: 0x00001EF8 + "\x00y\x03\x03\x00\x00\x1e\xf9" + // 0x00790303: 0x00001EF9 + "\x03\xb1\x03\x13\x00\x00\x1f\x00" + // 0x03B10313: 0x00001F00 + "\x03\xb1\x03\x14\x00\x00\x1f\x01" + // 0x03B10314: 0x00001F01 + "\x1f\x00\x03\x00\x00\x00\x1f\x02" + // 0x1F000300: 0x00001F02 + "\x1f\x01\x03\x00\x00\x00\x1f\x03" + // 0x1F010300: 0x00001F03 + "\x1f\x00\x03\x01\x00\x00\x1f\x04" + // 0x1F000301: 0x00001F04 + "\x1f\x01\x03\x01\x00\x00\x1f\x05" + // 0x1F010301: 0x00001F05 + "\x1f\x00\x03B\x00\x00\x1f\x06" + // 0x1F000342: 0x00001F06 + "\x1f\x01\x03B\x00\x00\x1f\a" + // 0x1F010342: 0x00001F07 + "\x03\x91\x03\x13\x00\x00\x1f\b" + // 0x03910313: 0x00001F08 + "\x03\x91\x03\x14\x00\x00\x1f\t" + // 0x03910314: 0x00001F09 + "\x1f\b\x03\x00\x00\x00\x1f\n" + // 0x1F080300: 0x00001F0A + "\x1f\t\x03\x00\x00\x00\x1f\v" + // 0x1F090300: 0x00001F0B + "\x1f\b\x03\x01\x00\x00\x1f\f" + // 0x1F080301: 0x00001F0C + "\x1f\t\x03\x01\x00\x00\x1f\r" + // 0x1F090301: 0x00001F0D + "\x1f\b\x03B\x00\x00\x1f\x0e" + // 0x1F080342: 0x00001F0E + "\x1f\t\x03B\x00\x00\x1f\x0f" + // 0x1F090342: 0x00001F0F + "\x03\xb5\x03\x13\x00\x00\x1f\x10" + // 0x03B50313: 0x00001F10 + "\x03\xb5\x03\x14\x00\x00\x1f\x11" + // 0x03B50314: 0x00001F11 + "\x1f\x10\x03\x00\x00\x00\x1f\x12" + // 0x1F100300: 0x00001F12 + "\x1f\x11\x03\x00\x00\x00\x1f\x13" + // 0x1F110300: 0x00001F13 + "\x1f\x10\x03\x01\x00\x00\x1f\x14" + // 0x1F100301: 0x00001F14 + "\x1f\x11\x03\x01\x00\x00\x1f\x15" + // 0x1F110301: 0x00001F15 + "\x03\x95\x03\x13\x00\x00\x1f\x18" + // 0x03950313: 0x00001F18 + "\x03\x95\x03\x14\x00\x00\x1f\x19" + // 0x03950314: 0x00001F19 + "\x1f\x18\x03\x00\x00\x00\x1f\x1a" + // 0x1F180300: 0x00001F1A + "\x1f\x19\x03\x00\x00\x00\x1f\x1b" + // 0x1F190300: 0x00001F1B + "\x1f\x18\x03\x01\x00\x00\x1f\x1c" + // 0x1F180301: 0x00001F1C + "\x1f\x19\x03\x01\x00\x00\x1f\x1d" + // 0x1F190301: 0x00001F1D + "\x03\xb7\x03\x13\x00\x00\x1f " + // 0x03B70313: 0x00001F20 + "\x03\xb7\x03\x14\x00\x00\x1f!" + // 0x03B70314: 0x00001F21 + "\x1f \x03\x00\x00\x00\x1f\"" + // 0x1F200300: 0x00001F22 + "\x1f!\x03\x00\x00\x00\x1f#" + // 0x1F210300: 0x00001F23 + "\x1f \x03\x01\x00\x00\x1f$" + // 0x1F200301: 0x00001F24 + "\x1f!\x03\x01\x00\x00\x1f%" + // 0x1F210301: 0x00001F25 + "\x1f \x03B\x00\x00\x1f&" + // 0x1F200342: 0x00001F26 + "\x1f!\x03B\x00\x00\x1f'" + // 0x1F210342: 0x00001F27 + "\x03\x97\x03\x13\x00\x00\x1f(" + // 0x03970313: 0x00001F28 + "\x03\x97\x03\x14\x00\x00\x1f)" + // 0x03970314: 0x00001F29 + "\x1f(\x03\x00\x00\x00\x1f*" + // 0x1F280300: 0x00001F2A + "\x1f)\x03\x00\x00\x00\x1f+" + // 0x1F290300: 0x00001F2B + "\x1f(\x03\x01\x00\x00\x1f," + // 0x1F280301: 0x00001F2C + "\x1f)\x03\x01\x00\x00\x1f-" + // 0x1F290301: 0x00001F2D + "\x1f(\x03B\x00\x00\x1f." + // 0x1F280342: 0x00001F2E + "\x1f)\x03B\x00\x00\x1f/" + // 0x1F290342: 0x00001F2F + "\x03\xb9\x03\x13\x00\x00\x1f0" + // 0x03B90313: 0x00001F30 + "\x03\xb9\x03\x14\x00\x00\x1f1" + // 0x03B90314: 0x00001F31 + "\x1f0\x03\x00\x00\x00\x1f2" + // 0x1F300300: 0x00001F32 + "\x1f1\x03\x00\x00\x00\x1f3" + // 0x1F310300: 0x00001F33 + "\x1f0\x03\x01\x00\x00\x1f4" + // 0x1F300301: 0x00001F34 + "\x1f1\x03\x01\x00\x00\x1f5" + // 0x1F310301: 0x00001F35 + "\x1f0\x03B\x00\x00\x1f6" + // 0x1F300342: 0x00001F36 + "\x1f1\x03B\x00\x00\x1f7" + // 0x1F310342: 0x00001F37 + "\x03\x99\x03\x13\x00\x00\x1f8" + // 0x03990313: 0x00001F38 + "\x03\x99\x03\x14\x00\x00\x1f9" + // 0x03990314: 0x00001F39 + "\x1f8\x03\x00\x00\x00\x1f:" + // 0x1F380300: 0x00001F3A + "\x1f9\x03\x00\x00\x00\x1f;" + // 0x1F390300: 0x00001F3B + "\x1f8\x03\x01\x00\x00\x1f<" + // 0x1F380301: 0x00001F3C + "\x1f9\x03\x01\x00\x00\x1f=" + // 0x1F390301: 0x00001F3D + "\x1f8\x03B\x00\x00\x1f>" + // 0x1F380342: 0x00001F3E + "\x1f9\x03B\x00\x00\x1f?" + // 0x1F390342: 0x00001F3F + "\x03\xbf\x03\x13\x00\x00\x1f@" + // 0x03BF0313: 0x00001F40 + "\x03\xbf\x03\x14\x00\x00\x1fA" + // 0x03BF0314: 0x00001F41 + "\x1f@\x03\x00\x00\x00\x1fB" + // 0x1F400300: 0x00001F42 + "\x1fA\x03\x00\x00\x00\x1fC" + // 0x1F410300: 0x00001F43 + "\x1f@\x03\x01\x00\x00\x1fD" + // 0x1F400301: 0x00001F44 + "\x1fA\x03\x01\x00\x00\x1fE" + // 0x1F410301: 0x00001F45 + "\x03\x9f\x03\x13\x00\x00\x1fH" + // 0x039F0313: 0x00001F48 + "\x03\x9f\x03\x14\x00\x00\x1fI" + // 0x039F0314: 0x00001F49 + "\x1fH\x03\x00\x00\x00\x1fJ" + // 0x1F480300: 0x00001F4A + "\x1fI\x03\x00\x00\x00\x1fK" + // 0x1F490300: 0x00001F4B + "\x1fH\x03\x01\x00\x00\x1fL" + // 0x1F480301: 0x00001F4C + "\x1fI\x03\x01\x00\x00\x1fM" + // 0x1F490301: 0x00001F4D + "\x03\xc5\x03\x13\x00\x00\x1fP" + // 0x03C50313: 0x00001F50 + "\x03\xc5\x03\x14\x00\x00\x1fQ" + // 0x03C50314: 0x00001F51 + "\x1fP\x03\x00\x00\x00\x1fR" + // 0x1F500300: 0x00001F52 + "\x1fQ\x03\x00\x00\x00\x1fS" + // 0x1F510300: 0x00001F53 + "\x1fP\x03\x01\x00\x00\x1fT" + // 0x1F500301: 0x00001F54 + "\x1fQ\x03\x01\x00\x00\x1fU" + // 0x1F510301: 0x00001F55 + "\x1fP\x03B\x00\x00\x1fV" + // 0x1F500342: 0x00001F56 + "\x1fQ\x03B\x00\x00\x1fW" + // 0x1F510342: 0x00001F57 + "\x03\xa5\x03\x14\x00\x00\x1fY" + // 0x03A50314: 0x00001F59 + "\x1fY\x03\x00\x00\x00\x1f[" + // 0x1F590300: 0x00001F5B + "\x1fY\x03\x01\x00\x00\x1f]" + // 0x1F590301: 0x00001F5D + "\x1fY\x03B\x00\x00\x1f_" + // 0x1F590342: 0x00001F5F + "\x03\xc9\x03\x13\x00\x00\x1f`" + // 0x03C90313: 0x00001F60 + "\x03\xc9\x03\x14\x00\x00\x1fa" + // 0x03C90314: 0x00001F61 + "\x1f`\x03\x00\x00\x00\x1fb" + // 0x1F600300: 0x00001F62 + "\x1fa\x03\x00\x00\x00\x1fc" + // 0x1F610300: 0x00001F63 + "\x1f`\x03\x01\x00\x00\x1fd" + // 0x1F600301: 0x00001F64 + "\x1fa\x03\x01\x00\x00\x1fe" + // 0x1F610301: 0x00001F65 + "\x1f`\x03B\x00\x00\x1ff" + // 0x1F600342: 0x00001F66 + "\x1fa\x03B\x00\x00\x1fg" + // 0x1F610342: 0x00001F67 + "\x03\xa9\x03\x13\x00\x00\x1fh" + // 0x03A90313: 0x00001F68 + "\x03\xa9\x03\x14\x00\x00\x1fi" + // 0x03A90314: 0x00001F69 + "\x1fh\x03\x00\x00\x00\x1fj" + // 0x1F680300: 0x00001F6A + "\x1fi\x03\x00\x00\x00\x1fk" + // 0x1F690300: 0x00001F6B + "\x1fh\x03\x01\x00\x00\x1fl" + // 0x1F680301: 0x00001F6C + "\x1fi\x03\x01\x00\x00\x1fm" + // 0x1F690301: 0x00001F6D + "\x1fh\x03B\x00\x00\x1fn" + // 0x1F680342: 0x00001F6E + "\x1fi\x03B\x00\x00\x1fo" + // 0x1F690342: 0x00001F6F + "\x03\xb1\x03\x00\x00\x00\x1fp" + // 0x03B10300: 0x00001F70 + "\x03\xb5\x03\x00\x00\x00\x1fr" + // 0x03B50300: 0x00001F72 + "\x03\xb7\x03\x00\x00\x00\x1ft" + // 0x03B70300: 0x00001F74 + "\x03\xb9\x03\x00\x00\x00\x1fv" + // 0x03B90300: 0x00001F76 + "\x03\xbf\x03\x00\x00\x00\x1fx" + // 0x03BF0300: 0x00001F78 + "\x03\xc5\x03\x00\x00\x00\x1fz" + // 0x03C50300: 0x00001F7A + "\x03\xc9\x03\x00\x00\x00\x1f|" + // 0x03C90300: 0x00001F7C + "\x1f\x00\x03E\x00\x00\x1f\x80" + // 0x1F000345: 0x00001F80 + "\x1f\x01\x03E\x00\x00\x1f\x81" + // 0x1F010345: 0x00001F81 + "\x1f\x02\x03E\x00\x00\x1f\x82" + // 0x1F020345: 0x00001F82 + "\x1f\x03\x03E\x00\x00\x1f\x83" + // 0x1F030345: 0x00001F83 + "\x1f\x04\x03E\x00\x00\x1f\x84" + // 0x1F040345: 0x00001F84 + "\x1f\x05\x03E\x00\x00\x1f\x85" + // 0x1F050345: 0x00001F85 + "\x1f\x06\x03E\x00\x00\x1f\x86" + // 0x1F060345: 0x00001F86 + "\x1f\a\x03E\x00\x00\x1f\x87" + // 0x1F070345: 0x00001F87 + "\x1f\b\x03E\x00\x00\x1f\x88" + // 0x1F080345: 0x00001F88 + "\x1f\t\x03E\x00\x00\x1f\x89" + // 0x1F090345: 0x00001F89 + "\x1f\n\x03E\x00\x00\x1f\x8a" + // 0x1F0A0345: 0x00001F8A + "\x1f\v\x03E\x00\x00\x1f\x8b" + // 0x1F0B0345: 0x00001F8B + "\x1f\f\x03E\x00\x00\x1f\x8c" + // 0x1F0C0345: 0x00001F8C + "\x1f\r\x03E\x00\x00\x1f\x8d" + // 0x1F0D0345: 0x00001F8D + "\x1f\x0e\x03E\x00\x00\x1f\x8e" + // 0x1F0E0345: 0x00001F8E + "\x1f\x0f\x03E\x00\x00\x1f\x8f" + // 0x1F0F0345: 0x00001F8F + "\x1f \x03E\x00\x00\x1f\x90" + // 0x1F200345: 0x00001F90 + "\x1f!\x03E\x00\x00\x1f\x91" + // 0x1F210345: 0x00001F91 + "\x1f\"\x03E\x00\x00\x1f\x92" + // 0x1F220345: 0x00001F92 + "\x1f#\x03E\x00\x00\x1f\x93" + // 0x1F230345: 0x00001F93 + "\x1f$\x03E\x00\x00\x1f\x94" + // 0x1F240345: 0x00001F94 + "\x1f%\x03E\x00\x00\x1f\x95" + // 0x1F250345: 0x00001F95 + "\x1f&\x03E\x00\x00\x1f\x96" + // 0x1F260345: 0x00001F96 + "\x1f'\x03E\x00\x00\x1f\x97" + // 0x1F270345: 0x00001F97 + "\x1f(\x03E\x00\x00\x1f\x98" + // 0x1F280345: 0x00001F98 + "\x1f)\x03E\x00\x00\x1f\x99" + // 0x1F290345: 0x00001F99 + "\x1f*\x03E\x00\x00\x1f\x9a" + // 0x1F2A0345: 0x00001F9A + "\x1f+\x03E\x00\x00\x1f\x9b" + // 0x1F2B0345: 0x00001F9B + "\x1f,\x03E\x00\x00\x1f\x9c" + // 0x1F2C0345: 0x00001F9C + "\x1f-\x03E\x00\x00\x1f\x9d" + // 0x1F2D0345: 0x00001F9D + "\x1f.\x03E\x00\x00\x1f\x9e" + // 0x1F2E0345: 0x00001F9E + "\x1f/\x03E\x00\x00\x1f\x9f" + // 0x1F2F0345: 0x00001F9F + "\x1f`\x03E\x00\x00\x1f\xa0" + // 0x1F600345: 0x00001FA0 + "\x1fa\x03E\x00\x00\x1f\xa1" + // 0x1F610345: 0x00001FA1 + "\x1fb\x03E\x00\x00\x1f\xa2" + // 0x1F620345: 0x00001FA2 + "\x1fc\x03E\x00\x00\x1f\xa3" + // 0x1F630345: 0x00001FA3 + "\x1fd\x03E\x00\x00\x1f\xa4" + // 0x1F640345: 0x00001FA4 + "\x1fe\x03E\x00\x00\x1f\xa5" + // 0x1F650345: 0x00001FA5 + "\x1ff\x03E\x00\x00\x1f\xa6" + // 0x1F660345: 0x00001FA6 + "\x1fg\x03E\x00\x00\x1f\xa7" + // 0x1F670345: 0x00001FA7 + "\x1fh\x03E\x00\x00\x1f\xa8" + // 0x1F680345: 0x00001FA8 + "\x1fi\x03E\x00\x00\x1f\xa9" + // 0x1F690345: 0x00001FA9 + "\x1fj\x03E\x00\x00\x1f\xaa" + // 0x1F6A0345: 0x00001FAA + "\x1fk\x03E\x00\x00\x1f\xab" + // 0x1F6B0345: 0x00001FAB + "\x1fl\x03E\x00\x00\x1f\xac" + // 0x1F6C0345: 0x00001FAC + "\x1fm\x03E\x00\x00\x1f\xad" + // 0x1F6D0345: 0x00001FAD + "\x1fn\x03E\x00\x00\x1f\xae" + // 0x1F6E0345: 0x00001FAE + "\x1fo\x03E\x00\x00\x1f\xaf" + // 0x1F6F0345: 0x00001FAF + "\x03\xb1\x03\x06\x00\x00\x1f\xb0" + // 0x03B10306: 0x00001FB0 + "\x03\xb1\x03\x04\x00\x00\x1f\xb1" + // 0x03B10304: 0x00001FB1 + "\x1fp\x03E\x00\x00\x1f\xb2" + // 0x1F700345: 0x00001FB2 + "\x03\xb1\x03E\x00\x00\x1f\xb3" + // 0x03B10345: 0x00001FB3 + "\x03\xac\x03E\x00\x00\x1f\xb4" + // 0x03AC0345: 0x00001FB4 + "\x03\xb1\x03B\x00\x00\x1f\xb6" + // 0x03B10342: 0x00001FB6 + "\x1f\xb6\x03E\x00\x00\x1f\xb7" + // 0x1FB60345: 0x00001FB7 + "\x03\x91\x03\x06\x00\x00\x1f\xb8" + // 0x03910306: 0x00001FB8 + "\x03\x91\x03\x04\x00\x00\x1f\xb9" + // 0x03910304: 0x00001FB9 + "\x03\x91\x03\x00\x00\x00\x1f\xba" + // 0x03910300: 0x00001FBA + "\x03\x91\x03E\x00\x00\x1f\xbc" + // 0x03910345: 0x00001FBC + "\x00\xa8\x03B\x00\x00\x1f\xc1" + // 0x00A80342: 0x00001FC1 + "\x1ft\x03E\x00\x00\x1f\xc2" + // 0x1F740345: 0x00001FC2 + "\x03\xb7\x03E\x00\x00\x1f\xc3" + // 0x03B70345: 0x00001FC3 + "\x03\xae\x03E\x00\x00\x1f\xc4" + // 0x03AE0345: 0x00001FC4 + "\x03\xb7\x03B\x00\x00\x1f\xc6" + // 0x03B70342: 0x00001FC6 + "\x1f\xc6\x03E\x00\x00\x1f\xc7" + // 0x1FC60345: 0x00001FC7 + "\x03\x95\x03\x00\x00\x00\x1f\xc8" + // 0x03950300: 0x00001FC8 + "\x03\x97\x03\x00\x00\x00\x1f\xca" + // 0x03970300: 0x00001FCA + "\x03\x97\x03E\x00\x00\x1f\xcc" + // 0x03970345: 0x00001FCC + "\x1f\xbf\x03\x00\x00\x00\x1f\xcd" + // 0x1FBF0300: 0x00001FCD + "\x1f\xbf\x03\x01\x00\x00\x1f\xce" + // 0x1FBF0301: 0x00001FCE + "\x1f\xbf\x03B\x00\x00\x1f\xcf" + // 0x1FBF0342: 0x00001FCF + "\x03\xb9\x03\x06\x00\x00\x1f\xd0" + // 0x03B90306: 0x00001FD0 + "\x03\xb9\x03\x04\x00\x00\x1f\xd1" + // 0x03B90304: 0x00001FD1 + "\x03\xca\x03\x00\x00\x00\x1f\xd2" + // 0x03CA0300: 0x00001FD2 + "\x03\xb9\x03B\x00\x00\x1f\xd6" + // 0x03B90342: 0x00001FD6 + "\x03\xca\x03B\x00\x00\x1f\xd7" + // 0x03CA0342: 0x00001FD7 + "\x03\x99\x03\x06\x00\x00\x1f\xd8" + // 0x03990306: 0x00001FD8 + "\x03\x99\x03\x04\x00\x00\x1f\xd9" + // 0x03990304: 0x00001FD9 + "\x03\x99\x03\x00\x00\x00\x1f\xda" + // 0x03990300: 0x00001FDA + "\x1f\xfe\x03\x00\x00\x00\x1f\xdd" + // 0x1FFE0300: 0x00001FDD + "\x1f\xfe\x03\x01\x00\x00\x1f\xde" + // 0x1FFE0301: 0x00001FDE + "\x1f\xfe\x03B\x00\x00\x1f\xdf" + // 0x1FFE0342: 0x00001FDF + "\x03\xc5\x03\x06\x00\x00\x1f\xe0" + // 0x03C50306: 0x00001FE0 + "\x03\xc5\x03\x04\x00\x00\x1f\xe1" + // 0x03C50304: 0x00001FE1 + "\x03\xcb\x03\x00\x00\x00\x1f\xe2" + // 0x03CB0300: 0x00001FE2 + "\x03\xc1\x03\x13\x00\x00\x1f\xe4" + // 0x03C10313: 0x00001FE4 + "\x03\xc1\x03\x14\x00\x00\x1f\xe5" + // 0x03C10314: 0x00001FE5 + "\x03\xc5\x03B\x00\x00\x1f\xe6" + // 0x03C50342: 0x00001FE6 + "\x03\xcb\x03B\x00\x00\x1f\xe7" + // 0x03CB0342: 0x00001FE7 + "\x03\xa5\x03\x06\x00\x00\x1f\xe8" + // 0x03A50306: 0x00001FE8 + "\x03\xa5\x03\x04\x00\x00\x1f\xe9" + // 0x03A50304: 0x00001FE9 + "\x03\xa5\x03\x00\x00\x00\x1f\xea" + // 0x03A50300: 0x00001FEA + "\x03\xa1\x03\x14\x00\x00\x1f\xec" + // 0x03A10314: 0x00001FEC + "\x00\xa8\x03\x00\x00\x00\x1f\xed" + // 0x00A80300: 0x00001FED + "\x1f|\x03E\x00\x00\x1f\xf2" + // 0x1F7C0345: 0x00001FF2 + "\x03\xc9\x03E\x00\x00\x1f\xf3" + // 0x03C90345: 0x00001FF3 + "\x03\xce\x03E\x00\x00\x1f\xf4" + // 0x03CE0345: 0x00001FF4 + "\x03\xc9\x03B\x00\x00\x1f\xf6" + // 0x03C90342: 0x00001FF6 + "\x1f\xf6\x03E\x00\x00\x1f\xf7" + // 0x1FF60345: 0x00001FF7 + "\x03\x9f\x03\x00\x00\x00\x1f\xf8" + // 0x039F0300: 0x00001FF8 + "\x03\xa9\x03\x00\x00\x00\x1f\xfa" + // 0x03A90300: 0x00001FFA + "\x03\xa9\x03E\x00\x00\x1f\xfc" + // 0x03A90345: 0x00001FFC + "!\x90\x038\x00\x00!\x9a" + // 0x21900338: 0x0000219A + "!\x92\x038\x00\x00!\x9b" + // 0x21920338: 0x0000219B + "!\x94\x038\x00\x00!\xae" + // 0x21940338: 0x000021AE + "!\xd0\x038\x00\x00!\xcd" + // 0x21D00338: 0x000021CD + "!\xd4\x038\x00\x00!\xce" + // 0x21D40338: 0x000021CE + "!\xd2\x038\x00\x00!\xcf" + // 0x21D20338: 0x000021CF + "\"\x03\x038\x00\x00\"\x04" + // 0x22030338: 0x00002204 + "\"\b\x038\x00\x00\"\t" + // 0x22080338: 0x00002209 + "\"\v\x038\x00\x00\"\f" + // 0x220B0338: 0x0000220C + "\"#\x038\x00\x00\"$" + // 0x22230338: 0x00002224 + "\"%\x038\x00\x00\"&" + // 0x22250338: 0x00002226 + "\"<\x038\x00\x00\"A" + // 0x223C0338: 0x00002241 + "\"C\x038\x00\x00\"D" + // 0x22430338: 0x00002244 + "\"E\x038\x00\x00\"G" + // 0x22450338: 0x00002247 + "\"H\x038\x00\x00\"I" + // 0x22480338: 0x00002249 + "\x00=\x038\x00\x00\"`" + // 0x003D0338: 0x00002260 + "\"a\x038\x00\x00\"b" + // 0x22610338: 0x00002262 + "\"M\x038\x00\x00\"m" + // 0x224D0338: 0x0000226D + "\x00<\x038\x00\x00\"n" + // 0x003C0338: 0x0000226E + "\x00>\x038\x00\x00\"o" + // 0x003E0338: 0x0000226F + "\"d\x038\x00\x00\"p" + // 0x22640338: 0x00002270 + "\"e\x038\x00\x00\"q" + // 0x22650338: 0x00002271 + "\"r\x038\x00\x00\"t" + // 0x22720338: 0x00002274 + "\"s\x038\x00\x00\"u" + // 0x22730338: 0x00002275 + "\"v\x038\x00\x00\"x" + // 0x22760338: 0x00002278 + "\"w\x038\x00\x00\"y" + // 0x22770338: 0x00002279 + "\"z\x038\x00\x00\"\x80" + // 0x227A0338: 0x00002280 + "\"{\x038\x00\x00\"\x81" + // 0x227B0338: 0x00002281 + "\"\x82\x038\x00\x00\"\x84" + // 0x22820338: 0x00002284 + "\"\x83\x038\x00\x00\"\x85" + // 0x22830338: 0x00002285 + "\"\x86\x038\x00\x00\"\x88" + // 0x22860338: 0x00002288 + "\"\x87\x038\x00\x00\"\x89" + // 0x22870338: 0x00002289 + "\"\xa2\x038\x00\x00\"\xac" + // 0x22A20338: 0x000022AC + "\"\xa8\x038\x00\x00\"\xad" + // 0x22A80338: 0x000022AD + "\"\xa9\x038\x00\x00\"\xae" + // 0x22A90338: 0x000022AE + "\"\xab\x038\x00\x00\"\xaf" + // 0x22AB0338: 0x000022AF + "\"|\x038\x00\x00\"\xe0" + // 0x227C0338: 0x000022E0 + "\"}\x038\x00\x00\"\xe1" + // 0x227D0338: 0x000022E1 + "\"\x91\x038\x00\x00\"\xe2" + // 0x22910338: 0x000022E2 + "\"\x92\x038\x00\x00\"\xe3" + // 0x22920338: 0x000022E3 + "\"\xb2\x038\x00\x00\"\xea" + // 0x22B20338: 0x000022EA + "\"\xb3\x038\x00\x00\"\xeb" + // 0x22B30338: 0x000022EB + "\"\xb4\x038\x00\x00\"\xec" + // 0x22B40338: 0x000022EC + "\"\xb5\x038\x00\x00\"\xed" + // 0x22B50338: 0x000022ED + "0K0\x99\x00\x000L" + // 0x304B3099: 0x0000304C + "0M0\x99\x00\x000N" + // 0x304D3099: 0x0000304E + "0O0\x99\x00\x000P" + // 0x304F3099: 0x00003050 + "0Q0\x99\x00\x000R" + // 0x30513099: 0x00003052 + "0S0\x99\x00\x000T" + // 0x30533099: 0x00003054 + "0U0\x99\x00\x000V" + // 0x30553099: 0x00003056 + "0W0\x99\x00\x000X" + // 0x30573099: 0x00003058 + "0Y0\x99\x00\x000Z" + // 0x30593099: 0x0000305A + "0[0\x99\x00\x000\\" + // 0x305B3099: 0x0000305C + "0]0\x99\x00\x000^" + // 0x305D3099: 0x0000305E + "0_0\x99\x00\x000`" + // 0x305F3099: 0x00003060 + "0a0\x99\x00\x000b" + // 0x30613099: 0x00003062 + "0d0\x99\x00\x000e" + // 0x30643099: 0x00003065 + "0f0\x99\x00\x000g" + // 0x30663099: 0x00003067 + "0h0\x99\x00\x000i" + // 0x30683099: 0x00003069 + "0o0\x99\x00\x000p" + // 0x306F3099: 0x00003070 + "0o0\x9a\x00\x000q" + // 0x306F309A: 0x00003071 + "0r0\x99\x00\x000s" + // 0x30723099: 0x00003073 + "0r0\x9a\x00\x000t" + // 0x3072309A: 0x00003074 + "0u0\x99\x00\x000v" + // 0x30753099: 0x00003076 + "0u0\x9a\x00\x000w" + // 0x3075309A: 0x00003077 + "0x0\x99\x00\x000y" + // 0x30783099: 0x00003079 + "0x0\x9a\x00\x000z" + // 0x3078309A: 0x0000307A + "0{0\x99\x00\x000|" + // 0x307B3099: 0x0000307C + "0{0\x9a\x00\x000}" + // 0x307B309A: 0x0000307D + "0F0\x99\x00\x000\x94" + // 0x30463099: 0x00003094 + "0\x9d0\x99\x00\x000\x9e" + // 0x309D3099: 0x0000309E + "0\xab0\x99\x00\x000\xac" + // 0x30AB3099: 0x000030AC + "0\xad0\x99\x00\x000\xae" + // 0x30AD3099: 0x000030AE + "0\xaf0\x99\x00\x000\xb0" + // 0x30AF3099: 0x000030B0 + "0\xb10\x99\x00\x000\xb2" + // 0x30B13099: 0x000030B2 + "0\xb30\x99\x00\x000\xb4" + // 0x30B33099: 0x000030B4 + "0\xb50\x99\x00\x000\xb6" + // 0x30B53099: 0x000030B6 + "0\xb70\x99\x00\x000\xb8" + // 0x30B73099: 0x000030B8 + "0\xb90\x99\x00\x000\xba" + // 0x30B93099: 0x000030BA + "0\xbb0\x99\x00\x000\xbc" + // 0x30BB3099: 0x000030BC + "0\xbd0\x99\x00\x000\xbe" + // 0x30BD3099: 0x000030BE + "0\xbf0\x99\x00\x000\xc0" + // 0x30BF3099: 0x000030C0 + "0\xc10\x99\x00\x000\xc2" + // 0x30C13099: 0x000030C2 + "0\xc40\x99\x00\x000\xc5" + // 0x30C43099: 0x000030C5 + "0\xc60\x99\x00\x000\xc7" + // 0x30C63099: 0x000030C7 + "0\xc80\x99\x00\x000\xc9" + // 0x30C83099: 0x000030C9 + "0\xcf0\x99\x00\x000\xd0" + // 0x30CF3099: 0x000030D0 + "0\xcf0\x9a\x00\x000\xd1" + // 0x30CF309A: 0x000030D1 + "0\xd20\x99\x00\x000\xd3" + // 0x30D23099: 0x000030D3 + "0\xd20\x9a\x00\x000\xd4" + // 0x30D2309A: 0x000030D4 + "0\xd50\x99\x00\x000\xd6" + // 0x30D53099: 0x000030D6 + "0\xd50\x9a\x00\x000\xd7" + // 0x30D5309A: 0x000030D7 + "0\xd80\x99\x00\x000\xd9" + // 0x30D83099: 0x000030D9 + "0\xd80\x9a\x00\x000\xda" + // 0x30D8309A: 0x000030DA + "0\xdb0\x99\x00\x000\xdc" + // 0x30DB3099: 0x000030DC + "0\xdb0\x9a\x00\x000\xdd" + // 0x30DB309A: 0x000030DD + "0\xa60\x99\x00\x000\xf4" + // 0x30A63099: 0x000030F4 + "0\xef0\x99\x00\x000\xf7" + // 0x30EF3099: 0x000030F7 + "0\xf00\x99\x00\x000\xf8" + // 0x30F03099: 0x000030F8 + "0\xf10\x99\x00\x000\xf9" + // 0x30F13099: 0x000030F9 + "0\xf20\x99\x00\x000\xfa" + // 0x30F23099: 0x000030FA + "0\xfd0\x99\x00\x000\xfe" + // 0x30FD3099: 0x000030FE + "\x10\x99\x10\xba\x00\x01\x10\x9a" + // 0x109910BA: 0x0001109A + "\x10\x9b\x10\xba\x00\x01\x10\x9c" + // 0x109B10BA: 0x0001109C + "\x10\xa5\x10\xba\x00\x01\x10\xab" + // 0x10A510BA: 0x000110AB + "\x111\x11'\x00\x01\x11." + // 0x11311127: 0x0001112E + "\x112\x11'\x00\x01\x11/" + // 0x11321127: 0x0001112F + "\x13G\x13>\x00\x01\x13K" + // 0x1347133E: 0x0001134B + "\x13G\x13W\x00\x01\x13L" + // 0x13471357: 0x0001134C + "\x14\xb9\x14\xba\x00\x01\x14\xbb" + // 0x14B914BA: 0x000114BB + "\x14\xb9\x14\xb0\x00\x01\x14\xbc" + // 0x14B914B0: 0x000114BC + "\x14\xb9\x14\xbd\x00\x01\x14\xbe" + // 0x14B914BD: 0x000114BE + "\x15\xb8\x15\xaf\x00\x01\x15\xba" + // 0x15B815AF: 0x000115BA + "\x15\xb9\x15\xaf\x00\x01\x15\xbb" + // 0x15B915AF: 0x000115BB + "" + // Total size of tables: 53KB (54514 bytes) diff --git a/vendor/golang.org/x/text/unicode/norm/transform.go b/vendor/golang.org/x/text/unicode/norm/transform.go index 9f47efba..a1d366ae 100644 --- a/vendor/golang.org/x/text/unicode/norm/transform.go +++ b/vendor/golang.org/x/text/unicode/norm/transform.go @@ -18,7 +18,6 @@ func (Form) Reset() {} // Users should either catch ErrShortDst and allow dst to grow or have dst be at // least of size MaxTransformChunkSize to be guaranteed of progress. func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - n := 0 // Cap the maximum number of src bytes to check. b := src eof := atEOF @@ -27,13 +26,14 @@ func (f Form) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) eof = false b = b[:ns] } - i, ok := formTable[f].quickSpan(inputBytes(b), n, len(b), eof) - n += copy(dst[n:], b[n:i]) + i, ok := formTable[f].quickSpan(inputBytes(b), 0, len(b), eof) + n := copy(dst, b[:i]) if !ok { nDst, nSrc, err = f.transform(dst[n:], src[n:], atEOF) return nDst + n, nSrc + n, err } - if n < len(src) && !atEOF { + + if err == nil && n < len(src) && !atEOF { err = transform.ErrShortSrc } return n, n, err @@ -79,7 +79,7 @@ func (f Form) transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) nSrc += n nDst += n if ok { - if n < rb.nsrc && !atEOF { + if err == nil && n < rb.nsrc && !atEOF { err = transform.ErrShortSrc } return nDst, nSrc, err diff --git a/vendor/google.golang.org/api/storage/v1/storage-api.json b/vendor/google.golang.org/api/storage/v1/storage-api.json index 20b9699e..ca630362 100644 --- a/vendor/google.golang.org/api/storage/v1/storage-api.json +++ b/vendor/google.golang.org/api/storage/v1/storage-api.json @@ -26,7 +26,7 @@ "description": "Stores and retrieves potentially large, immutable data objects.", "discoveryVersion": "v1", "documentationLink": "https://developers.google.com/storage/docs/json_api/", - "etag": "\"VPK3KBfpaEgZ16pozGOoMYfKc0U/p_spPkWHsRi33PRBHlYtU2G_uKg\"", + "etag": "\"VPK3KBfpaEgZ16pozGOoMYfKc0U/g26t9M1iNI-j1-5ry7bpKWNPs60\"", "icons": { "x16": "https://www.google.com/images/icons/product/cloud_storage-16.png", "x32": "https://www.google.com/images/icons/product/cloud_storage-32.png" @@ -3196,7 +3196,7 @@ } } }, - "revision": "20190426", + "revision": "20190523", "rootUrl": "https://www.googleapis.com/", "schemas": { "Bucket": { @@ -3742,11 +3742,6 @@ "description": "Textual representation of an expression in Common Expression Language syntax. The application context of the containing message determines which well-known feature set of CEL is supported.", "type": "string" }, - "kind": { - "default": "storage#expr", - "description": "The kind of item this is. For storage, this is always storage#expr. This field is ignored on input.", - "type": "string" - }, "location": { "description": "An optional string indicating the location of the expression for error reporting, e.g. a file name and a position in the file.", "type": "string" diff --git a/vendor/google.golang.org/api/storage/v1/storage-gen.go b/vendor/google.golang.org/api/storage/v1/storage-gen.go index 9924efb8..36e37a1a 100644 --- a/vendor/google.golang.org/api/storage/v1/storage-gen.go +++ b/vendor/google.golang.org/api/storage/v1/storage-gen.go @@ -1291,10 +1291,6 @@ type Expr struct { // message determines which well-known feature set of CEL is supported. Expression string `json:"expression,omitempty"` - // Kind: The kind of item this is. For storage, this is always - // storage#expr. This field is ignored on input. - Kind string `json:"kind,omitempty"` - // Location: An optional string indicating the location of the // expression for error reporting, e.g. a file name and a position in // the file. diff --git a/vendor/google.golang.org/appengine/README.md b/vendor/google.golang.org/appengine/README.md index d86768a2..9fdbacd3 100644 --- a/vendor/google.golang.org/appengine/README.md +++ b/vendor/google.golang.org/appengine/README.md @@ -71,3 +71,30 @@ A few APIs were cleaned up, and there are some differences: [blobstore package](https://google.golang.org/appengine/blobstore). * `appengine/socket` is not required on App Engine flexible environment / Managed VMs. Use the standard `net` package instead. + +## Key Encode/Decode compatibiltiy to help with datastore library migrations + +Key compatibility updates have been added to help customers transition from google.golang.org/appengine/datastore to cloud.google.com/go/datastore. +The `EnableKeyConversion` enables automatic conversion from a key encoded with cloud.google.com/go/datastore to google.golang.org/appengine/datastore key type. + +### Enabling key conversion + +Enable key conversion by calling `EnableKeyConversion(ctx)` in the `/_ah/start` handler for basic and manual scaling or any handler in automatic scaling. + +#### 1. Basic or manual scaling + +This start handler will enable key conversion for all handlers in the service. + +``` +http.HandleFunc("/_ah/start", func(w http.ResponseWriter, r *http.Request) { + datastore.EnableKeyConversion(appengine.NewContext(r)) +}) +``` + +#### 2. Automatic scaling + +`/_ah/start` is not supported for automatic scaling and `/_ah/warmup` is not guaranteed to run, so you must call `datastore.EnableKeyConversion(appengine.NewContext(r))` +before you use code that needs key conversion. + +You may want to add this to each of your handlers, or introduce middleware where it's called. +`EnableKeyConversion` is safe for concurrent use. Any call to it after the first is ignored. \ No newline at end of file diff --git a/vendor/google.golang.org/appengine/appengine.go b/vendor/google.golang.org/appengine/appengine.go index 0cca033d..8c969767 100644 --- a/vendor/google.golang.org/appengine/appengine.go +++ b/vendor/google.golang.org/appengine/appengine.go @@ -97,8 +97,6 @@ func WithContext(parent context.Context, req *http.Request) context.Context { return internal.WithContext(parent, req) } -// TODO(dsymonds): Add a Call function here? Otherwise other packages can't access internal.Call. - // BlobKey is a key for a blobstore blob. // // Conceptually, this type belongs in the blobstore package, but it lives in diff --git a/vendor/google.golang.org/appengine/go.mod b/vendor/google.golang.org/appengine/go.mod index f449359d..45159279 100644 --- a/vendor/google.golang.org/appengine/go.mod +++ b/vendor/google.golang.org/appengine/go.mod @@ -1,7 +1,10 @@ module google.golang.org/appengine require ( - github.com/golang/protobuf v1.2.0 - golang.org/x/net v0.0.0-20180724234803-3673e40ba225 - golang.org/x/text v0.3.0 + github.com/golang/protobuf v1.3.1 + golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 // indirect + golang.org/x/net v0.0.0-20190603091049-60506f45cf65 + golang.org/x/sys v0.0.0-20190606165138-5da285871e9c // indirect + golang.org/x/text v0.3.2 + golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b // indirect ) diff --git a/vendor/google.golang.org/appengine/go.sum b/vendor/google.golang.org/appengine/go.sum index 1a221c08..cb323255 100644 --- a/vendor/google.golang.org/appengine/go.sum +++ b/vendor/google.golang.org/appengine/go.sum @@ -1,6 +1,22 @@ github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/net v0.0.0-20180724234803-3673e40ba225 h1:kNX+jCowfMYzvlSvJu5pQWEmyWFrBXJ3PBy10xKMXK8= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65 h1:+rhAzEzT3f4JtomfC371qB+0Ola2caSKcY69NUBZrRQ= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= diff --git a/vendor/google.golang.org/appengine/internal/api.go b/vendor/google.golang.org/appengine/internal/api.go index bbc1cb9c..a6ec19e1 100644 --- a/vendor/google.golang.org/appengine/internal/api.go +++ b/vendor/google.golang.org/appengine/internal/api.go @@ -44,6 +44,7 @@ var ( curNamespaceHeader = http.CanonicalHeaderKey("X-AppEngine-Current-Namespace") userIPHeader = http.CanonicalHeaderKey("X-AppEngine-User-IP") remoteAddrHeader = http.CanonicalHeaderKey("X-AppEngine-Remote-Addr") + devRequestIdHeader = http.CanonicalHeaderKey("X-Appengine-Dev-Request-Id") // Outgoing headers. apiEndpointHeader = http.CanonicalHeaderKey("X-Google-RPC-Service-Endpoint") @@ -494,6 +495,9 @@ func Call(ctx netcontext.Context, service, method string, in, out proto.Message) if ticket == "" { ticket = DefaultTicket() } + if dri := c.req.Header.Get(devRequestIdHeader); IsDevAppServer() && dri != "" { + ticket = dri + } req := &remotepb.Request{ ServiceName: &service, Method: &method, diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go index c7bb5398..bf2f703f 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go @@ -1,12 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/api/annotations.proto -package annotations // import "google.golang.org/genproto/googleapis/api/annotations" +package annotations -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package var E_Http = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MethodOptions)(nil), @@ -32,11 +35,9 @@ func init() { proto.RegisterExtension(E_Http) } -func init() { - proto.RegisterFile("google/api/annotations.proto", fileDescriptor_annotations_e7ebfecbdd9698dc) -} +func init() { proto.RegisterFile("google/api/annotations.proto", fileDescriptor_c591c5aa9fb79aab) } -var fileDescriptor_annotations_e7ebfecbdd9698dc = []byte{ +var fileDescriptor_c591c5aa9fb79aab = []byte{ // 208 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0x2c, 0xc8, 0xd4, 0x4f, 0xcc, 0xcb, 0xcb, 0x2f, 0x49, 0x2c, 0xc9, 0xcc, diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go index 589e00d4..867fc0c3 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go @@ -1,12 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/api/client.proto -package annotations // import "google.golang.org/genproto/googleapis/api/annotations" +package annotations -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,14 +20,14 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package var E_MethodSignature = &proto.ExtensionDesc{ ExtendedType: (*descriptor.MethodOptions)(nil), ExtensionType: ([]string)(nil), Field: 1051, Name: "google.api.method_signature", - Tag: "bytes,1051,rep,name=method_signature,json=methodSignature", + Tag: "bytes,1051,rep,name=method_signature", Filename: "google/api/client.proto", } @@ -33,7 +36,7 @@ var E_DefaultHost = &proto.ExtensionDesc{ ExtensionType: (*string)(nil), Field: 1049, Name: "google.api.default_host", - Tag: "bytes,1049,opt,name=default_host,json=defaultHost", + Tag: "bytes,1049,opt,name=default_host", Filename: "google/api/client.proto", } @@ -42,7 +45,7 @@ var E_OauthScopes = &proto.ExtensionDesc{ ExtensionType: (*string)(nil), Field: 1050, Name: "google.api.oauth_scopes", - Tag: "bytes,1050,opt,name=oauth_scopes,json=oauthScopes", + Tag: "bytes,1050,opt,name=oauth_scopes", Filename: "google/api/client.proto", } @@ -52,9 +55,9 @@ func init() { proto.RegisterExtension(E_OauthScopes) } -func init() { proto.RegisterFile("google/api/client.proto", fileDescriptor_client_66b9a733374708c1) } +func init() { proto.RegisterFile("google/api/client.proto", fileDescriptor_78f2c6f7c3a942c1) } -var fileDescriptor_client_66b9a733374708c1 = []byte{ +var fileDescriptor_78f2c6f7c3a942c1 = []byte{ // 262 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x3f, 0x4f, 0xc3, 0x30, 0x10, 0xc5, 0x55, 0x40, 0xa8, 0x75, 0x11, 0xa0, 0x2c, 0x20, 0x06, 0xc8, 0xd8, 0xc9, 0x1e, 0xd8, diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go index 4fc5c40b..31f87dd0 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go @@ -1,12 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/api/field_behavior.proto -package annotations // import "google.golang.org/genproto/googleapis/api/annotations" +package annotations -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // An indicator of the behavior of a given field (for example, that a field // is required in requests, or given as output but ignored as input). @@ -61,6 +64,7 @@ var FieldBehavior_name = map[int32]string{ 4: "INPUT_ONLY", 5: "IMMUTABLE", } + var FieldBehavior_value = map[string]int32{ "FIELD_BEHAVIOR_UNSPECIFIED": 0, "OPTIONAL": 1, @@ -73,8 +77,9 @@ var FieldBehavior_value = map[string]int32{ func (x FieldBehavior) String() string { return proto.EnumName(FieldBehavior_name, int32(x)) } + func (FieldBehavior) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_field_behavior_540d8be7c570e386, []int{0} + return fileDescriptor_4648f18fd5079967, []int{0} } var E_FieldBehavior = &proto.ExtensionDesc{ @@ -82,7 +87,7 @@ var E_FieldBehavior = &proto.ExtensionDesc{ ExtensionType: ([]FieldBehavior)(nil), Field: 1052, Name: "google.api.field_behavior", - Tag: "varint,1052,rep,name=field_behavior,json=fieldBehavior,enum=google.api.FieldBehavior", + Tag: "varint,1052,rep,name=field_behavior,enum=google.api.FieldBehavior", Filename: "google/api/field_behavior.proto", } @@ -91,11 +96,9 @@ func init() { proto.RegisterExtension(E_FieldBehavior) } -func init() { - proto.RegisterFile("google/api/field_behavior.proto", fileDescriptor_field_behavior_540d8be7c570e386) -} +func init() { proto.RegisterFile("google/api/field_behavior.proto", fileDescriptor_4648f18fd5079967) } -var fileDescriptor_field_behavior_540d8be7c570e386 = []byte{ +var fileDescriptor_4648f18fd5079967 = []byte{ // 303 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0x4f, 0x4f, 0xb3, 0x30, 0x1c, 0xc7, 0x9f, 0xfd, 0x79, 0xcc, 0xac, 0x0e, 0x49, 0x4f, 0xba, 0x44, 0xdd, 0xd1, 0x78, 0x28, diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go index 5ee365a5..a6387037 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/api/http.proto -package annotations // import "google.golang.org/genproto/googleapis/api/annotations" +package annotations -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +19,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Defines the HTTP configuration for an API service. It contains a list of // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method @@ -42,16 +45,17 @@ func (m *Http) Reset() { *m = Http{} } func (m *Http) String() string { return proto.CompactTextString(m) } func (*Http) ProtoMessage() {} func (*Http) Descriptor() ([]byte, []int) { - return fileDescriptor_http_1e78ce0f8b702f4c, []int{0} + return fileDescriptor_ff9994be407cdcc9, []int{0} } + func (m *Http) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Http.Unmarshal(m, b) } func (m *Http) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Http.Marshal(b, m, deterministic) } -func (dst *Http) XXX_Merge(src proto.Message) { - xxx_messageInfo_Http.Merge(dst, src) +func (m *Http) XXX_Merge(src proto.Message) { + xxx_messageInfo_Http.Merge(m, src) } func (m *Http) XXX_Size() int { return xxx_messageInfo_Http.Size(m) @@ -389,16 +393,17 @@ func (m *HttpRule) Reset() { *m = HttpRule{} } func (m *HttpRule) String() string { return proto.CompactTextString(m) } func (*HttpRule) ProtoMessage() {} func (*HttpRule) Descriptor() ([]byte, []int) { - return fileDescriptor_http_1e78ce0f8b702f4c, []int{1} + return fileDescriptor_ff9994be407cdcc9, []int{1} } + func (m *HttpRule) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_HttpRule.Unmarshal(m, b) } func (m *HttpRule) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_HttpRule.Marshal(b, m, deterministic) } -func (dst *HttpRule) XXX_Merge(src proto.Message) { - xxx_messageInfo_HttpRule.Merge(dst, src) +func (m *HttpRule) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpRule.Merge(m, src) } func (m *HttpRule) XXX_Size() int { return xxx_messageInfo_HttpRule.Size(m) @@ -526,9 +531,9 @@ func (m *HttpRule) GetAdditionalBindings() []*HttpRule { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*HttpRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _HttpRule_OneofMarshaler, _HttpRule_OneofUnmarshaler, _HttpRule_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*HttpRule) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*HttpRule_Get)(nil), (*HttpRule_Put)(nil), (*HttpRule_Post)(nil), @@ -538,124 +543,6 @@ func (*HttpRule) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) erro } } -func _HttpRule_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*HttpRule) - // pattern - switch x := m.Pattern.(type) { - case *HttpRule_Get: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Get) - case *HttpRule_Put: - b.EncodeVarint(3<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Put) - case *HttpRule_Post: - b.EncodeVarint(4<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Post) - case *HttpRule_Delete: - b.EncodeVarint(5<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Delete) - case *HttpRule_Patch: - b.EncodeVarint(6<<3 | proto.WireBytes) - b.EncodeStringBytes(x.Patch) - case *HttpRule_Custom: - b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Custom); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("HttpRule.Pattern has unexpected type %T", x) - } - return nil -} - -func _HttpRule_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*HttpRule) - switch tag { - case 2: // pattern.get - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Get{x} - return true, err - case 3: // pattern.put - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Put{x} - return true, err - case 4: // pattern.post - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Post{x} - return true, err - case 5: // pattern.delete - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Delete{x} - return true, err - case 6: // pattern.patch - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Pattern = &HttpRule_Patch{x} - return true, err - case 8: // pattern.custom - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(CustomHttpPattern) - err := b.DecodeMessage(msg) - m.Pattern = &HttpRule_Custom{msg} - return true, err - default: - return false, nil - } -} - -func _HttpRule_OneofSizer(msg proto.Message) (n int) { - m := msg.(*HttpRule) - // pattern - switch x := m.Pattern.(type) { - case *HttpRule_Get: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Get))) - n += len(x.Get) - case *HttpRule_Put: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Put))) - n += len(x.Put) - case *HttpRule_Post: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Post))) - n += len(x.Post) - case *HttpRule_Delete: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Delete))) - n += len(x.Delete) - case *HttpRule_Patch: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.Patch))) - n += len(x.Patch) - case *HttpRule_Custom: - s := proto.Size(x.Custom) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // A custom pattern is used for defining custom HTTP verb. type CustomHttpPattern struct { // The name of this custom HTTP verb. @@ -671,16 +558,17 @@ func (m *CustomHttpPattern) Reset() { *m = CustomHttpPattern{} } func (m *CustomHttpPattern) String() string { return proto.CompactTextString(m) } func (*CustomHttpPattern) ProtoMessage() {} func (*CustomHttpPattern) Descriptor() ([]byte, []int) { - return fileDescriptor_http_1e78ce0f8b702f4c, []int{2} + return fileDescriptor_ff9994be407cdcc9, []int{2} } + func (m *CustomHttpPattern) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CustomHttpPattern.Unmarshal(m, b) } func (m *CustomHttpPattern) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_CustomHttpPattern.Marshal(b, m, deterministic) } -func (dst *CustomHttpPattern) XXX_Merge(src proto.Message) { - xxx_messageInfo_CustomHttpPattern.Merge(dst, src) +func (m *CustomHttpPattern) XXX_Merge(src proto.Message) { + xxx_messageInfo_CustomHttpPattern.Merge(m, src) } func (m *CustomHttpPattern) XXX_Size() int { return xxx_messageInfo_CustomHttpPattern.Size(m) @@ -711,9 +599,9 @@ func init() { proto.RegisterType((*CustomHttpPattern)(nil), "google.api.CustomHttpPattern") } -func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor_http_1e78ce0f8b702f4c) } +func init() { proto.RegisterFile("google/api/http.proto", fileDescriptor_ff9994be407cdcc9) } -var fileDescriptor_http_1e78ce0f8b702f4c = []byte{ +var fileDescriptor_ff9994be407cdcc9 = []byte{ // 419 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xc1, 0x8e, 0xd3, 0x30, 0x10, 0x86, 0x49, 0x9b, 0x76, 0xdb, 0xe9, 0x82, 0x84, 0x59, 0x90, 0x85, 0x40, 0x54, 0xe5, 0x52, diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go index 3622e034..af057b90 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go @@ -1,12 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/api/resource.proto -package annotations // import "google.golang.org/genproto/googleapis/api/annotations" +package annotations -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // A description of the historical or future-looking state of the // resource pattern. @@ -40,6 +43,7 @@ var ResourceDescriptor_History_name = map[int32]string{ 1: "ORIGINALLY_SINGLE_PATTERN", 2: "FUTURE_MULTI_PATTERN", } + var ResourceDescriptor_History_value = map[string]int32{ "HISTORY_UNSPECIFIED": 0, "ORIGINALLY_SINGLE_PATTERN": 1, @@ -49,8 +53,9 @@ var ResourceDescriptor_History_value = map[string]int32{ func (x ResourceDescriptor_History) String() string { return proto.EnumName(ResourceDescriptor_History_name, int32(x)) } + func (ResourceDescriptor_History) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_resource_8ecf418b4524f3f1, []int{0, 0} + return fileDescriptor_465e9122405d1bb5, []int{0, 0} } // A simple descriptor of a resource type. @@ -86,18 +91,18 @@ func (ResourceDescriptor_History) EnumDescriptor() ([]byte, []int) { // }; // } type ResourceDescriptor struct { - // The full name of the resource type. It must be in the format of - // {service_name}/{resource_type_kind}. The resource type names are - // singular and do not contain version numbers. + // The resource type. It must be in the format of + // {service_name}/{resource_type_kind}. The `resource_type_kind` must be + // singular and must not include version numbers. // - // For example: `storage.googleapis.com/Bucket` + // Example: `storage.googleapis.com/Bucket` // // The value of the resource_type_kind must follow the regular expression - // /[A-Z][a-zA-Z0-9]+/. It must start with upper case character and - // recommended to use PascalCase (UpperCamelCase). The maximum number of - // characters allowed for the resource_type_kind is 100. + // /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and + // should use PascalCase (UpperCamelCase). The maximum number of + // characters allowed for the `resource_type_kind` is 100. Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - // Required. The valid pattern or patterns for this resource's names. + // Optional. The valid resource name pattern(s) for this resource type. // // Examples: // - "projects/{project}/topics/{topic}" @@ -119,7 +124,8 @@ type ResourceDescriptor struct { // message InspectTemplate { // option (google.api.resource) = { // type: "dlp.googleapis.com/InspectTemplate" - // pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" + // pattern: + // "organizations/{organization}/inspectTemplates/{inspect_template}" // pattern: "projects/{project}/inspectTemplates/{inspect_template}" // history: ORIGINALLY_SINGLE_PATTERN // }; @@ -134,16 +140,17 @@ func (m *ResourceDescriptor) Reset() { *m = ResourceDescriptor{} } func (m *ResourceDescriptor) String() string { return proto.CompactTextString(m) } func (*ResourceDescriptor) ProtoMessage() {} func (*ResourceDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_resource_8ecf418b4524f3f1, []int{0} + return fileDescriptor_465e9122405d1bb5, []int{0} } + func (m *ResourceDescriptor) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResourceDescriptor.Unmarshal(m, b) } func (m *ResourceDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResourceDescriptor.Marshal(b, m, deterministic) } -func (dst *ResourceDescriptor) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResourceDescriptor.Merge(dst, src) +func (m *ResourceDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceDescriptor.Merge(m, src) } func (m *ResourceDescriptor) XXX_Size() int { return xxx_messageInfo_ResourceDescriptor.Size(m) @@ -182,11 +189,9 @@ func (m *ResourceDescriptor) GetHistory() ResourceDescriptor_History { return ResourceDescriptor_HISTORY_UNSPECIFIED } -// An annotation designating that this field is a reference to a resource -// defined by another message. +// Defines a proto annotation that describes a field that refers to a resource. type ResourceReference struct { - // The unified resource type name of the type that this field references. - // Marks this as a field referring to a resource in another message. + // The resource type that the annotated field references. // // Example: // @@ -196,11 +201,9 @@ type ResourceReference struct { // }]; // } Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - // The fully-qualified message name of a child of the type that this field - // references. - // - // This is useful for `parent` fields where a resource has more than one - // possible type of parent. + // The resource type of a child collection that the annotated field + // references. This is useful for `parent` fields where a resource has more + // than one possible type of parent. // // Example: // @@ -209,14 +212,6 @@ type ResourceReference struct { // child_type: "logging.googleapis.com/LogEntry" // }; // } - // - // If the referenced message is in the same proto package, the service name - // may be omitted: - // - // message ListLogEntriesRequest { - // string parent = 1 - // [(google.api.resource_reference).child_type = "LogEntry"]; - // } ChildType string `protobuf:"bytes,2,opt,name=child_type,json=childType,proto3" json:"child_type,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -227,16 +222,17 @@ func (m *ResourceReference) Reset() { *m = ResourceReference{} } func (m *ResourceReference) String() string { return proto.CompactTextString(m) } func (*ResourceReference) ProtoMessage() {} func (*ResourceReference) Descriptor() ([]byte, []int) { - return fileDescriptor_resource_8ecf418b4524f3f1, []int{1} + return fileDescriptor_465e9122405d1bb5, []int{1} } + func (m *ResourceReference) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_ResourceReference.Unmarshal(m, b) } func (m *ResourceReference) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ResourceReference.Marshal(b, m, deterministic) } -func (dst *ResourceReference) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResourceReference.Merge(dst, src) +func (m *ResourceReference) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceReference.Merge(m, src) } func (m *ResourceReference) XXX_Size() int { return xxx_messageInfo_ResourceReference.Size(m) @@ -266,7 +262,7 @@ var E_ResourceReference = &proto.ExtensionDesc{ ExtensionType: (*ResourceReference)(nil), Field: 1055, Name: "google.api.resource_reference", - Tag: "bytes,1055,opt,name=resource_reference,json=resourceReference", + Tag: "bytes,1055,opt,name=resource_reference", Filename: "google/api/resource.proto", } @@ -280,16 +276,16 @@ var E_Resource = &proto.ExtensionDesc{ } func init() { + proto.RegisterEnum("google.api.ResourceDescriptor_History", ResourceDescriptor_History_name, ResourceDescriptor_History_value) proto.RegisterType((*ResourceDescriptor)(nil), "google.api.ResourceDescriptor") proto.RegisterType((*ResourceReference)(nil), "google.api.ResourceReference") - proto.RegisterEnum("google.api.ResourceDescriptor_History", ResourceDescriptor_History_name, ResourceDescriptor_History_value) proto.RegisterExtension(E_ResourceReference) proto.RegisterExtension(E_Resource) } -func init() { proto.RegisterFile("google/api/resource.proto", fileDescriptor_resource_8ecf418b4524f3f1) } +func init() { proto.RegisterFile("google/api/resource.proto", fileDescriptor_465e9122405d1bb5) } -var fileDescriptor_resource_8ecf418b4524f3f1 = []byte{ +var fileDescriptor_465e9122405d1bb5 = []byte{ // 430 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x41, 0x6f, 0xd3, 0x30, 0x18, 0x25, 0x59, 0x45, 0xd7, 0x0f, 0x31, 0x6d, 0x06, 0x89, 0x0c, 0x29, 0x10, 0xf5, 0x80, 0x7a, diff --git a/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go b/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go index 1207018c..0499510d 100644 --- a/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go @@ -1,15 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/iam/v1/iam_policy.proto -package iam // import "google.golang.org/genproto/googleapis/iam/v1" - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" +package iam import ( - context "golang.org/x/net/context" + context "context" + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" ) @@ -22,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Request message for `SetIamPolicy` method. type SetIamPolicyRequest struct { @@ -43,16 +43,17 @@ func (m *SetIamPolicyRequest) Reset() { *m = SetIamPolicyRequest{} } func (m *SetIamPolicyRequest) String() string { return proto.CompactTextString(m) } func (*SetIamPolicyRequest) ProtoMessage() {} func (*SetIamPolicyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_iam_policy_b56603532236728f, []int{0} + return fileDescriptor_d2728eb97d748a32, []int{0} } + func (m *SetIamPolicyRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetIamPolicyRequest.Unmarshal(m, b) } func (m *SetIamPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_SetIamPolicyRequest.Marshal(b, m, deterministic) } -func (dst *SetIamPolicyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_SetIamPolicyRequest.Merge(dst, src) +func (m *SetIamPolicyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_SetIamPolicyRequest.Merge(m, src) } func (m *SetIamPolicyRequest) XXX_Size() int { return xxx_messageInfo_SetIamPolicyRequest.Size(m) @@ -81,26 +82,30 @@ func (m *SetIamPolicyRequest) GetPolicy() *Policy { type GetIamPolicyRequest struct { // REQUIRED: The resource for which the policy is being requested. // See the operation documentation for the appropriate value for this field. - Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Resource string `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"` + // OPTIONAL: A `GetPolicyOptions` object for specifying options to + // `GetIamPolicy`. This field is only used by Cloud IAM. + Options *GetPolicyOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *GetIamPolicyRequest) Reset() { *m = GetIamPolicyRequest{} } func (m *GetIamPolicyRequest) String() string { return proto.CompactTextString(m) } func (*GetIamPolicyRequest) ProtoMessage() {} func (*GetIamPolicyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_iam_policy_b56603532236728f, []int{1} + return fileDescriptor_d2728eb97d748a32, []int{1} } + func (m *GetIamPolicyRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetIamPolicyRequest.Unmarshal(m, b) } func (m *GetIamPolicyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_GetIamPolicyRequest.Marshal(b, m, deterministic) } -func (dst *GetIamPolicyRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetIamPolicyRequest.Merge(dst, src) +func (m *GetIamPolicyRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetIamPolicyRequest.Merge(m, src) } func (m *GetIamPolicyRequest) XXX_Size() int { return xxx_messageInfo_GetIamPolicyRequest.Size(m) @@ -118,6 +123,13 @@ func (m *GetIamPolicyRequest) GetResource() string { return "" } +func (m *GetIamPolicyRequest) GetOptions() *GetPolicyOptions { + if m != nil { + return m.Options + } + return nil +} + // Request message for `TestIamPermissions` method. type TestIamPermissionsRequest struct { // REQUIRED: The resource for which the policy detail is being requested. @@ -137,16 +149,17 @@ func (m *TestIamPermissionsRequest) Reset() { *m = TestIamPermissionsReq func (m *TestIamPermissionsRequest) String() string { return proto.CompactTextString(m) } func (*TestIamPermissionsRequest) ProtoMessage() {} func (*TestIamPermissionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_iam_policy_b56603532236728f, []int{2} + return fileDescriptor_d2728eb97d748a32, []int{2} } + func (m *TestIamPermissionsRequest) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TestIamPermissionsRequest.Unmarshal(m, b) } func (m *TestIamPermissionsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_TestIamPermissionsRequest.Marshal(b, m, deterministic) } -func (dst *TestIamPermissionsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestIamPermissionsRequest.Merge(dst, src) +func (m *TestIamPermissionsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestIamPermissionsRequest.Merge(m, src) } func (m *TestIamPermissionsRequest) XXX_Size() int { return xxx_messageInfo_TestIamPermissionsRequest.Size(m) @@ -185,16 +198,17 @@ func (m *TestIamPermissionsResponse) Reset() { *m = TestIamPermissionsRe func (m *TestIamPermissionsResponse) String() string { return proto.CompactTextString(m) } func (*TestIamPermissionsResponse) ProtoMessage() {} func (*TestIamPermissionsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_iam_policy_b56603532236728f, []int{3} + return fileDescriptor_d2728eb97d748a32, []int{3} } + func (m *TestIamPermissionsResponse) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TestIamPermissionsResponse.Unmarshal(m, b) } func (m *TestIamPermissionsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_TestIamPermissionsResponse.Marshal(b, m, deterministic) } -func (dst *TestIamPermissionsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_TestIamPermissionsResponse.Merge(dst, src) +func (m *TestIamPermissionsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TestIamPermissionsResponse.Merge(m, src) } func (m *TestIamPermissionsResponse) XXX_Size() int { return xxx_messageInfo_TestIamPermissionsResponse.Size(m) @@ -219,6 +233,42 @@ func init() { proto.RegisterType((*TestIamPermissionsResponse)(nil), "google.iam.v1.TestIamPermissionsResponse") } +func init() { proto.RegisterFile("google/iam/v1/iam_policy.proto", fileDescriptor_d2728eb97d748a32) } + +var fileDescriptor_d2728eb97d748a32 = []byte{ + // 465 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x53, 0xcd, 0x8a, 0x13, 0x31, + 0x1c, 0x27, 0x5d, 0x58, 0x6d, 0x56, 0x05, 0xa7, 0x88, 0x35, 0x2b, 0xb5, 0x44, 0x0f, 0x6d, 0xa1, + 0x19, 0xbb, 0x9e, 0xac, 0x28, 0xec, 0x7a, 0x18, 0xe6, 0x20, 0x96, 0x51, 0x16, 0x94, 0x82, 0xc6, + 0x31, 0x0c, 0x81, 0xc9, 0x24, 0x4e, 0xd2, 0x05, 0x11, 0x2f, 0x1e, 0x7c, 0x01, 0x6f, 0x3e, 0x82, + 0x67, 0x9f, 0x62, 0xaf, 0xbe, 0x82, 0x0f, 0xe1, 0x51, 0x66, 0x92, 0xee, 0xce, 0x47, 0x95, 0x0a, + 0x9e, 0x4a, 0xf3, 0xfb, 0xfa, 0x7f, 0xcc, 0x1f, 0x0e, 0x12, 0x29, 0x93, 0x94, 0xf9, 0x9c, 0x0a, + 0xff, 0x64, 0x56, 0xfc, 0xbc, 0x52, 0x32, 0xe5, 0xf1, 0x7b, 0xa2, 0x72, 0x69, 0xa4, 0x77, 0xd9, + 0xe2, 0x84, 0x53, 0x41, 0x4e, 0x66, 0x68, 0xbf, 0x4e, 0x97, 0xca, 0x70, 0x99, 0x69, 0xcb, 0x45, + 0xa8, 0x0e, 0x56, 0x7d, 0xd0, 0x4d, 0x87, 0x51, 0xc5, 0x7d, 0x9a, 0x65, 0xd2, 0xd0, 0xaa, 0xf2, + 0x7a, 0x05, 0x8d, 0x53, 0xce, 0x32, 0x63, 0x01, 0xfc, 0x1a, 0xf6, 0x9e, 0x31, 0x13, 0x52, 0xb1, + 0x28, 0xcd, 0x22, 0xf6, 0x6e, 0xc5, 0xb4, 0xf1, 0x10, 0xbc, 0x98, 0x33, 0x2d, 0x57, 0x79, 0xcc, + 0xfa, 0x60, 0x08, 0x46, 0xdd, 0xe8, 0xec, 0xbf, 0x37, 0x85, 0xbb, 0x36, 0xb9, 0xdf, 0x19, 0x82, + 0xd1, 0xde, 0xc1, 0x35, 0x52, 0x6b, 0x81, 0x38, 0x27, 0x47, 0xc2, 0x29, 0xec, 0x05, 0xff, 0x98, + 0x70, 0x1f, 0x5e, 0x70, 0x8d, 0xbb, 0x88, 0x5b, 0x8d, 0x88, 0x80, 0x19, 0xeb, 0xf6, 0xd4, 0xd2, + 0xa2, 0x35, 0x1f, 0xbf, 0x80, 0x37, 0x9e, 0x33, 0x5d, 0xc6, 0xb1, 0x5c, 0x70, 0xad, 0x4b, 0x78, + 0x8b, 0xcc, 0x21, 0xdc, 0x53, 0xe7, 0x8a, 0x7e, 0x67, 0xb8, 0x33, 0xea, 0x46, 0xd5, 0x27, 0xfc, + 0x08, 0xa2, 0x4d, 0xd6, 0x5a, 0xc9, 0x4c, 0xb7, 0xf4, 0xa0, 0xa5, 0x3f, 0xf8, 0xbe, 0x03, 0xbb, + 0xe1, 0xe1, 0x13, 0x5b, 0xb8, 0x67, 0xe0, 0xa5, 0xea, 0xe0, 0x3d, 0xdc, 0x68, 0x71, 0xc3, 0x56, + 0xd0, 0xe6, 0x49, 0xe3, 0xf1, 0xa7, 0x1f, 0x3f, 0xbf, 0x74, 0x6e, 0xe3, 0x41, 0xf1, 0x51, 0x7c, + 0x58, 0x77, 0xf4, 0x70, 0x32, 0xf9, 0x38, 0xd7, 0x15, 0x97, 0x39, 0x98, 0x14, 0xa9, 0xc1, 0xdf, + 0x52, 0x83, 0xff, 0x92, 0x9a, 0x34, 0x52, 0xbf, 0x02, 0xe8, 0xb5, 0x47, 0xe7, 0x8d, 0x1a, 0xc6, + 0x7f, 0x5c, 0x1c, 0x1a, 0x6f, 0xc1, 0xb4, 0x7b, 0xc0, 0x7e, 0x59, 0xd6, 0x18, 0xdf, 0x69, 0x97, + 0x65, 0x5a, 0xaa, 0x39, 0x98, 0xa0, 0xc1, 0xe9, 0xe1, 0x3e, 0xa7, 0x62, 0x2a, 0x98, 0xa1, 0x53, + 0xaa, 0xb8, 0x8b, 0xa2, 0x8a, 0x6b, 0x12, 0x4b, 0x71, 0xf4, 0x19, 0xc0, 0xab, 0xb1, 0x14, 0xf5, + 0x0a, 0x8e, 0xae, 0x9c, 0x35, 0xb8, 0x28, 0xee, 0x68, 0x01, 0x5e, 0xde, 0x75, 0x84, 0x44, 0xa6, + 0x34, 0x4b, 0x88, 0xcc, 0x13, 0x3f, 0x61, 0x59, 0x79, 0x65, 0xfe, 0xb9, 0xa5, 0xbb, 0xdd, 0x07, + 0x9c, 0x8a, 0x5f, 0x00, 0x7c, 0xeb, 0xf4, 0x02, 0xab, 0x7a, 0x9c, 0xca, 0xd5, 0x5b, 0x12, 0x52, + 0x41, 0x8e, 0x67, 0xa7, 0xeb, 0xd7, 0x65, 0xf9, 0xba, 0x0c, 0xa9, 0x58, 0x1e, 0xcf, 0xde, 0xec, + 0x96, 0x5e, 0xf7, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x57, 0xb0, 0xe9, 0x52, 0x04, 0x00, + 0x00, +} + // Reference imports to suppress errors if they are not otherwise used. var _ context.Context var _ grpc.ClientConn @@ -380,38 +430,3 @@ var _IAMPolicy_serviceDesc = grpc.ServiceDesc{ Streams: []grpc.StreamDesc{}, Metadata: "google/iam/v1/iam_policy.proto", } - -func init() { - proto.RegisterFile("google/iam/v1/iam_policy.proto", fileDescriptor_iam_policy_b56603532236728f) -} - -var fileDescriptor_iam_policy_b56603532236728f = []byte{ - // 419 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, - 0xcf, 0x49, 0xd5, 0xcf, 0x4c, 0xcc, 0xd5, 0x2f, 0x33, 0x04, 0x51, 0xf1, 0x05, 0xf9, 0x39, 0x99, - 0xc9, 0x95, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xbc, 0x10, 0x79, 0xbd, 0xcc, 0xc4, 0x5c, - 0xbd, 0x32, 0x43, 0x29, 0x49, 0xa8, 0xf2, 0xc4, 0x82, 0x4c, 0xfd, 0xa2, 0xd4, 0xe2, 0xfc, 0xd2, - 0xa2, 0xe4, 0x54, 0x88, 0x4a, 0x29, 0x29, 0x54, 0x93, 0x90, 0x4d, 0x91, 0x92, 0x41, 0xd2, 0x96, - 0x98, 0x97, 0x97, 0x5f, 0x92, 0x58, 0x92, 0x99, 0x9f, 0x57, 0x0c, 0x91, 0x55, 0x4a, 0xe0, 0x12, - 0x0e, 0x4e, 0x2d, 0xf1, 0x4c, 0xcc, 0x0d, 0x00, 0xeb, 0x09, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, - 0x11, 0x92, 0xe2, 0xe2, 0x80, 0x59, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04, 0xe7, 0x0b, - 0xe9, 0x72, 0xb1, 0x41, 0x2c, 0x90, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd5, 0x43, 0x71, - 0xa7, 0x1e, 0xd4, 0x24, 0xa8, 0x22, 0x25, 0x43, 0x2e, 0x61, 0x77, 0xd2, 0x6c, 0x50, 0x8a, 0xe4, - 0x92, 0x0c, 0x49, 0x2d, 0x06, 0xeb, 0x49, 0x2d, 0xca, 0xcd, 0x2c, 0x2e, 0x06, 0x39, 0x98, 0x18, - 0xa7, 0x29, 0x70, 0x71, 0x17, 0x20, 0x74, 0x48, 0x30, 0x29, 0x30, 0x6b, 0x70, 0x06, 0x21, 0x0b, - 0x29, 0xd9, 0x71, 0x49, 0x61, 0x33, 0xba, 0xb8, 0x20, 0x3f, 0xaf, 0x18, 0x43, 0x3f, 0x23, 0x86, - 0x7e, 0xa3, 0x29, 0xcc, 0x5c, 0x9c, 0x9e, 0x8e, 0xbe, 0x10, 0xbf, 0x08, 0x95, 0x70, 0xf1, 0x20, - 0x87, 0x9e, 0x90, 0x12, 0x5a, 0x50, 0x60, 0x09, 0x5a, 0x29, 0xec, 0xc1, 0xa5, 0xa4, 0xd9, 0x74, - 0xf9, 0xc9, 0x64, 0x26, 0x65, 0x25, 0x39, 0x50, 0x04, 0x56, 0xc3, 0x7c, 0x64, 0xab, 0xa5, 0x55, - 0x6b, 0x55, 0x8c, 0x64, 0x8a, 0x15, 0xa3, 0x16, 0xc8, 0x56, 0x77, 0x7c, 0xb6, 0xba, 0x53, 0xc5, - 0xd6, 0x74, 0x34, 0x5b, 0x67, 0x31, 0x72, 0x09, 0x61, 0x06, 0x9d, 0x90, 0x06, 0x9a, 0xc1, 0x38, - 0x23, 0x4e, 0x4a, 0x93, 0x08, 0x95, 0x90, 0x78, 0x50, 0xd2, 0x07, 0x3b, 0x4b, 0x53, 0x49, 0x05, - 0xd3, 0x59, 0x25, 0x18, 0xba, 0xac, 0x18, 0xb5, 0x9c, 0xda, 0x18, 0xb9, 0x04, 0x93, 0xf3, 0x73, - 0x51, 0x6d, 0x70, 0xe2, 0x83, 0x7b, 0x20, 0x00, 0x94, 0xd8, 0x03, 0x18, 0xa3, 0x0c, 0xa0, 0x0a, - 0xd2, 0xf3, 0x73, 0x12, 0xf3, 0xd2, 0xf5, 0xf2, 0x8b, 0xd2, 0xf5, 0xd3, 0x53, 0xf3, 0xc0, 0x59, - 0x41, 0x1f, 0x22, 0x95, 0x58, 0x90, 0x59, 0x0c, 0xcd, 0x47, 0xd6, 0x99, 0x89, 0xb9, 0x3f, 0x18, - 0x19, 0x57, 0x31, 0x09, 0xbb, 0x43, 0x74, 0x39, 0xe7, 0xe4, 0x97, 0xa6, 0xe8, 0x79, 0x26, 0xe6, - 0xea, 0x85, 0x19, 0x9e, 0x82, 0x89, 0xc6, 0x80, 0x45, 0x63, 0x3c, 0x13, 0x73, 0x63, 0xc2, 0x0c, - 0x93, 0xd8, 0xc0, 0x66, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xba, 0x05, 0xa3, 0xc3, 0xdc, - 0x03, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/genproto/googleapis/iam/v1/options.pb.go b/vendor/google.golang.org/genproto/googleapis/iam/v1/options.pb.go new file mode 100644 index 00000000..8f02bd3c --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/iam/v1/options.pb.go @@ -0,0 +1,92 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/iam/v1/options.proto + +package iam + +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Encapsulates settings provided to GetIamPolicy. +type GetPolicyOptions struct { + // Optional. The policy format version to be returned. + // Acceptable values are 0 and 1. + // If the value is 0, or the field is omitted, policy format version 1 will be + // returned. + RequestedPolicyVersion int32 `protobuf:"varint,1,opt,name=requested_policy_version,json=requestedPolicyVersion,proto3" json:"requested_policy_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetPolicyOptions) Reset() { *m = GetPolicyOptions{} } +func (m *GetPolicyOptions) String() string { return proto.CompactTextString(m) } +func (*GetPolicyOptions) ProtoMessage() {} +func (*GetPolicyOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_19aa09e909092bd1, []int{0} +} + +func (m *GetPolicyOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GetPolicyOptions.Unmarshal(m, b) +} +func (m *GetPolicyOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GetPolicyOptions.Marshal(b, m, deterministic) +} +func (m *GetPolicyOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_GetPolicyOptions.Merge(m, src) +} +func (m *GetPolicyOptions) XXX_Size() int { + return xxx_messageInfo_GetPolicyOptions.Size(m) +} +func (m *GetPolicyOptions) XXX_DiscardUnknown() { + xxx_messageInfo_GetPolicyOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_GetPolicyOptions proto.InternalMessageInfo + +func (m *GetPolicyOptions) GetRequestedPolicyVersion() int32 { + if m != nil { + return m.RequestedPolicyVersion + } + return 0 +} + +func init() { + proto.RegisterType((*GetPolicyOptions)(nil), "google.iam.v1.GetPolicyOptions") +} + +func init() { proto.RegisterFile("google/iam/v1/options.proto", fileDescriptor_19aa09e909092bd1) } + +var fileDescriptor_19aa09e909092bd1 = []byte{ + // 229 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0xcf, 0x4c, 0xcc, 0xd5, 0x2f, 0x33, 0xd4, 0xcf, 0x2f, 0x28, 0xc9, 0xcc, 0xcf, + 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x48, 0xea, 0x65, 0x26, 0xe6, 0xea, + 0x95, 0x19, 0x4a, 0xc9, 0x40, 0xd5, 0x26, 0x16, 0x64, 0xea, 0x27, 0xe6, 0xe5, 0xe5, 0x97, 0x24, + 0x22, 0x29, 0x56, 0xf2, 0xe1, 0x12, 0x70, 0x4f, 0x2d, 0x09, 0xc8, 0xcf, 0xc9, 0x4c, 0xae, 0xf4, + 0x87, 0x18, 0x23, 0x64, 0xc1, 0x25, 0x51, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x92, 0x9a, 0x12, + 0x5f, 0x00, 0x96, 0x8a, 0x2f, 0x4b, 0x2d, 0x2a, 0xce, 0xcc, 0xcf, 0x93, 0x60, 0x54, 0x60, 0xd4, + 0x60, 0x0d, 0x12, 0x83, 0xcb, 0x43, 0x74, 0x86, 0x41, 0x64, 0x9d, 0x5a, 0x18, 0xb9, 0x04, 0x93, + 0xf3, 0x73, 0xf5, 0x50, 0x5c, 0xe0, 0xc4, 0x03, 0x35, 0x38, 0x00, 0x64, 0x63, 0x00, 0x63, 0x94, + 0x01, 0x54, 0x3a, 0x3d, 0x3f, 0x27, 0x31, 0x2f, 0x5d, 0x2f, 0xbf, 0x28, 0x5d, 0x3f, 0x3d, 0x35, + 0x0f, 0xec, 0x1e, 0x7d, 0x88, 0x54, 0x62, 0x41, 0x66, 0x31, 0xd4, 0x73, 0xd6, 0x99, 0x89, 0xb9, + 0x3f, 0x18, 0x19, 0x57, 0x31, 0x09, 0xbb, 0x43, 0x74, 0x39, 0xe7, 0xe4, 0x97, 0xa6, 0xe8, 0x79, + 0x26, 0xe6, 0xea, 0x85, 0x19, 0x9e, 0x82, 0x89, 0xc6, 0x80, 0x45, 0x63, 0x3c, 0x13, 0x73, 0x63, + 0xc2, 0x0c, 0x93, 0xd8, 0xc0, 0x66, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x96, 0x0c, + 0x8b, 0x27, 0x01, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go b/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go index 9100ef9c..16301673 100644 --- a/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go @@ -1,13 +1,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/iam/v1/policy.proto -package iam // import "google.golang.org/genproto/googleapis/iam/v1" +package iam -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "google.golang.org/genproto/googleapis/api/annotations" -import expr "google.golang.org/genproto/googleapis/type/expr" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + expr "google.golang.org/genproto/googleapis/type/expr" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -18,7 +21,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The type of action performed on a Binding in a policy. type BindingDelta_Action int32 @@ -37,6 +40,7 @@ var BindingDelta_Action_name = map[int32]string{ 1: "ADD", 2: "REMOVE", } + var BindingDelta_Action_value = map[string]int32{ "ACTION_UNSPECIFIED": 0, "ADD": 1, @@ -46,8 +50,9 @@ var BindingDelta_Action_value = map[string]int32{ func (x BindingDelta_Action) String() string { return proto.EnumName(BindingDelta_Action_name, int32(x)) } + func (BindingDelta_Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_policy_178c0196ea84d022, []int{3, 0} + return fileDescriptor_a3cd40b8a66b2a99, []int{3, 0} } // The type of action performed on an audit configuration in a policy. @@ -67,6 +72,7 @@ var AuditConfigDelta_Action_name = map[int32]string{ 1: "ADD", 2: "REMOVE", } + var AuditConfigDelta_Action_value = map[string]int32{ "ACTION_UNSPECIFIED": 0, "ADD": 1, @@ -76,8 +82,9 @@ var AuditConfigDelta_Action_value = map[string]int32{ func (x AuditConfigDelta_Action) String() string { return proto.EnumName(AuditConfigDelta_Action_name, int32(x)) } + func (AuditConfigDelta_Action) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_policy_178c0196ea84d022, []int{4, 0} + return fileDescriptor_a3cd40b8a66b2a99, []int{4, 0} } // Defines an Identity and Access Management (IAM) policy. It is used to @@ -151,16 +158,17 @@ func (m *Policy) Reset() { *m = Policy{} } func (m *Policy) String() string { return proto.CompactTextString(m) } func (*Policy) ProtoMessage() {} func (*Policy) Descriptor() ([]byte, []int) { - return fileDescriptor_policy_178c0196ea84d022, []int{0} + return fileDescriptor_a3cd40b8a66b2a99, []int{0} } + func (m *Policy) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Policy.Unmarshal(m, b) } func (m *Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Policy.Marshal(b, m, deterministic) } -func (dst *Policy) XXX_Merge(src proto.Message) { - xxx_messageInfo_Policy.Merge(dst, src) +func (m *Policy) XXX_Merge(src proto.Message) { + xxx_messageInfo_Policy.Merge(m, src) } func (m *Policy) XXX_Size() int { return xxx_messageInfo_Policy.Size(m) @@ -236,16 +244,17 @@ func (m *Binding) Reset() { *m = Binding{} } func (m *Binding) String() string { return proto.CompactTextString(m) } func (*Binding) ProtoMessage() {} func (*Binding) Descriptor() ([]byte, []int) { - return fileDescriptor_policy_178c0196ea84d022, []int{1} + return fileDescriptor_a3cd40b8a66b2a99, []int{1} } + func (m *Binding) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Binding.Unmarshal(m, b) } func (m *Binding) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Binding.Marshal(b, m, deterministic) } -func (dst *Binding) XXX_Merge(src proto.Message) { - xxx_messageInfo_Binding.Merge(dst, src) +func (m *Binding) XXX_Merge(src proto.Message) { + xxx_messageInfo_Binding.Merge(m, src) } func (m *Binding) XXX_Size() int { return xxx_messageInfo_Binding.Size(m) @@ -292,16 +301,17 @@ func (m *PolicyDelta) Reset() { *m = PolicyDelta{} } func (m *PolicyDelta) String() string { return proto.CompactTextString(m) } func (*PolicyDelta) ProtoMessage() {} func (*PolicyDelta) Descriptor() ([]byte, []int) { - return fileDescriptor_policy_178c0196ea84d022, []int{2} + return fileDescriptor_a3cd40b8a66b2a99, []int{2} } + func (m *PolicyDelta) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_PolicyDelta.Unmarshal(m, b) } func (m *PolicyDelta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_PolicyDelta.Marshal(b, m, deterministic) } -func (dst *PolicyDelta) XXX_Merge(src proto.Message) { - xxx_messageInfo_PolicyDelta.Merge(dst, src) +func (m *PolicyDelta) XXX_Merge(src proto.Message) { + xxx_messageInfo_PolicyDelta.Merge(m, src) } func (m *PolicyDelta) XXX_Size() int { return xxx_messageInfo_PolicyDelta.Size(m) @@ -352,16 +362,17 @@ func (m *BindingDelta) Reset() { *m = BindingDelta{} } func (m *BindingDelta) String() string { return proto.CompactTextString(m) } func (*BindingDelta) ProtoMessage() {} func (*BindingDelta) Descriptor() ([]byte, []int) { - return fileDescriptor_policy_178c0196ea84d022, []int{3} + return fileDescriptor_a3cd40b8a66b2a99, []int{3} } + func (m *BindingDelta) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_BindingDelta.Unmarshal(m, b) } func (m *BindingDelta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_BindingDelta.Marshal(b, m, deterministic) } -func (dst *BindingDelta) XXX_Merge(src proto.Message) { - xxx_messageInfo_BindingDelta.Merge(dst, src) +func (m *BindingDelta) XXX_Merge(src proto.Message) { + xxx_messageInfo_BindingDelta.Merge(m, src) } func (m *BindingDelta) XXX_Size() int { return xxx_messageInfo_BindingDelta.Size(m) @@ -428,16 +439,17 @@ func (m *AuditConfigDelta) Reset() { *m = AuditConfigDelta{} } func (m *AuditConfigDelta) String() string { return proto.CompactTextString(m) } func (*AuditConfigDelta) ProtoMessage() {} func (*AuditConfigDelta) Descriptor() ([]byte, []int) { - return fileDescriptor_policy_178c0196ea84d022, []int{4} + return fileDescriptor_a3cd40b8a66b2a99, []int{4} } + func (m *AuditConfigDelta) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_AuditConfigDelta.Unmarshal(m, b) } func (m *AuditConfigDelta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_AuditConfigDelta.Marshal(b, m, deterministic) } -func (dst *AuditConfigDelta) XXX_Merge(src proto.Message) { - xxx_messageInfo_AuditConfigDelta.Merge(dst, src) +func (m *AuditConfigDelta) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuditConfigDelta.Merge(m, src) } func (m *AuditConfigDelta) XXX_Size() int { return xxx_messageInfo_AuditConfigDelta.Size(m) @@ -477,18 +489,18 @@ func (m *AuditConfigDelta) GetLogType() string { } func init() { + proto.RegisterEnum("google.iam.v1.BindingDelta_Action", BindingDelta_Action_name, BindingDelta_Action_value) + proto.RegisterEnum("google.iam.v1.AuditConfigDelta_Action", AuditConfigDelta_Action_name, AuditConfigDelta_Action_value) proto.RegisterType((*Policy)(nil), "google.iam.v1.Policy") proto.RegisterType((*Binding)(nil), "google.iam.v1.Binding") proto.RegisterType((*PolicyDelta)(nil), "google.iam.v1.PolicyDelta") proto.RegisterType((*BindingDelta)(nil), "google.iam.v1.BindingDelta") proto.RegisterType((*AuditConfigDelta)(nil), "google.iam.v1.AuditConfigDelta") - proto.RegisterEnum("google.iam.v1.BindingDelta_Action", BindingDelta_Action_name, BindingDelta_Action_value) - proto.RegisterEnum("google.iam.v1.AuditConfigDelta_Action", AuditConfigDelta_Action_name, AuditConfigDelta_Action_value) } -func init() { proto.RegisterFile("google/iam/v1/policy.proto", fileDescriptor_policy_178c0196ea84d022) } +func init() { proto.RegisterFile("google/iam/v1/policy.proto", fileDescriptor_a3cd40b8a66b2a99) } -var fileDescriptor_policy_178c0196ea84d022 = []byte{ +var fileDescriptor_a3cd40b8a66b2a99 = []byte{ // 550 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xcf, 0xae, 0xd2, 0x4e, 0x14, 0xc7, 0x7f, 0x03, 0xfc, 0xca, 0xe5, 0x70, 0x2f, 0xc2, 0xdc, 0x84, 0x54, 0x34, 0x91, 0x74, diff --git a/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go b/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go index d4388850..9ff770b5 100644 --- a/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/rpc/code.proto -package code // import "google.golang.org/genproto/googleapis/rpc/code" +package code -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +19,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The canonical error codes for Google APIs. // @@ -185,6 +188,7 @@ var Code_name = map[int32]string{ 14: "UNAVAILABLE", 15: "DATA_LOSS", } + var Code_value = map[string]int32{ "OK": 0, "CANCELLED": 1, @@ -208,17 +212,18 @@ var Code_value = map[string]int32{ func (x Code) String() string { return proto.EnumName(Code_name, int32(x)) } + func (Code) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_code_95b35ec52f4ac337, []int{0} + return fileDescriptor_fe593a732623ccf0, []int{0} } func init() { proto.RegisterEnum("google.rpc.Code", Code_name, Code_value) } -func init() { proto.RegisterFile("google/rpc/code.proto", fileDescriptor_code_95b35ec52f4ac337) } +func init() { proto.RegisterFile("google/rpc/code.proto", fileDescriptor_fe593a732623ccf0) } -var fileDescriptor_code_95b35ec52f4ac337 = []byte{ +var fileDescriptor_fe593a732623ccf0 = []byte{ // 362 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x51, 0xcd, 0x6e, 0x93, 0x31, 0x10, 0xa4, 0x69, 0x49, 0x9b, 0xcd, 0xdf, 0xd6, 0xa5, 0xf0, 0x0e, 0x1c, 0x92, 0x43, 0x8f, 0x9c, diff --git a/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go b/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go index a203bd45..0b9907f8 100644 --- a/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go @@ -1,12 +1,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/rpc/status.proto -package status // import "google.golang.org/genproto/googleapis/rpc/status" +package status -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import any "github.com/golang/protobuf/ptypes/any" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" + any "github.com/golang/protobuf/ptypes/any" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,7 +20,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // The `Status` type defines a logical error model that is suitable for // different programming environments, including REST APIs and RPC APIs. It is @@ -93,16 +96,17 @@ func (m *Status) Reset() { *m = Status{} } func (m *Status) String() string { return proto.CompactTextString(m) } func (*Status) ProtoMessage() {} func (*Status) Descriptor() ([]byte, []int) { - return fileDescriptor_status_8a460da8fb0891c1, []int{0} + return fileDescriptor_24d244abaf643bfe, []int{0} } + func (m *Status) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Status.Unmarshal(m, b) } func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Status.Marshal(b, m, deterministic) } -func (dst *Status) XXX_Merge(src proto.Message) { - xxx_messageInfo_Status.Merge(dst, src) +func (m *Status) XXX_Merge(src proto.Message) { + xxx_messageInfo_Status.Merge(m, src) } func (m *Status) XXX_Size() int { return xxx_messageInfo_Status.Size(m) @@ -138,9 +142,9 @@ func init() { proto.RegisterType((*Status)(nil), "google.rpc.Status") } -func init() { proto.RegisterFile("google/rpc/status.proto", fileDescriptor_status_8a460da8fb0891c1) } +func init() { proto.RegisterFile("google/rpc/status.proto", fileDescriptor_24d244abaf643bfe) } -var fileDescriptor_status_8a460da8fb0891c1 = []byte{ +var fileDescriptor_24d244abaf643bfe = []byte{ // 209 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x2a, 0x48, 0xd6, 0x2f, 0x2e, 0x49, 0x2c, 0x29, 0x2d, 0xd6, 0x2b, 0x28, diff --git a/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go b/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go index ed0566e5..27d46fe0 100644 --- a/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go @@ -1,11 +1,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/type/expr.proto -package expr // import "google.golang.org/genproto/googleapis/type/expr" +package expr -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + math "math" + + proto "github.com/golang/protobuf/proto" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +19,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // Represents an expression text. Example: // @@ -49,16 +52,17 @@ func (m *Expr) Reset() { *m = Expr{} } func (m *Expr) String() string { return proto.CompactTextString(m) } func (*Expr) ProtoMessage() {} func (*Expr) Descriptor() ([]byte, []int) { - return fileDescriptor_expr_e508ac4329fc65cc, []int{0} + return fileDescriptor_d7920f1ae7a2722f, []int{0} } + func (m *Expr) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Expr.Unmarshal(m, b) } func (m *Expr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Expr.Marshal(b, m, deterministic) } -func (dst *Expr) XXX_Merge(src proto.Message) { - xxx_messageInfo_Expr.Merge(dst, src) +func (m *Expr) XXX_Merge(src proto.Message) { + xxx_messageInfo_Expr.Merge(m, src) } func (m *Expr) XXX_Size() int { return xxx_messageInfo_Expr.Size(m) @@ -101,9 +105,9 @@ func init() { proto.RegisterType((*Expr)(nil), "google.type.Expr") } -func init() { proto.RegisterFile("google/type/expr.proto", fileDescriptor_expr_e508ac4329fc65cc) } +func init() { proto.RegisterFile("google/type/expr.proto", fileDescriptor_d7920f1ae7a2722f) } -var fileDescriptor_expr_e508ac4329fc65cc = []byte{ +var fileDescriptor_d7920f1ae7a2722f = []byte{ // 195 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x4f, 0xad, 0x28, 0x28, 0xd2, 0x2b, 0x28, 0xca, diff --git a/vendor/google.golang.org/grpc/.travis.yml b/vendor/google.golang.org/grpc/.travis.yml index 8f36b81a..591343ed 100644 --- a/vendor/google.golang.org/grpc/.travis.yml +++ b/vendor/google.golang.org/grpc/.travis.yml @@ -2,7 +2,7 @@ language: go matrix: include: - - go: 1.12beta2 + - go: 1.12.x env: GO111MODULE=on - go: 1.11.x env: VET=1 GO111MODULE=on diff --git a/vendor/google.golang.org/grpc/CONTRIBUTING.md b/vendor/google.golang.org/grpc/CONTRIBUTING.md index ca34e8aa..6e69b28c 100644 --- a/vendor/google.golang.org/grpc/CONTRIBUTING.md +++ b/vendor/google.golang.org/grpc/CONTRIBUTING.md @@ -11,22 +11,46 @@ In order to protect both you and ourselves, you will need to sign the ## Guidelines for Pull Requests How to get your contributions merged smoothly and quickly. - -- Create **small PRs** that are narrowly focused on **addressing a single concern**. We often times receive PRs that are trying to fix several things at a time, but only one fix is considered acceptable, nothing gets merged and both author's & review's time is wasted. Create more PRs to address different concerns and everyone will be happy. - -- For speculative changes, consider opening an issue and discussing it first. If you are suggesting a behavioral or API change, consider starting with a [gRFC proposal](https://github.com/grpc/proposal). - -- Provide a good **PR description** as a record of **what** change is being made and **why** it was made. Link to a github issue if it exists. - -- Don't fix code style and formatting unless you are already changing that line to address an issue. PRs with irrelevant changes won't be merged. If you do want to fix formatting or style, do that in a separate PR. - -- Unless your PR is trivial, you should expect there will be reviewer comments that you'll need to address before merging. We expect you to be reasonably responsive to those comments, otherwise the PR will be closed after 2-3 weeks of inactivity. - -- Maintain **clean commit history** and use **meaningful commit messages**. PRs with messy commit history are difficult to review and won't be merged. Use `rebase -i upstream/master` to curate your commit history and/or to bring in latest changes from master (but avoid rebasing in the middle of a code review). - -- Keep your PR up to date with upstream/master (if there are merge conflicts, we can't really merge your change). - -- **All tests need to be passing** before your change can be merged. We recommend you **run tests locally** before creating your PR to catch breakages early on. + +- Create **small PRs** that are narrowly focused on **addressing a single + concern**. We often times receive PRs that are trying to fix several things at + a time, but only one fix is considered acceptable, nothing gets merged and + both author's & review's time is wasted. Create more PRs to address different + concerns and everyone will be happy. + +- The grpc package should only depend on standard Go packages and a small number + of exceptions. If your contribution introduces new dependencies which are NOT + in the [list](https://godoc.org/google.golang.org/grpc?imports), you need a + discussion with gRPC-Go authors and consultants. + +- For speculative changes, consider opening an issue and discussing it first. If + you are suggesting a behavioral or API change, consider starting with a [gRFC + proposal](https://github.com/grpc/proposal). + +- Provide a good **PR description** as a record of **what** change is being made + and **why** it was made. Link to a github issue if it exists. + +- Don't fix code style and formatting unless you are already changing that line + to address an issue. PRs with irrelevant changes won't be merged. If you do + want to fix formatting or style, do that in a separate PR. + +- Unless your PR is trivial, you should expect there will be reviewer comments + that you'll need to address before merging. We expect you to be reasonably + responsive to those comments, otherwise the PR will be closed after 2-3 weeks + of inactivity. + +- Maintain **clean commit history** and use **meaningful commit messages**. PRs + with messy commit history are difficult to review and won't be merged. Use + `rebase -i upstream/master` to curate your commit history and/or to bring in + latest changes from master (but avoid rebasing in the middle of a code + review). + +- Keep your PR up to date with upstream/master (if there are merge conflicts, we + can't really merge your change). + +- **All tests need to be passing** before your change can be merged. We + recommend you **run tests locally** before creating your PR to catch breakages + early on. - `make all` to test everything, OR - `make vet` to catch vet errors - `make test` to run the tests @@ -34,4 +58,3 @@ How to get your contributions merged smoothly and quickly. - optional `make testappengine` to run tests with appengine - Exceptions to the rules can be made if there's a compelling reason for doing so. - diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index f5eec671..afbc43db 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -1,42 +1,96 @@ # gRPC-Go -[![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) [![GoDoc](https://godoc.org/google.golang.org/grpc?status.svg)](https://godoc.org/google.golang.org/grpc) [![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go) +[![Build Status](https://travis-ci.org/grpc/grpc-go.svg)](https://travis-ci.org/grpc/grpc-go) +[![GoDoc](https://godoc.org/google.golang.org/grpc?status.svg)](https://godoc.org/google.golang.org/grpc) +[![GoReportCard](https://goreportcard.com/badge/grpc/grpc-go)](https://goreportcard.com/report/github.com/grpc/grpc-go) -The Go implementation of [gRPC](https://grpc.io/): A high performance, open source, general RPC framework that puts mobile and HTTP/2 first. For more information see the [gRPC Quick Start: Go](https://grpc.io/docs/quickstart/go.html) guide. +The Go implementation of [gRPC](https://grpc.io/): A high performance, open +source, general RPC framework that puts mobile and HTTP/2 first. For more +information see the [gRPC Quick Start: +Go](https://grpc.io/docs/quickstart/go.html) guide. Installation ------------ -To install this package, you need to install Go and setup your Go workspace on your computer. The simplest way to install the library is to run: +To install this package, you need to install Go and setup your Go workspace on +your computer. The simplest way to install the library is to run: ``` $ go get -u google.golang.org/grpc ``` +With Go module support (Go 1.11+), simply `import "google.golang.org/grpc"` in +your source code and `go [build|run|test]` will automatically download the +necessary dependencies ([Go modules +ref](https://github.com/golang/go/wiki/Modules)). + +If you are trying to access grpc-go from within China, please see the +[FAQ](#FAQ) below. + Prerequisites ------------- - gRPC-Go requires Go 1.9 or later. -Constraints ------------ -The grpc package should only depend on standard Go packages and a small number of exceptions. If your contribution introduces new dependencies which are NOT in the [list](https://godoc.org/google.golang.org/grpc?imports), you need a discussion with gRPC-Go authors and consultants. - Documentation ------------- -See [API documentation](https://godoc.org/google.golang.org/grpc) for package and API descriptions and find examples in the [examples directory](examples/). +- See [godoc](https://godoc.org/google.golang.org/grpc) for package and API + descriptions. +- Documentation on specific topics can be found in the [Documentation + directory](Documentation/). +- Examples can be found in the [examples directory](examples/). Performance ----------- -See the current benchmarks for some of the languages supported in [this dashboard](https://performance-dot-grpc-testing.appspot.com/explore?dashboard=5652536396611584&widget=490377658&container=1286539696). +Performance benchmark data for grpc-go and other languages is maintained in +[this +dashboard](https://performance-dot-grpc-testing.appspot.com/explore?dashboard=5652536396611584&widget=490377658&container=1286539696). Status ------ -General Availability [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages). +General Availability [Google Cloud Platform Launch +Stages](https://cloud.google.com/terms/launch-stages). FAQ --- +#### I/O Timeout Errors + +The `golang.org` domain may be blocked from some countries. `go get` usually +produces an error like the following when this happens: + +``` +$ go get -u google.golang.org/grpc +package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc" (https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout) +``` + +To build Go code, there are several options: + +- Set up a VPN and access google.golang.org through that. + +- Without Go module support: `git clone` the repo manually: + + ``` + git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc + ``` + + You will need to do the same for all of grpc's dependencies in `golang.org`, + e.g. `golang.org/x/net`. + +- With Go module support: it is possible to use the `replace` feature of `go + mod` to create aliases for golang.org packages. In your project's directory: + + ``` + go mod edit -replace=google.golang.org/grpc=github.com/grpc/grpc-go@latest + go mod tidy + go mod vendor + go build -mod=vendor + ``` + + Again, this will need to be done for all transitive dependencies hosted on + golang.org as well. Please refer to [this + issue](https://github.com/golang/go/issues/28652) in the golang repo regarding + this concern. + #### Compiling error, undefined: grpc.SupportPackageIsVersion Please update proto package, gRPC package and rebuild the proto files: diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index 67518de9..4b72daa8 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -138,6 +138,8 @@ type ClientConn interface { ResolveNow(resolver.ResolveNowOption) // Target returns the dial target for this ClientConn. + // + // Deprecated: Use the Target field in the BuildOptions instead. Target() string } @@ -155,6 +157,10 @@ type BuildOptions struct { Dialer func(context.Context, string) (net.Conn, error) // ChannelzParentID is the entity parent's channelz unique identification number. ChannelzParentID int64 + // Target contains the parsed address info of the dial target. It is the same resolver.Target as + // passed to the resolver. + // See the documentation for the resolver.Target type for details about what it contains. + Target resolver.Target } // Builder creates a balancer. @@ -171,9 +177,6 @@ type PickOptions struct { // FullMethodName is the method name that NewClientStream() is called // with. The canonical format is /service/Method. FullMethodName string - // Header contains the metadata from the RPC's client header. The metadata - // should not be modified; make a copy first if needed. - Header metadata.MD } // DoneInfo contains additional information for done. @@ -186,6 +189,11 @@ type DoneInfo struct { BytesSent bool // BytesReceived indicates if any byte has been received from the server. BytesReceived bool + // ServerLoad is the load received from server. It's usually sent as part of + // trailing metadata. + // + // The only supported type now is *orca_v1.LoadReport. + ServerLoad interface{} } var ( @@ -215,8 +223,10 @@ type Picker interface { // // If a SubConn is returned: // - If it is READY, gRPC will send the RPC on it; - // - If it is not ready, or becomes not ready after it's returned, gRPC will block - // until UpdateBalancerState() is called and will call pick on the new picker. + // - If it is not ready, or becomes not ready after it's returned, gRPC will + // block until UpdateBalancerState() is called and will call pick on the + // new picker. The done function returned from Pick(), if not nil, will be + // called with nil error, no bytes sent and no bytes received. // // If the returned error is not nil: // - If the error is ErrNoSubConnAvailable, gRPC will block until UpdateBalancerState() @@ -249,18 +259,46 @@ type Balancer interface { // that back to gRPC. // Balancer should also generate and update Pickers when its internal state has // been changed by the new state. + // + // Deprecated: if V2Balancer is implemented by the Balancer, + // UpdateSubConnState will be called instead. HandleSubConnStateChange(sc SubConn, state connectivity.State) // HandleResolvedAddrs is called by gRPC to send updated resolved addresses to // balancers. // Balancer can create new SubConn or remove SubConn with the addresses. // An empty address slice and a non-nil error will be passed if the resolver returns // non-nil error to gRPC. + // + // Deprecated: if V2Balancer is implemented by the Balancer, + // UpdateResolverState will be called instead. HandleResolvedAddrs([]resolver.Address, error) // Close closes the balancer. The balancer is not required to call // ClientConn.RemoveSubConn for its existing SubConns. Close() } +// SubConnState describes the state of a SubConn. +type SubConnState struct { + ConnectivityState connectivity.State + // TODO: add last connection error +} + +// V2Balancer is defined for documentation purposes. If a Balancer also +// implements V2Balancer, its UpdateResolverState method will be called instead +// of HandleResolvedAddrs and its UpdateSubConnState will be called instead of +// HandleSubConnStateChange. +type V2Balancer interface { + // UpdateResolverState is called by gRPC when the state of the resolver + // changes. + UpdateResolverState(resolver.State) + // UpdateSubConnState is called by gRPC when the state of a SubConn + // changes. + UpdateSubConnState(SubConn, SubConnState) + // Close closes the balancer. The balancer is not required to call + // ClientConn.RemoveSubConn for its existing SubConns. + Close() +} + // ConnectivityStateEvaluator takes the connectivity states of multiple SubConns // and returns one aggregated connectivity state. // diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index 245785e7..c5a51bd1 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -67,14 +67,16 @@ type baseBalancer struct { } func (b *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { - if err != nil { - grpclog.Infof("base.baseBalancer: HandleResolvedAddrs called with error %v", err) - return - } - grpclog.Infoln("base.baseBalancer: got new resolved addresses: ", addrs) + panic("not implemented") +} + +func (b *baseBalancer) UpdateResolverState(s resolver.State) { + // TODO: handle s.Err (log if not nil) once implemented. + // TODO: handle s.ServiceConfig? + grpclog.Infoln("base.baseBalancer: got new resolver state: ", s) // addrsSet is the set converted from addrs, it's used for quick lookup of an address. addrsSet := make(map[resolver.Address]struct{}) - for _, a := range addrs { + for _, a := range s.Addresses { addrsSet[a] = struct{}{} if _, ok := b.subConns[a]; !ok { // a is a new address (not existing in b.subConns). @@ -120,6 +122,11 @@ func (b *baseBalancer) regeneratePicker() { } func (b *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { + panic("not implemented") +} + +func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { + s := state.ConnectivityState grpclog.Infof("base.baseBalancer: handle SubConn state change: %p, %v", sc, s) oldS, ok := b.scStates[sc] if !ok { diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go index 7233ade2..bc965f0a 100644 --- a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go +++ b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go @@ -82,20 +82,13 @@ func (b *scStateUpdateBuffer) get() <-chan *scStateUpdate { return b.c } -// resolverUpdate contains the new resolved addresses or error if there's -// any. -type resolverUpdate struct { - addrs []resolver.Address - err error -} - // ccBalancerWrapper is a wrapper on top of cc for balancers. // It implements balancer.ClientConn interface. type ccBalancerWrapper struct { cc *ClientConn balancer balancer.Balancer stateChangeQueue *scStateUpdateBuffer - resolverUpdateCh chan *resolverUpdate + resolverUpdateCh chan *resolver.State done chan struct{} mu sync.Mutex @@ -106,7 +99,7 @@ func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.Bui ccb := &ccBalancerWrapper{ cc: cc, stateChangeQueue: newSCStateUpdateBuffer(), - resolverUpdateCh: make(chan *resolverUpdate, 1), + resolverUpdateCh: make(chan *resolver.State, 1), done: make(chan struct{}), subConns: make(map[*acBalancerWrapper]struct{}), } @@ -128,15 +121,23 @@ func (ccb *ccBalancerWrapper) watcher() { return default: } - ccb.balancer.HandleSubConnStateChange(t.sc, t.state) - case t := <-ccb.resolverUpdateCh: + if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { + ub.UpdateSubConnState(t.sc, balancer.SubConnState{ConnectivityState: t.state}) + } else { + ccb.balancer.HandleSubConnStateChange(t.sc, t.state) + } + case s := <-ccb.resolverUpdateCh: select { case <-ccb.done: ccb.balancer.Close() return default: } - ccb.balancer.HandleResolvedAddrs(t.addrs, t.err) + if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { + ub.UpdateResolverState(*s) + } else { + ccb.balancer.HandleResolvedAddrs(s.Addresses, nil) + } case <-ccb.done: } @@ -177,37 +178,23 @@ func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s co }) } -func (ccb *ccBalancerWrapper) handleResolvedAddrs(addrs []resolver.Address, err error) { +func (ccb *ccBalancerWrapper) updateResolverState(s resolver.State) { if ccb.cc.curBalancerName != grpclbName { - var containsGRPCLB bool - for _, a := range addrs { - if a.Type == resolver.GRPCLB { - containsGRPCLB = true - break + // Filter any grpclb addresses since we don't have the grpclb balancer. + for i := 0; i < len(s.Addresses); { + if s.Addresses[i].Type == resolver.GRPCLB { + copy(s.Addresses[i:], s.Addresses[i+1:]) + s.Addresses = s.Addresses[:len(s.Addresses)-1] + continue } - } - if containsGRPCLB { - // The current balancer is not grpclb, but addresses contain grpclb - // address. This means we failed to switch to grpclb, most likely - // because grpclb is not registered. Filter out all grpclb addresses - // from addrs before sending to balancer. - tempAddrs := make([]resolver.Address, 0, len(addrs)) - for _, a := range addrs { - if a.Type != resolver.GRPCLB { - tempAddrs = append(tempAddrs, a) - } - } - addrs = tempAddrs + i++ } } select { case <-ccb.resolverUpdateCh: default: } - ccb.resolverUpdateCh <- &resolverUpdate{ - addrs: addrs, - err: err, - } + ccb.resolverUpdateCh <- &s } func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { diff --git a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go index 29bda635..66e9a44a 100644 --- a/vendor/google.golang.org/grpc/balancer_v1_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_v1_wrapper.go @@ -20,7 +20,6 @@ package grpc import ( "context" - "strings" "sync" "google.golang.org/grpc/balancer" @@ -34,13 +33,7 @@ type balancerWrapperBuilder struct { } func (bwb *balancerWrapperBuilder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { - targetAddr := cc.Target() - targetSplitted := strings.Split(targetAddr, ":///") - if len(targetSplitted) >= 2 { - targetAddr = targetSplitted[1] - } - - bwb.b.Start(targetAddr, BalancerConfig{ + bwb.b.Start(opts.Target.Endpoint, BalancerConfig{ DialCreds: opts.DialCreds, Dialer: opts.Dialer, }) @@ -49,7 +42,7 @@ func (bwb *balancerWrapperBuilder) Build(cc balancer.ClientConn, opts balancer.B balancer: bwb.b, pickfirst: pickfirst, cc: cc, - targetAddr: targetAddr, + targetAddr: opts.Target.Endpoint, startCh: make(chan struct{}), conns: make(map[resolver.Address]balancer.SubConn), connSt: make(map[balancer.SubConn]*scState), @@ -120,7 +113,7 @@ func (bw *balancerWrapper) lbWatcher() { } for addrs := range notifyCh { - grpclog.Infof("balancerWrapper: got update addr from Notify: %v\n", addrs) + grpclog.Infof("balancerWrapper: got update addr from Notify: %v", addrs) if bw.pickfirst { var ( oldA resolver.Address diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index edbed876..78e6d178 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -42,7 +42,6 @@ import ( "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. @@ -69,11 +68,9 @@ var ( errConnClosing = errors.New("grpc: the connection is closing") // errBalancerClosed indicates that the balancer is closed. errBalancerClosed = errors.New("grpc: balancer is closed") - // We use an accessor so that minConnectTimeout can be - // atomically read and updated while testing. - getMinConnectTimeout = func() time.Duration { - return minConnectTimeout - } + // invalidDefaultServiceConfigErrPrefix is used to prefix the json parsing error for the default + // service config. + invalidDefaultServiceConfigErrPrefix = "grpc: the provided default service config is invalid" ) // The following errors are returned from Dial and DialContext @@ -140,6 +137,15 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * opt.apply(&cc.dopts) } + chainUnaryClientInterceptors(cc) + chainStreamClientInterceptors(cc) + + defer func() { + if err != nil { + cc.Close() + } + }() + if channelz.IsOn() { if cc.dopts.channelzParentID != 0 { cc.channelzID = channelz.RegisterChannel(&channelzChannel{cc}, cc.dopts.channelzParentID, target) @@ -179,6 +185,13 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * } } + if cc.dopts.defaultServiceConfigRawJSON != nil { + sc, err := parseServiceConfig(*cc.dopts.defaultServiceConfigRawJSON) + if err != nil { + return nil, fmt.Errorf("%s: %v", invalidDefaultServiceConfigErrPrefix, err) + } + cc.dopts.defaultServiceConfig = sc + } cc.mkp = cc.dopts.copts.KeepaliveParams if cc.dopts.copts.Dialer == nil { @@ -201,17 +214,12 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * ctx, cancel = context.WithTimeout(ctx, cc.dopts.timeout) defer cancel() } - defer func() { select { case <-ctx.Done(): conn, err = nil, ctx.Err() default: } - - if err != nil { - cc.Close() - } }() scSet := false @@ -220,7 +228,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * select { case sc, ok := <-cc.dopts.scChan: if ok { - cc.sc = sc + cc.sc = &sc scSet = true } default: @@ -266,7 +274,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * select { case sc, ok := <-cc.dopts.scChan: if ok { - cc.sc = sc + cc.sc = &sc } case <-ctx.Done(): return nil, ctx.Err() @@ -285,6 +293,7 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * CredsBundle: cc.dopts.copts.CredsBundle, Dialer: cc.dopts.copts.Dialer, ChannelzParentID: cc.channelzID, + Target: cc.parsedTarget, } // Build the resolver. @@ -322,6 +331,68 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * return cc, nil } +// chainUnaryClientInterceptors chains all unary client interceptors into one. +func chainUnaryClientInterceptors(cc *ClientConn) { + interceptors := cc.dopts.chainUnaryInts + // Prepend dopts.unaryInt to the chaining interceptors if it exists, since unaryInt will + // be executed before any other chained interceptors. + if cc.dopts.unaryInt != nil { + interceptors = append([]UnaryClientInterceptor{cc.dopts.unaryInt}, interceptors...) + } + var chainedInt UnaryClientInterceptor + if len(interceptors) == 0 { + chainedInt = nil + } else if len(interceptors) == 1 { + chainedInt = interceptors[0] + } else { + chainedInt = func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, invoker UnaryInvoker, opts ...CallOption) error { + return interceptors[0](ctx, method, req, reply, cc, getChainUnaryInvoker(interceptors, 0, invoker), opts...) + } + } + cc.dopts.unaryInt = chainedInt +} + +// getChainUnaryInvoker recursively generate the chained unary invoker. +func getChainUnaryInvoker(interceptors []UnaryClientInterceptor, curr int, finalInvoker UnaryInvoker) UnaryInvoker { + if curr == len(interceptors)-1 { + return finalInvoker + } + return func(ctx context.Context, method string, req, reply interface{}, cc *ClientConn, opts ...CallOption) error { + return interceptors[curr+1](ctx, method, req, reply, cc, getChainUnaryInvoker(interceptors, curr+1, finalInvoker), opts...) + } +} + +// chainStreamClientInterceptors chains all stream client interceptors into one. +func chainStreamClientInterceptors(cc *ClientConn) { + interceptors := cc.dopts.chainStreamInts + // Prepend dopts.streamInt to the chaining interceptors if it exists, since streamInt will + // be executed before any other chained interceptors. + if cc.dopts.streamInt != nil { + interceptors = append([]StreamClientInterceptor{cc.dopts.streamInt}, interceptors...) + } + var chainedInt StreamClientInterceptor + if len(interceptors) == 0 { + chainedInt = nil + } else if len(interceptors) == 1 { + chainedInt = interceptors[0] + } else { + chainedInt = func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, streamer Streamer, opts ...CallOption) (ClientStream, error) { + return interceptors[0](ctx, desc, cc, method, getChainStreamer(interceptors, 0, streamer), opts...) + } + } + cc.dopts.streamInt = chainedInt +} + +// getChainStreamer recursively generate the chained client stream constructor. +func getChainStreamer(interceptors []StreamClientInterceptor, curr int, finalStreamer Streamer) Streamer { + if curr == len(interceptors)-1 { + return finalStreamer + } + return func(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) { + return interceptors[curr+1](ctx, desc, cc, method, getChainStreamer(interceptors, curr+1, finalStreamer), opts...) + } +} + // connectivityStateManager keeps the connectivity.State of ClientConn. // This struct will eventually be exported so the balancers can access it. type connectivityStateManager struct { @@ -388,14 +459,11 @@ type ClientConn struct { mu sync.RWMutex resolverWrapper *ccResolverWrapper - sc ServiceConfig - scRaw string + sc *ServiceConfig conns map[*addrConn]struct{} // Keepalive parameter can be updated if a GoAway is received. mkp keepalive.ClientParameters curBalancerName string - preBalancerName string // previous balancer name. - curAddresses []resolver.Address balancerWrapper *ccBalancerWrapper retryThrottler atomic.Value @@ -437,8 +505,7 @@ func (cc *ClientConn) scWatcher() { cc.mu.Lock() // TODO: load balance policy runtime change is ignored. // We may revisit this decision in the future. - cc.sc = sc - cc.scRaw = "" + cc.sc = &sc cc.mu.Unlock() case <-cc.ctx.Done(): return @@ -465,59 +532,84 @@ func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error { } } -func (cc *ClientConn) handleResolvedAddrs(addrs []resolver.Address, err error) { +// gRPC should resort to default service config when: +// * resolver service config is disabled +// * or, resolver does not return a service config or returns an invalid one. +func (cc *ClientConn) fallbackToDefaultServiceConfig(sc string) bool { + if cc.dopts.disableServiceConfig { + return true + } + // The logic below is temporary, will be removed once we change the resolver.State ServiceConfig field type. + // Right now, we assume that empty service config string means resolver does not return a config. + if sc == "" { + return true + } + // TODO: the logic below is temporary. Once we finish the logic to validate service config + // in resolver, we will replace the logic below. + _, err := parseServiceConfig(sc) + return err != nil +} + +func (cc *ClientConn) updateResolverState(s resolver.State) error { cc.mu.Lock() defer cc.mu.Unlock() + // Check if the ClientConn is already closed. Some fields (e.g. + // balancerWrapper) are set to nil when closing the ClientConn, and could + // cause nil pointer panic if we don't have this check. if cc.conns == nil { - // cc was closed. - return + return nil } - if reflect.DeepEqual(cc.curAddresses, addrs) { - return + if cc.fallbackToDefaultServiceConfig(s.ServiceConfig) { + if cc.dopts.defaultServiceConfig != nil && cc.sc == nil { + cc.applyServiceConfig(cc.dopts.defaultServiceConfig) + } + } else { + // TODO: the parsing logic below will be moved inside resolver. + sc, err := parseServiceConfig(s.ServiceConfig) + if err != nil { + return err + } + if cc.sc == nil || cc.sc.rawJSONString != s.ServiceConfig { + cc.applyServiceConfig(sc) + } } - cc.curAddresses = addrs - cc.firstResolveEvent.Fire() + // update the service config that will be sent to balancer. + if cc.sc != nil { + s.ServiceConfig = cc.sc.rawJSONString + } if cc.dopts.balancerBuilder == nil { // Only look at balancer types and switch balancer if balancer dial // option is not set. var isGRPCLB bool - for _, a := range addrs { + for _, a := range s.Addresses { if a.Type == resolver.GRPCLB { isGRPCLB = true break } } var newBalancerName string + // TODO: use new loadBalancerConfig field with appropriate priority. if isGRPCLB { newBalancerName = grpclbName + } else if cc.sc != nil && cc.sc.LB != nil { + newBalancerName = *cc.sc.LB } else { - // Address list doesn't contain grpclb address. Try to pick a - // non-grpclb balancer. - newBalancerName = cc.curBalancerName - // If current balancer is grpclb, switch to the previous one. - if newBalancerName == grpclbName { - newBalancerName = cc.preBalancerName - } - // The following could be true in two cases: - // - the first time handling resolved addresses - // (curBalancerName="") - // - the first time handling non-grpclb addresses - // (curBalancerName="grpclb", preBalancerName="") - if newBalancerName == "" { - newBalancerName = PickFirstBalancerName - } + newBalancerName = PickFirstBalancerName } cc.switchBalancer(newBalancerName) } else if cc.balancerWrapper == nil { // Balancer dial option was set, and this is the first time handling // resolved addresses. Build a balancer with dopts.balancerBuilder. + cc.curBalancerName = cc.dopts.balancerBuilder.Name() cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts) } - cc.balancerWrapper.handleResolvedAddrs(addrs, nil) + cc.balancerWrapper.updateResolverState(s) + cc.firstResolveEvent.Fire() + return nil } // switchBalancer starts the switching from current balancer to the balancer @@ -529,10 +621,6 @@ func (cc *ClientConn) handleResolvedAddrs(addrs []resolver.Address, err error) { // // Caller must hold cc.mu. func (cc *ClientConn) switchBalancer(name string) { - if cc.conns == nil { - return - } - if strings.ToLower(cc.curBalancerName) == strings.ToLower(name) { return } @@ -542,15 +630,11 @@ func (cc *ClientConn) switchBalancer(name string) { grpclog.Infoln("ignoring balancer switching: Balancer DialOption used instead") return } - // TODO(bar switching) change this to two steps: drain and close. - // Keep track of sc in wrapper. if cc.balancerWrapper != nil { cc.balancerWrapper.close() } builder := balancer.Get(name) - // TODO(yuxuanli): If user send a service config that does not contain a valid balancer name, should - // we reuse previous one? if channelz.IsOn() { if builder == nil { channelz.AddTraceEvent(cc.channelzID, &channelz.TraceEventDesc{ @@ -569,7 +653,6 @@ func (cc *ClientConn) switchBalancer(name string) { builder = newPickfirstBuilder() } - cc.preBalancerName = cc.curBalancerName cc.curBalancerName = builder.Name() cc.balancerWrapper = newCCBalancerWrapper(cc, builder, cc.balancerBuildOpts) } @@ -732,6 +815,9 @@ func (cc *ClientConn) GetMethodConfig(method string) MethodConfig { // TODO: Avoid the locking here. cc.mu.RLock() defer cc.mu.RUnlock() + if cc.sc == nil { + return MethodConfig{} + } m, ok := cc.sc.Methods[method] if !ok { i := strings.LastIndex(method, "/") @@ -743,14 +829,15 @@ func (cc *ClientConn) GetMethodConfig(method string) MethodConfig { func (cc *ClientConn) healthCheckConfig() *healthCheckConfig { cc.mu.RLock() defer cc.mu.RUnlock() + if cc.sc == nil { + return nil + } return cc.sc.healthCheckConfig } func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, func(balancer.DoneInfo), error) { - hdr, _ := metadata.FromOutgoingContext(ctx) t, done, err := cc.blockingpicker.pick(ctx, failfast, balancer.PickOptions{ FullMethodName: method, - Header: hdr, }) if err != nil { return nil, nil, toRPCErr(err) @@ -758,65 +845,25 @@ func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method st return t, done, nil } -// handleServiceConfig parses the service config string in JSON format to Go native -// struct ServiceConfig, and store both the struct and the JSON string in ClientConn. -func (cc *ClientConn) handleServiceConfig(js string) error { - if cc.dopts.disableServiceConfig { - return nil +func (cc *ClientConn) applyServiceConfig(sc *ServiceConfig) error { + if sc == nil { + // should never reach here. + return fmt.Errorf("got nil pointer for service config") } - if cc.scRaw == js { - return nil - } - if channelz.IsOn() { - channelz.AddTraceEvent(cc.channelzID, &channelz.TraceEventDesc{ - // The special formatting of \"%s\" instead of %q is to provide nice printing of service config - // for human consumption. - Desc: fmt.Sprintf("Channel has a new service config \"%s\"", js), - Severity: channelz.CtINFO, - }) - } - sc, err := parseServiceConfig(js) - if err != nil { - return err - } - cc.mu.Lock() - // Check if the ClientConn is already closed. Some fields (e.g. - // balancerWrapper) are set to nil when closing the ClientConn, and could - // cause nil pointer panic if we don't have this check. - if cc.conns == nil { - cc.mu.Unlock() - return nil - } - cc.scRaw = js cc.sc = sc - if sc.retryThrottling != nil { + if cc.sc.retryThrottling != nil { newThrottler := &retryThrottler{ - tokens: sc.retryThrottling.MaxTokens, - max: sc.retryThrottling.MaxTokens, - thresh: sc.retryThrottling.MaxTokens / 2, - ratio: sc.retryThrottling.TokenRatio, + tokens: cc.sc.retryThrottling.MaxTokens, + max: cc.sc.retryThrottling.MaxTokens, + thresh: cc.sc.retryThrottling.MaxTokens / 2, + ratio: cc.sc.retryThrottling.TokenRatio, } cc.retryThrottler.Store(newThrottler) } else { cc.retryThrottler.Store((*retryThrottler)(nil)) } - if sc.LB != nil && *sc.LB != grpclbName { // "grpclb" is not a valid balancer option in service config. - if cc.curBalancerName == grpclbName { - // If current balancer is grpclb, there's at least one grpclb - // balancer address in the resolved list. Don't switch the balancer, - // but change the previous balancer name, so if a new resolved - // address list doesn't contain grpclb address, balancer will be - // switched to *sc.LB. - cc.preBalancerName = *sc.LB - } else { - cc.switchBalancer(*sc.LB) - cc.balancerWrapper.handleResolvedAddrs(cc.curAddresses, nil) - } - } - - cc.mu.Unlock() return nil } @@ -892,7 +939,7 @@ func (cc *ClientConn) Close() error { } channelz.AddTraceEvent(cc.channelzID, ted) // TraceEvent needs to be called before RemoveEntry, as TraceEvent may add trace reference to - // the entity beng deleted, and thus prevent it from being deleted right away. + // the entity being deleted, and thus prevent it from being deleted right away. channelz.RemoveEntry(cc.channelzID) } return nil @@ -921,8 +968,6 @@ type addrConn struct { // Use updateConnectivityState for updating addrConn's connectivity state. state connectivity.State - tearDownErr error // The reason this addrConn is torn down. - backoffIdx int // Needs to be stateful for resetConnectBackoff. resetBackoff chan struct{} @@ -963,190 +1008,169 @@ func (ac *addrConn) adjustParams(r transport.GoAwayReason) { func (ac *addrConn) resetTransport() { for i := 0; ; i++ { - tryNextAddrFromStart := grpcsync.NewEvent() - - ac.mu.Lock() if i > 0 { ac.cc.resolveNow(resolver.ResolveNowOption{}) } + + ac.mu.Lock() + if ac.state == connectivity.Shutdown { + ac.mu.Unlock() + return + } + addrs := ac.addrs backoffFor := ac.dopts.bs.Backoff(ac.backoffIdx) - // This will be the duration that dial gets to finish. - dialDuration := getMinConnectTimeout() + dialDuration := minConnectTimeout + if ac.dopts.minConnectTimeout != nil { + dialDuration = ac.dopts.minConnectTimeout() + } + if dialDuration < backoffFor { // Give dial more time as we keep failing to connect. dialDuration = backoffFor } + // We can potentially spend all the time trying the first address, and + // if the server accepts the connection and then hangs, the following + // addresses will never be tried. + // + // The spec doesn't mention what should be done for multiple addresses. + // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md#proposed-backoff-algorithm connectDeadline := time.Now().Add(dialDuration) ac.mu.Unlock() - addrLoop: - for _, addr := range addrs { + newTr, addr, reconnect, err := ac.tryAllAddrs(addrs, connectDeadline) + if err != nil { + // After exhausting all addresses, the addrConn enters + // TRANSIENT_FAILURE. ac.mu.Lock() - if ac.state == connectivity.Shutdown { ac.mu.Unlock() return } - ac.updateConnectivityState(connectivity.Connecting) - ac.transport = nil + ac.updateConnectivityState(connectivity.TransientFailure) - ac.cc.mu.RLock() - ac.dopts.copts.KeepaliveParams = ac.cc.mkp - ac.cc.mu.RUnlock() + // Backoff. + b := ac.resetBackoff + ac.mu.Unlock() - if ac.state == connectivity.Shutdown { + timer := time.NewTimer(backoffFor) + select { + case <-timer.C: + ac.mu.Lock() + ac.backoffIdx++ ac.mu.Unlock() + case <-b: + timer.Stop() + case <-ac.ctx.Done(): + timer.Stop() return } - - copts := ac.dopts.copts - if ac.scopts.CredsBundle != nil { - copts.CredsBundle = ac.scopts.CredsBundle - } - hctx, hcancel := context.WithCancel(ac.ctx) - defer hcancel() - ac.mu.Unlock() - - if channelz.IsOn() { - channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ - Desc: fmt.Sprintf("Subchannel picks a new address %q to connect", addr.Addr), - Severity: channelz.CtINFO, - }) - } - - reconnect := grpcsync.NewEvent() - prefaceReceived := make(chan struct{}) - newTr, err := ac.createTransport(addr, copts, connectDeadline, reconnect, prefaceReceived) - if err == nil { - ac.mu.Lock() - ac.curAddr = addr - ac.transport = newTr - ac.mu.Unlock() - - healthCheckConfig := ac.cc.healthCheckConfig() - // LB channel health checking is only enabled when all the four requirements below are met: - // 1. it is not disabled by the user with the WithDisableHealthCheck DialOption, - // 2. the internal.HealthCheckFunc is set by importing the grpc/healthcheck package, - // 3. a service config with non-empty healthCheckConfig field is provided, - // 4. the current load balancer allows it. - healthcheckManagingState := false - if !ac.cc.dopts.disableHealthCheck && healthCheckConfig != nil && ac.scopts.HealthCheckEnabled { - if ac.cc.dopts.healthCheckFunc == nil { - // TODO: add a link to the health check doc in the error message. - grpclog.Error("the client side LB channel health check function has not been set.") - } else { - // TODO(deklerk) refactor to just return transport - go ac.startHealthCheck(hctx, newTr, addr, healthCheckConfig.ServiceName) - healthcheckManagingState = true - } - } - if !healthcheckManagingState { - ac.mu.Lock() - ac.updateConnectivityState(connectivity.Ready) - ac.mu.Unlock() - } - } else { - hcancel() - if err == errConnClosing { - return - } - - if tryNextAddrFromStart.HasFired() { - break addrLoop - } - continue - } - - ac.mu.Lock() - reqHandshake := ac.dopts.reqHandshake - ac.mu.Unlock() - - <-reconnect.Done() - hcancel() - - if reqHandshake == envconfig.RequireHandshakeHybrid { - // In RequireHandshakeHybrid mode, we must check to see whether - // server preface has arrived yet to decide whether to start - // reconnecting at the top of the list (server preface received) - // or continue with the next addr in the list as if the - // connection were not successful (server preface not received). - select { - case <-prefaceReceived: - // We received a server preface - huzzah! We consider this - // a success and restart from the top of the addr list. - ac.mu.Lock() - ac.backoffIdx = 0 - ac.mu.Unlock() - break addrLoop - default: - // Despite having set state to READY, in hybrid mode we - // consider this a failure and continue connecting at the - // next addr in the list. - ac.mu.Lock() - if ac.state == connectivity.Shutdown { - ac.mu.Unlock() - return - } - - ac.updateConnectivityState(connectivity.TransientFailure) - ac.mu.Unlock() - - if tryNextAddrFromStart.HasFired() { - break addrLoop - } - } - } else { - // In RequireHandshakeOn mode, we would have already waited for - // the server preface, so we consider this a success and restart - // from the top of the addr list. In RequireHandshakeOff mode, - // we don't care to wait for the server preface before - // considering this a success, so we also restart from the top - // of the addr list. - ac.mu.Lock() - ac.backoffIdx = 0 - ac.mu.Unlock() - break addrLoop - } + continue } - // After exhausting all addresses, or after need to reconnect after a - // READY, the addrConn enters TRANSIENT_FAILURE. + ac.mu.Lock() + if ac.state == connectivity.Shutdown { + newTr.Close() + ac.mu.Unlock() + return + } + ac.curAddr = addr + ac.transport = newTr + ac.backoffIdx = 0 + + healthCheckConfig := ac.cc.healthCheckConfig() + // LB channel health checking is only enabled when all the four requirements below are met: + // 1. it is not disabled by the user with the WithDisableHealthCheck DialOption, + // 2. the internal.HealthCheckFunc is set by importing the grpc/healthcheck package, + // 3. a service config with non-empty healthCheckConfig field is provided, + // 4. the current load balancer allows it. + hctx, hcancel := context.WithCancel(ac.ctx) + healthcheckManagingState := false + if !ac.cc.dopts.disableHealthCheck && healthCheckConfig != nil && ac.scopts.HealthCheckEnabled { + if ac.cc.dopts.healthCheckFunc == nil { + // TODO: add a link to the health check doc in the error message. + grpclog.Error("the client side LB channel health check function has not been set.") + } else { + // TODO(deklerk) refactor to just return transport + go ac.startHealthCheck(hctx, newTr, addr, healthCheckConfig.ServiceName) + healthcheckManagingState = true + } + } + if !healthcheckManagingState { + ac.updateConnectivityState(connectivity.Ready) + } + ac.mu.Unlock() + + // Block until the created transport is down. And when this happens, + // we restart from the top of the addr list. + <-reconnect.Done() + hcancel() + + // Need to reconnect after a READY, the addrConn enters + // TRANSIENT_FAILURE. + // + // This will set addrConn to TRANSIENT_FAILURE for a very short period + // of time, and turns CONNECTING. It seems reasonable to skip this, but + // READY-CONNECTING is not a valid transition. ac.mu.Lock() if ac.state == connectivity.Shutdown { ac.mu.Unlock() return } ac.updateConnectivityState(connectivity.TransientFailure) - - // Backoff. - b := ac.resetBackoff - timer := time.NewTimer(backoffFor) - acctx := ac.ctx ac.mu.Unlock() - - select { - case <-timer.C: - ac.mu.Lock() - ac.backoffIdx++ - ac.mu.Unlock() - case <-b: - timer.Stop() - case <-acctx.Done(): - timer.Stop() - return - } } } -// createTransport creates a connection to one of the backends in addrs. It -// sets ac.transport in the success case, or it returns an error if it was -// unable to successfully create a transport. -// -// If waitForHandshake is enabled, it blocks until server preface arrives. -func (ac *addrConn) createTransport(addr resolver.Address, copts transport.ConnectOptions, connectDeadline time.Time, reconnect *grpcsync.Event, prefaceReceived chan struct{}) (transport.ClientTransport, error) { +// tryAllAddrs tries to creates a connection to the addresses, and stop when at the +// first successful one. It returns the transport, the address and a Event in +// the successful case. The Event fires when the returned transport disconnects. +func (ac *addrConn) tryAllAddrs(addrs []resolver.Address, connectDeadline time.Time) (transport.ClientTransport, resolver.Address, *grpcsync.Event, error) { + for _, addr := range addrs { + ac.mu.Lock() + if ac.state == connectivity.Shutdown { + ac.mu.Unlock() + return nil, resolver.Address{}, nil, errConnClosing + } + ac.updateConnectivityState(connectivity.Connecting) + ac.transport = nil + + ac.cc.mu.RLock() + ac.dopts.copts.KeepaliveParams = ac.cc.mkp + ac.cc.mu.RUnlock() + + copts := ac.dopts.copts + if ac.scopts.CredsBundle != nil { + copts.CredsBundle = ac.scopts.CredsBundle + } + ac.mu.Unlock() + + if channelz.IsOn() { + channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Subchannel picks a new address %q to connect", addr.Addr), + Severity: channelz.CtINFO, + }) + } + + newTr, reconnect, err := ac.createTransport(addr, copts, connectDeadline) + if err == nil { + return newTr, addr, reconnect, nil + } + ac.cc.blockingpicker.updateConnectionError(err) + } + + // Couldn't connect to any address. + return nil, resolver.Address{}, nil, fmt.Errorf("couldn't connect to any address") +} + +// createTransport creates a connection to addr. It returns the transport and a +// Event in the successful case. The Event fires when the returned transport +// disconnects. +func (ac *addrConn) createTransport(addr resolver.Address, copts transport.ConnectOptions, connectDeadline time.Time) (transport.ClientTransport, *grpcsync.Event, error) { + prefaceReceived := make(chan struct{}) onCloseCalled := make(chan struct{}) + reconnect := grpcsync.NewEvent() target := transport.TargetInfo{ Addr: addr.Addr, @@ -1154,8 +1178,6 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne Authority: ac.cc.authority, } - prefaceTimer := time.NewTimer(time.Until(connectDeadline)) - onGoAway := func(r transport.GoAwayReason) { ac.mu.Lock() ac.adjustParams(r) @@ -1165,13 +1187,11 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne onClose := func() { close(onCloseCalled) - prefaceTimer.Stop() reconnect.Fire() } onPrefaceReceipt := func() { close(prefaceReceived) - prefaceTimer.Stop() } connectCtx, cancel := context.WithDeadline(ac.ctx, connectDeadline) @@ -1181,69 +1201,28 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne } newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, target, copts, onPrefaceReceipt, onGoAway, onClose) - - if err == nil { - if ac.dopts.reqHandshake == envconfig.RequireHandshakeOn { - select { - case <-prefaceTimer.C: - // We didn't get the preface in time. - newTr.Close() - err = errors.New("timed out waiting for server handshake") - case <-prefaceReceived: - // We got the preface - huzzah! things are good. - case <-onCloseCalled: - // The transport has already closed - noop. - return nil, errors.New("connection closed") - } - } else if ac.dopts.reqHandshake == envconfig.RequireHandshakeHybrid { - go func() { - select { - case <-prefaceTimer.C: - // We didn't get the preface in time. - newTr.Close() - case <-prefaceReceived: - // We got the preface just in the nick of time - huzzah! - case <-onCloseCalled: - // The transport has already closed - noop. - } - }() - } - } - if err != nil { // newTr is either nil, or closed. - ac.cc.blockingpicker.updateConnectionError(err) - ac.mu.Lock() - if ac.state == connectivity.Shutdown { - // ac.tearDown(...) has been invoked. - ac.mu.Unlock() - - return nil, errConnClosing - } - ac.mu.Unlock() grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v. Err :%v. Reconnecting...", addr, err) - return nil, err + return nil, nil, err } - // Now there is a viable transport to be use, so set ac.transport to reflect the new viable transport. - ac.mu.Lock() - if ac.state == connectivity.Shutdown { - ac.mu.Unlock() - newTr.Close() - return nil, errConnClosing + if ac.dopts.reqHandshake == envconfig.RequireHandshakeOn { + select { + case <-time.After(connectDeadline.Sub(time.Now())): + // We didn't get the preface in time. + newTr.Close() + grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v: didn't receive server preface in time. Reconnecting...", addr) + return nil, nil, errors.New("timed out waiting for server handshake") + case <-prefaceReceived: + // We got the preface - huzzah! things are good. + case <-onCloseCalled: + // The transport has already closed - noop. + return nil, nil, errors.New("connection closed") + // TODO(deklerk) this should bail on ac.ctx.Done(). Add a test and fix. + } } - ac.mu.Unlock() - - // Now there is a viable transport to be use, so set ac.transport to reflect the new viable transport. - ac.mu.Lock() - if ac.state == connectivity.Shutdown { - ac.mu.Unlock() - newTr.Close() - return nil, errConnClosing - } - ac.mu.Unlock() - - return newTr, nil + return newTr, reconnect, nil } func (ac *addrConn) startHealthCheck(ctx context.Context, newTr transport.ClientTransport, addr resolver.Address, serviceName string) { @@ -1331,7 +1310,6 @@ func (ac *addrConn) tearDown(err error) { // between setting the state and logic that waits on context cancelation / etc. ac.updateConnectivityState(connectivity.Shutdown) ac.cancel() - ac.tearDownErr = err ac.curAddr = resolver.Address{} if err == errConnDrain && curTr != nil { // GracefulClose(...) may be executed multiple times when diff --git a/vendor/google.golang.org/grpc/codes/codes.go b/vendor/google.golang.org/grpc/codes/codes.go index d9b9d578..02738839 100644 --- a/vendor/google.golang.org/grpc/codes/codes.go +++ b/vendor/google.golang.org/grpc/codes/codes.go @@ -132,7 +132,8 @@ const ( // Unavailable indicates the service is currently unavailable. // This is a most likely a transient condition and may be corrected - // by retrying with a backoff. + // by retrying with a backoff. Note that it is not always safe to retry + // non-idempotent operations. // // See litmus test above for deciding between FailedPrecondition, // Aborted, and Unavailable. diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index a8515604..88aff945 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -36,9 +36,6 @@ import ( "google.golang.org/grpc/credentials/internal" ) -// alpnProtoStr are the specified application level protocols for gRPC. -var alpnProtoStr = []string{"h2"} - // PerRPCCredentials defines the common interface for the credentials which need to // attach security information to every RPC (e.g., oauth2). type PerRPCCredentials interface { @@ -208,10 +205,23 @@ func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { return nil } +const alpnProtoStrH2 = "h2" + +func appendH2ToNextProtos(ps []string) []string { + for _, p := range ps { + if p == alpnProtoStrH2 { + return ps + } + } + ret := make([]string, 0, len(ps)+1) + ret = append(ret, ps...) + return append(ret, alpnProtoStrH2) +} + // NewTLS uses c to construct a TransportCredentials based on TLS. func NewTLS(c *tls.Config) TransportCredentials { tc := &tlsCreds{cloneTLSConfig(c)} - tc.config.NextProtos = alpnProtoStr + tc.config.NextProtos = appendH2ToNextProtos(tc.config.NextProtos) return tc } diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 537b2586..69c00315 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -39,8 +39,12 @@ import ( // dialOptions configure a Dial call. dialOptions are set by the DialOption // values passed to Dial. type dialOptions struct { - unaryInt UnaryClientInterceptor - streamInt StreamClientInterceptor + unaryInt UnaryClientInterceptor + streamInt StreamClientInterceptor + + chainUnaryInts []UnaryClientInterceptor + chainStreamInts []StreamClientInterceptor + cp Compressor dc Decompressor bs backoff.Strategy @@ -55,13 +59,16 @@ type dialOptions struct { // balancer, and also by WithBalancerName dial option. balancerBuilder balancer.Builder // This is to support grpclb. - resolverBuilder resolver.Builder - reqHandshake envconfig.RequireHandshakeSetting - channelzParentID int64 - disableServiceConfig bool - disableRetry bool - disableHealthCheck bool - healthCheckFunc internal.HealthChecker + resolverBuilder resolver.Builder + reqHandshake envconfig.RequireHandshakeSetting + channelzParentID int64 + disableServiceConfig bool + disableRetry bool + disableHealthCheck bool + healthCheckFunc internal.HealthChecker + minConnectTimeout func() time.Duration + defaultServiceConfig *ServiceConfig // defaultServiceConfig is parsed from defaultServiceConfigRawJSON. + defaultServiceConfigRawJSON *string } // DialOption configures how we set up the connection. @@ -411,6 +418,17 @@ func WithUnaryInterceptor(f UnaryClientInterceptor) DialOption { }) } +// WithChainUnaryInterceptor returns a DialOption that specifies the chained +// interceptor for unary RPCs. The first interceptor will be the outer most, +// while the last interceptor will be the inner most wrapper around the real call. +// All interceptors added by this method will be chained, and the interceptor +// defined by WithUnaryInterceptor will always be prepended to the chain. +func WithChainUnaryInterceptor(interceptors ...UnaryClientInterceptor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.chainUnaryInts = append(o.chainUnaryInts, interceptors...) + }) +} + // WithStreamInterceptor returns a DialOption that specifies the interceptor for // streaming RPCs. func WithStreamInterceptor(f StreamClientInterceptor) DialOption { @@ -419,6 +437,17 @@ func WithStreamInterceptor(f StreamClientInterceptor) DialOption { }) } +// WithChainStreamInterceptor returns a DialOption that specifies the chained +// interceptor for unary RPCs. The first interceptor will be the outer most, +// while the last interceptor will be the inner most wrapper around the real call. +// All interceptors added by this method will be chained, and the interceptor +// defined by WithStreamInterceptor will always be prepended to the chain. +func WithChainStreamInterceptor(interceptors ...StreamClientInterceptor) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.chainStreamInts = append(o.chainStreamInts, interceptors...) + }) +} + // WithAuthority returns a DialOption that specifies the value to be used as the // :authority pseudo-header. This value only works with WithInsecure and has no // effect if TransportCredentials are present. @@ -437,15 +466,30 @@ func WithChannelzParentID(id int64) DialOption { }) } -// WithDisableServiceConfig returns a DialOption that causes grpc to ignore any +// WithDisableServiceConfig returns a DialOption that causes gRPC to ignore any // service config provided by the resolver and provides a hint to the resolver // to not fetch service configs. +// +// Note that this dial option only disables service config from resolver. If +// default service config is provided, gRPC will use the default service config. func WithDisableServiceConfig() DialOption { return newFuncDialOption(func(o *dialOptions) { o.disableServiceConfig = true }) } +// WithDefaultServiceConfig returns a DialOption that configures the default +// service config, which will be used in cases where: +// 1. WithDisableServiceConfig is called. +// 2. Resolver does not return service config or if the resolver gets and invalid config. +// +// This API is EXPERIMENTAL. +func WithDefaultServiceConfig(s string) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.defaultServiceConfigRawJSON = &s + }) +} + // WithDisableRetry returns a DialOption that disables retries, even if the // service config enables them. This does not impact transparent retries, which // will happen automatically if no data is written to the wire or if the RPC is @@ -470,7 +514,8 @@ func WithMaxHeaderListSize(s uint32) DialOption { }) } -// WithDisableHealthCheck disables the LB channel health checking for all SubConns of this ClientConn. +// WithDisableHealthCheck disables the LB channel health checking for all +// SubConns of this ClientConn. // // This API is EXPERIMENTAL. func WithDisableHealthCheck() DialOption { @@ -479,8 +524,8 @@ func WithDisableHealthCheck() DialOption { }) } -// withHealthCheckFunc replaces the default health check function with the provided one. It makes -// tests easier to change the health check function. +// withHealthCheckFunc replaces the default health check function with the +// provided one. It makes tests easier to change the health check function. // // For testing purpose only. func withHealthCheckFunc(f internal.HealthChecker) DialOption { @@ -500,3 +545,14 @@ func defaultDialOptions() dialOptions { }, } } + +// withGetMinConnectDeadline specifies the function that clientconn uses to +// get minConnectDeadline. This can be used to make connection attempts happen +// faster/slower. +// +// For testing purpose only. +func withMinConnectDeadline(f func() time.Duration) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.minConnectTimeout = f + }) +} diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index ade8b7ce..30a75da9 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -102,10 +102,10 @@ func RegisterCodec(codec Codec) { if codec == nil { panic("cannot register a nil Codec") } - contentSubtype := strings.ToLower(codec.Name()) - if contentSubtype == "" { - panic("cannot register Codec with empty string result for String()") + if codec.Name() == "" { + panic("cannot register Codec with empty string result for Name()") } + contentSubtype := strings.ToLower(codec.Name()) registeredCodecs[contentSubtype] = codec } diff --git a/vendor/google.golang.org/grpc/go.mod b/vendor/google.golang.org/grpc/go.mod index 04188077..b75c069a 100644 --- a/vendor/google.golang.org/grpc/go.mod +++ b/vendor/google.golang.org/grpc/go.mod @@ -7,13 +7,13 @@ require ( github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/mock v1.1.1 github.com/golang/protobuf v1.2.0 - golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3 - golang.org/x/net v0.0.0-20180826012351-8a410e7b638d + github.com/google/go-cmp v0.2.0 + golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 + golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect - golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 - golang.org/x/text v0.3.0 // indirect - golang.org/x/tools v0.0.0-20190114222345-bf090417da8b + golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a + golang.org/x/tools v0.0.0-20190311212946-11955173bddd google.golang.org/appengine v1.1.0 // indirect google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099 diff --git a/vendor/google.golang.org/grpc/go.sum b/vendor/google.golang.org/grpc/go.sum index a79939d9..2a172347 100644 --- a/vendor/google.golang.org/grpc/go.sum +++ b/vendor/google.golang.org/grpc/go.sum @@ -10,20 +10,23 @@ github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3 h1:x/bBzNauLQAlE3fLku/xy92Y8QwKX5HZymrMz2IiKFc= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d h1:g9qWBGx4puODJTMVyoPrpoxPFgVGd+z1DZwjfRu4d0I= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522 h1:Ve1ORMCxvRmSXBwJK+t3Oy+V2vRW2OetUQBq4rJIkZE= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b h1:qMK98NmNCRVDIYFycQ5yVRkvgDUFfdP8Ip4KqmDEB7g= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go index 1fabb11e..51bb9457 100644 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ b/vendor/google.golang.org/grpc/grpclog/grpclog.go @@ -18,7 +18,7 @@ // Package grpclog defines logging for grpc. // -// All logs in transport package only go to verbose level 2. +// All logs in transport and grpclb packages only go to verbose level 2. // All logs in other packages in grpc are logged in spite of the verbosity level. // // In the default logger, diff --git a/vendor/google.golang.org/grpc/internal/balancerload/load.go b/vendor/google.golang.org/grpc/internal/balancerload/load.go new file mode 100644 index 00000000..3a905d96 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/balancerload/load.go @@ -0,0 +1,46 @@ +/* + * Copyright 2019 gRPC authors. + * + * 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. + */ + +// Package balancerload defines APIs to parse server loads in trailers. The +// parsed loads are sent to balancers in DoneInfo. +package balancerload + +import ( + "google.golang.org/grpc/metadata" +) + +// Parser converts loads from metadata into a concrete type. +type Parser interface { + // Parse parses loads from metadata. + Parse(md metadata.MD) interface{} +} + +var parser Parser + +// SetParser sets the load parser. +// +// Not mutex-protected, should be called before any gRPC functions. +func SetParser(lr Parser) { + parser = lr +} + +// Parse calls parser.Read(). +func Parse(md metadata.MD) interface{} { + if parser == nil { + return nil + } + return parser.Parse(md) +} diff --git a/vendor/google.golang.org/grpc/internal/channelz/funcs.go b/vendor/google.golang.org/grpc/internal/channelz/funcs.go index 041520d3..f0744f99 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/funcs.go +++ b/vendor/google.golang.org/grpc/internal/channelz/funcs.go @@ -24,6 +24,7 @@ package channelz import ( + "fmt" "sort" "sync" "sync/atomic" @@ -95,9 +96,14 @@ func (d *dbWrapper) get() *channelMap { // NewChannelzStorage initializes channelz data storage and id generator. // +// This function returns a cleanup function to wait for all channelz state to be reset by the +// grpc goroutines when those entities get closed. By using this cleanup function, we make sure tests +// don't mess up each other, i.e. lingering goroutine from previous test doing entity removal happen +// to remove some entity just register by the new test, since the id space is the same. +// // Note: This function is exported for testing purpose only. User should not call // it in most cases. -func NewChannelzStorage() { +func NewChannelzStorage() (cleanup func() error) { db.set(&channelMap{ topLevelChannels: make(map[int64]struct{}), channels: make(map[int64]*channel), @@ -107,6 +113,28 @@ func NewChannelzStorage() { subChannels: make(map[int64]*subChannel), }) idGen.reset() + return func() error { + var err error + cm := db.get() + if cm == nil { + return nil + } + for i := 0; i < 1000; i++ { + cm.mu.Lock() + if len(cm.topLevelChannels) == 0 && len(cm.servers) == 0 && len(cm.channels) == 0 && len(cm.subChannels) == 0 && len(cm.listenSockets) == 0 && len(cm.normalSockets) == 0 { + cm.mu.Unlock() + // all things stored in the channelz map have been cleared. + return nil + } + cm.mu.Unlock() + time.Sleep(10 * time.Millisecond) + } + + cm.mu.Lock() + err = fmt.Errorf("after 10s the channelz map has not been cleaned up yet, topchannels: %d, servers: %d, channels: %d, subchannels: %d, listen sockets: %d, normal sockets: %d", len(cm.topLevelChannels), len(cm.servers), len(cm.channels), len(cm.subChannels), len(cm.listenSockets), len(cm.normalSockets)) + cm.mu.Unlock() + return err + } } // GetTopChannels returns a slice of top channel's ChannelMetric, along with a diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 62ed0f2f..11be7cd0 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -34,13 +34,9 @@ const ( type RequireHandshakeSetting int const ( - // RequireHandshakeHybrid (default, deprecated) indicates to not wait for - // handshake before considering a connection ready, but wait before - // considering successful. - RequireHandshakeHybrid RequireHandshakeSetting = iota - // RequireHandshakeOn (default after the 1.17 release) indicates to wait - // for handshake before considering a connection ready/successful. - RequireHandshakeOn + // RequireHandshakeOn indicates to wait for handshake before considering a + // connection ready/successful. + RequireHandshakeOn RequireHandshakeSetting = iota // RequireHandshakeOff indicates to not wait for handshake before // considering a connection ready/successful. RequireHandshakeOff @@ -53,7 +49,7 @@ var ( // environment variable. // // Will be removed after the 1.18 release. - RequireHandshake RequireHandshakeSetting + RequireHandshake = RequireHandshakeOn ) func init() { @@ -64,8 +60,5 @@ func init() { RequireHandshake = RequireHandshakeOn case "off": RequireHandshake = RequireHandshakeOff - case "hybrid": - // Will be removed after the 1.17 release. - RequireHandshake = RequireHandshakeHybrid } } diff --git a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go b/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go index 61678feb..d3fd9dab 100644 --- a/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go +++ b/vendor/google.golang.org/grpc/internal/syscall/syscall_nonlinux.go @@ -22,18 +22,24 @@ package syscall import ( "net" + "sync" "time" "google.golang.org/grpc/grpclog" ) -func init() { - grpclog.Info("CPU time info is unavailable on non-linux or appengine environment.") +var once sync.Once + +func log() { + once.Do(func() { + grpclog.Info("CPU time info is unavailable on non-linux or appengine environment.") + }) } // GetCPUTime returns the how much CPU time has passed since the start of this process. // It always returns 0 under non-linux or appengine environment. func GetCPUTime() int64 { + log() return 0 } @@ -42,22 +48,26 @@ type Rusage struct{} // GetRusage is a no-op function under non-linux or appengine environment. func GetRusage() (rusage *Rusage) { + log() return nil } // CPUTimeDiff returns the differences of user CPU time and system CPU time used // between two Rusage structs. It a no-op function for non-linux or appengine environment. func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) { + log() return 0, 0 } // SetTCPUserTimeout is a no-op function under non-linux or appengine environments func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error { + log() return nil } // GetTCPUserTimeout is a no-op function under non-linux or appengine environments // a negative return value indicates the operation is not supported func GetTCPUserTimeout(conn net.Conn) (int, error) { + log() return -1, nil } diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 73b41ea7..f2de84d4 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -63,9 +63,6 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats sta if _, ok := w.(http.Flusher); !ok { return nil, errors.New("gRPC requires a ResponseWriter supporting http.Flusher") } - if _, ok := w.(http.CloseNotifier); !ok { - return nil, errors.New("gRPC requires a ResponseWriter supporting http.CloseNotifier") - } st := &serverHandlerTransport{ rw: w, @@ -176,17 +173,11 @@ func (a strAddr) String() string { return string(a) } // do runs fn in the ServeHTTP goroutine. func (ht *serverHandlerTransport) do(fn func()) error { - // Avoid a panic writing to closed channel. Imperfect but maybe good enough. select { case <-ht.closedCh: return ErrConnClosing - default: - select { - case ht.writes <- fn: - return nil - case <-ht.closedCh: - return ErrConnClosing - } + case ht.writes <- fn: + return nil } } @@ -237,7 +228,6 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro if ht.stats != nil { ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) } - close(ht.writes) } ht.Close() return err @@ -315,19 +305,13 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace ctx, cancel = context.WithCancel(ctx) } - // requestOver is closed when either the request's context is done - // or the status has been written via WriteStatus. + // requestOver is closed when the status has been written via WriteStatus. requestOver := make(chan struct{}) - - // clientGone receives a single value if peer is gone, either - // because the underlying connection is dead or because the - // peer sends an http2 RST_STREAM. - clientGone := ht.rw.(http.CloseNotifier).CloseNotify() go func() { select { case <-requestOver: case <-ht.closedCh: - case <-clientGone: + case <-ht.req.Context().Done(): } cancel() ht.Close() @@ -407,10 +391,7 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace func (ht *serverHandlerTransport) runStream() { for { select { - case fn, ok := <-ht.writes: - if !ok { - return - } + case fn := <-ht.writes: fn() case <-ht.closedCh: return diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index ff8f4db0..e26e2814 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -549,7 +549,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea s.write(recvMsg{err: err}) close(s.done) // If headerChan isn't closed, then close it. - if atomic.SwapUint32(&s.headerDone, 1) == 0 { + if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { close(s.headerChan) } @@ -713,7 +713,7 @@ func (t *http2Client) closeStream(s *Stream, err error, rst bool, rstCode http2. s.write(recvMsg{err: err}) } // If headerChan isn't closed, then close it. - if atomic.SwapUint32(&s.headerDone, 1) == 0 { + if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { s.noHeaders = true close(s.headerChan) } @@ -794,21 +794,21 @@ func (t *http2Client) Close() error { // stream is closed. If there are no active streams, the transport is closed // immediately. This does nothing if the transport is already draining or // closing. -func (t *http2Client) GracefulClose() error { +func (t *http2Client) GracefulClose() { t.mu.Lock() // Make sure we move to draining only from active. if t.state == draining || t.state == closing { t.mu.Unlock() - return nil + return } t.state = draining active := len(t.activeStreams) t.mu.Unlock() if active == 0 { - return t.Close() + t.Close() + return } t.controlBuf.put(&incomingGoAway{}) - return nil } // Write formats the data into HTTP2 data frame(s) and sends it out. The caller @@ -1140,16 +1140,26 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { if !ok { return } + endStream := frame.StreamEnded() atomic.StoreUint32(&s.bytesReceived, 1) - var state decodeState - if err := state.decodeHeader(frame); err != nil { - t.closeStream(s, err, true, http2.ErrCodeProtocol, status.New(codes.Internal, err.Error()), nil, false) - // Something wrong. Stops reading even when there is remaining. + initialHeader := atomic.LoadUint32(&s.headerChanClosed) == 0 + + if !initialHeader && !endStream { + // As specified by gRPC over HTTP2, a HEADERS frame (and associated CONTINUATION frames) can only appear at the start or end of a stream. Therefore, second HEADERS frame must have EOS bit set. + st := status.New(codes.Internal, "a HEADERS frame cannot appear in the middle of a stream") + t.closeStream(s, st.Err(), true, http2.ErrCodeProtocol, st, nil, false) return } - endStream := frame.StreamEnded() - var isHeader bool + state := &decodeState{} + // Initialize isGRPC value to be !initialHeader, since if a gRPC Response-Headers has already been received, then it means that the peer is speaking gRPC and we are in gRPC mode. + state.data.isGRPC = !initialHeader + if err := state.decodeHeader(frame); err != nil { + t.closeStream(s, err, true, http2.ErrCodeProtocol, status.Convert(err), nil, endStream) + return + } + + isHeader := false defer func() { if t.statsHandler != nil { if isHeader { @@ -1167,29 +1177,33 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { } } }() - // If headers haven't been received yet. - if atomic.SwapUint32(&s.headerDone, 1) == 0 { + + // If headerChan hasn't been closed yet + if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { if !endStream { - // Headers frame is not actually a trailers-only frame. + // HEADERS frame block carries a Response-Headers. isHeader = true // These values can be set without any synchronization because // stream goroutine will read it only after seeing a closed // headerChan which we'll close after setting this. - s.recvCompress = state.encoding - if len(state.mdata) > 0 { - s.header = state.mdata + s.recvCompress = state.data.encoding + if len(state.data.mdata) > 0 { + s.header = state.data.mdata } } else { + // HEADERS frame block carries a Trailers-Only. s.noHeaders = true } close(s.headerChan) } + if !endStream { return } + // if client received END_STREAM from server while stream was still active, send RST_STREAM rst := s.getState() == streamActive - t.closeStream(s, io.EOF, rst, http2.ErrCodeNo, state.status(), state.mdata, true) + t.closeStream(s, io.EOF, rst, http2.ErrCodeNo, state.status(), state.data.mdata, true) } // reader runs as a separate goroutine in charge of reading data from network @@ -1356,6 +1370,8 @@ func (t *http2Client) ChannelzMetric() *channelz.SocketInternalMetric { return &s } +func (t *http2Client) RemoteAddr() net.Addr { return t.remoteAddr } + func (t *http2Client) IncrMsgSent() { atomic.AddInt64(&t.czData.msgSent, 1) atomic.StoreInt64(&t.czData.lastMsgSentTime, time.Now().UnixNano()) diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index d038b2df..435092e5 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -286,7 +286,9 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err // operateHeader takes action on the decoded headers. func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (fatal bool) { streamID := frame.Header().StreamID - state := decodeState{serverSide: true} + state := &decodeState{ + serverSide: true, + } if err := state.decodeHeader(frame); err != nil { if se, ok := status.FromError(err); ok { t.controlBuf.put(&cleanupStream{ @@ -305,16 +307,16 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( st: t, buf: buf, fc: &inFlow{limit: uint32(t.initialWindowSize)}, - recvCompress: state.encoding, - method: state.method, - contentSubtype: state.contentSubtype, + recvCompress: state.data.encoding, + method: state.data.method, + contentSubtype: state.data.contentSubtype, } if frame.StreamEnded() { // s is just created by the caller. No lock needed. s.state = streamReadDone } - if state.timeoutSet { - s.ctx, s.cancel = context.WithTimeout(t.ctx, state.timeout) + if state.data.timeoutSet { + s.ctx, s.cancel = context.WithTimeout(t.ctx, state.data.timeout) } else { s.ctx, s.cancel = context.WithCancel(t.ctx) } @@ -327,19 +329,19 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( } s.ctx = peer.NewContext(s.ctx, pr) // Attach the received metadata to the context. - if len(state.mdata) > 0 { - s.ctx = metadata.NewIncomingContext(s.ctx, state.mdata) + if len(state.data.mdata) > 0 { + s.ctx = metadata.NewIncomingContext(s.ctx, state.data.mdata) } - if state.statsTags != nil { - s.ctx = stats.SetIncomingTags(s.ctx, state.statsTags) + if state.data.statsTags != nil { + s.ctx = stats.SetIncomingTags(s.ctx, state.data.statsTags) } - if state.statsTrace != nil { - s.ctx = stats.SetIncomingTrace(s.ctx, state.statsTrace) + if state.data.statsTrace != nil { + s.ctx = stats.SetIncomingTrace(s.ctx, state.data.statsTrace) } if t.inTapHandle != nil { var err error info := &tap.Info{ - FullMethodName: state.method, + FullMethodName: state.data.method, } s.ctx, err = t.inTapHandle(s.ctx, info) if err != nil { @@ -435,7 +437,7 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context. s := t.activeStreams[se.StreamID] t.mu.Unlock() if s != nil { - t.closeStream(s, true, se.Code, nil, false) + t.closeStream(s, true, se.Code, false) } else { t.controlBuf.put(&cleanupStream{ streamID: se.StreamID, @@ -577,7 +579,7 @@ func (t *http2Server) handleData(f *http2.DataFrame) { } if size > 0 { if err := s.fc.onData(size); err != nil { - t.closeStream(s, true, http2.ErrCodeFlowControl, nil, false) + t.closeStream(s, true, http2.ErrCodeFlowControl, false) return } if f.Header().Flags.Has(http2.FlagDataPadded) { @@ -602,11 +604,18 @@ func (t *http2Server) handleData(f *http2.DataFrame) { } func (t *http2Server) handleRSTStream(f *http2.RSTStreamFrame) { - s, ok := t.getStream(f) - if !ok { + // If the stream is not deleted from the transport's active streams map, then do a regular close stream. + if s, ok := t.getStream(f); ok { + t.closeStream(s, false, 0, false) return } - t.closeStream(s, false, 0, nil, false) + // If the stream is already deleted from the active streams map, then put a cleanupStream item into controlbuf to delete the stream from loopy writer's established streams map. + t.controlBuf.put(&cleanupStream{ + streamID: f.Header().StreamID, + rst: false, + rstCode: 0, + onWrite: func() {}, + }) } func (t *http2Server) handleSettings(f *http2.SettingsFrame) { @@ -770,7 +779,7 @@ func (t *http2Server) writeHeaderLocked(s *Stream) error { if err != nil { return err } - t.closeStream(s, true, http2.ErrCodeInternal, nil, false) + t.closeStream(s, true, http2.ErrCodeInternal, false) return ErrHeaderListSizeLimitViolation } if t.stats != nil { @@ -834,10 +843,12 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { if err != nil { return err } - t.closeStream(s, true, http2.ErrCodeInternal, nil, false) + t.closeStream(s, true, http2.ErrCodeInternal, false) return ErrHeaderListSizeLimitViolation } - t.closeStream(s, false, 0, trailingHeader, true) + // Send a RST_STREAM after the trailers if the client has not already half-closed. + rst := s.getState() == streamActive + t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true) if t.stats != nil { t.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) } @@ -849,6 +860,9 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { if !s.isHeaderSent() { // Headers haven't been written yet. if err := t.WriteHeader(s, nil); err != nil { + if _, ok := err.(ConnectionError); ok { + return err + } // TODO(mmukhi, dfawley): Make sure this is the right code to return. return status.Errorf(codes.Internal, "transport: %v", err) } @@ -1005,16 +1019,24 @@ func (t *http2Server) Close() error { } // deleteStream deletes the stream s from transport's active streams. -func (t *http2Server) deleteStream(s *Stream, eosReceived bool) { - t.mu.Lock() - if _, ok := t.activeStreams[s.id]; !ok { - t.mu.Unlock() - return +func (t *http2Server) deleteStream(s *Stream, eosReceived bool) (oldState streamState) { + oldState = s.swapState(streamDone) + if oldState == streamDone { + // If the stream was already done, return. + return oldState } - delete(t.activeStreams, s.id) - if len(t.activeStreams) == 0 { - t.idle = time.Now() + // In case stream sending and receiving are invoked in separate + // goroutines (e.g., bi-directional streaming), cancel needs to be + // called to interrupt the potential blocking on other goroutines. + s.cancel() + + t.mu.Lock() + if _, ok := t.activeStreams[s.id]; ok { + delete(t.activeStreams, s.id) + if len(t.activeStreams) == 0 { + t.idle = time.Now() + } } t.mu.Unlock() @@ -1025,55 +1047,38 @@ func (t *http2Server) deleteStream(s *Stream, eosReceived bool) { atomic.AddInt64(&t.czData.streamsFailed, 1) } } + + return oldState } -// closeStream clears the footprint of a stream when the stream is not needed -// any more. -func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { - // Mark the stream as done - oldState := s.swapState(streamDone) +// finishStream closes the stream and puts the trailing headerFrame into controlbuf. +func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { + oldState := t.deleteStream(s, eosReceived) + // If the stream is already closed, then don't put trailing header to controlbuf. + if oldState == streamDone { + return + } - // In case stream sending and receiving are invoked in separate - // goroutines (e.g., bi-directional streaming), cancel needs to be - // called to interrupt the potential blocking on other goroutines. - s.cancel() - - // Deletes the stream from active streams - t.deleteStream(s, eosReceived) - - cleanup := &cleanupStream{ + hdr.cleanup = &cleanupStream{ streamID: s.id, rst: rst, rstCode: rstCode, onWrite: func() {}, } - - // No trailer. Puts cleanupFrame into transport's control buffer. - if hdr == nil { - t.controlBuf.put(cleanup) - return - } - - // We do the check here, because of the following scenario: - // 1. closeStream is called first with a trailer. A trailer item with a piggybacked cleanup item - // is put to control buffer. - // 2. Loopy writer is waiting on a stream quota. It will never get it because client errored at - // some point. So loopy can't act on trailer - // 3. Client sends a RST_STREAM due to the error. Then closeStream is called without a trailer as - // the result of the received RST_STREAM. - // If we do this check at the beginning of the closeStream, then we won't put a cleanup item in - // response to received RST_STREAM into the control buffer and outStream in loopy writer will - // never get cleaned up. - - // If the stream is already done, don't send the trailer. - if oldState == streamDone { - return - } - - hdr.cleanup = cleanup t.controlBuf.put(hdr) } +// closeStream clears the footprint of a stream when the stream is not needed any more. +func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eosReceived bool) { + t.deleteStream(s, eosReceived) + t.controlBuf.put(&cleanupStream{ + streamID: s.id, + rst: rst, + rstCode: rstCode, + onWrite: func() {}, + }) +} + func (t *http2Server) RemoteAddr() net.Addr { return t.remoteAddr } diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index 77a2cfaa..9d212867 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -78,7 +78,8 @@ var ( codes.ResourceExhausted: http2.ErrCodeEnhanceYourCalm, codes.PermissionDenied: http2.ErrCodeInadequateSecurity, } - httpStatusConvTab = map[int]codes.Code{ + // HTTPStatusConvTab is the HTTP status code to gRPC error code conversion table. + HTTPStatusConvTab = map[int]codes.Code{ // 400 Bad Request - INTERNAL. http.StatusBadRequest: codes.Internal, // 401 Unauthorized - UNAUTHENTICATED. @@ -98,9 +99,7 @@ var ( } ) -// Records the states during HPACK decoding. Must be reset once the -// decoding of the entire headers are finished. -type decodeState struct { +type parsedHeaderData struct { encoding string // statusGen caches the stream status received from the trailer the server // sent. Client side only. Do not access directly. After all trailers are @@ -120,8 +119,30 @@ type decodeState struct { statsTags []byte statsTrace []byte contentSubtype string + + // isGRPC field indicates whether the peer is speaking gRPC (otherwise HTTP). + // + // We are in gRPC mode (peer speaking gRPC) if: + // * We are client side and have already received a HEADER frame that indicates gRPC peer. + // * The header contains valid a content-type, i.e. a string starts with "application/grpc" + // And we should handle error specific to gRPC. + // + // Otherwise (i.e. a content-type string starts without "application/grpc", or does not exist), we + // are in HTTP fallback mode, and should handle error specific to HTTP. + isGRPC bool + grpcErr error + httpErr error + contentTypeErr string +} + +// decodeState configures decoding criteria and records the decoded data. +type decodeState struct { // whether decoding on server side or not serverSide bool + + // Records the states during HPACK decoding. It will be filled with info parsed from HTTP HEADERS + // frame once decodeHeader function has been invoked and returned. + data parsedHeaderData } // isReservedHeader checks whether hdr belongs to HTTP2 headers @@ -202,11 +223,11 @@ func contentType(contentSubtype string) string { } func (d *decodeState) status() *status.Status { - if d.statusGen == nil { + if d.data.statusGen == nil { // No status-details were provided; generate status using code/msg. - d.statusGen = status.New(codes.Code(int32(*(d.rawStatusCode))), d.rawStatusMsg) + d.data.statusGen = status.New(codes.Code(int32(*(d.data.rawStatusCode))), d.data.rawStatusMsg) } - return d.statusGen + return d.data.statusGen } const binHdrSuffix = "-bin" @@ -244,113 +265,146 @@ func (d *decodeState) decodeHeader(frame *http2.MetaHeadersFrame) error { if frame.Truncated { return status.Error(codes.Internal, "peer header list size exceeded limit") } + for _, hf := range frame.Fields { - if err := d.processHeaderField(hf); err != nil { - return err + d.processHeaderField(hf) + } + + if d.data.isGRPC { + if d.data.grpcErr != nil { + return d.data.grpcErr + } + if d.serverSide { + return nil + } + if d.data.rawStatusCode == nil && d.data.statusGen == nil { + // gRPC status doesn't exist. + // Set rawStatusCode to be unknown and return nil error. + // So that, if the stream has ended this Unknown status + // will be propagated to the user. + // Otherwise, it will be ignored. In which case, status from + // a later trailer, that has StreamEnded flag set, is propagated. + code := int(codes.Unknown) + d.data.rawStatusCode = &code } - } - - if d.serverSide { return nil } - // If grpc status exists, no need to check further. - if d.rawStatusCode != nil || d.statusGen != nil { - return nil + // HTTP fallback mode + if d.data.httpErr != nil { + return d.data.httpErr } - // If grpc status doesn't exist and http status doesn't exist, - // then it's a malformed header. - if d.httpStatus == nil { - return status.Error(codes.Internal, "malformed header: doesn't contain status(gRPC or HTTP)") - } + var ( + code = codes.Internal // when header does not include HTTP status, return INTERNAL + ok bool + ) - if *(d.httpStatus) != http.StatusOK { - code, ok := httpStatusConvTab[*(d.httpStatus)] + if d.data.httpStatus != nil { + code, ok = HTTPStatusConvTab[*(d.data.httpStatus)] if !ok { code = codes.Unknown } - return status.Error(code, http.StatusText(*(d.httpStatus))) } - // gRPC status doesn't exist and http status is OK. - // Set rawStatusCode to be unknown and return nil error. - // So that, if the stream has ended this Unknown status - // will be propagated to the user. - // Otherwise, it will be ignored. In which case, status from - // a later trailer, that has StreamEnded flag set, is propagated. - code := int(codes.Unknown) - d.rawStatusCode = &code - return nil + return status.Error(code, d.constructHTTPErrMsg()) +} + +// constructErrMsg constructs error message to be returned in HTTP fallback mode. +// Format: HTTP status code and its corresponding message + content-type error message. +func (d *decodeState) constructHTTPErrMsg() string { + var errMsgs []string + + if d.data.httpStatus == nil { + errMsgs = append(errMsgs, "malformed header: missing HTTP status") + } else { + errMsgs = append(errMsgs, fmt.Sprintf("%s: HTTP status code %d", http.StatusText(*(d.data.httpStatus)), *d.data.httpStatus)) + } + + if d.data.contentTypeErr == "" { + errMsgs = append(errMsgs, "transport: missing content-type field") + } else { + errMsgs = append(errMsgs, d.data.contentTypeErr) + } + + return strings.Join(errMsgs, "; ") } func (d *decodeState) addMetadata(k, v string) { - if d.mdata == nil { - d.mdata = make(map[string][]string) + if d.data.mdata == nil { + d.data.mdata = make(map[string][]string) } - d.mdata[k] = append(d.mdata[k], v) + d.data.mdata[k] = append(d.data.mdata[k], v) } -func (d *decodeState) processHeaderField(f hpack.HeaderField) error { +func (d *decodeState) processHeaderField(f hpack.HeaderField) { switch f.Name { case "content-type": contentSubtype, validContentType := contentSubtype(f.Value) if !validContentType { - return status.Errorf(codes.Internal, "transport: received the unexpected content-type %q", f.Value) + d.data.contentTypeErr = fmt.Sprintf("transport: received the unexpected content-type %q", f.Value) + return } - d.contentSubtype = contentSubtype + d.data.contentSubtype = contentSubtype // TODO: do we want to propagate the whole content-type in the metadata, // or come up with a way to just propagate the content-subtype if it was set? // ie {"content-type": "application/grpc+proto"} or {"content-subtype": "proto"} // in the metadata? d.addMetadata(f.Name, f.Value) + d.data.isGRPC = true case "grpc-encoding": - d.encoding = f.Value + d.data.encoding = f.Value case "grpc-status": code, err := strconv.Atoi(f.Value) if err != nil { - return status.Errorf(codes.Internal, "transport: malformed grpc-status: %v", err) + d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-status: %v", err) + return } - d.rawStatusCode = &code + d.data.rawStatusCode = &code case "grpc-message": - d.rawStatusMsg = decodeGrpcMessage(f.Value) + d.data.rawStatusMsg = decodeGrpcMessage(f.Value) case "grpc-status-details-bin": v, err := decodeBinHeader(f.Value) if err != nil { - return status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) + d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) + return } s := &spb.Status{} if err := proto.Unmarshal(v, s); err != nil { - return status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) + d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) + return } - d.statusGen = status.FromProto(s) + d.data.statusGen = status.FromProto(s) case "grpc-timeout": - d.timeoutSet = true + d.data.timeoutSet = true var err error - if d.timeout, err = decodeTimeout(f.Value); err != nil { - return status.Errorf(codes.Internal, "transport: malformed time-out: %v", err) + if d.data.timeout, err = decodeTimeout(f.Value); err != nil { + d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed time-out: %v", err) } case ":path": - d.method = f.Value + d.data.method = f.Value case ":status": code, err := strconv.Atoi(f.Value) if err != nil { - return status.Errorf(codes.Internal, "transport: malformed http-status: %v", err) + d.data.httpErr = status.Errorf(codes.Internal, "transport: malformed http-status: %v", err) + return } - d.httpStatus = &code + d.data.httpStatus = &code case "grpc-tags-bin": v, err := decodeBinHeader(f.Value) if err != nil { - return status.Errorf(codes.Internal, "transport: malformed grpc-tags-bin: %v", err) + d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-tags-bin: %v", err) + return } - d.statsTags = v + d.data.statsTags = v d.addMetadata(f.Name, string(v)) case "grpc-trace-bin": v, err := decodeBinHeader(f.Value) if err != nil { - return status.Errorf(codes.Internal, "transport: malformed grpc-trace-bin: %v", err) + d.data.grpcErr = status.Errorf(codes.Internal, "transport: malformed grpc-trace-bin: %v", err) + return } - d.statsTrace = v + d.data.statsTrace = v d.addMetadata(f.Name, string(v)) default: if isReservedHeader(f.Name) && !isWhitelistedHeader(f.Name) { @@ -359,11 +413,10 @@ func (d *decodeState) processHeaderField(f hpack.HeaderField) error { v, err := decodeMetadataHeader(f.Name, f.Value) if err != nil { errorf("Failed to decode metadata header (%q, %q): %v", f.Name, f.Value, err) - return nil + return } d.addMetadata(f.Name, v) } - return nil } type timeoutUnit uint8 diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index 2580aa7d..4bf583ef 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -204,8 +204,8 @@ type Stream struct { // is used to adjust flow control, if needed. requestRead func(int) - headerChan chan struct{} // closed to indicate the end of header metadata. - headerDone uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. + headerChan chan struct{} // closed to indicate the end of header metadata. + headerChanClosed uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. // hdrMu protects header and trailer metadata on the server-side. hdrMu sync.Mutex @@ -327,8 +327,7 @@ func (s *Stream) TrailersOnly() (bool, error) { if err != nil { return false, err } - // if !headerDone, some other connection error occurred. - return s.noHeaders && atomic.LoadUint32(&s.headerDone) == 1, nil + return s.noHeaders, nil } // Trailer returns the cached trailer metedata. Note that if it is not called @@ -579,9 +578,12 @@ type ClientTransport interface { // is called only once. Close() error - // GracefulClose starts to tear down the transport. It stops accepting - // new RPCs and wait the completion of the pending RPCs. - GracefulClose() error + // GracefulClose starts to tear down the transport: the transport will stop + // accepting new RPCs and NewStream will return error. Once all streams are + // finished, the transport will close. + // + // It does not block. + GracefulClose() // Write sends the data for the given stream. A nil stream indicates // the write is to be performed on the transport as a whole. @@ -611,6 +613,9 @@ type ClientTransport interface { // GetGoAwayReason returns the reason why GoAway frame was received. GetGoAwayReason() GoAwayReason + // RemoteAddr returns the remote network address. + RemoteAddr() net.Addr + // IncrMsgSent increments the number of message sent through this transport. IncrMsgSent() diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index a2575c96..45baa2ae 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -120,6 +120,14 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. bp.mu.Unlock() select { case <-ctx.Done(): + if connectionErr := bp.connectionError(); connectionErr != nil { + switch ctx.Err() { + case context.DeadlineExceeded: + return nil, nil, status.Errorf(codes.DeadlineExceeded, "latest connection error: %v", connectionErr) + case context.Canceled: + return nil, nil, status.Errorf(codes.Canceled, "latest connection error: %v", connectionErr) + } + } return nil, nil, ctx.Err() case <-ch: } @@ -165,6 +173,11 @@ func (bp *pickerWrapper) pick(ctx context.Context, failfast bool, opts balancer. } return t, done, nil } + if done != nil { + // Calling done with nil error, no bytes sent and no bytes received. + // DoneInfo with default value works. + done(balancer.DoneInfo{}) + } grpclog.Infof("blockingPicker: the picked transport is not ready, loop back to repick") // If ok == false, ac.state is not READY. // A valid picker always returns READY subConn. This means the state of ac diff --git a/vendor/google.golang.org/grpc/preloader.go b/vendor/google.golang.org/grpc/preloader.go new file mode 100644 index 00000000..76acbbcc --- /dev/null +++ b/vendor/google.golang.org/grpc/preloader.go @@ -0,0 +1,64 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * 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. + * + */ + +package grpc + +import ( + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// PreparedMsg is responsible for creating a Marshalled and Compressed object. +// +// This API is EXPERIMENTAL. +type PreparedMsg struct { + // Struct for preparing msg before sending them + encodedData []byte + hdr []byte + payload []byte +} + +// Encode marshalls and compresses the message using the codec and compressor for the stream. +func (p *PreparedMsg) Encode(s Stream, msg interface{}) error { + ctx := s.Context() + rpcInfo, ok := rpcInfoFromContext(ctx) + if !ok { + return status.Errorf(codes.Internal, "grpc: unable to get rpcInfo") + } + + // check if the context has the relevant information to prepareMsg + if rpcInfo.preloaderInfo == nil { + return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo is nil") + } + if rpcInfo.preloaderInfo.codec == nil { + return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo.codec is nil") + } + + // prepare the msg + data, err := encode(rpcInfo.preloaderInfo.codec, msg) + if err != nil { + return err + } + p.encodedData = data + compData, err := compress(data, rpcInfo.preloaderInfo.cp, rpcInfo.preloaderInfo.comp) + if err != nil { + return err + } + p.hdr, p.payload = msgHeader(data, compData) + return nil +} diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go index 2d8da331..297492e8 100644 --- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go @@ -47,6 +47,8 @@ const ( defaultFreq = time.Minute * 30 defaultDNSSvrPort = "53" golang = "GO" + // txtPrefix is the prefix string to be prepended to the host name for txt record lookup. + txtPrefix = "_grpc_config." // In DNS, service config is encoded in a TXT record via the mechanism // described in RFC-1464 using the attribute name grpc_config. txtAttribute = "grpc_config=" @@ -64,6 +66,9 @@ var ( var ( defaultResolver netResolver = net.DefaultResolver + // To prevent excessive re-resolution, we enforce a rate limit on DNS + // resolution requests. + minDNSResRate = 30 * time.Second ) var customAuthorityDialler = func(authority string) func(ctx context.Context, network, address string) (net.Conn, error) { @@ -239,7 +244,13 @@ func (d *dnsResolver) watcher() { return case <-d.t.C: case <-d.rn: + if !d.t.Stop() { + // Before resetting a timer, it should be stopped to prevent racing with + // reads on it's channel. + <-d.t.C + } } + result, sc := d.lookup() // Next lookup should happen within an interval defined by d.freq. It may be // more often due to exponential retry on empty address list. @@ -252,6 +263,16 @@ func (d *dnsResolver) watcher() { } d.cc.NewServiceConfig(sc) d.cc.NewAddress(result) + + // Sleep to prevent excessive re-resolutions. Incoming resolution requests + // will be queued in d.rn. + t := time.NewTimer(minDNSResRate) + select { + case <-t.C: + case <-d.ctx.Done(): + t.Stop() + return + } } } @@ -282,7 +303,7 @@ func (d *dnsResolver) lookupSRV() []resolver.Address { } func (d *dnsResolver) lookupTXT() string { - ss, err := d.resolver.LookupTXT(d.ctx, d.host) + ss, err := d.resolver.LookupTXT(d.ctx, txtPrefix+d.host) if err != nil { grpclog.Infof("grpc: failed dns TXT record lookup due to %v.\n", err) return "" diff --git a/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go b/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go index b76010d7..893d5d12 100644 --- a/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go +++ b/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go @@ -45,7 +45,7 @@ type passthroughResolver struct { } func (r *passthroughResolver) start() { - r.cc.NewAddress([]resolver.Address{{Addr: r.target.Endpoint}}) + r.cc.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: r.target.Endpoint}}}) } func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOption) {} diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index 145cf477..f6f6934d 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -98,6 +98,15 @@ type BuildOption struct { DisableServiceConfig bool } +// State contains the current Resolver state relevant to the ClientConn. +type State struct { + Addresses []Address // Resolved addresses for the target + ServiceConfig string // JSON representation of the service config + + // TODO: add Err error + // TODO: add ParsedServiceConfig interface{} +} + // ClientConn contains the callbacks for resolver to notify any updates // to the gRPC ClientConn. // @@ -106,17 +115,38 @@ type BuildOption struct { // testing, the new implementation should embed this interface. This allows // gRPC to add new methods to this interface. type ClientConn interface { + // UpdateState updates the state of the ClientConn appropriately. + UpdateState(State) // NewAddress is called by resolver to notify ClientConn a new list // of resolved addresses. // The address list should be the complete list of resolved addresses. + // + // Deprecated: Use UpdateState instead. NewAddress(addresses []Address) // NewServiceConfig is called by resolver to notify ClientConn a new // service config. The service config should be provided as a json string. + // + // Deprecated: Use UpdateState instead. NewServiceConfig(serviceConfig string) } // Target represents a target for gRPC, as specified in: // https://github.com/grpc/grpc/blob/master/doc/naming.md. +// It is parsed from the target string that gets passed into Dial or DialContext by the user. And +// grpc passes it to the resolver and the balancer. +// +// If the target follows the naming spec, and the parsed scheme is registered with grpc, we will +// parse the target string according to the spec. e.g. "dns://some_authority/foo.bar" will be parsed +// into &Target{Scheme: "dns", Authority: "some_authority", Endpoint: "foo.bar"} +// +// If the target does not contain a scheme, we will apply the default scheme, and set the Target to +// be the full target string. e.g. "foo.bar" will be parsed into +// &Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "foo.bar"}. +// +// If the parsed scheme is not registered (i.e. no corresponding resolver available to resolve the +// endpoint), we set the Scheme to be the default scheme, and set the Endpoint to be the full target +// string. e.g. target string "unknown_scheme://authority/endpoint" will be parsed into +// &Target{Scheme: resolver.GetDefaultScheme(), Endpoint: "unknown_scheme://authority/endpoint"}. type Target struct { Scheme string Authority string diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go index 50991eaf..e9cef3a9 100644 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go @@ -21,6 +21,7 @@ package grpc import ( "fmt" "strings" + "sync/atomic" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/channelz" @@ -30,12 +31,12 @@ import ( // ccResolverWrapper is a wrapper on top of cc for resolvers. // It implements resolver.ClientConnection interface. type ccResolverWrapper struct { - cc *ClientConn - resolver resolver.Resolver - addrCh chan []resolver.Address - scCh chan string - done chan struct{} - lastAddressesCount int + cc *ClientConn + resolver resolver.Resolver + addrCh chan []resolver.Address + scCh chan string + done uint32 // accessed atomically; set to 1 when closed. + curState resolver.State } // split2 returns the values from strings.SplitN(s, sep, 2). @@ -82,7 +83,6 @@ func newCCResolverWrapper(cc *ClientConn) (*ccResolverWrapper, error) { cc: cc, addrCh: make(chan []resolver.Address, 1), scCh: make(chan string, 1), - done: make(chan struct{}), } var err error @@ -99,57 +99,67 @@ func (ccr *ccResolverWrapper) resolveNow(o resolver.ResolveNowOption) { func (ccr *ccResolverWrapper) close() { ccr.resolver.Close() - close(ccr.done) + atomic.StoreUint32(&ccr.done, 1) } -// NewAddress is called by the resolver implemenetion to send addresses to gRPC. -func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { - select { - case <-ccr.done: +func (ccr *ccResolverWrapper) isDone() bool { + return atomic.LoadUint32(&ccr.done) == 1 +} + +func (ccr *ccResolverWrapper) UpdateState(s resolver.State) { + if ccr.isDone() { + return + } + grpclog.Infof("ccResolverWrapper: sending update to cc: %v", s) + if channelz.IsOn() { + ccr.addChannelzTraceEvent(s) + } + ccr.cc.updateResolverState(s) + ccr.curState = s +} + +// NewAddress is called by the resolver implementation to send addresses to gRPC. +func (ccr *ccResolverWrapper) NewAddress(addrs []resolver.Address) { + if ccr.isDone() { return - default: } grpclog.Infof("ccResolverWrapper: sending new addresses to cc: %v", addrs) if channelz.IsOn() { - ccr.addChannelzTraceEvent(addrs) + ccr.addChannelzTraceEvent(resolver.State{Addresses: addrs, ServiceConfig: ccr.curState.ServiceConfig}) } - ccr.cc.handleResolvedAddrs(addrs, nil) + ccr.curState.Addresses = addrs + ccr.cc.updateResolverState(ccr.curState) } -// NewServiceConfig is called by the resolver implemenetion to send service +// NewServiceConfig is called by the resolver implementation to send service // configs to gRPC. func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { - select { - case <-ccr.done: + if ccr.isDone() { return - default: } grpclog.Infof("ccResolverWrapper: got new service config: %v", sc) - ccr.cc.handleServiceConfig(sc) + if channelz.IsOn() { + ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: sc}) + } + ccr.curState.ServiceConfig = sc + ccr.cc.updateResolverState(ccr.curState) } -func (ccr *ccResolverWrapper) addChannelzTraceEvent(addrs []resolver.Address) { - if len(addrs) == 0 && ccr.lastAddressesCount != 0 { - channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{ - Desc: "Resolver returns an empty address list", - Severity: channelz.CtWarning, - }) - } else if len(addrs) != 0 && ccr.lastAddressesCount == 0 { - var s string - for i, a := range addrs { - if a.ServerName != "" { - s += a.Addr + "(" + a.ServerName + ")" - } else { - s += a.Addr - } - if i != len(addrs)-1 { - s += " " - } - } - channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{ - Desc: fmt.Sprintf("Resolver returns a non-empty address list (previous one was empty) %q", s), - Severity: channelz.CtINFO, - }) +func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { + if s.ServiceConfig == ccr.curState.ServiceConfig && (len(ccr.curState.Addresses) == 0) == (len(s.Addresses) == 0) { + return } - ccr.lastAddressesCount = len(addrs) + var updates []string + if s.ServiceConfig != ccr.curState.ServiceConfig { + updates = append(updates, "service config updated") + } + if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { + updates = append(updates, "resolver returned an empty address list") + } else if len(ccr.curState.Addresses) == 0 && len(s.Addresses) > 0 { + updates = append(updates, "resolver returned new addresses") + } + channelz.AddTraceEvent(ccr.cc.channelzID, &channelz.TraceEventDesc{ + Desc: fmt.Sprintf("Resolver state updated: %+v (%v)", s, strings.Join(updates, "; ")), + Severity: channelz.CtINFO, + }) } diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index 2a595622..088c3f1b 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -694,14 +694,34 @@ func recv(p *parser, c baseCodec, s *transport.Stream, dc Decompressor, m interf return nil } +// Information about RPC type rpcInfo struct { - failfast bool + failfast bool + preloaderInfo *compressorInfo +} + +// Information about Preloader +// Responsible for storing codec, and compressors +// If stream (s) has context s.Context which stores rpcInfo that has non nil +// pointers to codec, and compressors, then we can use preparedMsg for Async message prep +// and reuse marshalled bytes +type compressorInfo struct { + codec baseCodec + cp Compressor + comp encoding.Compressor } type rpcInfoContextKey struct{} -func newContextWithRPCInfo(ctx context.Context, failfast bool) context.Context { - return context.WithValue(ctx, rpcInfoContextKey{}, &rpcInfo{failfast: failfast}) +func newContextWithRPCInfo(ctx context.Context, failfast bool, codec baseCodec, cp Compressor, comp encoding.Compressor) context.Context { + return context.WithValue(ctx, rpcInfoContextKey{}, &rpcInfo{ + failfast: failfast, + preloaderInfo: &compressorInfo{ + codec: codec, + cp: cp, + comp: comp, + }, + }) } func rpcInfoFromContext(ctx context.Context) (s *rpcInfo, ok bool) { diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 33272a47..495a4f9b 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -86,7 +86,7 @@ type service struct { // Server is a gRPC server to serve RPC requests. type Server struct { - opts options + opts serverOptions mu sync.Mutex // guards following lis map[net.Listener]bool @@ -108,7 +108,7 @@ type Server struct { czData *channelzData } -type options struct { +type serverOptions struct { creds credentials.TransportCredentials codec baseCodec cp Compressor @@ -131,7 +131,7 @@ type options struct { maxHeaderListSize *uint32 } -var defaultServerOptions = options{ +var defaultServerOptions = serverOptions{ maxReceiveMessageSize: defaultServerMaxReceiveMessageSize, maxSendMessageSize: defaultServerMaxSendMessageSize, connectionTimeout: 120 * time.Second, @@ -140,7 +140,33 @@ var defaultServerOptions = options{ } // A ServerOption sets options such as credentials, codec and keepalive parameters, etc. -type ServerOption func(*options) +type ServerOption interface { + apply(*serverOptions) +} + +// EmptyServerOption does not alter the server configuration. It can be embedded +// in another structure to build custom server options. +// +// This API is EXPERIMENTAL. +type EmptyServerOption struct{} + +func (EmptyServerOption) apply(*serverOptions) {} + +// funcServerOption wraps a function that modifies serverOptions into an +// implementation of the ServerOption interface. +type funcServerOption struct { + f func(*serverOptions) +} + +func (fdo *funcServerOption) apply(do *serverOptions) { + fdo.f(do) +} + +func newFuncServerOption(f func(*serverOptions)) *funcServerOption { + return &funcServerOption{ + f: f, + } +} // WriteBufferSize determines how much data can be batched before doing a write on the wire. // The corresponding memory allocation for this buffer will be twice the size to keep syscalls low. @@ -148,9 +174,9 @@ type ServerOption func(*options) // Zero will disable the write buffer such that each write will be on underlying connection. // Note: A Send call may not directly translate to a write. func WriteBufferSize(s int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.writeBufferSize = s - } + }) } // ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most @@ -159,25 +185,25 @@ func WriteBufferSize(s int) ServerOption { // Zero will disable read buffer for a connection so data framer can access the underlying // conn directly. func ReadBufferSize(s int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.readBufferSize = s - } + }) } // InitialWindowSize returns a ServerOption that sets window size for stream. // The lower bound for window size is 64K and any value smaller than that will be ignored. func InitialWindowSize(s int32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.initialWindowSize = s - } + }) } // InitialConnWindowSize returns a ServerOption that sets window size for a connection. // The lower bound for window size is 64K and any value smaller than that will be ignored. func InitialConnWindowSize(s int32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.initialConnWindowSize = s - } + }) } // KeepaliveParams returns a ServerOption that sets keepalive and max-age parameters for the server. @@ -187,25 +213,25 @@ func KeepaliveParams(kp keepalive.ServerParameters) ServerOption { kp.Time = time.Second } - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.keepaliveParams = kp - } + }) } // KeepaliveEnforcementPolicy returns a ServerOption that sets keepalive enforcement policy for the server. func KeepaliveEnforcementPolicy(kep keepalive.EnforcementPolicy) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.keepalivePolicy = kep - } + }) } // CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. // // This will override any lookups by content-subtype for Codecs registered with RegisterCodec. func CustomCodec(codec Codec) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.codec = codec - } + }) } // RPCCompressor returns a ServerOption that sets a compressor for outbound @@ -216,9 +242,9 @@ func CustomCodec(codec Codec) ServerOption { // // Deprecated: use encoding.RegisterCompressor instead. func RPCCompressor(cp Compressor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.cp = cp - } + }) } // RPCDecompressor returns a ServerOption that sets a decompressor for inbound @@ -227,9 +253,9 @@ func RPCCompressor(cp Compressor) ServerOption { // // Deprecated: use encoding.RegisterCompressor instead. func RPCDecompressor(dc Decompressor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.dc = dc - } + }) } // MaxMsgSize returns a ServerOption to set the max message size in bytes the server can receive. @@ -243,73 +269,73 @@ func MaxMsgSize(m int) ServerOption { // MaxRecvMsgSize returns a ServerOption to set the max message size in bytes the server can receive. // If this is not set, gRPC uses the default 4MB. func MaxRecvMsgSize(m int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxReceiveMessageSize = m - } + }) } // MaxSendMsgSize returns a ServerOption to set the max message size in bytes the server can send. // If this is not set, gRPC uses the default `math.MaxInt32`. func MaxSendMsgSize(m int) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxSendMessageSize = m - } + }) } // MaxConcurrentStreams returns a ServerOption that will apply a limit on the number // of concurrent streams to each ServerTransport. func MaxConcurrentStreams(n uint32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxConcurrentStreams = n - } + }) } // Creds returns a ServerOption that sets credentials for server connections. func Creds(c credentials.TransportCredentials) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.creds = c - } + }) } // UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the // server. Only one unary interceptor can be installed. The construction of multiple // interceptors (e.g., chaining) can be implemented at the caller. func UnaryInterceptor(i UnaryServerInterceptor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { if o.unaryInt != nil { panic("The unary server interceptor was already set and may not be reset.") } o.unaryInt = i - } + }) } // StreamInterceptor returns a ServerOption that sets the StreamServerInterceptor for the // server. Only one stream interceptor can be installed. func StreamInterceptor(i StreamServerInterceptor) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { if o.streamInt != nil { panic("The stream server interceptor was already set and may not be reset.") } o.streamInt = i - } + }) } // InTapHandle returns a ServerOption that sets the tap handle for all the server // transport to be created. Only one can be installed. func InTapHandle(h tap.ServerInHandle) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { if o.inTapHandle != nil { panic("The tap handle was already set and may not be reset.") } o.inTapHandle = h - } + }) } // StatsHandler returns a ServerOption that sets the stats handler for the server. func StatsHandler(h stats.Handler) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.statsHandler = h - } + }) } // UnknownServiceHandler returns a ServerOption that allows for adding a custom @@ -319,7 +345,7 @@ func StatsHandler(h stats.Handler) ServerOption { // The handling function has full access to the Context of the request and the // stream, and the invocation bypasses interceptors. func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.unknownStreamDesc = &StreamDesc{ StreamName: "unknown_service_handler", Handler: streamHandler, @@ -327,7 +353,7 @@ func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { ClientStreams: true, ServerStreams: true, } - } + }) } // ConnectionTimeout returns a ServerOption that sets the timeout for @@ -337,17 +363,17 @@ func UnknownServiceHandler(streamHandler StreamHandler) ServerOption { // // This API is EXPERIMENTAL. func ConnectionTimeout(d time.Duration) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.connectionTimeout = d - } + }) } // MaxHeaderListSize returns a ServerOption that sets the max (uncompressed) size // of header list that the server is prepared to accept. func MaxHeaderListSize(s uint32) ServerOption { - return func(o *options) { + return newFuncServerOption(func(o *serverOptions) { o.maxHeaderListSize = &s - } + }) } // NewServer creates a gRPC server which has no service registered and has not @@ -355,7 +381,7 @@ func MaxHeaderListSize(s uint32) ServerOption { func NewServer(opt ...ServerOption) *Server { opts := defaultServerOptions for _, o := range opt { - o(&opts) + o.apply(&opts) } s := &Server{ lis: make(map[net.Listener]bool), @@ -614,12 +640,13 @@ func (s *Server) handleRawConn(rawConn net.Conn) { rawConn.SetDeadline(time.Now().Add(s.opts.connectionTimeout)) conn, authInfo, err := s.useTransportAuthenticator(rawConn) if err != nil { - s.mu.Lock() - s.errorf("ServerHandshake(%q) failed: %v", rawConn.RemoteAddr(), err) - s.mu.Unlock() - grpclog.Warningf("grpc: Server.Serve failed to complete security handshake from %q: %v", rawConn.RemoteAddr(), err) - // If serverHandshake returns ErrConnDispatched, keep rawConn open. + // ErrConnDispatched means that the connection was dispatched away from + // gRPC; those connections should be left open. if err != credentials.ErrConnDispatched { + s.mu.Lock() + s.errorf("ServerHandshake(%q) failed: %v", rawConn.RemoteAddr(), err) + s.mu.Unlock() + grpclog.Warningf("grpc: Server.Serve failed to complete security handshake from %q: %v", rawConn.RemoteAddr(), err) rawConn.Close() } rawConn.SetDeadline(time.Time{}) @@ -748,10 +775,11 @@ func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Strea trInfo = &traceInfo{ tr: tr, + firstLine: firstLine{ + client: false, + remoteAddr: st.RemoteAddr(), + }, } - trInfo.firstLine.client = false - trInfo.firstLine.remoteAddr = st.RemoteAddr() - if dl, ok := stream.Context().Deadline(); ok { trInfo.firstLine.deadline = time.Until(dl) } @@ -859,7 +887,6 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } if trInfo != nil { defer trInfo.tr.Finish() - trInfo.firstLine.client = false trInfo.tr.LazyLog(&trInfo.firstLine, false) defer func() { if err != nil && err != io.EOF { @@ -1245,7 +1272,8 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str service := sm[:pos] method := sm[pos+1:] - if srv, ok := s.m[service]; ok { + srv, knownService := s.m[service] + if knownService { if md, ok := srv.md[method]; ok { s.processUnaryRPC(t, stream, srv, md, trInfo) return @@ -1260,11 +1288,16 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Str s.processStreamingRPC(t, stream, nil, unknownDesc, trInfo) return } + var errDesc string + if !knownService { + errDesc = fmt.Sprintf("unknown service %v", service) + } else { + errDesc = fmt.Sprintf("unknown method %v for service %v", method, service) + } if trInfo != nil { - trInfo.tr.LazyLog(&fmtStringer{"Unknown service %v", []interface{}{service}}, true) + trInfo.tr.LazyPrintf("%s", errDesc) trInfo.tr.SetError() } - errDesc := fmt.Sprintf("unknown service %v", service) if err := t.WriteStatus(stream, status.New(codes.Unimplemented, errDesc)); err != nil { if trInfo != nil { trInfo.tr.LazyLog(&fmtStringer{"%v", []interface{}{err}}, true) diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go index 162857e2..1c522742 100644 --- a/vendor/google.golang.org/grpc/service_config.go +++ b/vendor/google.golang.org/grpc/service_config.go @@ -99,6 +99,9 @@ type ServiceConfig struct { // healthCheckConfig must be set as one of the requirement to enable LB channel // health check. healthCheckConfig *healthCheckConfig + // rawJSONString stores service config json string that get parsed into + // this service config struct. + rawJSONString string } // healthCheckConfig defines the go-native version of the LB channel health check config. @@ -238,24 +241,22 @@ type jsonSC struct { HealthCheckConfig *healthCheckConfig } -func parseServiceConfig(js string) (ServiceConfig, error) { - if len(js) == 0 { - return ServiceConfig{}, fmt.Errorf("no JSON service config provided") - } +func parseServiceConfig(js string) (*ServiceConfig, error) { var rsc jsonSC err := json.Unmarshal([]byte(js), &rsc) if err != nil { grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return ServiceConfig{}, err + return nil, err } sc := ServiceConfig{ LB: rsc.LoadBalancingPolicy, Methods: make(map[string]MethodConfig), retryThrottling: rsc.RetryThrottling, healthCheckConfig: rsc.HealthCheckConfig, + rawJSONString: js, } if rsc.MethodConfig == nil { - return sc, nil + return &sc, nil } for _, m := range *rsc.MethodConfig { @@ -265,7 +266,7 @@ func parseServiceConfig(js string) (ServiceConfig, error) { d, err := parseDuration(m.Timeout) if err != nil { grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return ServiceConfig{}, err + return nil, err } mc := MethodConfig{ @@ -274,7 +275,7 @@ func parseServiceConfig(js string) (ServiceConfig, error) { } if mc.retryPolicy, err = convertRetryPolicy(m.RetryPolicy); err != nil { grpclog.Warningf("grpc: parseServiceConfig error unmarshaling %s due to %v", js, err) - return ServiceConfig{}, err + return nil, err } if m.MaxRequestMessageBytes != nil { if *m.MaxRequestMessageBytes > int64(maxInt) { @@ -299,13 +300,13 @@ func parseServiceConfig(js string) (ServiceConfig, error) { if sc.retryThrottling != nil { if sc.retryThrottling.MaxTokens <= 0 || - sc.retryThrottling.MaxTokens >= 1000 || + sc.retryThrottling.MaxTokens > 1000 || sc.retryThrottling.TokenRatio <= 0 { // Illegal throttling config; disable throttling. sc.retryThrottling = nil } } - return sc, nil + return &sc, nil } func convertRetryPolicy(jrp *jsonRetryPolicy) (p *retryPolicy, err error) { diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index 84f77daf..f3f593c8 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -27,6 +27,8 @@ import ( "context" "net" "time" + + "google.golang.org/grpc/metadata" ) // RPCStats contains stats information about RPCs. @@ -172,6 +174,9 @@ type End struct { BeginTime time.Time // EndTime is the time when the RPC ends. EndTime time.Time + // Trailer contains the trailer metadata received from the server. This + // field is only valid if this End is from the client side. + Trailer metadata.MD // Error is the error the RPC ended with. It is an error generated from // status.Status and can be converted back to status.Status using // status.FromError if non-nil. diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index ccf996b4..e10e6231 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/connectivity" "google.golang.org/grpc/encoding" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/balancerload" "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcrand" @@ -230,17 +231,21 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth if c.creds != nil { callHdr.Creds = c.creds } - var trInfo traceInfo + var trInfo *traceInfo if EnableTracing { - trInfo.tr = trace.New("grpc.Sent."+methodFamily(method), method) - trInfo.firstLine.client = true + trInfo = &traceInfo{ + tr: trace.New("grpc.Sent."+methodFamily(method), method), + firstLine: firstLine{ + client: true, + }, + } if deadline, ok := ctx.Deadline(); ok { trInfo.firstLine.deadline = time.Until(deadline) } trInfo.tr.LazyLog(&trInfo.firstLine, false) ctx = trace.NewContext(ctx, trInfo.tr) } - ctx = newContextWithRPCInfo(ctx, c.failFast) + ctx = newContextWithRPCInfo(ctx, c.failFast, c.codec, cp, comp) sh := cc.dopts.copts.StatsHandler var beginTime time.Time if sh != nil { @@ -323,7 +328,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth return cs, nil } -func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo traceInfo) error { +func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo *traceInfo) error { cs.attempt = &csAttempt{ cs: cs, dc: cs.cc.dopts.dc, @@ -338,6 +343,9 @@ func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo traceInfo) err if err != nil { return err } + if trInfo != nil { + trInfo.firstLine.SetRemoteAddr(t.RemoteAddr()) + } cs.attempt.t = t cs.attempt.done = done return nil @@ -414,9 +422,10 @@ type csAttempt struct { decompSet bool mu sync.Mutex // guards trInfo.tr + // trInfo may be nil (if EnableTracing is false). // trInfo.tr is set when created (if EnableTracing is true), // and cleared when the finish method is called. - trInfo traceInfo + trInfo *traceInfo statsHandler stats.Handler } @@ -540,7 +549,7 @@ func (cs *clientStream) retryLocked(lastErr error) error { cs.commitAttemptLocked() return err } - if err := cs.newAttemptLocked(nil, traceInfo{}); err != nil { + if err := cs.newAttemptLocked(nil, nil); err != nil { return err } if lastErr = cs.replayBufferLocked(); lastErr == nil { @@ -668,15 +677,13 @@ func (cs *clientStream) SendMsg(m interface{}) (err error) { if !cs.desc.ClientStreams { cs.sentLast = true } - data, err := encode(cs.codec, m) + + // load hdr, payload, data + hdr, payload, data, err := prepareMsg(m, cs.codec, cs.cp, cs.comp) if err != nil { return err } - compData, err := compress(data, cs.cp, cs.comp) - if err != nil { - return err - } - hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? if len(payload) > *cs.callInfo.maxSendMessageSize { return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), *cs.callInfo.maxSendMessageSize) @@ -811,7 +818,7 @@ func (cs *clientStream) finish(err error) { func (a *csAttempt) sendMsg(m interface{}, hdr, payld, data []byte) error { cs := a.cs - if EnableTracing { + if a.trInfo != nil { a.mu.Lock() if a.trInfo.tr != nil { a.trInfo.tr.LazyLog(&payload{sent: true, msg: m}, true) @@ -868,7 +875,7 @@ func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) { } return toRPCErr(err) } - if EnableTracing { + if a.trInfo != nil { a.mu.Lock() if a.trInfo.tr != nil { a.trInfo.tr.LazyLog(&payload{sent: false, msg: m}, true) @@ -881,8 +888,9 @@ func (a *csAttempt) recvMsg(m interface{}, payInfo *payloadInfo) (err error) { RecvTime: time.Now(), Payload: m, // TODO truncate large payload. - Data: payInfo.uncompressedBytes, - Length: len(payInfo.uncompressedBytes), + Data: payInfo.uncompressedBytes, + WireLength: payInfo.wireLength, + Length: len(payInfo.uncompressedBytes), }) } if channelz.IsOn() { @@ -915,22 +923,23 @@ func (a *csAttempt) finish(err error) { // Ending a stream with EOF indicates a success. err = nil } + var tr metadata.MD if a.s != nil { a.t.CloseStream(a.s, err) + tr = a.s.Trailer() } if a.done != nil { br := false - var tr metadata.MD if a.s != nil { br = a.s.BytesReceived() - tr = a.s.Trailer() } a.done(balancer.DoneInfo{ Err: err, Trailer: tr, BytesSent: a.s != nil, BytesReceived: br, + ServerLoad: balancerload.Parse(tr), }) } if a.statsHandler != nil { @@ -938,11 +947,12 @@ func (a *csAttempt) finish(err error) { Client: true, BeginTime: a.cs.beginTime, EndTime: time.Now(), + Trailer: tr, Error: err, } a.statsHandler.HandleRPC(a.cs.ctx, end) } - if a.trInfo.tr != nil { + if a.trInfo != nil && a.trInfo.tr != nil { if err == nil { a.trInfo.tr.LazyPrintf("RPC: [OK]") } else { @@ -1138,15 +1148,13 @@ func (as *addrConnStream) SendMsg(m interface{}) (err error) { if !as.desc.ClientStreams { as.sentLast = true } - data, err := encode(as.codec, m) + + // load hdr, payload, data + hdr, payld, _, err := prepareMsg(m, as.codec, as.cp, as.comp) if err != nil { return err } - compData, err := compress(data, as.cp, as.comp) - if err != nil { - return err - } - hdr, payld := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? if len(payld) > *as.callInfo.maxSendMessageSize { return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payld), *as.callInfo.maxSendMessageSize) @@ -1383,15 +1391,13 @@ func (ss *serverStream) SendMsg(m interface{}) (err error) { ss.t.IncrMsgSent() } }() - data, err := encode(ss.codec, m) + + // load hdr, payload, data + hdr, payload, data, err := prepareMsg(m, ss.codec, ss.cp, ss.comp) if err != nil { return err } - compData, err := compress(data, ss.cp, ss.comp) - if err != nil { - return err - } - hdr, payload := msgHeader(data, compData) + // TODO(dfawley): should we be checking len(data) instead? if len(payload) > ss.maxSendMessageSize { return status.Errorf(codes.ResourceExhausted, "trying to send message larger than max (%d vs. %d)", len(payload), ss.maxSendMessageSize) @@ -1466,8 +1472,9 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { RecvTime: time.Now(), Payload: m, // TODO truncate large payload. - Data: payInfo.uncompressedBytes, - Length: len(payInfo.uncompressedBytes), + Data: payInfo.uncompressedBytes, + WireLength: payInfo.wireLength, + Length: len(payInfo.uncompressedBytes), }) } if ss.binlog != nil { @@ -1483,3 +1490,24 @@ func (ss *serverStream) RecvMsg(m interface{}) (err error) { func MethodFromServerStream(stream ServerStream) (string, bool) { return Method(stream.Context()) } + +// prepareMsg returns the hdr, payload and data +// using the compressors passed or using the +// passed preparedmsg +func prepareMsg(m interface{}, codec baseCodec, cp Compressor, comp encoding.Compressor) (hdr, payload, data []byte, err error) { + if preparedMsg, ok := m.(*PreparedMsg); ok { + return preparedMsg.hdr, preparedMsg.payload, preparedMsg.encodedData, nil + } + // The input interface is not a prepared msg. + // Marshal and Compress the data at this point + data, err = encode(codec, m) + if err != nil { + return nil, nil, nil, err + } + compData, err := compress(data, cp, comp) + if err != nil { + return nil, nil, nil, err + } + hdr, payload = msgHeader(data, compData) + return hdr, payload, data, nil +} diff --git a/vendor/google.golang.org/grpc/trace.go b/vendor/google.golang.org/grpc/trace.go index c1c96ded..0a57b999 100644 --- a/vendor/google.golang.org/grpc/trace.go +++ b/vendor/google.golang.org/grpc/trace.go @@ -24,6 +24,7 @@ import ( "io" "net" "strings" + "sync" "time" "golang.org/x/net/trace" @@ -53,13 +54,25 @@ type traceInfo struct { } // firstLine is the first line of an RPC trace. +// It may be mutated after construction; remoteAddr specifically may change +// during client-side use. type firstLine struct { + mu sync.Mutex client bool // whether this is a client (outgoing) RPC remoteAddr net.Addr deadline time.Duration // may be zero } +func (f *firstLine) SetRemoteAddr(addr net.Addr) { + f.mu.Lock() + f.remoteAddr = addr + f.mu.Unlock() +} + func (f *firstLine) String() string { + f.mu.Lock() + defer f.mu.Unlock() + var line bytes.Buffer io.WriteString(&line, "RPC: ") if f.client { diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index c30e84c0..5c8cb709 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.19.0" +const Version = "1.21.1" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index 7209aa5b..11037b94 100644 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -75,7 +75,7 @@ git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO # - Do not import math/rand for real library code. Use internal/grpcrand for # thread safety. -git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand') +git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand\|wrr_test') # - Ensure all ptypes proto packages are renamed when importing. git ls-files "*.go" | (! xargs grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/") @@ -86,9 +86,9 @@ go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go # - gofmt, goimports, golint (with exceptions for generated code), go vet. gofmt -s -d -l . 2>&1 | fail_on_output -goimports -l . 2>&1 | fail_on_output +goimports -l . 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") | fail_on_output golint ./... 2>&1 | (! grep -vE "(_mock|\.pb)\.go:") -go tool vet -all . +go vet -all . # - Check that generated proto files are up to date. if [[ -z "${VET_SKIP_PROTO}" ]]; then @@ -108,13 +108,19 @@ fi # TODO(menghanl): fix errors in transport_test. staticcheck -go 1.9 -checks 'inherit,-ST1015' -ignore ' google.golang.org/grpc/balancer.go:SA1019 -google.golang.org/grpc/balancer_test.go:SA1019 -google.golang.org/grpc/clientconn_test.go:SA1019 google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go:SA1019 +google.golang.org/grpc/balancer/xds/edsbalancer/balancergroup.go:SA1019 +google.golang.org/grpc/balancer/xds/xds.go:SA1019 +google.golang.org/grpc/balancer_conn_wrappers.go:SA1019 +google.golang.org/grpc/balancer_test.go:SA1019 google.golang.org/grpc/benchmark/benchmain/main.go:SA1019 google.golang.org/grpc/benchmark/worker/benchmark_client.go:SA1019 +google.golang.org/grpc/clientconn.go:S1024 +google.golang.org/grpc/clientconn_state_transition_test.go:SA1019 +google.golang.org/grpc/clientconn_test.go:SA1019 google.golang.org/grpc/internal/transport/handler_server.go:SA1019 google.golang.org/grpc/internal/transport/handler_server_test.go:SA1019 +google.golang.org/grpc/resolver/dns/dns_resolver.go:SA1019 google.golang.org/grpc/stats/stats_test.go:SA1019 google.golang.org/grpc/test/channelz_test.go:SA1019 google.golang.org/grpc/test/end2end_test.go:SA1019 diff --git a/vendor/modules.txt b/vendor/modules.txt index 8b653eca..71362a75 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# cloud.google.com/go v0.39.0 +# cloud.google.com/go v0.43.0 cloud.google.com/go/storage cloud.google.com/go/iam cloud.google.com/go/internal @@ -6,26 +6,27 @@ cloud.google.com/go/internal/optional cloud.google.com/go/internal/trace cloud.google.com/go/internal/version cloud.google.com/go/compute/metadata -# github.com/beorn7/perks v1.0.0 +# github.com/beorn7/perks v1.0.1 github.com/beorn7/perks/quantile # github.com/cheekybits/genny v1.0.0 github.com/cheekybits/genny/generic +# github.com/gen2brain/x264-go v0.0.0-20180306035800-58f586137654 +github.com/gen2brain/x264-go +github.com/gen2brain/x264-go/x264c # github.com/gofrs/uuid v3.2.0+incompatible github.com/gofrs/uuid -# github.com/golang/protobuf v1.3.1 +# github.com/golang/protobuf v1.3.2 github.com/golang/protobuf/proto github.com/golang/protobuf/ptypes github.com/golang/protobuf/protoc-gen-go/descriptor github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration github.com/golang/protobuf/ptypes/timestamp -# github.com/googleapis/gax-go/v2 v2.0.4 +# github.com/googleapis/gax-go/v2 v2.0.5 github.com/googleapis/gax-go/v2 # github.com/gorilla/websocket v1.4.0 github.com/gorilla/websocket -# github.com/gortc/turn v0.7.3 -github.com/gortc/turn -# github.com/hashicorp/golang-lru v0.5.0 +# github.com/hashicorp/golang-lru v0.5.1 github.com/hashicorp/golang-lru/simplelru # github.com/lucas-clemente/quic-go v0.7.1-0.20190401152353-907071221cf9 github.com/lucas-clemente/quic-go @@ -41,39 +42,45 @@ github.com/lucas-clemente/quic-go/internal/wire github.com/marten-seemann/qtls # github.com/matttproud/golang_protobuf_extensions v1.0.1 github.com/matttproud/golang_protobuf_extensions/pbutil -# github.com/pion/datachannel v1.4.3 +# github.com/pion/datachannel v1.4.5 github.com/pion/datachannel -# github.com/pion/dtls v1.3.5 +# github.com/pion/dtls v1.5.0 github.com/pion/dtls +github.com/pion/dtls/internal/crypto/ccm github.com/pion/dtls/internal/udp -# github.com/pion/ice v0.4.0 +# github.com/pion/ice v0.5.7 github.com/pion/ice -# github.com/pion/logging v0.2.1 +# github.com/pion/logging v0.2.2 github.com/pion/logging -# github.com/pion/mdns v0.0.2 +# github.com/pion/mdns v0.0.3 github.com/pion/mdns # github.com/pion/quic v0.1.1 github.com/pion/quic github.com/pion/quic/internal/wrapper -# github.com/pion/rtcp v1.2.0 +# github.com/pion/rtcp v1.2.1 github.com/pion/rtcp -# github.com/pion/rtp v1.1.2 +# github.com/pion/rtp v1.1.3 github.com/pion/rtp github.com/pion/rtp/codecs -# github.com/pion/sctp v1.6.3 +# github.com/pion/sctp v1.6.4 github.com/pion/sctp -# github.com/pion/sdp/v2 v2.2.0 +# github.com/pion/sdp/v2 v2.3.0 github.com/pion/sdp/v2 -# github.com/pion/srtp v1.2.4 +# github.com/pion/srtp v1.2.6 github.com/pion/srtp # github.com/pion/stun v0.3.1 github.com/pion/stun github.com/pion/stun/internal/hmac -# github.com/pion/transport v0.8.0 +# github.com/pion/transport v0.8.6 github.com/pion/transport/packetio -# github.com/pion/turnc v0.0.6 -github.com/pion/turnc -# github.com/pion/webrtc/v2 v2.0.23 +github.com/pion/transport/vnet +# github.com/pion/turn v1.3.3 +github.com/pion/turn +github.com/pion/turn/internal/allocation +github.com/pion/turn/internal/client +github.com/pion/turn/internal/ipnet +github.com/pion/turn/internal/proto +# github.com/pion/webrtc/v2 v2.1.2 github.com/pion/webrtc/v2 github.com/pion/webrtc/v2/pkg/media github.com/pion/webrtc/v2/internal/mux @@ -81,20 +88,20 @@ github.com/pion/webrtc/v2/internal/util github.com/pion/webrtc/v2/pkg/rtcerr # github.com/pkg/errors v0.8.1 github.com/pkg/errors -# github.com/prometheus/client_golang v0.9.3 +# github.com/prometheus/client_golang v1.1.0 github.com/prometheus/client_golang/prometheus/promhttp github.com/prometheus/client_golang/prometheus github.com/prometheus/client_golang/prometheus/internal # github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.4.0 +# github.com/prometheus/common v0.6.0 github.com/prometheus/common/expfmt github.com/prometheus/common/model github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg -# github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 +# github.com/prometheus/procfs v0.0.3 github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs -# go.opencensus.io v0.21.0 +# go.opencensus.io v0.22.0 go.opencensus.io/trace go.opencensus.io/plugin/ochttp go.opencensus.io/internal @@ -111,7 +118,7 @@ go.opencensus.io/stats/internal go.opencensus.io/internal/tagencoding go.opencensus.io/metric/metricproducer go.opencensus.io/resource -# golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5 +# golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 golang.org/x/crypto/curve25519 golang.org/x/crypto/hkdf golang.org/x/crypto/chacha20poly1305 @@ -120,36 +127,36 @@ golang.org/x/crypto/internal/chacha20 golang.org/x/crypto/internal/subtle golang.org/x/crypto/poly1305 golang.org/x/crypto/cryptobyte/asn1 -# golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b +# golang.org/x/net v0.0.0-20190628185345-da137c7871d7 golang.org/x/net/ipv4 -golang.org/x/net/context golang.org/x/net/dns/dnsmessage golang.org/x/net/bpf golang.org/x/net/internal/iana golang.org/x/net/internal/socket golang.org/x/net/trace +golang.org/x/net/context golang.org/x/net/internal/timeseries golang.org/x/net/http2 golang.org/x/net/http2/hpack golang.org/x/net/context/ctxhttp golang.org/x/net/http/httpguts golang.org/x/net/idna -# golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 +# golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/oauth2 golang.org/x/oauth2/google golang.org/x/oauth2/internal golang.org/x/oauth2/jws golang.org/x/oauth2/jwt -# golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e -golang.org/x/sys/unix +# golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 golang.org/x/sys/windows +golang.org/x/sys/unix golang.org/x/sys/cpu -# golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 +# golang.org/x/text v0.3.2 golang.org/x/text/secure/bidirule golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/transform -# google.golang.org/api v0.5.0 +# google.golang.org/api v0.7.0 google.golang.org/api/googleapi google.golang.org/api/iterator google.golang.org/api/option @@ -160,7 +167,7 @@ google.golang.org/api/internal google.golang.org/api/gensupport google.golang.org/api/googleapi/transport google.golang.org/api/transport/http/internal/propagation -# google.golang.org/appengine v1.4.0 +# google.golang.org/appengine v1.6.1 google.golang.org/appengine/urlfetch google.golang.org/appengine google.golang.org/appengine/internal @@ -171,13 +178,13 @@ google.golang.org/appengine/internal/base google.golang.org/appengine/internal/datastore google.golang.org/appengine/internal/log google.golang.org/appengine/internal/remote_api -# google.golang.org/genproto v0.0.0-20190508193815-b515fa19cec8 +# google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610 google.golang.org/genproto/googleapis/iam/v1 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/api/annotations google.golang.org/genproto/googleapis/type/expr google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.19.0 +# google.golang.org/grpc v1.21.1 google.golang.org/grpc google.golang.org/grpc/codes google.golang.org/grpc/metadata @@ -191,6 +198,7 @@ google.golang.org/grpc/encoding/proto google.golang.org/grpc/grpclog google.golang.org/grpc/internal google.golang.org/grpc/internal/backoff +google.golang.org/grpc/internal/balancerload google.golang.org/grpc/internal/binarylog google.golang.org/grpc/internal/channelz google.golang.org/grpc/internal/envconfig